glib (2.79.0)

(root)/
include/
glib-2.0/
gio/
gnetworking.h
       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  
      51  
      52  #ifndef __GI_SCANNER__
      53  
      54  #ifndef T_SRV
      55  #define T_SRV 33
      56  #endif
      57  
      58  #ifndef _PATH_RESCONF
      59  #define _PATH_RESCONF "/etc/resolv.conf"
      60  #endif
      61  
      62  #ifndef CMSG_LEN
      63  /* CMSG_LEN and CMSG_SPACE are defined by RFC 2292, but missing on
      64   * some older platforms.
      65   */
      66  #define CMSG_LEN(len) ((size_t)CMSG_DATA((struct cmsghdr *)NULL) + (len))
      67  
      68  /* CMSG_SPACE must add at least as much padding as CMSG_NXTHDR()
      69   * adds. We overestimate here.
      70   */
      71  #define GLIB_ALIGN_TO_SIZEOF(len, obj) (((len) + sizeof (obj) - 1) & ~(sizeof (obj) - 1))
      72  #define CMSG_SPACE(len) GLIB_ALIGN_TO_SIZEOF (CMSG_LEN (len), struct cmsghdr)
      73  #endif
      74  #endif
      75  
      76  #endif  /* !__GI_SCANNER__ */
      77  
      78  G_BEGIN_DECLS
      79  
      80  GIO_AVAILABLE_IN_2_36
      81  void g_networking_init (void);
      82  
      83  G_END_DECLS
      84  
      85  #endif /* __G_NETWORKING_H__ */