Fix up indentation.
[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  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24 #ifndef __SOCKET_H__
25 #define __SOCKET_H__
26
27 #include "config.h"
28
29 #if defined(_WIN32) && !defined(__CYGWIN__)
30         #ifdef HAVE_WINDOWS_H
31                 #include <windows.h>
32         #endif
33
34         #include <ws2tcpip.h>
35
36         #ifdef HAVE_WINSOCK2_H
37                 #include <winsock2.h>
38         #endif
39
40         #include <process.h>
41
42         #define socket_handle_t SOCKET
43         #define socklen_t int
44 #else
45         /*
46          * UN*X, or Windows pretending to be UN*X with the aid of Cygwin.
47          */
48         #ifdef HAVE_UNISTD_H
49                 /*
50                  * For close().
51                  */
52                 #include <unistd.h>
53         #endif
54         #ifdef HAVE_SYS_SOCKET_H
55                 #include <sys/socket.h>
56         #endif
57
58         #define closesocket(socket)     close(socket)
59         #define socket_handle_t         int
60         #define INVALID_SOCKET          (-1)
61         #define SOCKET_ERROR            (-1)
62 #endif
63
64 #ifdef HAVE_ARPA_INET_H
65         #include <arpa/inet.h>
66 #endif
67
68 #endif /* __SOCKET_H__ */
69
70 /*
71  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
72  *
73  * Local variables:
74  * c-basic-offset: 8
75  * tab-width: 8
76  * indent-tabs-mode: t
77  * End:
78  *
79  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
80  * :indentSize=8:tabSize=8:noTabs=false:
81  */