HMINETB.H 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. /****************************************************************************
  2. *
  3. * File : netbios.c
  4. * Date Created : 1/18/95
  5. * Description : NETBIOS support library header file
  6. *
  7. * Programmer(s) : Nick Skrepetos
  8. * Last Modification : 9/11/95 - 2:41:22 PM
  9. * Additional Notes :
  10. *
  11. *****************************************************************************
  12. * Copyright (c) 1994-95, HMI, Inc. All Rights Reserved *
  13. ****************************************************************************/
  14. #ifndef _HMI_NETBIOS_DEFINED
  15. #define _HMI_NETBIOS_DEFINED
  16. // equates for interrupts used
  17. #define _NETBIOS_INT 0x5c
  18. // maximum nodes supported at once
  19. #define _NETBIOS_MAX_NODES _NETNOW_MAX_NODES
  20. // broadcast command
  21. #define _NETBIOS_BROADCAST _NETBIOS_MAX_NODES + 1
  22. // maximum number of packets that can be in packet queue
  23. #define _NETBIOS_MAX_SEND_PACKETS _NETNOW_MAX_SEND_PACKETS
  24. #define _NETBIOS_MAX_LISTEN_PACKETS _NETNOW_MAX_LISTEN_PACKETS
  25. // size of the packet for transmission
  26. #define _NETBIOS_DATA_PACKET _NETNOW_DATA_PACKET
  27. // offset of data
  28. #define _NETBIOS_DATA_OFFSET sizeof( _NETBIOS_NCB )
  29. // real mode memory sizes fro sending and receiving
  30. // datagrams.
  31. #define _NETBIOS_REAL_SEND_SIZE _NETBIOS_MAX_SEND_PACKETS * \
  32. ( _NETBIOS_DATA_PACKET + _NETBIOS_DATA_OFFSET )
  33. #define _NETBIOS_REAL_LISTEN_SIZE _NETBIOS_MAX_LISTEN_PACKETS * \
  34. ( _NETBIOS_DATA_PACKET + _NETBIOS_DATA_OFFSET )
  35. // set structure packing to byte packing
  36. #pragma pack(1)
  37. // protected mode pointer
  38. typedef struct
  39. {
  40. PSTR pData; // pointer to data
  41. } _PROT_PTR;
  42. // real mode pointer
  43. typedef struct
  44. {
  45. SHORT wOffset; // address offset
  46. SHORT wSegment; // address segment
  47. } _REAL_PTR;
  48. // real/protected pointer
  49. typedef union
  50. {
  51. _PROT_PTR sPointer;
  52. _REAL_PTR sRealPtr;
  53. } _PTR;
  54. // network control block (NCB)
  55. typedef struct _tag_NETBIOS_NCB
  56. {
  57. BYTE bCommand; // command
  58. BYTE bReturnCode; // return code from command
  59. BYTE bLocalSession; // local session number
  60. BYTE bNetworkNameNumber; // network name number
  61. _PTR sPtr; // pointer to buffer
  62. USHORT wLength; // length of buffer
  63. BYTE bCallName[ 16 ]; // destination computer
  64. BYTE bName[ 16 ]; // source computer
  65. BYTE bReceiveTimeOut; // receive time out, 500 ms increments
  66. BYTE bSendTimeOut; // send time out, 500 ms increments
  67. PSTR pPostFunction; // pointer to post function
  68. BYTE bAdapter; // adapter 0 or 1
  69. BYTE bCompletionCode; // return code ( completion )
  70. BYTE bReserve[ 14 ]; // reserved for system
  71. } _NETBIOS_NCB;
  72. // NetBIOS adapter status information
  73. typedef struct _tagNETBIOS_ADAPTER_STATUS
  74. {
  75. BYTE bCardID[ 6 ]; // card id ( node addr )
  76. BYTE bReleaseLevel; // release level
  77. BYTE bReserved1; // reserved
  78. BYTE bTypeOfAdapter; // adapter type
  79. BYTE bOldOrNewParameters; // parameters
  80. USHORT wReportingPeriodMinutes; // reporting period
  81. USHORT wFrameRejectReceivedCount; // rejected count
  82. USHORT wFrameRejectSentCount; // rejected send count
  83. USHORT wReceivedDataFrameErrors; // receive errors
  84. USHORT wUnsuccessfulTransmissions; // unsuccessful transmissions
  85. LONG dwGoodTransmissions; // good transmissions
  86. LONG dwGoodReceptions; // good receptions
  87. USHORT wRetransmissions; // retry transmissions
  88. USHORT wExhaustedResourceCount; //
  89. USHORT wT1TimerExpiredCount; //
  90. USHORT wTITimerExpiredCount; //
  91. BYTE bReserved2[4]; // reserved
  92. USHORT wAvailableNCBS; //
  93. USHORT wMaxNCBSConfigured; //
  94. USHORT wMaxNCBSPossible; //
  95. USHORT wBufferOrStationBusyCount; //
  96. USHORT wMaxDatagramSize; // max datagram size
  97. USHORT wPendingSessions; //
  98. USHORT wMaxSessionsConfigured; //
  99. USHORT wMaxSessionsPossible; //
  100. USHORT wMaxFrameSize; //
  101. USHORT wNameCount; //
  102. struct
  103. {
  104. BYTE bName[ 16 ]; // name
  105. BYTE bNameNumber; // name number in list
  106. BYTE bNameStatus; // status
  107. } sNameTable[ 20 ];
  108. } _NETBIOS_ADAPTER_STATUS;
  109. // flags for send/listen element
  110. #define _NETBIOS_ELEMENT_ACTIVE 0x8000 // element is active
  111. #define _NETBIOS_ELEMENT_DATA 0x4000 // element has data waiting
  112. #define _NETBIOS_ELEMENT_LISTENING 0x2000 // element is listening for packet
  113. #define _NETBIOS_ELEMENT_SENDING 0x1000 // element is sending packet
  114. // structure for send/listen elements
  115. typedef struct _tagNETBIOS_ELEMENT
  116. {
  117. USHORT wFlags; // misc flags
  118. USHORT wOffset; // offset into data area
  119. _NETBIOS_NCB sNCB; // control block
  120. _NETBIOS_NCB * pNCB; // pointer to NCB
  121. PSTR pHeader; // application specific header
  122. USHORT wHSize; // application header size
  123. } _NETBIOS_ELEMENT;
  124. // address structure for NetBIOS
  125. typedef struct _tagNETBIOS_LOCAL_TARGET
  126. {
  127. BYTE bNode[ 16 ]; // node address
  128. } _NETBIOS_LOCAL_TARGET;
  129. // equates for node addition
  130. enum
  131. {
  132. _NETBIOS_ADD_COMPLETE,
  133. _NETBIOS_ADD_DUPLICATE,
  134. _NETBIOS_ADD_LIST_FULL
  135. };
  136. // equates for node deletion
  137. enum
  138. {
  139. _NETBIOS_DELETE_COMPLETE,
  140. _NETBIOS_DELETE_INVALID,
  141. };
  142. // equates for init error
  143. enum
  144. {
  145. _NETBIOS_INIT_NO_ERROR,
  146. _NETBIOS_INIT_NO_MEMORY,
  147. _NETBIOS_INIT_NO_NETBIOS,
  148. _NETBIOS_INIT_NO_TEMPNAME
  149. };
  150. // reset structure packing
  151. #pragma pack()
  152. // NetBIOS commands
  153. #define _NETBIOS_RESET 0x32
  154. #define _NETBIOS_CANCEL 0x35
  155. #define _NETBIOS_STATUS 0xb3
  156. #define _NETBIOS_STATUS_WAIT 0x33
  157. #define _NETBIOS_UNLINK 0x70
  158. #define _NETBIOS_ADD_NAME 0xb0
  159. #define _NETBIOS_ADD_NAME_WAIT 0x30
  160. #define _NETBIOS_ADD_GROUP_NAME 0xb6
  161. #define _NETBIOS_ADD_GROUP_NAME_WAIT 0x36
  162. #define _NETBIOS_DELETE_NAME 0xb1
  163. #define _NETBIOS_DELETE_NAME_WAIT 0x31
  164. #define _NETBIOS_CALL 0x90
  165. #define _NETBIOS_CALL_WAIT 0x10
  166. #define _NETBIOS_LISTEN 0x91
  167. #define _NETBIOS_LISTEN_WAIT 0x11
  168. #define _NETBIOS_HANG_UP 0x92
  169. #define _NETBIOS_HANG_UP_WAIT 0x12
  170. #define _NETBIOS_SEND 0x94
  171. #define _NETBIOS_SEND_WAIT 0x14
  172. #define _NETBIOS_SEND_NO_ACK 0xf1
  173. #define _NETBIOS_SEND_NO_ACK_WAIT 0x71
  174. #define _NETBIOS_CHAIN_SEND 0x97
  175. #define _NETBIOS_CHAIN_SEND_WAIT 0x17
  176. #define _NETBIOS_CHAIN_SEND_NO_ACK 0xf2
  177. #define _NETBIOS_CHAIN_SEND_NO_ACK_W 0x72
  178. #define _NETBIOS_RECEIVE 0x95
  179. #define _NETBIOS_RECEIVE_WAIT 0x15
  180. #define _NETBIOS_RECEIVE_ANY 0x96
  181. #define _NETBIOS_RECEIVE_ANY_WAIT 0x16
  182. #define _NETBIOS_SESSION_STATUS 0xb4
  183. #define _NETBIOS_SESSION_STATUS_WAIT 0x34
  184. #define _NETBIOS_SEND_DATAGRAM 0xa0
  185. #define _NETBIOS_SEND_DATAGRAM_WAIT 0x20
  186. #define _NETBIOS_SEND_BROADCAST_DATAGRAM 0xa2
  187. #define _NETBIOS_SEND_BROADCAST_DATAGRAM_W 0x22
  188. #define _NETBIOS_RECEIVE_DATAGRAM 0xa1
  189. #define _NETBIOS_RECEIVE_DATAGRAM_WAIT 0x21
  190. #define _NETBIOS_RECEIVE_BROADCAST_DATAGRAM 0xa3
  191. #define _NETBIOS_RECEIVE_BROADCAST_DATAGRAM_W 0x23
  192. #endif
  193. // function prototypes
  194. BOOL cdecl hmiNETBIOSInitSystem ( W32 wNodes );
  195. BOOL cdecl hmiNETBIOSUnInitSystem ( VOID );
  196. W32 cdecl hmiNETBIOSGetActiveNodes ( VOID );
  197. BOOL cdecl hmiNETBIOSPostListen ( VOID );
  198. BOOL cdecl hmiNETBIOSInstalled ( VOID );
  199. BOOL cdecl hmiNETBIOSAddName ( PSTR szName );
  200. BOOL cdecl hmiNETBIOSDeleteName ( PSTR szName );
  201. BOOL cdecl hmiNETBIOSGetAdapterStatus ( VOID );
  202. VOID cdecl hmiNETBIOSSortNodes ( VOID );
  203. W32 cdecl hmiNETBIOSGetConsoleNode ( VOID );
  204. VOID cdecl hmiNETBIOSListenForPacket ( _NETBIOS_NCB * sNCB,
  205. _NETBIOS_NCB ** pPacket );
  206. VOID cdecl hmiNETBIOSSendPacket ( _NETBIOS_NCB * sNCB,
  207. _NETBIOS_NCB ** pPacket,
  208. PSTR pHeader,
  209. W32 wSize );
  210. BOOL cdecl hmiNETBIOSSendData ( PSTR pHeader, W32 wHSize,
  211. PSTR pData, W32 wDSize,
  212. W32 wNode );
  213. BOOL cdecl hmiNETBIOSGetData ( PSTR pHeader, W32 wHSize,
  214. PSTR pData, W32 wDSize );
  215. BOOL cdecl hmiNETBIOSCancelAll ( VOID );
  216. BOOL cdecl hmiNETBIOSGetHeader ( PSTR pHeader, W32 wHSize,
  217. PSTR * pPacket );
  218. W32 cdecl hmiNETBIOSDeleteNode ( W32 wNode );