VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/include/ws2tcpip.h@ 33656

Last change on this file since 33656 was 33656, checked in by vboxsync, 14 years ago

*: rebrand Sun (L)GPL disclaimers

  • Property svn:eol-style set to native
File size: 6.6 KB
Line 
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19/*
20 * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
21 * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
22 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
23 * a choice of LGPL license versions is made available with the language indicating
24 * that LGPLv2 or any later version may be used, or where a choice of which version
25 * of the LGPL is applied is otherwise unspecified.
26 */
27
28#ifndef __WS2TCPIP__
29#define __WS2TCPIP__
30
31#include <winsock2.h>
32#include <ws2ipdef.h>
33#include <limits.h>
34
35#ifdef USE_WS_PREFIX
36#define WS(x) WS_##x
37#else
38#define WS(x) x
39#endif
40
41/* for addrinfo calls */
42typedef struct WS(addrinfo)
43{
44 int ai_flags;
45 int ai_family;
46 int ai_socktype;
47 int ai_protocol;
48 size_t ai_addrlen;
49 char * ai_canonname;
50 struct WS(sockaddr)* ai_addr;
51 struct WS(addrinfo)* ai_next;
52} ADDRINFOA, *PADDRINFOA;
53
54typedef struct WS(addrinfoW)
55{
56 int ai_flags;
57 int ai_family;
58 int ai_socktype;
59 int ai_protocol;
60 size_t ai_addrlen;
61 PWSTR ai_canonname;
62 struct WS(sockaddr)* ai_addr;
63 struct WS(addrinfoW)* ai_next;
64} ADDRINFOW, *PADDRINFOW;
65
66typedef int WS(socklen_t);
67
68typedef ADDRINFOA ADDRINFO, *LPADDRINFO;
69
70/* Possible Windows flags for getaddrinfo() */
71#ifndef USE_WS_PREFIX
72# define AI_PASSIVE 0x0001
73# define AI_CANONNAME 0x0002
74# define AI_NUMERICHOST 0x0004
75/* getaddrinfo error codes */
76# define EAI_AGAIN WSATRY_AGAIN
77# define EAI_BADFLAGS WSAEINVAL
78# define EAI_FAIL WSANO_RECOVERY
79# define EAI_FAMILY WSAEAFNOSUPPORT
80# define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
81# define EAI_NODATA EAI_NONAME
82# define EAI_NONAME WSAHOST_NOT_FOUND
83# define EAI_SERVICE WSATYPE_NOT_FOUND
84# define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
85#else
86# define WS_AI_PASSIVE 0x0001
87# define WS_AI_CANONNAME 0x0002
88# define WS_AI_NUMERICHOST 0x0004
89/* getaddrinfo error codes */
90# define WS_EAI_AGAIN WSATRY_AGAIN
91# define WS_EAI_BADFLAGS WSAEINVAL
92# define WS_EAI_FAIL WSANO_RECOVERY
93# define WS_EAI_FAMILY WSAEAFNOSUPPORT
94# define WS_EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
95# define WS_EAI_NODATA WS_EAI_NONAME
96# define WS_EAI_NONAME WSAHOST_NOT_FOUND
97# define WS_EAI_SERVICE WSATYPE_NOT_FOUND
98# define WS_EAI_SOCKTYPE WSAESOCKTNOSUPPORT
99#endif
100
101#ifndef USE_WS_PREFIX
102# define NI_MAXHOST 1025
103# define NI_MAXSERV 32
104#else
105# define WS_NI_MAXHOST 1025
106# define WS_NI_MAXSERV 32
107#endif
108
109/* Possible Windows flags for getnameinfo() */
110#ifndef USE_WS_PREFIX
111# define NI_NOFQDN 0x01
112# define NI_NUMERICHOST 0x02
113# define NI_NAMEREQD 0x04
114# define NI_NUMERICSERV 0x08
115# define NI_DGRAM 0x10
116#else
117# define WS_NI_NOFQDN 0x01
118# define WS_NI_NUMERICHOST 0x02
119# define WS_NI_NAMEREQD 0x04
120# define WS_NI_NUMERICSERV 0x08
121# define WS_NI_DGRAM 0x10
122#endif
123
124
125#ifdef __cplusplus
126extern "C" {
127#endif
128
129#define GAI_STRERROR_BUFFER_SIZE 1024
130
131static inline char *gai_strerrorA(int errcode)
132{
133 static char buffer[GAI_STRERROR_BUFFER_SIZE + 1];
134
135 /* FIXME: should format message from system, ignoring inserts in neutral
136 * language */
137 buffer[0] = '\0';
138
139 return buffer;
140}
141
142static inline WCHAR *gai_strerrorW(int errcode)
143{
144 static WCHAR buffer[GAI_STRERROR_BUFFER_SIZE + 1];
145
146 /* FIXME: should format message from system, ignoring inserts in neutral
147 * language */
148 buffer[0] = '\0';
149
150 return buffer;
151}
152
153#ifdef USE_WS_PREFIX
154# define WS_gai_strerror WINELIB_NAME_AW(gai_strerror)
155#elif defined(WINE_NO_UNICODE_MACROS)
156# define gai_strerror gai_strerrorA
157#else
158# define gai_strerror WINELIB_NAME_AW(gai_strerror)
159#endif
160
161void WINAPI WS(freeaddrinfo)(LPADDRINFO);
162#define FreeAddrInfoA WS(freeaddrinfo)
163void WINAPI FreeAddrInfoW(PADDRINFOW);
164#define FreeAddrInfo WINELIB_NAME_AW(FreeAddrInfo)
165int WINAPI WS(getaddrinfo)(const char*,const char*,const struct WS(addrinfo)*,struct WS(addrinfo)**);
166#define GetAddrInfoA WS(getaddrinfo)
167int WINAPI GetAddrInfoW(PCWSTR,PCWSTR,const ADDRINFOW*,PADDRINFOW*);
168#define GetAddrInfo WINELIB_NAME_AW(GetAddrInfo)
169int WINAPI WS(getnameinfo)(const SOCKADDR*,WS(socklen_t),PCHAR,DWORD,PCHAR,DWORD,INT);
170#define GetNameInfoA WS(getnameinfo)
171INT WINAPI GetNameInfoW(const SOCKADDR*,WS(socklen_t),PWCHAR,DWORD,PWCHAR,DWORD,INT);
172#define GetNameInfo WINELIB_NAME_AW(GetNameInfo)
173PCSTR WINAPI WS(inet_ntop)(INT,PVOID,PSTR,SIZE_T);
174#define InetNtopA WS(inet_ntop)
175PCWSTR WINAPI InetNtopW(INT,PVOID,PWSTR,SIZE_T);
176#define InetNtop WINELIB_NAME_AW(InetNtop)
177int WINAPI WS(inet_pton)(INT,PCSTR,PVOID);
178#define InetPtonA WS(inet_pton)
179int WINAPI InetPtonW(INT,PCWSTR,PVOID);
180#define InetPton WINELIB_NAME_AW(InetPton)
181
182/*
183 * Ws2tcpip Function Typedefs
184 *
185 * Remember to keep this section in sync with the
186 * prototypes above.
187 */
188#if INCL_WINSOCK_API_TYPEDEFS
189
190typedef void (WINAPI *LPFN_FREEADDRINFO)(LPADDRINFO);
191#define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO
192typedef void (WINAPI *LPFN_FREEADDRINFOW)(PADDRINFOW);
193#define LPFN_FREEADDRINFOT WINELIB_NAME_AW(LPFN_FREEADDRINFO)
194typedef int (WINAPI *LPFN_GETADDRINFO)(const char*,const char*,const struct WS(addrinfo)*,struct WS(addrinfo)**);
195#define LPFN_GETADDRINFOA LPFN_GETADDRINFO
196typedef int (WINAPI *LPFN_GETADDRINFOW)(PCWSTR,PCWSTR,const ADDRINFOW*,PADDRINFOW*);
197#define LPFN_GETADDRINFOT WINELIB_NAME_AW(LPFN_GETADDRINFO)
198typedef int (WINAPI *LPFN_GETNAMEINFO)(const struct sockaddr*,socklen_t,char*,DWORD,char*,DWORD,int);
199#define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO
200typedef int (WINAPI *LPFN_GETNAMEINFOW)(const SOCKADDR*,socklen_t,PWCHAR,DWORD,PWCHAR,DWORD,INT);
201#define LPFN_GETNAMEINFOT WINELIB_NAME_AW(LPFN_GETNAMEINFO)
202
203#endif
204
205#ifdef __cplusplus
206}
207#endif
208
209#endif /* __WS2TCPIP__ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette