Added a few more Unicode digits from Unicode version 4.1.
[wine] / include / ws2tcpip.h
1 /*
2  * Copyright (C) 2001 Francois Gouget
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #ifndef __WS2TCPIP__
20 #define __WS2TCPIP__
21
22 #ifdef USE_WS_PREFIX
23 #define WS(x)    WS_##x
24 #else
25 #define WS(x)    x
26 #endif
27
28 /* FIXME: This gets defined by some Unix (Linux) header and messes things */
29 #undef s6_addr
30
31 /* for addrinfo calls */
32 typedef struct WS(addrinfo)
33 {
34     int                ai_flags;
35     int                ai_family;
36     int                ai_socktype;
37     int                ai_protocol;
38     size_t             ai_addrlen;
39     char *             ai_canonname;
40     struct WS(sockaddr)*   ai_addr;
41     struct WS(addrinfo)*   ai_next;
42 } ADDRINFOA, *PADDRINFOA;
43
44 typedef struct WS(addrinfoW)
45 {
46     int                ai_flags;
47     int                ai_family;
48     int                ai_socktype;
49     int                ai_protocol;
50     size_t             ai_addrlen;
51     PWSTR              ai_canonname;
52     struct WS(sockaddr)*   ai_addr;
53     struct WS(addrinfoW)*   ai_next;
54 } ADDRINFOW, *PADDRINFOW;
55
56 typedef ADDRINFOA ADDRINFO;
57
58 /*
59  * Multicast group information
60  */
61
62 struct WS(ip_mreq)
63 {
64     struct WS(in_addr) imr_multiaddr;
65     struct WS(in_addr) imr_interface;
66 };
67
68 struct WS(ip_mreq_source) {
69     struct WS(in_addr) imr_multiaddr;
70     struct WS(in_addr) imr_sourceaddr;
71     struct WS(in_addr) imr_interface;
72 };
73
74 struct WS(ip_msfilter) {
75     struct WS(in_addr) imsf_multiaddr;
76     struct WS(in_addr) imsf_interface;
77     u_long             imsf_fmode;
78     u_long             imsf_numsrc;
79     struct WS(in_addr) imsf_slist[1];
80 };
81
82 typedef struct WS(in_addr6)
83 {
84    u_char s6_addr[16];   /* IPv6 address */
85 } IN6_ADDR, *PIN6_ADDR, *LPIN6_ADDR;
86
87 /* check for sockaddr_in6 / sockaddr_in6_old madness:
88  * http://msdn.microsoft.com/library/en-us/winsock/winsock/sockaddr_2.asp
89  */
90 typedef struct WS(sockaddr_in6)
91 {
92    short   sin6_family;            /* AF_INET6 */
93    u_short sin6_port;              /* Transport level port number */
94    u_long  sin6_flowinfo;          /* IPv6 flow information */
95    struct  WS(in_addr6) sin6_addr; /* IPv6 address */
96    u_long  sin6_scope_id;          /* IPv6 scope id */
97 } SOCKADDR_IN6,*PSOCKADDR_IN6, *LPSOCKADDR_IN6;
98
99 typedef struct WS(sockaddr_in6_old)
100 {
101    short   sin6_family;            /* AF_INET6 */
102    u_short sin6_port;              /* Transport level port number */
103    u_long  sin6_flowinfo;          /* IPv6 flow information */
104    struct  WS(in_addr6) sin6_addr; /* IPv6 address */
105 } SOCKADDR_IN6_OLD,*PSOCKADDR_IN6_OLD, *LPSOCKADDR_IN6_OLD;
106
107 typedef union sockaddr_gen
108 {
109    struct WS(sockaddr) Address;
110    struct WS(sockaddr_in)  AddressIn;
111    struct WS(sockaddr_in6_old) AddressIn6;
112 } WS(sockaddr_gen);
113
114 /* Structure to keep interface specific information */
115 typedef struct _INTERFACE_INFO
116 {
117     u_long            iiFlags;             /* Interface flags */
118     WS(sockaddr_gen)  iiAddress;           /* Interface address */
119     WS(sockaddr_gen)  iiBroadcastAddress;  /* Broadcast address */
120     WS(sockaddr_gen)  iiNetmask;           /* Network mask */
121 } INTERFACE_INFO, * LPINTERFACE_INFO;
122
123 /* Possible flags for the  iiFlags - bitmask  */
124 #ifndef USE_WS_PREFIX
125 #define IFF_UP                0x00000001 /* Interface is up */
126 #define IFF_BROADCAST         0x00000002 /* Broadcast is  supported */
127 #define IFF_LOOPBACK          0x00000004 /* this is loopback interface */
128 #define IFF_POINTTOPOINT      0x00000008 /* this is point-to-point interface */
129 #define IFF_MULTICAST         0x00000010 /* multicast is supported */
130 #else
131 #define WS_IFF_UP             0x00000001 /* Interface is up */
132 #define WS_IFF_BROADCAST      0x00000002 /* Broadcast is  supported */
133 #define WS_IFF_LOOPBACK       0x00000004 /* this is loopback interface */
134 #define WS_IFF_POINTTOPOINT   0x00000008 /* this is point-to-point interface */
135 #define WS_IFF_MULTICAST      0x00000010 /* multicast is supported */
136 #endif /* USE_WS_PREFIX */
137
138 #ifndef USE_WS_PREFIX
139 #define IP_OPTIONS             1
140 #define IP_HDRINCL             2
141 #define IP_TOS                 3
142 #define IP_TTL                 4
143 #define IP_MULTICAST_IF        9
144 #define IP_MULTICAST_TTL       10
145 #define IP_MULTICAST_LOOP      11
146 #define IP_ADD_MEMBERSHIP      12
147 #define IP_DROP_MEMBERSHIP     13
148 #define IP_DONTFRAGMENT        14
149 #else
150 #define WS_IP_OPTIONS          1
151 #define WS_IP_HDRINCL          2
152 #define WS_IP_TOS              3
153 #define WS_IP_TTL              4
154 #define WS_IP_MULTICAST_IF     9
155 #define WS_IP_MULTICAST_TTL    10
156 #define WS_IP_MULTICAST_LOOP   11
157 #define WS_IP_ADD_MEMBERSHIP   12
158 #define WS_IP_DROP_MEMBERSHIP  13
159 #define WS_IP_DONTFRAGMENT     14
160 #endif /* USE_WS_PREFIX */
161
162 /* Possible Windows flags for getaddrinfo() */
163 #ifndef USE_WS_PREFIX
164 # define AI_PASSIVE     0x0001
165 # define AI_CANONNAME   0x0002
166 # define AI_NUMERICHOST 0x0004
167 /* getaddrinfo error codes */
168 # define EAI_AGAIN      WSATRY_AGAIN
169 # define EAI_BADFLAGS   WSAEINVAL
170 # define EAI_FAIL       WSANO_RECOVERY
171 # define EAI_FAMILY     WSAEAFNOSUPPORT
172 # define EAI_MEMORY     WSA_NOT_ENOUGH_MEMORY
173 # define EAI_NODATA     WSANO_DATA
174 # define EAI_NONAME     WSAHOST_NOT_FOUND
175 # define EAI_SERVICE    WSATYPE_NOT_FOUND
176 # define EAI_SOCKTYPE   WSAESOCKTNOSUPPORT
177 #else
178 # define WS_AI_PASSIVE     0x0001
179 # define WS_AI_CANONNAME   0x0002
180 # define WS_AI_NUMERICHOST 0x0004
181 /* getaddrinfo error codes */
182 # define WS_EAI_AGAIN   WSATRY_AGAIN
183 # define WS_EAI_BADFLAGS        WSAEINVAL
184 # define WS_EAI_FAIL    WSANO_RECOVERY
185 # define WS_EAI_FAMILY  WSAEAFNOSUPPORT
186 # define WS_EAI_MEMORY  WSA_NOT_ENOUGH_MEMORY
187 # define WS_EAI_NODATA  WSANO_DATA
188 # define WS_EAI_NONAME  WSAHOST_NOT_FOUND
189 # define WS_EAI_SERVICE WSATYPE_NOT_FOUND
190 # define WS_EAI_SOCKTYPE        WSAESOCKTNOSUPPORT
191 #endif
192
193 int WINAPI WS(getaddrinfo)(LPCSTR,LPCSTR,const ADDRINFOA *,ADDRINFOA **);
194 int WINAPI GetAddrInfoW(LPCWSTR,LPCWSTR,const ADDRINFOW *,ADDRINFOW **);
195
196 #endif /* __WS2TCPIP__ */