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 HINSTANCE g_hInstDll
;
32 extern HANDLE GlobalHeap
;
33 extern BOOL WsaInitialized
; /* TRUE if WSAStartup() has been successfully called */
34 extern WSPUPCALLTABLE UpcallTable
;
36 #define WS2_INTERNAL_MAX_ALIAS 16
38 typedef struct _WINSOCK_GETSERVBYNAME_CACHE
42 PCHAR Aliases
[WS2_INTERNAL_MAX_ALIAS
];
44 } WINSOCK_GETSERVBYNAME_CACHE
, *PWINSOCK_GETSERVBYNAME_CACHE
;
46 typedef struct _WINSOCK_GETSERVBYPORT_CACHE
50 PCHAR Aliases
[WS2_INTERNAL_MAX_ALIAS
];
52 } WINSOCK_GETSERVBYPORT_CACHE
, *PWINSOCK_GETSERVBYPORT_CACHE
;
54 typedef struct _WINSOCK_THREAD_BLOCK
56 INT LastErrorValue
; /* Error value from last function that failed */
57 CHAR Intoa
[16]; /* Buffer for inet_ntoa() */
58 PWINSOCK_GETSERVBYNAME_CACHE
59 Getservbyname
; /* Buffer used by getservbyname */
60 PWINSOCK_GETSERVBYPORT_CACHE
61 Getservbyport
; /* Buffer used by getservbyname */
62 struct hostent
* Hostent
;
63 } WINSOCK_THREAD_BLOCK
, *PWINSOCK_THREAD_BLOCK
;
68 #define WSAINITIALIZED (WsaInitialized)
70 #define WSASETINITIALIZED (WsaInitialized = TRUE)
72 /* ws2_32 internal Functions */
73 void check_hostent(struct hostent
**he
);
74 void populate_hostent(struct hostent
*he
, char* name
, DNS_A_DATA addr
);
75 void free_hostent(struct hostent
*he
);
76 void free_servent(struct servent
* s
);
80 /* DWORD network to host byte order conversion for little endian machines */
82 ((((dw) & 0xFF000000L) >> 24) | \
83 (((dw) & 0x00FF0000L) >> 8) | \
84 (((dw) & 0x0000FF00L) << 8) | \
85 (((dw) & 0x000000FFL) << 24))
87 /* DWORD host to network byte order conversion for little endian machines */
89 ((((dw) & 0xFF000000L) >> 24) | \
90 (((dw) & 0x00FF0000L) >> 8) | \
91 (((dw) & 0x0000FF00L) << 8) | \
92 (((dw) & 0x000000FFL) << 24))
94 /* WORD network to host order conversion for little endian machines */
96 ((((w) & 0xFF00) >> 8) | \
97 (((w) & 0x00FF) << 8))
99 /* WORD host to network byte order conversion for little endian machines */
101 ((((w) & 0xFF00) >> 8) | \
102 (((w) & 0x00FF) << 8))
106 /* DWORD network to host byte order conversion for big endian machines */
110 /* DWORD host to network byte order conversion big endian machines */
114 /* WORD network to host order conversion for big endian machines */
118 /* WORD host to network byte order conversion for big endian machines */
124 #endif /* __WS2_32_H */