wsnwlink.inc
上传用户:hndmjx
上传日期:2014-09-16
资源大小:3369k
文件大小:9k
源码类别:

Delphi控件源码

开发平台:

Delphi

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