ole32: Make all formats available to the clipboard.
[wine/hacks.git] / include / ws2tcpip.h
blobfc9f2587d2694a9abaddf51ba5ba50785efccae9
1 /*
2 * Copyright (C) 2001 Francois Gouget
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WS2TCPIP__
20 #define __WS2TCPIP__
22 #include <winsock2.h>
23 #include <ws2ipdef.h>
24 #include <limits.h>
26 #ifdef USE_WS_PREFIX
27 #define WS(x) WS_##x
28 #else
29 #define WS(x) x
30 #endif
32 /* FIXME: This gets defined by some Unix (Linux) header and messes things */
33 #undef s6_addr
35 /* for addrinfo calls */
36 typedef struct WS(addrinfo)
38 int ai_flags;
39 int ai_family;
40 int ai_socktype;
41 int ai_protocol;
42 size_t ai_addrlen;
43 char * ai_canonname;
44 struct WS(sockaddr)* ai_addr;
45 struct WS(addrinfo)* ai_next;
46 } ADDRINFOA, *PADDRINFOA;
48 typedef struct WS(addrinfoW)
50 int ai_flags;
51 int ai_family;
52 int ai_socktype;
53 int ai_protocol;
54 size_t ai_addrlen;
55 PWSTR ai_canonname;
56 struct WS(sockaddr)* ai_addr;
57 struct WS(addrinfoW)* ai_next;
58 } ADDRINFOW, *PADDRINFOW;
60 typedef int WS(socklen_t);
62 typedef ADDRINFOA ADDRINFO, *LPADDRINFO;
64 /* Possible Windows flags for getaddrinfo() */
65 #ifndef USE_WS_PREFIX
66 # define AI_PASSIVE 0x0001
67 # define AI_CANONNAME 0x0002
68 # define AI_NUMERICHOST 0x0004
69 /* getaddrinfo error codes */
70 # define EAI_AGAIN WSATRY_AGAIN
71 # define EAI_BADFLAGS WSAEINVAL
72 # define EAI_FAIL WSANO_RECOVERY
73 # define EAI_FAMILY WSAEAFNOSUPPORT
74 # define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
75 # define EAI_NODATA EAI_NONAME
76 # define EAI_NONAME WSAHOST_NOT_FOUND
77 # define EAI_SERVICE WSATYPE_NOT_FOUND
78 # define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
79 #else
80 # define WS_AI_PASSIVE 0x0001
81 # define WS_AI_CANONNAME 0x0002
82 # define WS_AI_NUMERICHOST 0x0004
83 /* getaddrinfo error codes */
84 # define WS_EAI_AGAIN WSATRY_AGAIN
85 # define WS_EAI_BADFLAGS WSAEINVAL
86 # define WS_EAI_FAIL WSANO_RECOVERY
87 # define WS_EAI_FAMILY WSAEAFNOSUPPORT
88 # define WS_EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
89 # define WS_EAI_NODATA WS_EAI_NONAME
90 # define WS_EAI_NONAME WSAHOST_NOT_FOUND
91 # define WS_EAI_SERVICE WSATYPE_NOT_FOUND
92 # define WS_EAI_SOCKTYPE WSAESOCKTNOSUPPORT
93 #endif
95 #ifndef USE_WS_PREFIX
96 # define NI_MAXHOST 1025
97 # define NI_MAXSERV 32
98 #else
99 # define WS_NI_MAXHOST 1025
100 # define WS_NI_MAXSERV 32
101 #endif
103 /* Possible Windows flags for getnameinfo() */
104 #ifndef USE_WS_PREFIX
105 # define NI_NOFQDN 0x01
106 # define NI_NUMERICHOST 0x02
107 # define NI_NAMEREQD 0x04
108 # define NI_NUMERICSERV 0x08
109 # define NI_DGRAM 0x10
110 #else
111 # define WS_NI_NOFQDN 0x01
112 # define WS_NI_NUMERICHOST 0x02
113 # define WS_NI_NAMEREQD 0x04
114 # define WS_NI_NUMERICSERV 0x08
115 # define WS_NI_DGRAM 0x10
116 #endif
119 #ifdef __cplusplus
120 extern "C" {
121 #endif
123 #define GAI_STRERROR_BUFFER_SIZE 1024
125 static inline char *gai_strerrorA(int errcode)
127 static char buffer[GAI_STRERROR_BUFFER_SIZE + 1];
129 /* FIXME: should format message from system, ignoring inserts in neutral
130 * language */
131 buffer[0] = '\0';
133 return buffer;
136 static inline WCHAR *gai_strerrorW(int errcode)
138 static WCHAR buffer[GAI_STRERROR_BUFFER_SIZE + 1];
140 /* FIXME: should format message from system, ignoring inserts in neutral
141 * language */
142 buffer[0] = '\0';
144 return buffer;
147 #ifdef USE_WS_PREFIX
148 # define WS_gai_strerror WINELIB_NAME_AW(gai_strerror)
149 #elif defined(WINE_NO_UNICODE_MACROS)
150 # define gai_strerror gai_strerrorA
151 #else
152 # define gai_strerror WINELIB_NAME_AW(gai_strerror)
153 #endif
155 void WINAPI WS(freeaddrinfo)(LPADDRINFO);
156 #define FreeAddrInfoA WS(freeaddrinfo)
157 void WINAPI FreeAddrInfoW(PADDRINFOW);
158 #define FreeAddrInfo WINELIB_NAME_AW(FreeAddrInfo)
159 int WINAPI WS(getaddrinfo)(const char*,const char*,const struct WS(addrinfo)*,struct WS(addrinfo)**);
160 #define GetAddrInfoA WS(getaddrinfo)
161 int WINAPI GetAddrInfoW(PCWSTR,PCWSTR,const ADDRINFOW*,PADDRINFOW*);
162 #define GetAddrInfo WINELIB_NAME_AW(GetAddrInfo)
163 int WINAPI WS(getnameinfo)(const SOCKADDR*,WS(socklen_t),PCHAR,DWORD,PCHAR,DWORD,INT);
164 #define GetNameInfoA WS(getnameinfo)
165 INT WINAPI GetNameInfoW(const SOCKADDR*,WS(socklen_t),PWCHAR,DWORD,PWCHAR,DWORD,INT);
166 #define GetNameInfo WINELIB_NAME_AW(GetNameInfo)
167 PCSTR WINAPI WS(inet_ntop)(INT,PVOID,PSTR,size_t);
168 #define InetNtopA WS(inet_ntop)
169 PCWSTR WINAPI InetNtopW(INT,PVOID,PWSTR,size_t);
170 #define InetNtop WINELIB_NAME_AW(InetNtop)
171 int WINAPI WS(inet_pton)(INT,PCSTR,PVOID);
172 #define InetPtonA WS(inet_pton)
173 int WINAPI InetPtonW(INT,PCWSTR,PVOID);
174 #define InetPton WINELIB_NAME_AW(InetPton)
177 * Ws2tcpip Function Typedefs
179 * Remember to keep this section in sync with the
180 * prototypes above.
182 #if INCL_WINSOCK_API_TYPEDEFS
184 typedef void (WINAPI *LPFN_FREEADDRINFO)(LPADDRINFO);
185 #define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO
186 typedef void (WINAPI *LPFN_FREEADDRINFOW)(PADDRINFOW);
187 #define LPFN_FREEADDRINFOT WINELIB_NAME_AW(LPFN_FREEADDRINFO)
188 typedef int (WINAPI *LPFN_GETADDRINFO)(const char*,const char*,const struct WS(addrinfo)*,struct WS(addrinfo)**);
189 #define LPFN_GETADDRINFOA LPFN_GETADDRINFO
190 typedef int (WINAPI *LPFN_GETADDRINFOW)(PCWSTR,PCWSTR,const ADDRINFOW*,PADDRINFOW*);
191 #define LPFN_GETADDRINFOT WINELIB_NAME_AW(LPFN_GETADDRINFO)
192 typedef int (WINAPI *LPFN_GETNAMEINFO)(const struct sockaddr*,socklen_t,char*,DWORD,char*,DWORD,int);
193 #define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO
194 typedef int (WINAPI *LPFN_GETNAMEINFOW)(const SOCKADDR*,socklen_t,PWCHAR,DWORD,PWCHAR,DWORD,INT);
195 #define LPFN_GETNAMEINFOT WINELIB_NAME_AW(LPFN_GETNAMEINFO)
197 #endif
199 #ifdef __cplusplus
201 #endif
203 #endif /* __WS2TCPIP__ */