home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: InfoMgt / InfoMgt.zip / MAILMIND.ZOO / NETBIOS.H < prev    next >
Text File  |  1991-02-05  |  4KB  |  123 lines

  1. #ifndef NETBIOS_H
  2. #define NETBIOS_H
  3.  
  4. /* netbios.h - defines for NETBIOS calls
  5.  * adapted from Nance B., Network Programming in C, Carmel, IN: Que, 1990
  6.  * Division of Cancer Prevention & Control, NCI
  7.  */
  8.  
  9. /* Revision history:
  10.  * 1.00  tam  01/31/91  first release
  11.  */
  12.  
  13. /* Program notes:
  14.  * The capitalizations of the NCB structure and defines is consistent with
  15.  * the 3Com documentation and not DCPC standards!
  16.  */
  17.  
  18. /* constants */
  19. #define NETBIOS_NAME_LEN 16
  20. #define MAX_PACKET       512
  21. #define MAX_NB_NAMES     15
  22.  
  23. /* Network Control Block (NCB) */
  24. #define NCB struct ncb
  25. NCB
  26.   {
  27.   byte NCB_COMMAND;                     /* command id */
  28.   byte NCB_RETCODE;                     /* immediate return code */
  29.   byte NCB_LSN;                         /* local session number               */
  30.   byte NCB_NUM;                         /* network name number */
  31.   void far *NCB_BUFFER;                 /* address of message packet */
  32.   word NCB_LENGTH;                      /* length of message packet */
  33.   byte NCB_CALLNAME[NETBIOS_NAME_LEN];  /* name of the other computer */
  34.   byte NCB_NAME[NETBIOS_NAME_LEN];      /* our network name */
  35.   byte NCB_RTO;                         /* receive time-out in 500 ms. */
  36.   byte NCB_STO;                         /* send time-out in 500 ms. */
  37.   void interrupt (*NCB_POST)(void);     /* address of POST routine */
  38.   byte NCB_LANA_NUM;                    /* adapter number (0 or 1) */
  39.   byte NCB_CMD_CPLT;                    /* final return code */
  40.   byte NCB_RESERVE[14];                 /* reserved area */
  41.   };
  42.  
  43. /* Netbios name table entry */
  44. #define NB_NAME_ENTRY struct nb_name_entry
  45. NB_NAME_ENTRY
  46.   {
  47.   char caName[16];                        /* name */
  48.   byte byNcbNum;                          /* network name number */
  49.   byte byStatus;                          /* status */
  50.   };
  51.  
  52. /* Adapter status table */
  53. #define NB_STATUS struct nb_status
  54. NB_STATUS
  55.   {
  56.   byte byaUnitID[6];
  57.   byte byaReserved1[2];
  58.   word wVersion;
  59.   word wLength;
  60.   byte byaReserved2[4];
  61.   word wCollisions;
  62.   word wAborts;
  63.   long lTransmissions;
  64.   long lReceptions;
  65.   word wRetransmissions;
  66.   byte byaReserved3[10];
  67.   word wFreeBlks;
  68.   word wConfigMaxBlks;
  69.   word wTotalMaxBlks;
  70.   byte byaReserved4[4];
  71.   word wPending;
  72.   word wConfigMaxSessions;
  73.   word wTotalMaxSessions;
  74.   word wMaxPacket;
  75.   word wNames;
  76.   NB_NAME_ENTRY aNameEntry[MAX_NB_NAMES];
  77.   };
  78.  
  79. /* Symbolic names for NetBIOS commands  */
  80. #define RESET                           0x32
  81. #define CANCEL                          0x35
  82. #define STATUS                          0xb3
  83. #define STATUS_WAIT                     0x33
  84. #define TRACE                           0xf9
  85. #define TRACE_WAIT                      0x79
  86. #define UNLINK                          0x70
  87. #define ADD_NAME                        0xb0
  88. #define ADD_NAME_WAIT                   0x30
  89. #define ADD_GROUP_NAME                  0xb6
  90. #define ADD_GROUP_NAME_WAIT             0x36
  91. #define DELETE_NAME                     0xb1
  92. #define DELETE_NAME_WAIT                0x31
  93. #define CALL                            0x90
  94. #define CALL_WAIT                       0x10
  95. #define LISTEN                          0x91
  96. #define LISTEN_WAIT                     0x11
  97. #define HANG_UP                         0x92
  98. #define HANG_UP_WAIT                    0x12
  99. #define SEND                            0x94
  100. #define SEND_WAIT                       0x14
  101. #define SEND_NO_ACK                     0xf1
  102. #define SEND_NO_ACK_WAIT                0x71
  103. #define CHAIN_SEND                      0x97
  104. #define CHAIN_SEND_WAIT                 0x17
  105. #define CHAIN_SEND_NO_ACK               0xf2
  106. #define CHAIN_SEND_NO_ACK_WAIT          0x72
  107. #define RECEIVE                         0x95
  108. #define RECEIVE_WAIT                    0x15
  109. #define RECEIVE_ANY                     0x96
  110. #define RECEIVE_ANY_WAIT                0x16
  111. #define SESSION_STATUS                  0xb4
  112. #define SESSION_STATUS_WAIT             0x34
  113. #define SEND_DATAGRAM                   0xa0
  114. #define SEND_DATAGRAM_WAIT              0x20
  115. #define SEND_BCST_DATAGRAM              0xa2
  116. #define SEND_BCST_DATAGRAM_WAIT         0x22
  117. #define RECEIVE_DATAGRAM                0xa1
  118. #define RECEIVE_DATAGRAM_WAIT           0x21
  119. #define RECEIVE_BCST_DATAGRAM           0xa3
  120. #define RECEIVE_BCST_DATAGRAM_WAIT      0x23
  121.  
  122. #endif /* NETBIOS_H */
  123.