Add .keep guard files in order to restore lost but empty directories we had with...
[reactos.git] / dll / win32 / ws2_32 / include / ws2_32.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS WinSock 2 DLL
4 * FILE: dll/win32/ws2_32/include/ws2_32.h
5 * PURPOSE: WinSock 2 DLL header
6 */
7
8 #ifndef __WS2_32_H
9 #define __WS2_32_H
10
11 #include <stdarg.h>
12
13 #define WIN32_NO_STATUS
14 #define _INC_WINDOWS
15 #define COM_NO_WINDOWS_H
16
17 #include <windef.h>
18 #include <winbase.h>
19 #include <winnls.h>
20 #include <winuser.h>
21 #include <ws2spi.h>
22 #define NTOS_MODE_USER
23 #include <ndk/rtlfuncs.h>
24 #include <pseh/pseh2.h>
25
26 #include <wsahelp.h>
27
28 #undef assert
29 #include <debug.h>
30 #include <windns.h> // DNS_A_DATA
31
32 #include "catalog.h"
33 #include "handle.h"
34
35 #define EXPORT WINAPI
36
37 extern HINSTANCE g_hInstDll;
38 extern HANDLE GlobalHeap;
39 extern BOOL WsaInitialized; /* TRUE if WSAStartup() has been successfully called */
40 extern WSPUPCALLTABLE UpcallTable;
41
42 #define WS2_INTERNAL_MAX_ALIAS 16
43
44 typedef struct _WINSOCK_GETSERVBYNAME_CACHE
45 {
46 UINT Size;
47 SERVENT ServerEntry;
48 PCHAR Aliases[WS2_INTERNAL_MAX_ALIAS];
49 CHAR Data[1];
50 } WINSOCK_GETSERVBYNAME_CACHE, *PWINSOCK_GETSERVBYNAME_CACHE;
51
52 typedef struct _WINSOCK_GETSERVBYPORT_CACHE
53 {
54 UINT Size;
55 SERVENT ServerEntry;
56 PCHAR Aliases[WS2_INTERNAL_MAX_ALIAS];
57 CHAR Data[1];
58 } WINSOCK_GETSERVBYPORT_CACHE, *PWINSOCK_GETSERVBYPORT_CACHE;
59
60 typedef struct _WINSOCK_THREAD_BLOCK
61 {
62 INT LastErrorValue; /* Error value from last function that failed */
63 CHAR Intoa[16]; /* Buffer for inet_ntoa() */
64 PWINSOCK_GETSERVBYNAME_CACHE
65 Getservbyname; /* Buffer used by getservbyname */
66 PWINSOCK_GETSERVBYPORT_CACHE
67 Getservbyport; /* Buffer used by getservbyname */
68 struct hostent* Hostent;
69 } WINSOCK_THREAD_BLOCK, *PWINSOCK_THREAD_BLOCK;
70
71
72 /* Macros */
73
74 #define WSAINITIALIZED (WsaInitialized)
75
76 #define WSASETINITIALIZED (WsaInitialized = TRUE)
77
78 /* ws2_32 internal Functions */
79 void check_hostent(struct hostent **he);
80 void populate_hostent(struct hostent *he, char* name, IP4_ADDRESS addr);
81 void free_hostent(struct hostent *he);
82 void free_servent(struct servent* s);
83
84 #ifdef LE
85
86 /* DWORD network to host byte order conversion for little endian machines */
87 #define DN2H(dw) \
88 ((((dw) & 0xFF000000L) >> 24) | \
89 (((dw) & 0x00FF0000L) >> 8) | \
90 (((dw) & 0x0000FF00L) << 8) | \
91 (((dw) & 0x000000FFL) << 24))
92
93 /* DWORD host to network byte order conversion for little endian machines */
94 #define DH2N(dw) \
95 ((((dw) & 0xFF000000L) >> 24) | \
96 (((dw) & 0x00FF0000L) >> 8) | \
97 (((dw) & 0x0000FF00L) << 8) | \
98 (((dw) & 0x000000FFL) << 24))
99
100 /* WORD network to host order conversion for little endian machines */
101 #define WN2H(w) \
102 ((((w) & 0xFF00) >> 8) | \
103 (((w) & 0x00FF) << 8))
104
105 /* WORD host to network byte order conversion for little endian machines */
106 #define WH2N(w) \
107 ((((w) & 0xFF00) >> 8) | \
108 (((w) & 0x00FF) << 8))
109
110 #else /* LE */
111
112 /* DWORD network to host byte order conversion for big endian machines */
113 #define DN2H(dw) \
114 (dw)
115
116 /* DWORD host to network byte order conversion big endian machines */
117 #define DH2N(dw) \
118 (dw)
119
120 /* WORD network to host order conversion for big endian machines */
121 #define WN2H(w) \
122 (w)
123
124 /* WORD host to network byte order conversion for big endian machines */
125 #define WH2N(w) \
126 (w)
127
128 #endif /* LE */
129
130 #endif /* __WS2_32_H */