ReactOS 0.4.16-dev-321-g63bb46a
wspiapi.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#if (NTDDI_VERSION >= NTDDI_WIN2K)
8
9#include <stdio.h>
10#include <stdlib.h>
11#include <malloc.h>
12#include <string.h>
13
14#if defined(__GOT_SECURE_LIB__) && __GOT_SECURE_LIB__ >= 200402L
15
16#define _WSPIAPI_STRCPY_S strcpy_s
17#define _WSPIAPI_STRCAT_S strcat_s
18
19#else
20
21#define _WSPIAPI_STRCPY_S(_Dst, _Size, _Src) strcpy((_Dst), (_Src))
22#define _WSPIAPI_STRCAT_S(_Dst, _Size, _Src) strcat((_Dst), (_Src))
23
24#endif /* defined(__GOT_SECURE_LIB__) && __GOT_SECURE_LIB__ >= 200402L */
25
26#define _WSPIAPI_STRNCPY_S(_Dst, _Size, _Src, _Count) strncpy((_Dst), (_Src), (_Count)); (_Dst)[(_Size) - 1] = 0 //FIXME
27#define _WSPIAPI_SPRINTF_S_1(_Dst, _Size, _Format, _Arg1) sprintf((_Dst), (_Format), (_Arg1)) //FIXME
28
29#if !defined(_WSPIAPI_COUNTOF)
30
31#if !defined(__cplusplus)
32#define _WSPIAPI_COUNTOF(_Array) (sizeof(_Array) / sizeof(_Array[0]))
33#else
34template <typename __CountofType, size_t _N>
35char (&__wspiapi_countof_helper(__CountofType (&_Array)[_N]))[_N];
36#define _WSPIAPI_COUNTOF(_Array) sizeof(__wspiapi_countof_helper(_Array))
37#endif
38
39#endif /* !defined(_WSPIAPI_COUNTOF) */
40
41#define WspiapiMalloc(tSize) calloc(1, (tSize))
42#define WspiapiFree(p) free(p)
43#define WspiapiSwap(a, b, c) {(c) = (a); (a) = (b); (b) = (c);}
44#define getaddrinfo WspiapiGetAddrInfo
45#define getnameinfo WspiapiGetNameInfo
46#define freeaddrinfo WspiapiFreeAddrInfo
47
48#if _MSC_VER
49#define WSPIAPI_INLINE __inline
50#else
51#define WSPIAPI_INLINE static inline
52#endif
53
54typedef int
56 IN const char *nodename,
57 IN const char *servname,
58 IN const struct addrinfo *hints,
59 OUT struct addrinfo **res);
60
61typedef int
63 IN const struct sockaddr *sa,
64 IN socklen_t salen,
65 OUT char *host,
66 IN size_t hostlen,
67 OUT char *serv,
68 IN size_t servlen,
69 IN int flags);
70
71typedef void
73 IN struct addrinfo *ai);
74
76char *
79 IN const char *pszString)
80{
81 char *pszMemory;
82 size_t cchMemory;
83
84 if (!pszString) return(NULL);
85 cchMemory = strlen(pszString) + 1;
86 pszMemory = (char *) WspiapiMalloc(cchMemory);
87 if (!pszMemory) return(NULL);
88 _WSPIAPI_STRCPY_S(pszMemory, cchMemory, pszString);
89 return pszMemory;
90}
91
93BOOL
96 IN const char *pszAddress,
97 OUT PDWORD pdwAddress)
98{
99 DWORD dwAddress = 0;
100 const char *pcNext = NULL;
101 int iCount = 0;
102
103 for (pcNext = pszAddress; *pcNext != '\0'; pcNext++)
104 if (*pcNext == '.') iCount++;
105 if (iCount != 3) return FALSE;
106 dwAddress = inet_addr(pszAddress);
107 if (dwAddress == INADDR_NONE) return FALSE;
108 *pdwAddress = dwAddress;
109 return TRUE;
110}
111
113struct addrinfo *
114WINAPI
116 IN int iSocketType,
117 IN int iProtocol,
118 IN WORD wPort,
119 IN DWORD dwAddress)
120{
121 struct addrinfo *ptNew;
122 struct sockaddr_in *ptAddress;
123
124 ptNew = (struct addrinfo *) WspiapiMalloc(sizeof(struct addrinfo));
125 if (!ptNew) return NULL;
126 ptAddress = (struct sockaddr_in *) WspiapiMalloc(sizeof(struct sockaddr_in));
127 if (!ptAddress) {
128 WspiapiFree(ptNew);
129 return NULL;
130 }
131 ptAddress->sin_family = AF_INET;
132 ptAddress->sin_port = wPort;
133 ptAddress->sin_addr.s_addr = dwAddress;
134 ptNew->ai_family = PF_INET;
135 ptNew->ai_socktype = iSocketType;
136 ptNew->ai_protocol = iProtocol;
137 ptNew->ai_addrlen = sizeof(struct sockaddr_in);
138 ptNew->ai_addr = (struct sockaddr *) ptAddress;
139
140 return ptNew;
141}
142
144int
145WINAPI
147 IN const char *pszNodeName,
148 IN int iSocketType,
149 IN int iProtocol,
150 IN WORD wPort,
151 OUT char pszAlias[NI_MAXHOST],
152 OUT struct addrinfo **pptResult)
153{
154 struct addrinfo **pptNext = pptResult;
155 struct hostent *ptHost = NULL;
156 char **ppAddresses;
157
158 *pptNext = NULL;
159 pszAlias[0] = '\0';
160
161 ptHost = gethostbyname(pszNodeName);
162 if (ptHost) {
163 if ((ptHost->h_addrtype == AF_INET) && (ptHost->h_length == sizeof(struct in_addr))) {
164 for (ppAddresses = ptHost->h_addr_list; *ppAddresses != NULL; ppAddresses++) {
165 *pptNext = WspiapiNewAddrInfo(iSocketType, iProtocol, wPort, ((struct in_addr *) *ppAddresses)->s_addr);
166 if (!*pptNext) return EAI_MEMORY;
167 pptNext = &((*pptNext)->ai_next);
168 }
169 }
170 _WSPIAPI_STRNCPY_S(pszAlias, NI_MAXHOST, ptHost->h_name, NI_MAXHOST - 1);
171 return 0;
172 }
173 switch (WSAGetLastError()) {
174 case WSAHOST_NOT_FOUND: return EAI_NONAME;
175 case WSATRY_AGAIN: return EAI_AGAIN;
176 case WSANO_RECOVERY: return EAI_FAIL;
177 case WSANO_DATA: return EAI_NODATA;
178 default: return EAI_NONAME;
179 }
180}
181
183int
184WINAPI
186 IN const char *pszNodeName,
187 IN int iSocketType,
188 IN int iProtocol,
189 IN WORD wPort,
190 IN BOOL bAI_CANONNAME,
191 OUT struct addrinfo **pptResult)
192{
193 int iError = 0;
194 int iAliasCount = 0;
195 char szFQDN1[NI_MAXHOST] = "";
196 char szFQDN2[NI_MAXHOST] = "";
197 char *pszName = szFQDN1;
198 char *pszAlias = szFQDN2;
199 char *pszScratch = NULL;
200
201 _WSPIAPI_STRNCPY_S(pszName, NI_MAXHOST, pszNodeName, NI_MAXHOST - 1);
202 for (;;) {
203 iError = WspiapiQueryDNS(pszNodeName, iSocketType, iProtocol, wPort, pszAlias, pptResult);
204 if (iError) break;
205 if (*pptResult) break;
206 if ((!strlen(pszAlias)) || (!strcmp(pszName, pszAlias)) || (++iAliasCount == 16)) {
207 iError = EAI_FAIL;
208 break;
209 }
210 WspiapiSwap(pszName, pszAlias, pszScratch);
211 }
212 if (!iError && bAI_CANONNAME) {
213 (*pptResult)->ai_canonname = WspiapiStrdup(pszAlias);
214 if (!(*pptResult)->ai_canonname) iError = EAI_MEMORY;
215 }
216
217 return iError;
218}
219
220
221
223int
224WINAPI
226 IN WORD wPort,
227 IN struct addrinfo *ptResult)
228{
229 struct addrinfo *ptNext = NULL;
230 struct addrinfo *ptNew = NULL;
231
232 for (ptNext = ptResult; ptNext != NULL; ) {
233 ptNew = WspiapiNewAddrInfo(SOCK_DGRAM, ptNext->ai_protocol, wPort,
234 ((struct sockaddr_in *) ptNext->ai_addr)->sin_addr.s_addr);
235 if (!ptNew) break;
236 ptNew->ai_next = ptNext->ai_next;
237 ptNext->ai_next = ptNew;
238 ptNext = ptNew->ai_next;
239 }
240 if (ptNext != NULL) return EAI_MEMORY;
241
242 return 0;
243}
244
245static __inline
246void
247WINAPI
249 IN struct addrinfo *ptHead)
250{
251 struct addrinfo *ptNext;
252
253 for (ptNext = ptHead; ptNext != NULL; ptNext = ptHead) {
254 if (ptNext->ai_canonname) WspiapiFree(ptNext->ai_canonname);
255 if (ptNext->ai_addr) WspiapiFree(ptNext->ai_addr);
256 ptHead = ptNext->ai_next;
257 WspiapiFree(ptNext);
258 }
259}
260
261static __inline
262int
263WINAPI
265 IN const char *pszNodeName,
266 IN const char *pszServiceName,
267 IN const struct addrinfo *ptHints,
268 OUT struct addrinfo **pptResult)
269{
270 int iError = 0;
271 int iFlags = 0;
272 int iFamily = PF_UNSPEC;
273 int iSocketType = 0;
274 int iProtocol = 0;
275 WORD wPort = 0;
276 DWORD dwAddress = 0;
277 struct servent *ptService = NULL;
278 char *pc = NULL;
279 BOOL bClone = FALSE;
280 WORD wTcpPort = 0;
281 WORD wUdpPort = 0;
282 *pptResult = NULL;
283
284 if ((!pszNodeName) && (!pszServiceName)) return EAI_NONAME;
285 if (ptHints) {
286 if ((ptHints->ai_addrlen != 0) ||
287 (ptHints->ai_canonname != NULL) ||
288 (ptHints->ai_addr != NULL) ||
289 (ptHints->ai_next != NULL)) {
290 return EAI_FAIL;
291 }
292 iFlags = ptHints->ai_flags;
293 if ((iFlags & AI_CANONNAME) && !pszNodeName) return EAI_BADFLAGS;
294 iFamily = ptHints->ai_family;
295 if ((iFamily != PF_UNSPEC) && (iFamily != PF_INET)) return EAI_FAMILY;
296 iSocketType = ptHints->ai_socktype;
297 if ((iSocketType != 0) &&
298 (iSocketType != SOCK_STREAM) &&
299 (iSocketType != SOCK_DGRAM) &&
300 (iSocketType != SOCK_RAW))
301 return EAI_SOCKTYPE;
302 iProtocol = ptHints->ai_protocol;
303 }
304 if (pszServiceName) {
305 wPort = (WORD) strtoul(pszServiceName, &pc, 10);
306 if (*pc == '\0') {
307 wPort = wTcpPort = wUdpPort = htons(wPort);
308 if (iSocketType == 0) {
309 bClone = TRUE;
310 iSocketType = SOCK_STREAM;
311 }
312 }
313 else {
314 if ((iSocketType == 0) || (iSocketType == SOCK_DGRAM)) {
315 ptService = getservbyname(pszServiceName, "udp");
316 if (ptService) wPort = wUdpPort = ptService->s_port;
317 }
318 if ((iSocketType == 0) || (iSocketType == SOCK_STREAM)) {
319 ptService = getservbyname(pszServiceName, "tcp");
320 if (ptService) wPort = wTcpPort = ptService->s_port;
321 }
322 if (wPort == 0) return (iSocketType ? EAI_SERVICE : EAI_NONAME);
323 if (iSocketType == 0) {
324 iSocketType = (wTcpPort) ? SOCK_STREAM : SOCK_DGRAM;
325 bClone = (wTcpPort && wUdpPort);
326 }
327 }
328 }
329 if ((!pszNodeName) || (WspiapiParseV4Address(pszNodeName, &dwAddress))) {
330 if (!pszNodeName) dwAddress = htonl((iFlags & AI_PASSIVE) ? INADDR_ANY : INADDR_LOOPBACK);
331 *pptResult = WspiapiNewAddrInfo(iSocketType, iProtocol, wPort, dwAddress);
332 if (!(*pptResult)) iError = EAI_MEMORY;
333 if (!iError && pszNodeName) {
334 (*pptResult)->ai_flags |= AI_NUMERICHOST;
335 if (iFlags & AI_CANONNAME) {
336 (*pptResult)->ai_canonname = WspiapiStrdup(inet_ntoa(*((struct in_addr *) &dwAddress)));
337 if (!(*pptResult)->ai_canonname) iError = EAI_MEMORY;
338 }
339 }
340 }
341 else if (iFlags & AI_NUMERICHOST) {
342 iError = EAI_NONAME;
343 }
344 else {
345 iError = WspiapiLookupNode(pszNodeName, iSocketType,
346 iProtocol, wPort,
347 (iFlags & AI_CANONNAME),
348 pptResult);
349 }
350 if (!iError && bClone) {
351 iError = WspiapiClone(wUdpPort, *pptResult);
352 }
353 if (iError) {
354 WspiapiLegacyFreeAddrInfo(*pptResult);
355 *pptResult = NULL;
356 }
357
358 return (iError);
359}
360
361static __inline
362int
363WINAPI
365 IN const struct sockaddr *ptSocketAddress,
366 IN socklen_t tSocketLength,
367 OUT char *pszNodeName,
368 IN size_t tNodeLength,
369 OUT char *pszServiceName,
370 IN size_t tServiceLength,
371 IN int iFlags)
372{
373 struct servent *ptService;
374 WORD wPort;
375 char szBuffer[] = "65535";
376 char *pszService = szBuffer;
377 struct hostent *ptHost;
378 struct in_addr tAddress;
379 char *pszNode = NULL;
380 char *pc = NULL;
381
382 if ((!ptSocketAddress) || (tSocketLength < sizeof(struct sockaddr))) return EAI_FAIL;
383 if (ptSocketAddress->sa_family != AF_INET) return EAI_FAMILY;
384 if (tSocketLength < sizeof(struct sockaddr_in)) return EAI_FAIL;
385 if (!(pszNodeName && tNodeLength) && !(pszServiceName && tServiceLength)) {
386 return EAI_NONAME;
387 }
388 if ((iFlags & NI_NUMERICHOST) && (iFlags & NI_NAMEREQD)) {
389 return EAI_BADFLAGS;
390 }
391 if (pszServiceName && tServiceLength) {
392 wPort = ((struct sockaddr_in *) ptSocketAddress)->sin_port;
393 if (iFlags & NI_NUMERICSERV) {
394 _WSPIAPI_SPRINTF_S_1(szBuffer, _WSPIAPI_COUNTOF(szBuffer), "%u", ntohs(wPort));
395 }
396 else {
397 ptService = getservbyport(wPort, (iFlags & NI_DGRAM) ? "udp" : NULL);
398 if (ptService && ptService->s_name) {
399 pszService = ptService->s_name;
400 }
401 else {
402 _WSPIAPI_SPRINTF_S_1(szBuffer, _WSPIAPI_COUNTOF(szBuffer), "%u", ntohs(wPort));
403 }
404 }
405 if (tServiceLength > strlen(pszService))
406 _WSPIAPI_STRCPY_S(pszServiceName, tServiceLength, pszService);
407 else return EAI_FAIL;
408 }
409 if (pszNodeName && tNodeLength) {
410 tAddress = ((struct sockaddr_in *) ptSocketAddress)->sin_addr;
411 if (iFlags & NI_NUMERICHOST) {
412 pszNode = inet_ntoa(tAddress);
413 }
414 else {
415 ptHost = gethostbyaddr((char *) &tAddress, sizeof(struct in_addr), AF_INET);
416 if (ptHost && ptHost->h_name) {
417 pszNode = ptHost->h_name;
418 if ((iFlags & NI_NOFQDN) && ((pc = strchr(pszNode, '.')) != NULL)) *pc = '\0';
419 }
420 else {
421 if (iFlags & NI_NAMEREQD) {
422 switch (WSAGetLastError()) {
423 case WSAHOST_NOT_FOUND: return EAI_NONAME;
424 case WSATRY_AGAIN: return EAI_AGAIN;
425 case WSANO_RECOVERY: return EAI_FAIL;
426 default: return EAI_NONAME;
427 }
428 }
429 else pszNode = inet_ntoa(tAddress);
430 }
431 }
432 if (tNodeLength > strlen(pszNode)) _WSPIAPI_STRCPY_S(pszNodeName, tNodeLength, pszNode);
433 else return EAI_FAIL;
434 }
435
436 return 0;
437}
438
439typedef struct {
440 char const *pszName;
443
444#define WSPIAPI_FUNCTION_ARRAY { \
445 {"getaddrinfo", (FARPROC) WspiapiLegacyGetAddrInfo}, \
446 {"getnameinfo", (FARPROC) WspiapiLegacyGetNameInfo}, \
447 {"freeaddrinfo", (FARPROC) WspiapiLegacyFreeAddrInfo} \
448}
449
452WINAPI
454 IN WORD wFunction)
455{
457
458 static BOOL bInitialized = FALSE;
459 static WSPIAPI_FUNCTION rgtGlobal[] = WSPIAPI_FUNCTION_ARRAY;
460 static const int iNumGlobal = (sizeof(rgtGlobal) / sizeof(WSPIAPI_FUNCTION));
462 FARPROC fScratch = NULL;
463 int i = 0;
464
465 if (bInitialized) return (rgtGlobal[wFunction].pfAddress);
466 for (;;) {
467 CHAR SystemDir[MAX_PATH + 1];
468 CHAR Path[MAX_PATH + 8];
469 if (GetSystemDirectoryA(SystemDir, MAX_PATH) == 0) break;
473 if (hLibrary != NULL) {
474 fScratch = GetProcAddress(hLibrary, "getaddrinfo");
475 if (fScratch == NULL) {
477 hLibrary = NULL;
478 }
479 }
480 if (hLibrary != NULL) break;
484 if (hLibrary != NULL) {
485 fScratch = GetProcAddress(hLibrary, "getaddrinfo");
486 if (fScratch == NULL) {
488 hLibrary = NULL;
489 }
490 }
491 break;
492 }
493 if (hLibrary != NULL) {
494 for (i = 0; i < iNumGlobal; i++) {
495 rgtLocal[i].pfAddress = GetProcAddress(hLibrary, rgtLocal[i].pszName);
496 if (rgtLocal[i].pfAddress == NULL) {
498 hLibrary = NULL;
499 break;
500 }
501 }
502 if (hLibrary != NULL) {
503 for (i = 0; i < iNumGlobal; i++)
504 rgtGlobal[i].pfAddress = rgtLocal[i].pfAddress;
505 }
506 }
508
509 return (rgtGlobal[wFunction].pfAddress);
510}
511
513int
514WINAPI
516 IN const char *nodename OPTIONAL,
517 IN const char *servname OPTIONAL,
518 IN const struct addrinfo *hints OPTIONAL,
519 OUT struct addrinfo **res)
520{
521 int iError;
522 static WSPIAPI_PGETADDRINFO pfGetAddrInfo = NULL;
523
524 if (!pfGetAddrInfo) pfGetAddrInfo = (WSPIAPI_PGETADDRINFO) WspiapiLoad(0);
525 iError = (*pfGetAddrInfo)(nodename, servname, hints, res);
526 WSASetLastError(iError);
527
528 return iError;
529}
530
532int
533WINAPI
535 IN const struct sockaddr *sa,
536 IN socklen_t salen,
537 OUT char *host,
538 IN size_t hostlen,
539 OUT char *serv,
540 IN size_t servlen,
541 IN int flags)
542{
543 int iError;
544 static WSPIAPI_PGETNAMEINFO pfGetNameInfo = NULL;
545
546 if (!pfGetNameInfo) pfGetNameInfo = (WSPIAPI_PGETNAMEINFO) WspiapiLoad(1);
547 iError = (*pfGetNameInfo)(sa, salen, host, hostlen, serv, servlen, flags);
548 WSASetLastError(iError);
549
550 return iError;
551}
552
554void
555WINAPI
557 IN struct addrinfo *ai)
558{
559 static WSPIAPI_PFREEADDRINFO pfFreeAddrInfo = NULL;
560
561 if (!pfFreeAddrInfo) pfFreeAddrInfo = (WSPIAPI_PFREEADDRINFO) WspiapiLoad(2);
562 (*pfFreeAddrInfo)(ai);
563}
564
565#endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
566
567#ifdef __cplusplus
568}
569#endif
PRTL_UNICODE_STRING_BUFFER Path
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strchr(const char *String, int ch)
Definition: utclib.c:501
CHAR FAR *WSAAPI inet_ntoa(IN IN_ADDR in)
Definition: addrconv.c:160
ULONG WSAAPI inet_addr(IN CONST CHAR FAR *cp)
Definition: addrconv.c:71
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
#define INADDR_NONE
Definition: tcp.c:42
HMODULE hLibrary
Definition: odbccp32.c:12
static BOOL bInitialized
Definition: dde.cpp:48
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
int(* FARPROC)()
Definition: compat.h:36
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define MAX_PATH
Definition: compat.h:34
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2283
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned char
Definition: typeof.h:29
VOID WSAAPI WSASetLastError(IN INT iError)
Definition: dllmain.c:123
#define SOCK_STREAM
Definition: tcpip.h:118
#define AF_INET
Definition: tcpip.h:117
#define s_addr
Definition: tcpip.h:133
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
PSERVENT WSAAPI getservbyport(IN int port, IN const char FAR *proto)
Definition: getxbyxx.c:431
PHOSTENT WSAAPI gethostbyname(IN const char FAR *name)
Definition: getxbyxx.c:221
PSERVENT WSAAPI getservbyname(IN const char FAR *name, IN const char FAR *proto)
Definition: getxbyxx.c:500
PHOSTENT WSAAPI gethostbyaddr(IN const char FAR *addr, IN int len, IN int type)
Definition: getxbyxx.c:309
GLuint res
Definition: glext.h:9613
GLbitfield flags
Definition: glext.h:7161
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_N
Definition: wchar.h:2530
#define INADDR_ANY
Definition: inet.h:80
#define INADDR_LOOPBACK
Definition: inet.h:78
#define htons(x)
Definition: module.h:215
#define ntohs(x)
Definition: module.h:210
#define htonl(x)
Definition: module.h:214
int socklen_t
Definition: tcp.c:35
DWORD * PDWORD
Definition: pedump.c:68
namespace GUID const ADDRINFOEXW * hints
Definition: sock.c:80
static const ADDRINFOW PADDRINFOW *static const WCHAR * servname
Definition: sock.c:79
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
FARPROC pfAddress
Definition: wspiapi.h:441
char const * pszName
Definition: wspiapi.h:440
size_t ai_addrlen
Definition: ws2def.h:669
struct sockaddr * ai_addr
Definition: ws2def.h:671
char * ai_canonname
Definition: ws2def.h:670
int ai_socktype
Definition: ws2def.h:667
int ai_protocol
Definition: ws2def.h:668
struct addrinfo * ai_next
Definition: ws2def.h:672
int ai_family
Definition: ws2def.h:666
char * h_name
Definition: winsock.h:134
short h_length
Definition: winsock.h:137
short h_addrtype
Definition: winsock.h:136
char ** h_addr_list
Definition: winsock.h:138
Definition: tcpip.h:126
char * s_name
Definition: winsock.h:159
short s_port
Definition: winsock.h:165
struct in_addr sin_addr
Definition: winsock.h:512
short sin_family
Definition: winsock.h:510
u_short sin_port
Definition: winsock.h:511
#define IN
Definition: typedefs.h:39
#define OUT
Definition: typedefs.h:40
#define FORCEINLINE
Definition: wdftypes.h:67
char * host
Definition: whois.c:55
_In_ DWORD _In_ DWORD _Out_writes_to_opt_ pcchString LPSTR pszString
Definition: wincrypt.h:4505
#define WINAPI
Definition: msvc.h:6
#define WSATRY_AGAIN
Definition: winerror.h:2001
#define WSAHOST_NOT_FOUND
Definition: winerror.h:2000
#define WSANO_DATA
Definition: winerror.h:2003
#define WSANO_RECOVERY
Definition: winerror.h:2002
int PASCAL FAR WSAGetLastError(void)
Definition: dllmain.c:112
#define SOCK_RAW
Definition: winsock.h:337
#define PF_INET
Definition: winsock.h:373
#define SOCK_DGRAM
Definition: winsock.h:336
#define PF_UNSPEC
Definition: winsock.h:371
#define NI_NAMEREQD
Definition: ws2def.h:355
#define AI_NUMERICHOST
Definition: ws2def.h:295
#define NI_NUMERICHOST
Definition: ws2def.h:354
#define AI_CANONNAME
Definition: ws2def.h:294
#define NI_DGRAM
Definition: ws2def.h:357
#define NI_NOFQDN
Definition: ws2def.h:353
#define NI_MAXHOST
Definition: ws2def.h:359
#define AI_PASSIVE
Definition: ws2def.h:293
#define NI_NUMERICSERV
Definition: ws2def.h:356
#define EAI_NONAME
Definition: ws2tcpip.h:38
#define EAI_SOCKTYPE
Definition: ws2tcpip.h:40
#define EAI_FAMILY
Definition: ws2tcpip.h:34
#define EAI_MEMORY
Definition: ws2tcpip.h:35
#define EAI_BADFLAGS
Definition: ws2tcpip.h:32
#define EAI_AGAIN
Definition: ws2tcpip.h:31
#define EAI_NODATA
Definition: ws2tcpip.h:36
#define EAI_SERVICE
Definition: ws2tcpip.h:39
#define EAI_FAIL
Definition: ws2tcpip.h:33
FORCEINLINE int WINAPI WspiapiLookupNode(IN const char *pszNodeName, IN int iSocketType, IN int iProtocol, IN WORD wPort, IN BOOL bAI_CANONNAME, OUT struct addrinfo **pptResult)
Definition: wspiapi.h:185
static __inline void WINAPI WspiapiLegacyFreeAddrInfo(IN struct addrinfo *ptHead)
Definition: wspiapi.h:248
static __inline int WINAPI WspiapiLegacyGetNameInfo(IN const struct sockaddr *ptSocketAddress, IN socklen_t tSocketLength, OUT char *pszNodeName, IN size_t tNodeLength, OUT char *pszServiceName, IN size_t tServiceLength, IN int iFlags)
Definition: wspiapi.h:364
int(WINAPI * WSPIAPI_PGETNAMEINFO)(IN const struct sockaddr *sa, IN socklen_t salen, OUT char *host, IN size_t hostlen, OUT char *serv, IN size_t servlen, IN int flags)
Definition: wspiapi.h:62
#define _WSPIAPI_SPRINTF_S_1(_Dst, _Size, _Format, _Arg1)
Definition: wspiapi.h:27
static __inline int WINAPI WspiapiLegacyGetAddrInfo(IN const char *pszNodeName, IN const char *pszServiceName, IN const struct addrinfo *ptHints, OUT struct addrinfo **pptResult)
Definition: wspiapi.h:264
WSPIAPI_INLINE int WINAPI WspiapiGetAddrInfo(IN const char *nodename OPTIONAL, IN const char *servname OPTIONAL, IN const struct addrinfo *hints OPTIONAL, OUT struct addrinfo **res)
Definition: wspiapi.h:515
#define WSPIAPI_FUNCTION_ARRAY
Definition: wspiapi.h:444
#define WSPIAPI_INLINE
Definition: wspiapi.h:51
FORCEINLINE struct addrinfo *WINAPI WspiapiNewAddrInfo(IN int iSocketType, IN int iProtocol, IN WORD wPort, IN DWORD dwAddress)
Definition: wspiapi.h:115
WSPIAPI_INLINE void WINAPI WspiapiFreeAddrInfo(IN struct addrinfo *ai)
Definition: wspiapi.h:556
FORCEINLINE char *WINAPI WspiapiStrdup(IN const char *pszString)
Definition: wspiapi.h:78
#define WspiapiMalloc(tSize)
Definition: wspiapi.h:41
WSPIAPI_INLINE int WINAPI WspiapiGetNameInfo(IN const struct sockaddr *sa, IN socklen_t salen, OUT char *host, IN size_t hostlen, OUT char *serv, IN size_t servlen, IN int flags)
Definition: wspiapi.h:534
void(WINAPI * WSPIAPI_PFREEADDRINFO)(IN struct addrinfo *ai)
Definition: wspiapi.h:72
int(WINAPI * WSPIAPI_PGETADDRINFO)(IN const char *nodename, IN const char *servname, IN const struct addrinfo *hints, OUT struct addrinfo **res)
Definition: wspiapi.h:55
FORCEINLINE BOOL WINAPI WspiapiParseV4Address(IN const char *pszAddress, OUT PDWORD pdwAddress)
Definition: wspiapi.h:95
#define _WSPIAPI_STRNCPY_S(_Dst, _Size, _Src, _Count)
Definition: wspiapi.h:26
FORCEINLINE int WINAPI WspiapiQueryDNS(IN const char *pszNodeName, IN int iSocketType, IN int iProtocol, IN WORD wPort, OUT char pszAlias[NI_MAXHOST], OUT struct addrinfo **pptResult)
Definition: wspiapi.h:146
WSPIAPI_INLINE FARPROC WINAPI WspiapiLoad(IN WORD wFunction)
Definition: wspiapi.h:453
#define _WSPIAPI_STRCPY_S(_Dst, _Size, _Src)
Definition: wspiapi.h:21
#define WspiapiSwap(a, b, c)
Definition: wspiapi.h:43
FORCEINLINE int WINAPI WspiapiClone(IN WORD wPort, IN struct addrinfo *ptResult)
Definition: wspiapi.h:225
#define _WSPIAPI_COUNTOF(_Array)
Definition: wspiapi.h:32
#define WspiapiFree(p)
Definition: wspiapi.h:42
#define _WSPIAPI_STRCAT_S(_Dst, _Size, _Src)
Definition: wspiapi.h:22
char CHAR
Definition: xmlstorage.h:175