Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

283 lines
8.9 KiB

  1. /*
  2. * wsnwlink.h
  3. *
  4. *
  5. * Microsoft Windows
  6. * Copyright (C) Microsoft Corporation, 1992-1999.
  7. * Microsoft-specific extensions to the Windows NT IPX/SPX Windows
  8. * Sockets interface. These extensions are provided for use as
  9. * necessary for compatibility with existing applications. They are
  10. * otherwise not recommended for use, as they are only guaranteed to
  11. * work * over the Microsoft IPX/SPX stack. An application which
  12. * uses these * extensions may not work over other IPX/SPX
  13. * implementations. Include this header file after winsock.h and
  14. * wsipx.h.
  15. *
  16. * To open an IPX socket where a particular packet type is sent in
  17. * the IPX header, specify NSPROTO_IPX + n as the protocol parameter
  18. * of the socket() API. For example, to open an IPX socket that
  19. * sets the packet type to 34, use the following socket() call:
  20. *
  21. * s = socket(AF_IPX, SOCK_DGRAM, NSPROTO_IPX + 34);
  22. *
  23. * Below are socket option that may be set or retrieved by specifying
  24. * the appropriate manifest in the "optname" parameter of getsockopt()
  25. * or setsockopt(). Use NSPROTO_IPX as the "level" argument for the
  26. * call.
  27. *
  28. */
  29. #ifndef _WSNWLINK_
  30. #define _WSNWLINK_
  31. #if _MSC_VER > 1000
  32. #pragma once
  33. #endif
  34. /*
  35. * Set/get the IPX packet type. The value specified in the
  36. * optval argument will be set as the packet type on every IPX
  37. * packet sent from this socket. The optval parameter of
  38. * getsockopt()/setsockopt() points to an int.
  39. *
  40. */
  41. #define IPX_PTYPE 0x4000
  42. /*
  43. * Set/get the receive filter packet type. Only IPX packets with
  44. * a packet type equal to the value specified in the optval
  45. * argument will be returned; packets with a packet type that
  46. * does not match are discarded. optval points to an int.
  47. *
  48. */
  49. #define IPX_FILTERPTYPE 0x4001
  50. /*
  51. * Stop filtering on packet type set with IPX_FILTERPTYPE.
  52. *
  53. */
  54. #define IPX_STOPFILTERPTYPE 0x4003
  55. /*
  56. * Set/get the value of the datastream field in the SPX header on
  57. * every packet sent. optval points to an int.
  58. *
  59. */
  60. #define IPX_DSTYPE 0x4002
  61. /*
  62. * Enable extended addressing. On sends, adds the element
  63. * "unsigned char sa_ptype" to the SOCKADDR_IPX structure,
  64. * making the total length 15 bytes. On receives, add both
  65. * the sa_ptype and "unsigned char sa_flags" to the SOCKADDR_IPX
  66. * structure, making the total length 16 bytes. The current
  67. * bits defined in sa_flags are:
  68. *
  69. * 0x01 - the received frame was sent as a broadcast
  70. * 0x02 - the received frame was sent from this machine
  71. *
  72. * optval points to a BOOL.
  73. *
  74. */
  75. #define IPX_EXTENDED_ADDRESS 0x4004
  76. /*
  77. * Send protocol header up on all receive packets. optval points
  78. * to a BOOL.
  79. *
  80. */
  81. #define IPX_RECVHDR 0x4005
  82. /*
  83. * Get the maximum data size that can be sent. Not valid with
  84. * setsockopt(). optval points to an int where the value is
  85. * returned.
  86. *
  87. */
  88. #define IPX_MAXSIZE 0x4006
  89. /*
  90. * Query information about a specific adapter that IPX is bound
  91. * to. In a system with n adapters they are numbered 0 through n-1.
  92. * Callers can issue the IPX_MAX_ADAPTER_NUM getsockopt() to find
  93. * out the number of adapters present, or call IPX_ADDRESS with
  94. * increasing values of adapternum until it fails. Not valid
  95. * with setsockopt(). optval points to an instance of the
  96. * IPX_ADDRESS_DATA structure with the adapternum filled in.
  97. *
  98. */
  99. #define IPX_ADDRESS 0x4007
  100. typedef struct _IPX_ADDRESS_DATA {
  101. INT adapternum; /* input: 0-based adapter number */
  102. UCHAR netnum[4]; /* output: IPX network number */
  103. UCHAR nodenum[6]; /* output: IPX node address */
  104. BOOLEAN wan; /* output: TRUE = adapter is on a wan link */
  105. BOOLEAN status; /* output: TRUE = wan link is up (or adapter is not wan) */
  106. INT maxpkt; /* output: max packet size, not including IPX header */
  107. ULONG linkspeed; /* output: link speed in 100 bytes/sec (i.e. 96 == 9600 bps) */
  108. } IPX_ADDRESS_DATA, *PIPX_ADDRESS_DATA;
  109. /*
  110. * Query information about a specific IPX network number. If the
  111. * network is in IPX's cache it will return the information directly,
  112. * otherwise it will issue RIP requests to find it. Not valid with
  113. * setsockopt(). optval points to an instance of the IPX_NETNUM_DATA
  114. * structure with the netnum filled in.
  115. *
  116. */
  117. #define IPX_GETNETINFO 0x4008
  118. typedef struct _IPX_NETNUM_DATA {
  119. UCHAR netnum[4]; /* input: IPX network number */
  120. USHORT hopcount; /* output: hop count to this network, in machine order */
  121. USHORT netdelay; /* output: tick count to this network, in machine order */
  122. INT cardnum; /* output: 0-based adapter number used to route to this net;
  123. /* can be used as adapternum input to IPX_ADDRESS */
  124. UCHAR router[6]; /* output: MAC address of the next hop router, zeroed if
  125. /* the network is directly attached */
  126. } IPX_NETNUM_DATA, *PIPX_NETNUM_DATA;
  127. /*
  128. * Like IPX_GETNETINFO except it *does not* issue RIP requests. If the
  129. * network is in IPX's cache it will return the information, otherwise
  130. * it will fail (see also IPX_RERIPNETNUMBER which *always* forces a
  131. * re-RIP). Not valid with setsockopt(). optval points to an instance of
  132. * the IPX_NETNUM_DATA structure with the netnum filled in.
  133. *
  134. */
  135. #define IPX_GETNETINFO_NORIP 0x4009
  136. /*
  137. * Get information on a connected SPX socket. optval points
  138. * to an instance of the IPX_SPXCONNSTATUS_DATA structure.
  139. *
  140. * All numbers are in Novell (high-low) order.
  141. *
  142. */
  143. #define IPX_SPXGETCONNECTIONSTATUS 0x400B
  144. typedef struct _IPX_SPXCONNSTATUS_DATA {
  145. UCHAR ConnectionState;
  146. UCHAR WatchDogActive;
  147. USHORT LocalConnectionId;
  148. USHORT RemoteConnectionId;
  149. USHORT LocalSequenceNumber;
  150. USHORT LocalAckNumber;
  151. USHORT LocalAllocNumber;
  152. USHORT RemoteAckNumber;
  153. USHORT RemoteAllocNumber;
  154. USHORT LocalSocket;
  155. UCHAR ImmediateAddress[6];
  156. UCHAR RemoteNetwork[4];
  157. UCHAR RemoteNode[6];
  158. USHORT RemoteSocket;
  159. USHORT RetransmissionCount;
  160. USHORT EstimatedRoundTripDelay; /* In milliseconds */
  161. USHORT RetransmittedPackets;
  162. USHORT SuppressedPacket;
  163. } IPX_SPXCONNSTATUS_DATA, *PIPX_SPXCONNSTATUS_DATA;
  164. /*
  165. * Get notification when the status of an adapter that IPX is
  166. * bound to changes. Typically this will happen when a wan line
  167. * goes up or down. Not valid with setsockopt(). optval points
  168. * to a buffer which contains an IPX_ADDRESS_DATA structure
  169. * followed immediately by a HANDLE to an unsignaled event.
  170. *
  171. * When the getsockopt() query is submitted, it will complete
  172. * successfully. However, the IPX_ADDRESS_DATA pointed to by
  173. * optval will not be updated at that point. Instead the
  174. * request is queued internally inside the transport.
  175. *
  176. * When the status of an adapter changes, IPX will locate a
  177. * queued getsockopt() query and fill in all the fields in the
  178. * IPX_ADDRESS_DATA structure. It will then signal the event
  179. * pointed to by the HANDLE in the optval buffer. This handle
  180. * should be obtained before calling getsockopt() by calling
  181. * CreateEvent(). If multiple getsockopts() are submitted at
  182. * once, different events must be used.
  183. *
  184. * The event is used because the call needs to be asynchronous
  185. * but currently getsockopt() does not support this.
  186. *
  187. * WARNING: In the current implementation, the transport will
  188. * only signal one queued query for each status change. Therefore
  189. * only one service which uses this query should be running at
  190. * once.
  191. *
  192. */
  193. #define IPX_ADDRESS_NOTIFY 0x400C
  194. /*
  195. * Get the maximum number of adapters present. If this call returns
  196. * n then the adapters are numbered 0 through n-1. Not valid
  197. * with setsockopt(). optval points to an int where the value
  198. * is returned.
  199. *
  200. */
  201. #define IPX_MAX_ADAPTER_NUM 0x400D
  202. /*
  203. * Like IPX_GETNETINFO except it forces IPX to re-RIP even if the
  204. * network is in its cache (but not if it is directly attached to).
  205. * Not valid with setsockopt(). optval points to an instance of
  206. * the IPX_NETNUM_DATA structure with the netnum filled in.
  207. *
  208. */
  209. #define IPX_RERIPNETNUMBER 0x400E
  210. /*
  211. * A hint that broadcast packets may be received. The default is
  212. * TRUE. Applications that do not need to receive broadcast packets
  213. * should set this sockopt to FALSE which may cause better system
  214. * performance (note that it does not necessarily cause broadcasts
  215. * to be filtered for the application). Not valid with getsockopt().
  216. * optval points to a BOOL.
  217. *
  218. */
  219. #define IPX_RECEIVE_BROADCAST 0x400F
  220. /*
  221. * On SPX connections, don't delay before sending ack. Applications
  222. * that do not tend to have back-and-forth traffic over SPX should
  223. * set this; it will increase the number of acks sent but will remove
  224. * delays in sending acks. optval points to a BOOL.
  225. *
  226. */
  227. #define IPX_IMMEDIATESPXACK 0x4010
  228. #endif