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
14 #define WIN32_NO_STATUS
19 #define NTOS_MODE_USER
20 #include <ndk/rtlfuncs.h>
26 #include <windns.h> // DNS_A_DATA
36 extern HINSTANCE g_hInstDll
;
37 extern HANDLE GlobalHeap
;
38 extern BOOL WsaInitialized
; /* TRUE if WSAStartup() has been successfully called */
39 extern WSPUPCALLTABLE UpcallTable
;
41 #define WS2_INTERNAL_MAX_ALIAS 16
43 typedef struct _WINSOCK_GETSERVBYNAME_CACHE
47 PCHAR Aliases
[WS2_INTERNAL_MAX_ALIAS
];
49 } WINSOCK_GETSERVBYNAME_CACHE
, *PWINSOCK_GETSERVBYNAME_CACHE
;
51 typedef struct _WINSOCK_GETSERVBYPORT_CACHE
55 PCHAR Aliases
[WS2_INTERNAL_MAX_ALIAS
];
57 } WINSOCK_GETSERVBYPORT_CACHE
, *PWINSOCK_GETSERVBYPORT_CACHE
;
59 typedef struct _WINSOCK_THREAD_BLOCK
61 INT LastErrorValue
; /* Error value from last function that failed */
62 CHAR Intoa
[16]; /* Buffer for inet_ntoa() */
63 PWINSOCK_GETSERVBYNAME_CACHE
64 Getservbyname
; /* Buffer used by getservbyname */
65 PWINSOCK_GETSERVBYPORT_CACHE
66 Getservbyport
; /* Buffer used by getservbyname */
67 struct hostent
* Hostent
;
68 } WINSOCK_THREAD_BLOCK
, *PWINSOCK_THREAD_BLOCK
;
73 #define WSAINITIALIZED (WsaInitialized)
75 #define WSASETINITIALIZED (WsaInitialized = TRUE)
77 /* ws2_32 internal Functions */
78 void check_hostent(struct hostent
**he
);
79 void populate_hostent(struct hostent
*he
, char* name
, IP4_ADDRESS addr
);
80 void free_hostent(struct hostent
*he
);
81 void free_servent(struct servent
* s
);
85 /* DWORD network to host byte order conversion for little endian machines */
87 ((((dw) & 0xFF000000L) >> 24) | \
88 (((dw) & 0x00FF0000L) >> 8) | \
89 (((dw) & 0x0000FF00L) << 8) | \
90 (((dw) & 0x000000FFL) << 24))
92 /* DWORD host to network byte order conversion for little endian machines */
94 ((((dw) & 0xFF000000L) >> 24) | \
95 (((dw) & 0x00FF0000L) >> 8) | \
96 (((dw) & 0x0000FF00L) << 8) | \
97 (((dw) & 0x000000FFL) << 24))
99 /* WORD network to host order conversion for little endian machines */
101 ((((w) & 0xFF00) >> 8) | \
102 (((w) & 0x00FF) << 8))
104 /* WORD host to network byte order conversion for little endian machines */
106 ((((w) & 0xFF00) >> 8) | \
107 (((w) & 0x00FF) << 8))
111 /* DWORD network to host byte order conversion for big endian machines */
115 /* DWORD host to network byte order conversion big endian machines */
119 /* WORD network to host order conversion for big endian machines */
123 /* WORD host to network byte order conversion for big endian machines */
129 #endif /* __WS2_32_H */