home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / wsnwlink.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  9.2 KB  |  286 lines

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