Change LGPL-2.1+ to LGPL-2.1-or-later
[platform/upstream/glib.git] / gio / gnetworking.h.in
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright (C) 2008-2011 Red Hat, Inc.
4  *
5  * SPDX-License-Identifier: LGPL-2.1-or-later
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #ifndef __G_NETWORKING_H__
22 #define __G_NETWORKING_H__
23
24 #include <glib.h>
25 #include <gio/gio-visibility.h>
26
27 #ifdef G_OS_WIN32
28 #include <winsock2.h>
29 #include <ws2tcpip.h>
30 #include <windns.h>
31 #include <mswsock.h>
32 #include <wspiapi.h>
33 #include <iphlpapi.h>
34 #undef interface
35
36 #else /* !G_OS_WIN32 */
37
38 #include <sys/types.h>
39
40 #include <netdb.h>
41 #include <netinet/in.h>
42 #include <netinet/tcp.h>
43 #include <resolv.h>
44 #include <sys/socket.h>
45 #include <sys/un.h>
46 #include <net/if.h>
47
48 #include <arpa/inet.h>
49 #include <arpa/nameser.h>
50 @NAMESER_COMPAT_INCLUDE@
51
52 #ifndef T_SRV
53 #define T_SRV 33
54 #endif
55
56 #ifndef _PATH_RESCONF
57 #define _PATH_RESCONF "/etc/resolv.conf"
58 #endif
59
60 #ifndef CMSG_LEN
61 /* CMSG_LEN and CMSG_SPACE are defined by RFC 2292, but missing on
62  * some older platforms.
63  */
64 #define CMSG_LEN(len) ((size_t)CMSG_DATA((struct cmsghdr *)NULL) + (len))
65
66 /* CMSG_SPACE must add at least as much padding as CMSG_NXTHDR()
67  * adds. We overestimate here.
68  */
69 #define GLIB_ALIGN_TO_SIZEOF(len, obj) (((len) + sizeof (obj) - 1) & ~(sizeof (obj) - 1))
70 #define CMSG_SPACE(len) GLIB_ALIGN_TO_SIZEOF (CMSG_LEN (len), struct cmsghdr)
71 #endif
72 #endif
73
74 G_BEGIN_DECLS
75
76 GIO_AVAILABLE_IN_2_36
77 void g_networking_init (void);
78
79 G_END_DECLS
80
81 #endif /* __G_NETWORKING_H__ */