1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2008-2011 Red Hat, Inc.
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 of the License, or (at your option) any later version.
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.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 #ifndef __G_NETWORKING_H__
20 #define __G_NETWORKING_H__
27 #define _WIN32_WINNT 0x0501
37 #else /* !G_OS_WIN32 */
39 #include <sys/types.h>
42 #include <netinet/in.h>
43 #include <netinet/tcp.h>
45 #include <sys/socket.h>
49 #include <arpa/inet.h>
50 #include <arpa/nameser.h>
51 @NAMESER_COMPAT_INCLUDE@
58 #define _PATH_RESCONF "/etc/resolv.conf"
62 /* CMSG_LEN and CMSG_SPACE are defined by RFC 2292, but missing on
63 * some older platforms.
65 #define CMSG_LEN(len) ((size_t)CMSG_DATA((struct cmsghdr *)NULL) + (len))
67 /* CMSG_SPACE must add at least as much padding as CMSG_NXTHDR()
68 * adds. We overestimate here.
70 #define GLIB_ALIGN_TO_SIZEOF(len, obj) (((len) + sizeof (obj) - 1) & ~(sizeof (obj) - 1))
71 #define CMSG_SPACE(len) GLIB_ALIGN_TO_SIZEOF (CMSG_LEN (len), struct cmsghdr)
77 GLIB_AVAILABLE_IN_2_36
78 void g_networking_init (void);
82 #endif /* __G_NETWORKING_H__ */