2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS WinSock 2 DLL
4 * FILE: include/ws2_32.h
5 * PURPOSE: WinSock 2 DLL header
11 #include <ddk/ntddk.h>
12 #include <ddk/ntifs.h>
21 #include <windns.h> // DNS_A_DATA
23 /* Exported by ntdll.dll, but where is the prototype? */
24 unsigned long strtoul(const char *nptr
, char **endptr
, int base
);
27 #define EXPORT STDCALL
29 extern HANDLE GlobalHeap
;
30 extern BOOL Initialized
; /* TRUE if WSAStartup() has been successfully called */
31 extern WSPUPCALLTABLE UpcallTable
;
33 #define WS2_INTERNAL_MAX_ALIAS 16
35 typedef struct _WINSOCK_GETSERVBYNAME_CACHE
{
38 PCHAR Aliases
[WS2_INTERNAL_MAX_ALIAS
];
40 } WINSOCK_GETSERVBYNAME_CACHE
, *PWINSOCK_GETSERVBYNAME_CACHE
;
42 typedef struct _WINSOCK_GETSERVBYPORT_CACHE
{
45 PCHAR Aliases
[WS2_INTERNAL_MAX_ALIAS
];
47 } WINSOCK_GETSERVBYPORT_CACHE
, *PWINSOCK_GETSERVBYPORT_CACHE
;
49 typedef struct _WINSOCK_THREAD_BLOCK
{
50 INT LastErrorValue
; /* Error value from last function that failed */
51 CHAR Intoa
[16]; /* Buffer for inet_ntoa() */
52 PWINSOCK_GETSERVBYNAME_CACHE
53 Getservbyname
; /* Buffer used by getservbyname */
54 PWINSOCK_GETSERVBYPORT_CACHE
55 Getservbyport
; /* Buffer used by getservbyname */
56 struct hostent
* Hostent
;
57 } WINSOCK_THREAD_BLOCK
, *PWINSOCK_THREAD_BLOCK
;
62 #define WSAINITIALIZED (Initialized)
64 #define WSASETINITIALIZED (Initialized = TRUE)
66 /* ws2_32 internal Functions */
67 void check_hostent(struct hostent
**he
);
68 void populate_hostent(struct hostent
*he
, char* name
, DNS_A_DATA addr
);
69 void free_hostent(struct hostent
*he
);
70 void free_servent(struct servent
* s
);
74 /* DWORD network to host byte order conversion for little endian machines */
76 ((((dw) & 0xFF000000L) >> 24) | \
77 (((dw) & 0x00FF0000L) >> 8) | \
78 (((dw) & 0x0000FF00L) << 8) | \
79 (((dw) & 0x000000FFL) << 24))
81 /* DWORD host to network byte order conversion for little endian machines */
83 ((((dw) & 0xFF000000L) >> 24) | \
84 (((dw) & 0x00FF0000L) >> 8) | \
85 (((dw) & 0x0000FF00L) << 8) | \
86 (((dw) & 0x000000FFL) << 24))
88 /* WORD network to host order conversion for little endian machines */
90 ((((w) & 0xFF00) >> 8) | \
91 (((w) & 0x00FF) << 8))
93 /* WORD host to network byte order conversion for little endian machines */
95 ((((w) & 0xFF00) >> 8) | \
96 (((w) & 0x00FF) << 8))
100 /* DWORD network to host byte order conversion for big endian machines */
104 /* DWORD host to network byte order conversion big endian machines */
108 /* WORD network to host order conversion for big endian machines */
112 /* WORD host to network byte order conversion for big endian machines */
118 #endif /* __WS2_32_H */