wmem: allow wmem_destroy_list to ignore a NULL list.
[metze/wireshark/wip.git] / wsutil / socket.h
1 /* socket.h
2  * Socket wrappers
3  *
4  * Copyright 2016, Dario Lombardo
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * SPDX-License-Identifier: GPL-2.0-or-later
11  */
12 #ifndef __SOCKET_H__
13 #define __SOCKET_H__
14
15 #if defined(_WIN32) && !defined(__CYGWIN__)
16         #include <windows.h>
17         #include <ws2tcpip.h>
18         #include <winsock2.h>
19         #include <process.h>
20
21         #define socket_handle_t SOCKET
22         #define socklen_t int
23 #else
24         /*
25          * UN*X, or Windows pretending to be UN*X with the aid of Cygwin.
26          */
27         #ifdef HAVE_UNISTD_H
28                 /*
29                  * For close().
30                  */
31                 #include <unistd.h>
32         #endif
33         #ifdef HAVE_SYS_SOCKET_H
34                 #include <sys/socket.h>
35         #endif
36
37         #define closesocket(socket)     close(socket)
38         #define socket_handle_t         int
39 #ifndef INVALID_SOCKET
40         #define INVALID_SOCKET          (-1)
41 #endif
42         #define SOCKET_ERROR            (-1)
43 #endif
44
45 #ifdef HAVE_ARPA_INET_H
46         #include <arpa/inet.h>
47 #endif
48
49 #endif /* __SOCKET_H__ */
50
51 /*
52  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
53  *
54  * Local variables:
55  * c-basic-offset: 8
56  * tab-width: 8
57  * indent-tabs-mode: t
58  * End:
59  *
60  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
61  * :indentSize=8:tabSize=8:noTabs=false:
62  */