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