HMIIPX.H 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /****************************************************************************
  2. *
  3. * File : hmiipx.h
  4. * Date Created : 12/21/94
  5. * Description : ipx header information including data structures
  6. *
  7. * Programmer(s) : Nick Skrepetos
  8. * Last Modification : 9/15/95 - 10:1:15 AM
  9. * Additional Notes :
  10. *
  11. *****************************************************************************
  12. * Copyright (c) 1994-95, HMI, Inc. All Rights Reserved *
  13. ****************************************************************************/
  14. #ifndef _HMI_IPX_DEFINED
  15. #define _HMI_IPX_DEFINED
  16. // equates
  17. #define _IPX_INT 0x7a
  18. // maximum number of nodes to support at once
  19. #define _IPX_MAX_NODES _NETNOW_MAX_NODES
  20. // broadcast command
  21. #define _IPX_BROADCAST _IPX_MAX_NODES + 1
  22. // maximum number of packets that can be in packet queue
  23. #define _IPX_MAX_SEND_PACKETS _NETNOW_MAX_SEND_PACKETS
  24. #define _IPX_MAX_LISTEN_PACKETS _NETNOW_MAX_LISTEN_PACKETS
  25. // size of the packet for transmission
  26. #define _IPX_DATA_PACKET _NETNOW_DATA_PACKET
  27. // socket number for our use
  28. #define _IPX_SOCKET 0x4545
  29. // offset for ipx header from start of ECB area
  30. #define _IPX_HEADER_OFFSET sizeof( _IPX_ECB )
  31. // offset for ipx data packet
  32. #define _IPX_DATA_OFFSET _IPX_HEADER_OFFSET + sizeof( _IPX_HEADER )
  33. // real mode memory sizes for sending and receiving
  34. // packets.
  35. #define _IPX_REAL_SEND_SIZE _IPX_MAX_SEND_PACKETS * \
  36. ( _IPX_DATA_PACKET + _IPX_DATA_OFFSET )
  37. #define _IPX_REAL_LISTEN_SIZE _IPX_MAX_LISTEN_PACKETS * \
  38. ( _IPX_DATA_PACKET + _IPX_DATA_OFFSET )
  39. // ipx commands
  40. #define _IPX_OPEN_SOCKET 0x00
  41. #define _IPX_CLOSE_SOCKET 0x01
  42. #define _IPX_GET_LOCAL_TARGET 0x02
  43. #define _IPX_SEND_PACKET 0x03
  44. #define _IPX_LISTEN_FOR_PACKET 0x04
  45. #define _IPX_SCHEDULE_IPX_EVENT 0x05
  46. #define _IPX_CANCEL_EVENT 0x06
  47. #define _IPX_GET_INTERVAL_MARKER 0x08
  48. #define _IPX_GET_INTERWORK_ADDRESS 0x09
  49. #define _IPX_RELINQUISH_CONTROL 0x0a
  50. #define _IPX_DISCONNECT_FROM_TARGET 0x0b
  51. // ipx packet types
  52. #define _IPX_PACKET_UNKNOWN 0x00
  53. #define _IPX_PACKET_ROUTING_INFO 0x01
  54. #define _IPX_PACKET_ECHO 0x02
  55. #define _IPX_PACKET_ERROR 0x03
  56. #define _IPX_PACKET_IPX 0x04
  57. #define _IPX_PACKET_SPX 0x05
  58. // socket types
  59. #define _IPX_SOCKET_DYNAMIC 0x00
  60. #define _IPX_SOCKET_SHORT_LIVED 0x00
  61. #define _IPX_SOCKET_LONG_LIVED 0xff
  62. // set structure packing to byte packing
  63. #pragma pack(1)
  64. // ipx header structure
  65. typedef struct _tagIPX_HEADER
  66. {
  67. USHORT wChecksum; // checksum, 0xffff
  68. USHORT wLength; // length
  69. BYTE bTransportControl; //
  70. BYTE bPacketType; // usually type _IPX_PACKET_IPX
  71. BYTE bDestNetworkNumber[ 4 ]; // destination network
  72. BYTE bDestNetworkNode[ 6 ]; // destination node
  73. USHORT wDestNetworkSocket; // destination socket
  74. BYTE bSourceNetworkNumber[ 4 ]; // source network
  75. BYTE bSourceNetworkNode[ 6 ]; // source node
  76. USHORT wSourceNetworkSocket; // source socket
  77. } _IPX_HEADER;
  78. // packet header for protected mode
  79. typedef struct
  80. {
  81. PSTR pData; // pointer to data
  82. USHORT wLength; // length of packet
  83. } _PACKET;
  84. // real mode packet structure
  85. typedef struct
  86. {
  87. SHORT wOffset; // address of header
  88. SHORT wSegment; // address of header
  89. USHORT wLength; // length of packet
  90. } _REAL_PACKET;
  91. // packet information
  92. typedef union
  93. {
  94. _PACKET sPacket; // protected mode version
  95. _REAL_PACKET sRealPacket; // real mode version
  96. } _ECB_PACKET;
  97. // ECB structure
  98. typedef struct _tagIPX_ECB
  99. {
  100. PSTR pLinkAddress; // link address
  101. PSTR pESRRoutine; // ESR service routine
  102. BYTE bInUse; // in use flag
  103. BYTE bCompletionCode; // completion code
  104. USHORT wSocket; // socket
  105. USHORT wConnectionID; // returned by listen
  106. USHORT wWorkSpace; // temp work space
  107. BYTE bDriverWorkSpace[ 12 ]; // temp work space for driver
  108. BYTE bImmediateAddress[ 6 ]; // address
  109. USHORT wPacketCount; // number of packets
  110. _ECB_PACKET sPacket[ 2 ]; // packets 386/real
  111. } _IPX_ECB;
  112. // internet address
  113. typedef struct _tagIPX_INTERNET_ADDR
  114. {
  115. BYTE bNetwork[ 4 ]; // network address
  116. BYTE bNode[ 6 ]; // node address
  117. } _IPX_INTERNET_ADDR;
  118. // network address
  119. typedef struct _tagIPX_NETWORK_ADDR
  120. {
  121. _IPX_INTERNET_ADDR sInternetAddr; // internet address
  122. BYTE bSocket[ 2 ]; // socket
  123. } _IPX_NETWORK_ADDR;
  124. // local target immediate address
  125. typedef struct _tagIPX_LOCAL_TARGET
  126. {
  127. _IPX_INTERNET_ADDR sInternetAddr; // internet address
  128. BYTE bImmediate[ 6 ]; // immediate address
  129. } _IPX_LOCAL_TARGET;
  130. // flags for send/listen element
  131. #define _IPX_ELEMENT_ACTIVE 0x8000 // element is active
  132. #define _IPX_ELEMENT_DATA 0x4000 // element has data waiting
  133. #define _IPX_ELEMENT_LISTENING 0x2000 // element is listening for packet
  134. #define _IPX_ELEMENT_SENDING 0x1000 // element is sending packet
  135. // structure for send/listen elements
  136. typedef struct _tagIPX_ELEMENT
  137. {
  138. USHORT wFlags; // misc flags
  139. USHORT wOffset; // offset into data area
  140. _IPX_HEADER sHeader; // IPX header
  141. _IPX_ECB sECB; // IPX ECB
  142. _IPX_ECB * pECB; // pointer to ECB
  143. _IPX_HEADER * pIPXHeader; // pointer to IPX header
  144. PSTR pHeader; // application specific header
  145. USHORT wHSize; // application header size
  146. } _IPX_ELEMENT;
  147. // equates for node addition
  148. enum
  149. {
  150. _IPX_ADD_COMPLETE,
  151. _IPX_ADD_DUPLICATE,
  152. _IPX_ADD_LIST_FULL
  153. };
  154. // equates for node deletion
  155. enum
  156. {
  157. _IPX_DELETE_COMPLETE,
  158. _IPX_DELETE_INVALID,
  159. };
  160. // equates for init error
  161. enum
  162. {
  163. _IPX_INIT_NO_ERROR,
  164. _IPX_INIT_NO_MEMORY,
  165. _IPX_INIT_NO_IPX,
  166. _IPX_INIT_NO_SOCKET
  167. };
  168. // reset structure packing
  169. #pragma pack()
  170. #endif
  171. // function prototypes
  172. BOOL cdecl hmiIPXInitSystem ( W32 wNodes, W32 wSocket );
  173. BOOL cdecl hmiIPXUnInitSystem ( VOID );
  174. BOOL cdecl hmiIPXInstalled ( VOID );
  175. BOOL cdecl hmiIPXOpenSocket ( W32 wSocket );
  176. BOOL cdecl hmiIPXCloseSocket ( W32 wSocket );
  177. VOID cdecl hmiIPXRelinquishControl ( VOID );
  178. VOID cdecl hmiIPXListenForPacket ( _IPX_ECB * sECB, _IPX_ECB ** pPacket );
  179. VOID cdecl hmiIPXSendPacket ( _IPX_ECB * sECB, _IPX_ECB ** pPacket, PSTR pHeader, W32 wSize );
  180. VOID cdecl hmiIPXGetInternetworkAddr ( _IPX_INTERNET_ADDR * sInterworkAddr );
  181. VOID cdecl hmiIPXGetLocalTarget ( _IPX_LOCAL_TARGET * sNetworkAddr );
  182. BOOL cdecl hmiIPXSendData ( PSTR pHeader, W32 wHSize,
  183. PSTR pData, W32 wDSize,
  184. W32 wNode );
  185. BOOL cdecl hmiIPXGetData ( PSTR pHeader, W32 wHSize,
  186. PSTR pData, W32 wDSize );
  187. BOOL cdecl hmiIPXPostListen ( VOID );
  188. W32 cdecl hmiIPXServiceSend ( VOID );
  189. VOID cdecl hmiIPXGetListenData ( _IPX_ECB * sECB, PSTR pHeader, W32 wSize );
  190. VOID cdecl hmiIPXSortNodes ( VOID );
  191. W32 cdecl hmiIPXGetConsoleNode ( VOID );
  192. W32 cdecl hmiIPXGetActiveNodes ( VOID );
  193. BOOL cdecl hmiIPXGetHeader ( PSTR pHeader, W32 wHSize,
  194. PSTR * pPacket );
  195. W32 cdecl hmiIPXDeleteNode ( W32 wNode );