home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / v7nl.zip / V7NL.H < prev    next >
C/C++ Source or Header  |  1993-12-21  |  9KB  |  191 lines

  1. #if !defined _V7NL_H_INCLUDED_
  2. #define _V7NL_H_INCLUDED_
  3.  
  4. /***********************************************************************
  5.  * return codes
  6.  ***********************************************************************
  7.  */
  8. #define V7NL_SUCCESS                    0 
  9. #define V7NL_NODEINDEX_OPENFAILED       1
  10. #define V7NL_SYSOPINDEX_OPENFAILED      2
  11. #define V7NL_NODEDAT_OPENFAILED         3
  12. #define V7NL_NODENUMBER_NOTFOUND        4
  13. #define V7NL_SYSOPNAME_NOTFOUND         5
  14. #define V7Nl_NODEDAT_READERROR          6
  15. #define V7NL_NODEDAT_SEEKERROR          7
  16. #define V7NL_FINDNEXT_END               8
  17. #define V7NL_NODEDELETE_FAILED          9
  18. #define V7NL_SYSOPDELETE_FAILED         10
  19. #define V7NL_ZONENUMBER_REQUIRED        11
  20. #define V7NL_NETNUMBER_REQUIRED         12
  21. #define V7NL_NODENUMBER_REQUIRED        13
  22. #define V7NL_PHONENUMBER_REQUIRED       14
  23. #define V7NL_SYSOPNAME_REQUIRED         15
  24. #define V7NL_MODMEMBAUD_LESSTHAN300     16
  25. #define V7NL_MODEMBAUD_NOTMULTIPLE300   17
  26. #define V7NL_NODEDAT_WRITEERROR         18
  27. #define V7NL_NODEINDEX_UPDATEERR        19
  28. #define V7NL_SYSOPINDEX_UPDATEERR       20
  29.  
  30.  
  31. #ifndef WORD_DEFINED
  32. #define WORD_DEFINED                
  33. typedef short WORD ;
  34. typedef unsigned short UWORD ;
  35. #endif                      
  36.  
  37. typedef int V7RC ;
  38.  
  39.  
  40. /***********************************************************************
  41.  * structure of a fido net node.  this structure is based primarily
  42.  * on the NEWNODE structure of Opus CBCS
  43.  ***********************************************************************
  44.  */
  45.  
  46. typedef struct {
  47.     WORD    ZoneNumber ;        /* *jbd* */
  48.     WORD    NetNumber;
  49.     WORD    NodeNumber;
  50.     UWORD   Cost;               /* cost to user for * message */
  51.     char    SysopName[26] ;     /* sysop *jbd* */
  52.     char    SystemName[34];     /* node name */
  53.     char    PhoneNumber[40];    /* phone number */
  54.     char    MiscInfo[30];       /* city and state */
  55.     char    Password[9];        /* necessarily null-terminated */
  56.     UWORD   RealCost;           /* phone company's charge */
  57.     short   HubNode;            /* node # of this node's hub
  58.                                  * or point number if node is a point */
  59.     UWORD   BaudRate;           /* baud rate divided by 300 */
  60.     BYTE    ModemType;          /* RESERVED for modem type */
  61.     UWORD   NodeFlags;          /* set of flags (see below) */
  62.     ULONG   ulOffset ;          /* offset into DAT file */
  63. } V7NODE, *PV7NODE ;
  64.  
  65.  
  66. /*
  67.  ***********************************************************************
  68.  * Values for the `NodeFlags' field
  69.  ***********************************************************************
  70.  */
  71. #define B_hub    0x0001  /* node is a net hub     0000 0000 0000 0001 */
  72. #define B_host   0x0002  /* node is a net host    0000 0000 0000 0010 */
  73. #define B_region 0x0004  /* node is region coord  0000 0000 0000 0100 */
  74. #define B_zone   0x0008  /* is a zone gateway     0000 0000 0000 1000 */
  75. #define B_CM     0x0010  /* runs continuous mail  0000 0000 0001 0000 */
  76. #define B_res1   0x0020  /* reserved by Opus      0000 0000 0010 0000 */
  77. #define B_res2   0x0040  /* reserved by Opus      0000 0000 0100 0000 */
  78. #define B_res3   0x0080  /* reserved by Opus      0000 0000 1000 0000 */
  79. #define B_res4   0x0100  /* reserved by Opus      0000 0001 0000 0000 */
  80. #define B_res5   0x0200  /* reserved for non-Opus 0000 0010 0000 0000 */
  81. #define B_res6   0x0400  /* reserved for non-Opus 0000 0100 0000 0000 */
  82. #define B_res7   0x0800  /* reserved for non-Opus 0000 1000 0000 0000 */
  83. #define B_point  0x1000  /* node is a point       0001 0000 0000 0000 */
  84. #define B_res9   0x2000  /* reserved for non-Opus 0010 0000 0000 0000 */
  85. #define B_resa   0x4000  /* reserved for non-Opus 0100 0000 0000 0000 */
  86. #define B_resb   0x8000  /* reserved for non-Opus 1000 0000 0000 0000 */
  87.  
  88. /***********************************************************************
  89.  * V7Nl request control block
  90.  ***********************************************************************
  91.  */
  92. typedef struct {
  93.     PSZ     pszIndexName ;      /* path and name of node index */
  94.     PSZ     pszSysOpIndex ;     /* path and name of Sysop index */
  95.     PSZ     pszDataName ;       /* path and name of .DAT file */
  96.     PV7NODE pV7Node ;           /* address of where to copy nodlist
  97.                                    record */  
  98.     WORD    wLen ;              /* length for find first node function
  99.                                    2 = search on Zone
  100.                                    4 = search on Zone + Net
  101.                                    6 = search on Zone + Net + Node
  102.                                    8 = search on Zone + Net + Node + Point
  103.                                 */
  104.     UWORD   V7Flags ;           /* Flags */                    
  105.     PVOID   pnlFh ;             /* used by find first/next */
  106. } V7RCB, *PV7RCB ;
  107.  
  108. /*
  109.  ***********************************************************************
  110.  * Values for the "V7Flags" field
  111.  ***********************************************************************
  112.  */
  113. #define V7_SYSOPDUP         0x0001  /* when adding entry to SysOp index
  114.                                        duplicate entry is ok */
  115. #define V7_SYSOPADD         0x0002  /* when adding an entry to the node
  116.                                        index, add an entry to the sysop
  117.                                        index also */      
  118.  
  119. /*
  120.  ************************************************************************
  121.  *
  122.  * Function protoypes
  123.  *
  124.  ************************************************************************
  125.  */
  126.  
  127. /************************************************************************
  128.  * nodelist processing and initialization and termination.  V7Initialize
  129.  * must be called prior to making any request to acces the nodelist
  130.  ************************************************************************
  131.  */
  132. BOOL   V7Initialize(VOID) ;
  133. VOID   V7Finish(VOID) ;             /* done with the nodelist processor */
  134.  
  135. /************************************************************************
  136.  * functions for random reading of both indexes - these functions are
  137.  * for random reading of the nodelist. open will be done in "read"
  138.  * mode.
  139.  ************************************************************************
  140.  */
  141. V7RC   V7OpenIndex(PV7RCB) ;        /* opens indexes for random reading */
  142. V7RC   V7ReadIndex(PV7RCB) ;        /* reads a record from the nodex index */
  143. VOID   V7CloseIndex(PV7RCB) ;       /* closes the indexes */
  144.  
  145.  
  146. /************************************************************************
  147.  * functions for findfirst/findnext access of the nodelist
  148.  ************************************************************************
  149.  */
  150. V7RC  V7FindFirstNode(PV7RCB) ;    /* opens the nodelist index and finds
  151.                                        the first matching nodenumber */
  152. V7RC  V7FindFirstSysOp(PV7RCB) ;   /* opens the sysop index and finds
  153.                                       the first matching sysop name */
  154. V7RC  V7FindNext(PV7RCB) ;         /* finds the next node/sysop entry */
  155. VOID  V7FindClose(PV7RCB) ;        /* closes the index after findfirst
  156.                                       findnext processing */
  157.  
  158.  
  159. /************************************************************************
  160.  * maintenance type functions - - these functions will open the required
  161.  * files, perform the function, then close the files.
  162.  ************************************************************************
  163.  */
  164. V7RC V7AddNode(PV7RCB) ;            /* adds an entry to the nodeindex
  165.                                        if the V7_SYSOPADD flag is set
  166.                                        an entry is also added to the
  167.                                        sysop index */
  168. V7RC V7DeleteNode(PV7RCB) ;         /* deletes a nodes entry from the
  169.                                        node index.  A find node must
  170.                                        be done first as the offset is
  171.                                        required to delete the entry */
  172.  
  173. V7RC V7DeleteSysOp(PV7RCB) ;        /* deletes a sysop entry from the
  174.                                        sysop index. A read must have
  175.                                        been done first to obtain the
  176.                                        offset */
  177. V7RC V7UpdateNode(PV7RCB) ;         /* updates a previously read
  178.                                        node entry. this function will
  179.                                        also update the sysop index
  180.                                        entry if it exists. */
  181.  
  182. /************************************************************************
  183.  * misc read functions - these functions will open the required files,
  184.  * perform the function, then close the files.
  185.  ************************************************************************
  186.  */
  187. V7RC V7FindNode(PV7RCB) ;         /* find a node */
  188.  
  189. #endif
  190.  
  191.