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
23 #define NTOS_MODE_USER
24 #include <ndk/rtlfuncs.h>
30 #include <windns.h> // DNS_A_DATA
38 extern HINSTANCE g_hInstDll
;
39 extern HANDLE GlobalHeap
;
40 extern BOOL WsaInitialized
; /* TRUE if WSAStartup() has been successfully called */
41 extern WSPUPCALLTABLE UpcallTable
;
43 #define WS2_INTERNAL_MAX_ALIAS 16
45 typedef struct _WINSOCK_GETSERVBYNAME_CACHE
49 PCHAR Aliases
[WS2_INTERNAL_MAX_ALIAS
];
51 } WINSOCK_GETSERVBYNAME_CACHE
, *PWINSOCK_GETSERVBYNAME_CACHE
;
53 typedef struct _WINSOCK_GETSERVBYPORT_CACHE
57 PCHAR Aliases
[WS2_INTERNAL_MAX_ALIAS
];
59 } WINSOCK_GETSERVBYPORT_CACHE
, *PWINSOCK_GETSERVBYPORT_CACHE
;
61 typedef struct _WINSOCK_THREAD_BLOCK
63 INT LastErrorValue
; /* Error value from last function that failed */
64 CHAR Intoa
[16]; /* Buffer for inet_ntoa() */
65 PWINSOCK_GETSERVBYNAME_CACHE
66 Getservbyname
; /* Buffer used by getservbyname */
67 PWINSOCK_GETSERVBYPORT_CACHE
68 Getservbyport
; /* Buffer used by getservbyname */
69 struct hostent
* Hostent
;
70 } WINSOCK_THREAD_BLOCK
, *PWINSOCK_THREAD_BLOCK
;
75 #define WSAINITIALIZED (WsaInitialized)
77 #define WSASETINITIALIZED (WsaInitialized = TRUE)
79 /* ws2_32 internal Functions */
80 void check_hostent(struct hostent
**he
);
81 void populate_hostent(struct hostent
*he
, char* name
, IP4_ADDRESS addr
);
82 void free_hostent(struct hostent
*he
);
83 void free_servent(struct servent
* s
);
87 /* DWORD network to host byte order conversion for little endian machines */
89 ((((dw) & 0xFF000000L) >> 24) | \
90 (((dw) & 0x00FF0000L) >> 8) | \
91 (((dw) & 0x0000FF00L) << 8) | \
92 (((dw) & 0x000000FFL) << 24))
94 /* DWORD host to network byte order conversion for little endian machines */
96 ((((dw) & 0xFF000000L) >> 24) | \
97 (((dw) & 0x00FF0000L) >> 8) | \
98 (((dw) & 0x0000FF00L) << 8) | \
99 (((dw) & 0x000000FFL) << 24))
101 /* WORD network to host order conversion for little endian machines */
103 ((((w) & 0xFF00) >> 8) | \
104 (((w) & 0x00FF) << 8))
106 /* WORD host to network byte order conversion for little endian machines */
108 ((((w) & 0xFF00) >> 8) | \
109 (((w) & 0x00FF) << 8))
113 /* DWORD network to host byte order conversion for big endian machines */
117 /* DWORD host to network byte order conversion big endian machines */
121 /* WORD network to host order conversion for big endian machines */
125 /* WORD host to network byte order conversion for big endian machines */
131 #endif /* __WS2_32_H */