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
13 #define WIN32_NO_STATUS
15 #define COM_NO_WINDOWS_H
21 #define NTOS_MODE_USER
22 #include <ndk/rtlfuncs.h>
28 #include <windns.h> // DNS_A_DATA
35 extern HINSTANCE g_hInstDll
;
36 extern HANDLE GlobalHeap
;
37 extern BOOL WsaInitialized
; /* TRUE if WSAStartup() has been successfully called */
38 extern WSPUPCALLTABLE UpcallTable
;
40 #define WS2_INTERNAL_MAX_ALIAS 16
42 typedef struct _WINSOCK_GETSERVBYNAME_CACHE
46 PCHAR Aliases
[WS2_INTERNAL_MAX_ALIAS
];
48 } WINSOCK_GETSERVBYNAME_CACHE
, *PWINSOCK_GETSERVBYNAME_CACHE
;
50 typedef struct _WINSOCK_GETSERVBYPORT_CACHE
54 PCHAR Aliases
[WS2_INTERNAL_MAX_ALIAS
];
56 } WINSOCK_GETSERVBYPORT_CACHE
, *PWINSOCK_GETSERVBYPORT_CACHE
;
58 typedef struct _WINSOCK_THREAD_BLOCK
60 INT LastErrorValue
; /* Error value from last function that failed */
61 CHAR Intoa
[16]; /* Buffer for inet_ntoa() */
62 PWINSOCK_GETSERVBYNAME_CACHE
63 Getservbyname
; /* Buffer used by getservbyname */
64 PWINSOCK_GETSERVBYPORT_CACHE
65 Getservbyport
; /* Buffer used by getservbyname */
66 struct hostent
* Hostent
;
67 } WINSOCK_THREAD_BLOCK
, *PWINSOCK_THREAD_BLOCK
;
72 #define WSAINITIALIZED (WsaInitialized)
74 #define WSASETINITIALIZED (WsaInitialized = TRUE)
76 /* ws2_32 internal Functions */
77 void check_hostent(struct hostent
**he
);
78 void populate_hostent(struct hostent
*he
, char* name
, IP4_ADDRESS addr
);
79 void free_hostent(struct hostent
*he
);
80 void free_servent(struct servent
* s
);
84 /* DWORD network to host byte order conversion for little endian machines */
86 ((((dw) & 0xFF000000L) >> 24) | \
87 (((dw) & 0x00FF0000L) >> 8) | \
88 (((dw) & 0x0000FF00L) << 8) | \
89 (((dw) & 0x000000FFL) << 24))
91 /* DWORD host to network byte order conversion for little endian machines */
93 ((((dw) & 0xFF000000L) >> 24) | \
94 (((dw) & 0x00FF0000L) >> 8) | \
95 (((dw) & 0x0000FF00L) << 8) | \
96 (((dw) & 0x000000FFL) << 24))
98 /* WORD network to host order conversion for little endian machines */
100 ((((w) & 0xFF00) >> 8) | \
101 (((w) & 0x00FF) << 8))
103 /* WORD host to network byte order conversion for little endian machines */
105 ((((w) & 0xFF00) >> 8) | \
106 (((w) & 0x00FF) << 8))
110 /* DWORD network to host byte order conversion for big endian machines */
114 /* DWORD host to network byte order conversion big endian machines */
118 /* WORD network to host order conversion for big endian machines */
122 /* WORD host to network byte order conversion for big endian machines */
128 #endif /* __WS2_32_H */