CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/data/headers/windows/Winsock2.h
Views: 1904
1
//
2
// License:
3
// https://github.com/rapid7/metasploit-framework/blob/master/LICENSE
4
//
5
6
#define IPPROTO_IP 0
7
#define IPPROTO_ICMP 1
8
#define IPPROTO_IGMP 2
9
#define IPPROTO_GGP 3
10
#define IPPROTO_TCP 6
11
#define IPPROTO_PUP 12
12
#define IPPROTO_UDP 17
13
#define IPPROTO_IDP 22
14
#define IPPROTO_ND 77
15
#define IPPROTO_RAW 255
16
#define IPPROTO_MAX 256
17
#define IPPORT_ECHO 7
18
#define IPPORT_DISCARD 9
19
#define IPPORT_SYSTAT 11
20
#define IPPORT_DAYTIME 13
21
#define IPPORT_NETSTAT 15
22
#define IPPORT_FTP 21
23
#define IPPORT_TELNET 23
24
#define IPPORT_SMTP 25
25
#define IPPORT_TIMESERVER 37
26
#define IPPORT_NAMESERVER 42
27
#define IPPORT_WHOIS 43
28
#define IPPORT_MTP 57
29
#define IPPORT_TFTP 69
30
#define IPPORT_RJE 77
31
#define IPPORT_FINGER 79
32
#define IPPORT_TTYLINK 87
33
#define IPPORT_SUPDUP 95
34
#define IPPORT_EXECSERVER 512
35
#define IPPORT_LOGINSERVER 513
36
#define IPPORT_CMDSERVER 514
37
#define IPPORT_EFSSERVER 520
38
#define IPPORT_BIFFUDP 512
39
#define IPPORT_WHOSERVER 513
40
#define IPPORT_ROUTESERVER 520
41
#define IPPORT_RESERVED 1024
42
#define IMPLINK_IP 155
43
#define IMPLINK_LOWEXPER 156
44
#define IMPLINK_HIGHEXPER 158
45
#define WSADESCRIPTION_LEN 256
46
#define WSASYS_STATUS_LEN 128
47
#define SD_RECEIVE 0x00
48
#define SD_SEND 0x01
49
#define SD_BOTH 0x02
50
#define FD_SETSIZE 64
51
#define WSA_INVALID_HANDLE 6
52
#define WSA_NOT_ENOUGH_MEMORY 8
53
#define WSA_INVALID_PARAMETER 87
54
#define WSA_OPERATION_ABORTED 995
55
#define WSA_IO_INCOMPLETE 996
56
#define WSA_IO_PENDING 997
57
#define WSAEINTR 10004
58
#define WSAEBADF 10009
59
#define WSAEACCES 10013
60
#define WSAEFAULT 10014
61
#define WSAEINVAL 10022
62
#define WSAEMFILE 10024
63
#define WSAEWOULDBLOCK 10035
64
#define WSAEINPROGRESS 10036
65
#define WSAEALREADY 10037
66
#define WSAENOTSOCK 10038
67
#define WSAEDESTADDRREQ 10039
68
#define WSAEMSGSIZE 10040
69
#define WSAEPROTOTYPE 10041
70
#define WSAENOPROTOOPT 10042
71
#define WSAEPROTONOSUPPORT 10043
72
#define WSAESOCKTNOSUPPORT 10044
73
#define WSAEOPNOTSUPP 10045
74
#define WSAEPFNOSUPPORT 10046
75
#define WSAEAFNOSUPPORT 10047
76
#define WSAEADDRINUSE 10048
77
#define WSAEADDRNOTAVAIL 10049
78
#define WSAENETDOWN 10050
79
#define WSAENETUNREACH 10051
80
#define WSAENETRESET 10052
81
#define WSAECONNABORTED 10053
82
#define WSAECONNRESET 10054
83
#define WSAENOBUFS 10055
84
#define WSAEISCONN 10056
85
#define WSAENOTCONN 10057
86
#define WSAESHUTDOWN 10058
87
#define WSAETOOMANYREFS 10059
88
#define WSAETIMEDOUT 10060
89
#define WSAECONNREFUSED 10061
90
#define WSAELOOP 10062
91
#define WSAENAMETOOLONG 10063
92
#define WSAEHOSTDOWN 10064
93
#define WSAEHOSTUNREACH 10065
94
#define WSAENOTEMPTY 10066
95
#define WSAEPROCLIM 10067
96
#define WSAEUSERS 10068
97
#define WSAEDQUOT 10069
98
#define WSAESTALE 10070
99
#define WSAEREMOTE 10071
100
#define WSASYSNOTREADY 10091
101
#define WSAVERNOTSUPPORTED 10092
102
#define WSANOTINITIALISED 10093
103
#define WSAEDISCON 10101
104
#define WSAENOMORE 10102
105
#define WSAECANCELLED 10103
106
#define WSAEINVALIDPROCTABLE 10104
107
#define WSAEINVALIDPROVIDER 10105
108
#define WSAEPROVIDERFAILEDINIT 10106
109
#define WSASYSCALLFAILURE 10107
110
#define WSASERVICE_NOT_FOUND 10108
111
#define WSATYPE_NOT_FOUND 10109
112
#define WSA_E_NO_MORE 10110
113
#define WSA_E_CANCELLED 10111
114
#define WSAEREFUSED 10112
115
#define WSAHOST_NOT_FOUND 11001
116
#define WSATRY_AGAIN 11002
117
#define WSANO_RECOVERY 11003
118
#define WSANO_DATA 11004
119
#define WSA_QOS_RECEIVERS 11005
120
#define WSA_QOS_SENDERS 11006
121
#define WSA_QOS_NO_SENDERS 11007
122
#define WSA_QOS_NO_RECEIVERS 11008
123
#define WSA_QOS_REQUEST_CONFIRMED 11009
124
#define WSA_QOS_ADMISSION_FAILURE 11010
125
#define WSA_QOS_POLICY_FAILURE 11011
126
#define WSA_QOS_BAD_STYLE 11012
127
#define WSA_QOS_BAD_OBJECT 11013
128
#define WSA_QOS_TRAFFIC_CTRL_ERROR 11014
129
#define WSA_QOS_GENERIC_ERROR 11015
130
#define WSA_QOS_ESERVICETYPE 11016
131
#define WSA_QOS_EFLOWSPEC 11017
132
#define WSA_QOS_EPROVSPECBUF 11018
133
#define WSA_QOS_EFILTERSTYLE 11019
134
#define WSA_QOS_EFILTERTYPE 11020
135
#define WSA_QOS_EFILTERCOUNT 11021
136
#define WSA_QOS_EOBJLENGTH 11022
137
#define WSA_QOS_EFLOWCOUNT 11023
138
#define WSA_QOS_EUNKOWNPSOBJ 11024
139
#define WSA_QOS_EPOLICYOBJ 11025
140
#define WSA_QOS_EFLOWDESC 11026
141
#define WSA_QOS_EPSFLOWSPEC 11027
142
#define WSA_QOS_EPSFILTERSPEC 11028
143
#define WSA_QOS_ESDMODEOBJ 11029
144
#define WSA_QOS_ESHAPERATEOBJ 11030
145
#define WSA_QOS_RESERVED_PETYPE 11031
146
#define AF_UNSPEC 0
147
#define AF_INET 2
148
#define AF_IPX 6
149
#define AF_APPLETALK 16
150
#define AF_NETBIOS 17
151
#define AF_INET6 23
152
#define AF_IRDA 26
153
#define AF_BTH 32
154
#define SOCK_STREAM 1
155
#define SOCK_DGRAM 2
156
#define SOCK_RAW 3
157
#define SOCK_RDM 4
158
#define SOCK_SEQPACKET 5
159
#define INVALID_SOCKET (SOCKET)(~0)
160
#define SOCKET_ERROR (-1)
161
#define AI_PASSIVE 0x00000001
162
#define AI_CANONNAME 0x00000002
163
#define AI_NUMERICHOST 0x00000004
164
#define AI_NUMERICSERV 0x00000008
165
#define AI_ALL 0x00000100
166
#define AI_ADDRCONFIG 0x00000400
167
#define AI_V4MAPPED 0x00000800
168
#define AI_NON_AUTHORITATIVE 0x00004000
169
#define AI_SECURE 0x00008000
170
#define AI_RETURN_PREFERRED_NAMES 0x00010000
171
#define AI_FQDN 0x00020000
172
#define AI_FILESERVER 0x00040000
173
#define MAX_PROTOCOL_CHAIN 7
174
#define WSAPROTOCOL_LEN 255
175
#define SOMAXCONN 0x7fffffff
176
177
typedef unsigned char u_char;
178
typedef unsigned short u_short;
179
typedef unsigned int u_int;
180
typedef unsigned long u_long;
181
typedef u_int SOCKET;
182
typedef unsigned int GROUP;
183
typedef ULONG SERVICETYPE;
184
185
struct sockaddr {
186
u_short sa_family;
187
char sa_data[14];
188
} SOCKADDR;
189
190
typedef struct WSAData {
191
WORD wVersion;
192
WORD wHighVersion;
193
char szDescription[WSADESCRIPTION_LEN+1];
194
char szSystemStatus[WSASYS_STATUS_LEN+1];
195
unsigned short iMaxSockets;
196
unsigned short iMaxUdpDg;
197
char *lpVendorInfo;
198
} WSADATA, *LPWSADATA;
199
200
typedef struct addrinfo {
201
int ai_flags;
202
int ai_family;
203
int ai_socktype;
204
int ai_protocol;
205
size_t ai_addrlen;
206
char *ai_canonname;
207
struct sockaddr *ai_addr;
208
struct addrinfo *ai_next;
209
} ADDRINFOA, *PADDRINFOA;
210
211
typedef struct fd_set {
212
u_int fd_count;
213
SOCKET fd_array[FD_SETSIZE];
214
} fd_set;
215
216
typedef struct in_addr {
217
union {
218
struct {
219
u_char s_b1,s_b2,s_b3,s_b4;
220
} S_un_b;
221
struct {
222
u_short s_w1,s_w2;
223
} S_un_w;
224
u_long S_addr;
225
} S_un;
226
} IN_ADDR, *PIN_ADDR, *LPIN_ADDR;
227
228
struct sockaddr_in {
229
short sin_family;
230
u_short sin_port;
231
struct in_addr sin_addr;
232
char sin_zero[8];
233
};
234
235
struct sockproto {
236
u_short sp_family;
237
u_short sp_protocol;
238
};
239
240
typedef struct hostent {
241
char *h_name;
242
char **h_aliases;
243
short h_addrtype;
244
short h_length;
245
char **h_addr_list;
246
} HOSTENT, *PHOSTENT, *LPHOSTENT;
247
248
typedef struct _WSAPROTOCOLCHAIN {
249
int ChainLen;
250
DWORD ChainEntries[MAX_PROTOCOL_CHAIN];
251
} WSAPROTOCOLCHAIN, *LPWSAPROTOCOLCHAIN;
252
253
typedef struct _WSAPROTOCOL_INFO {
254
DWORD dwServiceFlags1;
255
DWORD dwServiceFlags2;
256
DWORD dwServiceFlags3;
257
DWORD dwServiceFlags4;
258
DWORD dwProviderFlags;
259
GUID ProviderId;
260
DWORD dwCatalogEntryId;
261
WSAPROTOCOLCHAIN ProtocolChain;
262
int iVersion;
263
int iAddressFamily;
264
int iMaxSockAddr;
265
int iMinSockAddr;
266
int iSocketType;
267
int iProtocol;
268
int iProtocolMaxOffset;
269
int iNetworkByteOrder;
270
int iSecurityScheme;
271
DWORD dwMessageSize;
272
DWORD dwProviderReserved;
273
TCHAR szProtocol[WSAPROTOCOL_LEN+1];
274
} WSAPROTOCOL_INFO, *LPWSAPROTOCOL_INFO;
275
276
typedef struct _WSABUF
277
{
278
ULONG len;
279
CHAR* buf;
280
} WSABUF, *LPWSABUF;
281
282
typedef struct _FLOWSPEC {
283
unsigned int TokenRate;
284
unsigned int TokenBucketSize;
285
unsigned int PeakBandwidth;
286
unsigned int Latency;
287
unsigned int DelayVariation;
288
SERVICETYPE ServiceType;
289
unsigned int MaxSduSize;
290
unsigned int MinimumPolicedSize;
291
} FLOWSPEC, *PFLOWSPEC, *LPFLOWSPEC;
292
293
typedef struct _QUALITYOFSERVICE {
294
FLOWSPEC SendingFlowspec;
295
FLOWSPEC ReceivingFlowspec;
296
WSABUF ProviderSpecific;
297
} QOS, *LPQOS;
298
299
typedef int (CALLBACK *LPCONDITIONPROC)(LPWSABUF, LPWSABUF, LPQOS, LPQOS, LPWSABUF, LPWSABUF, GROUP *, DWORD);
300
typedef struct sockaddr_in SOCKADDR_IN;
301
typedef struct sockaddr_in *PSOCKADDR_IN;
302
typedef struct sockaddr_in *LPSOCKADDR_IN;
303
304
WINAPI int WSAStartup __attribute__((dllimport))(WORD, LPWSADATA);
305
WINAPI int WSACleanup __attribute__((dllimport))();
306
WINAPI int getaddrinfo __attribute__((dllimport))(PCSTR, PCSTR, const ADDRINFOA*, PADDRINFOA*);
307
WINAPI SOCKET socket __attribute__((dllimport))(int, int, int);
308
WINAPI void freeaddrinfo __attribute__((dllimport))(struct addrinfo*);
309
WINAPI int closesocket __attribute__((dllimport))(SOCKET);
310
WINAPI int bind __attribute__((dllimport))(SOCKET, const struct sockaddr*, int);
311
WINAPI SOCKET accept __attribute__((dllimport))(SOCKET, struct sockaddr*, int*);
312
WINAPI BOOL AcceptEx __attribute__((dllimport))(SOCKET, SOCKET, PVOID, DWORD, DWORD, DWORD, LPDWORD, LPOVERLAPPED);
313
WINAPI int connect __attribute__((dllimport))(SOCKET, const struct sockaddr*, int);
314
WINAPI int gethostname __attribute__((dllimport))(char*, int);
315
WINAPI int listen __attribute__((dllimport))(SOCKET, int);
316
WINAPI int recv __attribute__((dllimport))(SOCKET, char*, int, int);
317
WINAPI int recvfrom __attribute__((dllimport))(SOCKET, char*, int, int, struct sockaddr*, int*);
318
WINAPI int send __attribute__((dllimport))(SOCKET, char*, int, int);
319
WINAPI int sendto __attribute__((dllimport))(SOCKET, char*, int, int, const struct sockaddr*, int);
320
WINAPI int select __attribute__((dllimport))(int, fd_set*, fd_set*, fd_set*, const struct timeval*);
321
WINAPI int setsockopt __attribute__((dllimport))(SOCKET, int, int, const char*, int);
322
WINAPI char* inet_ntoa __attribute__((dllimport))(struct in_addr);
323
WINAPI unsigned long inet_addr __attribute__((dllimport))(const char*);
324
WINAPI int shutdown __attribute__((dllimport))(SOCKET, int);
325
WINAPI u_short htons __attribute__((dllimport))(u_short);
326
WINAPI u_long htonl __attribute__((dllimport))(u_long);
327
WINAPI struct hostent* gethostbyname __attribute__((dllimport))(const char*);
328
WINAPI struct hostent* gethostbyaddr __attribute__((dllimport))(const char*, int, int);
329
WINAPI int WSAGetLastError __attribute__((dllimport))();
330
WINAPI SOCKET WSASocket __attribute__((dllimport))(int, int, int, LPWSAPROTOCOL_INFO, GROUP, DWORD);
331
WINAPI SOCKET WSAAccept __attribute__((dllimport))(SOCKET, struct sockaddr*, LPINT, LPCONDITIONPROC, DWORD_PTR);
332
333