home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 June / Chip_2002-06_cd1.bin / zkuste / cecko / install / devcpp4920.exe / include / ws2tcpip.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-14  |  4.2 KB  |  139 lines

  1. /*
  2.  *  ws2tcpip.h : TCP/IP specific extensions in Windows Sockets 2
  3.  *
  4.  * Portions Copyright (c) 1980, 1983, 1988, 1993
  5.  * The Regents of the University of California.  All rights reserved.
  6.  *
  7.  */
  8.  
  9. #ifndef _WS2TCPIP_H
  10. #define _WS2TCPIP_H
  11.  
  12. #include <winsock2.h>
  13.  
  14. /* 
  15.  * The IP_* macros are also defined in winsock.h, but some values are different there.
  16.  * The values defined in winsock.h for 1.1 and used in wsock32.dll are consistent
  17.  * with the original values Steve Deering defined in his document "IP Multicast Extensions
  18.  * for 4.3BSD UNIX related systems (MULTICAST 1.2 Release)." However, these conflicted with
  19.  * the definitions for some IPPROTO_IP level socket options already assigned by BSD,
  20.  * so Berkeley changed all the values by adding 7.  WinSock2 (ws2_32.dll)  uses
  21.  * the BSD 4.4 compatible values defined here.
  22.  *
  23.  * See also: msdn kb article Q257460
  24.  * http://support.microsoft.com/support/kb/articles/Q257/4/60.asp
  25.  */
  26.  
  27. /* This is also defined in winsock.h; value hasn't changed */
  28. #define    IP_OPTIONS  1
  29.  
  30. #define    IP_HDRINCL  2
  31. /*
  32.  * These are also be defined in winsock.h,
  33.  * but values have changed for WinSock2 interface
  34.  */
  35. #define    IP_TOS  3   /* old (winsock 1.1) value 8 */
  36. #define    IP_TTL  4  /* old value 7 */
  37. #define    IP_MULTICAST_IF     9 /* old value 2 */
  38. #define    IP_MULTICAST_TTL    10 /* old value 3 */
  39. #define    IP_MULTICAST_LOOP   11 /* old value 4 */
  40. #define    IP_ADD_MEMBERSHIP   12 /* old value 5 */
  41. #define    IP_DROP_MEMBERSHIP  13 /* old value 6 */
  42. #define IP_DONTFRAGMENT 14 /* old value 9 */
  43.  
  44. #define IP_DEFAULT_MULTICAST_TTL 1 
  45. #define IP_DEFAULT_MULTICAST_LOOP 1 
  46. #define IP_MAX_MEMBERSHIPS 20 
  47.  
  48. #define TCP_EXPEDITED_1122  2
  49.  
  50. #define UDP_NOCHECKSUM    1
  51.  
  52. #define IFF_UP  1
  53. #define IFF_BROADCAST   2
  54. #define IFF_LOOPBACK    4
  55. #define IFF_POINTTOPOINT    8
  56. #define IFF_MULTICAST   16
  57.  
  58. #define SIO_GET_INTERFACE_LIST  _IOR('t', 127, u_long)    
  59.  
  60. /*
  61.  *   ip_mreq also in winsock.h for WinSock1.1,
  62.  *   but online msdn docs say it is defined here for WinSock2.
  63.  */ 
  64. struct ip_mreq {
  65.     struct in_addr imr_multiaddr;
  66.     struct in_addr imr_interface;
  67. };
  68.  
  69. typedef struct _INTERFACE_INFO {
  70.     u_long        iiFlags;
  71.     struct sockaddr iiAddress;
  72.     struct sockaddr iiBroadcastAddress;
  73.     struct sockaddr iiNetmask;
  74. } INTERFACE_INFO, *LPINTERFACE_INFO;
  75.  
  76.  
  77. /* ipv6 */ 
  78.  
  79. /*
  80.  * According to online msdn documentation (12 Dec 2000), two separate implentations
  81.  * of ipv6 are available (1) the Microsoft IPv6 Technology Preview  (requires W2K SP1)
  82.  * and (2) the MS Research IPV6 implementation (requires NT4 or W2K).
  83.  * Neither are production level implementations.    
  84.  */
  85.  
  86. #if 0
  87. /*
  88.  * The following is based on what online msdn PSDK docs say as at 5 Dec 2000
  89.  */
  90. struct in_addr6 /* sic */ { u_char s6_addr[16]; };
  91. typedef struct in_addr6 IN6_ADDR,  *PIN6_ADDR, *LPIN6_ADDR;
  92.  
  93. typedef struct sockaddr_in6 {
  94.         short    sin6_family;
  95.         u_short sin6_port;
  96.         u_long    sin6_flowinfo;
  97.         struct in_addr6 sin6_addr;
  98. } SOCKADDR_IN6, *PSOCKADDR_IN6, *LPSOCKADDR_IN6;
  99.  
  100. #elif 0
  101. /*
  102.  * In the FAQ section of Microsoft IPv6 Technology Preview for Windows 2000
  103.  * (dated 12 Dec 2000) it says that the Preview and the MS Research implemntation
  104.  * support RFC 2553, and in particular, uses the sockaddr_in6 structure defined
  105.  * in Section 3.3. That would look something like this:
  106. */
  107. #include <stdint.h>
  108. struct in6_addr { /* this is the standard name */
  109.         union {
  110.                 uint8_t   _u6_addr8[16];
  111.                 uint16_t  _u6_addr16[8];
  112.                 uint32_t  _u6_addr32[4];
  113.              /* uint64_t  _u6_addr64[2];*/ 
  114.         } _u6_addr;
  115. };
  116. typedef struct in6_addr IN6_ADDR,  *PIN6_ADDR, *LPIN6_ADDR;
  117. #define s6_addr   _u6_addr._u6_addr8
  118.  
  119. struct sockaddr_in6 {
  120.     uint16_t sin6_family; /* AF_INET6 */
  121.     uint16_t sin6_port; /* transport layer port # */
  122.     uint32_t sin6_flowinfo; /* IPv6 traffic class & flow info */
  123.     struct in6_addr sin6_addr;  /* IPv6 address */
  124.     uint32_t sin6_scope_id;  /* set of interfaces for a scope */
  125. };
  126. typedef struct sockaddr_in6  SOCKADDR_IN6, *PSOCKADDR_IN6, *LPSOCKADDR_IN6;
  127.  
  128. /*
  129.  * Watch this space.
  130.  * These may get moved out to ipv6 specific header(s). along with other
  131.  * standard structures and functions specified in RFC 2553.    
  132.  */
  133. #endif
  134.  
  135. #endif    /* _WS2TCPIP_H */
  136.  
  137.  
  138.  
  139.