2
0

gnetworking.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. #ifndef __G_NETWORKING_H__
  19. #define __G_NETWORKING_H__
  20. #include <glib.h>
  21. #ifdef G_OS_WIN32
  22. #include <winsock2.h>
  23. #include <ws2tcpip.h>
  24. #include <windns.h>
  25. #include <mswsock.h>
  26. #include <wspiapi.h>
  27. #include <iphlpapi.h>
  28. #undef interface
  29. #else /* !G_OS_WIN32 */
  30. #include <sys/types.h>
  31. #include <netdb.h>
  32. #include <netinet/in.h>
  33. #include <netinet/tcp.h>
  34. #include <resolv.h>
  35. #include <sys/socket.h>
  36. #include <sys/un.h>
  37. #include <net/if.h>
  38. #include <arpa/inet.h>
  39. #include <arpa/nameser.h>
  40. #include <arpa/nameser_compat.h>
  41. #ifndef T_SRV
  42. #define T_SRV 33
  43. #endif
  44. #ifndef _PATH_RESCONF
  45. #define _PATH_RESCONF "/etc/resolv.conf"
  46. #endif
  47. #ifndef CMSG_LEN
  48. /* CMSG_LEN and CMSG_SPACE are defined by RFC 2292, but missing on
  49. * some older platforms.
  50. */
  51. #define CMSG_LEN(len) ((size_t)CMSG_DATA((struct cmsghdr *)NULL) + (len))
  52. /* CMSG_SPACE must add at least as much padding as CMSG_NXTHDR()
  53. * adds. We overestimate here.
  54. */
  55. #define GLIB_ALIGN_TO_SIZEOF(len, obj) (((len) + sizeof (obj) - 1) & ~(sizeof (obj) - 1))
  56. #define CMSG_SPACE(len) GLIB_ALIGN_TO_SIZEOF (CMSG_LEN (len), struct cmsghdr)
  57. #endif
  58. #endif
  59. G_BEGIN_DECLS
  60. GLIB_AVAILABLE_IN_2_36
  61. void g_networking_init (void);
  62. G_END_DECLS
  63. #endif /* __G_NETWORKING_H__ */