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