home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / WSNWLINK.H < prev    next >
C/C++ Source or Header  |  1997-02-14  |  10KB  |  293 lines

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