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
10 #define WIN32_NO_STATUS
16 #define NTOS_MODE_USER
17 #include <ndk/ntndk.h>
23 #include <windns.h> // DNS_A_DATA
25 /* Exported by ntdll.dll, but where is the prototype? */
26 unsigned long strtoul(const char *nptr
, char **endptr
, int base
);
29 #define EXPORT STDCALL
31 extern HANDLE GlobalHeap
;
32 extern BOOL WsaInitialized
; /* TRUE if WSAStartup() has been successfully called */
33 extern WSPUPCALLTABLE UpcallTable
;
35 #define WS2_INTERNAL_MAX_ALIAS 16
37 typedef struct _WINSOCK_GETSERVBYNAME_CACHE
{
40 PCHAR Aliases
[WS2_INTERNAL_MAX_ALIAS
];
42 } WINSOCK_GETSERVBYNAME_CACHE
, *PWINSOCK_GETSERVBYNAME_CACHE
;
44 typedef struct _WINSOCK_GETSERVBYPORT_CACHE
{
47 PCHAR Aliases
[WS2_INTERNAL_MAX_ALIAS
];
49 } WINSOCK_GETSERVBYPORT_CACHE
, *PWINSOCK_GETSERVBYPORT_CACHE
;
51 typedef struct _WINSOCK_THREAD_BLOCK
{
52 INT LastErrorValue
; /* Error value from last function that failed */
53 CHAR Intoa
[16]; /* Buffer for inet_ntoa() */
54 PWINSOCK_GETSERVBYNAME_CACHE
55 Getservbyname
; /* Buffer used by getservbyname */
56 PWINSOCK_GETSERVBYPORT_CACHE
57 Getservbyport
; /* Buffer used by getservbyname */
58 struct hostent
* Hostent
;
59 } WINSOCK_THREAD_BLOCK
, *PWINSOCK_THREAD_BLOCK
;
64 #define WSAINITIALIZED (WsaInitialized)
66 #define WSASETINITIALIZED (WsaInitialized = TRUE)
68 /* ws2_32 internal Functions */
69 void check_hostent(struct hostent
**he
);
70 void populate_hostent(struct hostent
*he
, char* name
, DNS_A_DATA addr
);
71 void free_hostent(struct hostent
*he
);
72 void free_servent(struct servent
* s
);
76 /* DWORD network to host byte order conversion for little endian machines */
78 ((((dw) & 0xFF000000L) >> 24) | \
79 (((dw) & 0x00FF0000L) >> 8) | \
80 (((dw) & 0x0000FF00L) << 8) | \
81 (((dw) & 0x000000FFL) << 24))
83 /* DWORD host to network byte order conversion for little endian machines */
85 ((((dw) & 0xFF000000L) >> 24) | \
86 (((dw) & 0x00FF0000L) >> 8) | \
87 (((dw) & 0x0000FF00L) << 8) | \
88 (((dw) & 0x000000FFL) << 24))
90 /* WORD network to host order conversion for little endian machines */
92 ((((w) & 0xFF00) >> 8) | \
93 (((w) & 0x00FF) << 8))
95 /* WORD host to network byte order conversion for little endian machines */
97 ((((w) & 0xFF00) >> 8) | \
98 (((w) & 0x00FF) << 8))
102 /* DWORD network to host byte order conversion for big endian machines */
106 /* DWORD host to network byte order conversion big endian machines */
110 /* WORD network to host order conversion for big endian machines */
114 /* WORD host to network byte order conversion for big endian machines */
120 #endif /* __WS2_32_H */