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

source code of gtk/build/subprojects/glib/gio/gnetworking.h