OLE: ITypeInfo_Invoke parameter naming change.
[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, *LPADDRINFO;
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 #define IP_ADD_SOURCE_MEMBERSHIP        15
150 #define IP_DROP_SOURCE_MEMBERSHIP       16
151 #define IP_BLOCK_SOURCE                 17
152 #define IP_UNBLOCK_SOURCE               18
153 #define IP_PKTINFO                      19
154 #define IP_RECEIVE_BROADCAST            22
155 #else
156 #define WS_IP_OPTIONS                   1
157 #define WS_IP_HDRINCL                   2
158 #define WS_IP_TOS                       3
159 #define WS_IP_TTL                       4
160 #define WS_IP_MULTICAST_IF              9
161 #define WS_IP_MULTICAST_TTL             10
162 #define WS_IP_MULTICAST_LOOP            11
163 #define WS_IP_ADD_MEMBERSHIP            12
164 #define WS_IP_DROP_MEMBERSHIP           13
165 #define WS_IP_DONTFRAGMENT              14
166 #define WS_IP_ADD_SOURCE_MEMBERSHIP     15
167 #define WS_IP_DROP_SOURCE_MEMBERSHIP    16
168 #define WS_IP_BLOCK_SOURCE              17
169 #define WS_IP_UNBLOCK_SOURCE            18
170 #define WS_IP_PKTINFO                   19
171 #define WS_IP_RECEIVE_BROADCAST         22
172 #endif /* USE_WS_PREFIX */
173
174 /* Possible Windows flags for getaddrinfo() */
175 #ifndef USE_WS_PREFIX
176 # define AI_PASSIVE     0x0001
177 # define AI_CANONNAME   0x0002
178 # define AI_NUMERICHOST 0x0004
179 /* getaddrinfo error codes */
180 # define EAI_AGAIN      WSATRY_AGAIN
181 # define EAI_BADFLAGS   WSAEINVAL
182 # define EAI_FAIL       WSANO_RECOVERY
183 # define EAI_FAMILY     WSAEAFNOSUPPORT
184 # define EAI_MEMORY     WSA_NOT_ENOUGH_MEMORY
185 # define EAI_NODATA     WSANO_DATA
186 # define EAI_NONAME     WSAHOST_NOT_FOUND
187 # define EAI_SERVICE    WSATYPE_NOT_FOUND
188 # define EAI_SOCKTYPE   WSAESOCKTNOSUPPORT
189 #else
190 # define WS_AI_PASSIVE     0x0001
191 # define WS_AI_CANONNAME   0x0002
192 # define WS_AI_NUMERICHOST 0x0004
193 /* getaddrinfo error codes */
194 # define WS_EAI_AGAIN   WSATRY_AGAIN
195 # define WS_EAI_BADFLAGS        WSAEINVAL
196 # define WS_EAI_FAIL    WSANO_RECOVERY
197 # define WS_EAI_FAMILY  WSAEAFNOSUPPORT
198 # define WS_EAI_MEMORY  WSA_NOT_ENOUGH_MEMORY
199 # define WS_EAI_NODATA  WSANO_DATA
200 # define WS_EAI_NONAME  WSAHOST_NOT_FOUND
201 # define WS_EAI_SERVICE WSATYPE_NOT_FOUND
202 # define WS_EAI_SOCKTYPE        WSAESOCKTNOSUPPORT
203 #endif
204
205
206 #ifdef __cplusplus
207 extern "C" {
208 #endif
209
210 void WINAPI WS(freeaddrinfo)(LPADDRINFO);
211 #define     FreeAddrInfoA WS(freeaddrinfo)
212 void WINAPI FreeAddrInfoW(PADDRINFOW);
213 #define     FreeAddrInfo WINELIB_NAME_AW(FreeAddrInfo)
214 int WINAPI  WS(getaddrinfo)(const char*,const char*,const struct WS(addrinfo)*,struct WS(addrinfo)**);
215 #define     GetAddrInfoA WS(getaddrinfo)
216 int WINAPI  GetAddrInfoW(PCWSTR,PCWSTR,const ADDRINFOW*,PADDRINFOW*);
217 #define     GetAddrInfo WINELIB_NAME_AW(GetAddrInfo)
218 int WINAPI  WS(getnameinfo)(const struct sockaddr*,socklen_t,char*,DWORD,char*,DWORD,int);
219 #define     GetNameInfoA WS(getnameinfo)
220 INT WINAPI  GetNameInfoW(const SOCKADDR*,socklen_t,PWCHAR,DWORD,PWCHAR,DWORD,INT);
221 #define     GetNameInfo WINELIB_NAME_AW(GetNameInfo)
222
223 /*
224  * Ws2tcpip Function Typedefs
225  *
226  * Remember to keep this section in sync with the
227  * prototypes above.
228  */
229 #if INCL_WINSOCK_API_TYPEDEFS
230
231 typedef void (WINAPI *LPFN_FREEADDRINFO)(LPADDRINFO);
232 #define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO
233 typedef void (WINAPI *LPFN_FREEADDRINFOW)(PADDRINFOW);
234 #define LPFN_FREEADDRINFOT WINELIB_NAME_AW(LPFN_FREEADDRINFO)
235 typedef int (WINAPI *LPFN_GETADDRINFO)(const char*,const char*,const struct WS(addrinfo)*,struct WS(addrinfo)**);
236 #define LPFN_GETADDRINFOA LPFN_GETADDRINFO
237 typedef int (WINAPI *LPFN_GETADDRINFOW)(PCWSTR,PCWSTR,const ADDRINFOW*,PADDRINFOW*);
238 #define LPFN_GETADDRINFOT WINELIB_NAME_AW(LPFN_GETADDRINFO)
239 typedef int (WINAPI *LPFN_GETNAMEINFO)(const struct sockaddr*,socklen_t,char*,DWORD,char*,DWORD,int);
240 #define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO
241 typedef int (WINAPI *LPFN_GETNAMEINFOW)(const SOCKADDR*,socklen_t,PWCHAR,DWORD,PWCHAR,DWORD,INT);
242 #define LPFN_GETNAMEINFOT WINELIB_NAME_AW(LPFN_GETNAMEINFO)
243
244 #endif
245
246 #ifdef __cplusplus
247 }
248 #endif
249
250 #endif /* __WS2TCPIP__ */