PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/dep/acelite/ace/os_include/net/os_if.h

https://bitbucket.org/n0n4m3/cataclysm/
C++ Header | 112 lines | 79 code | 16 blank | 17 comment | 5 complexity | f66b4918526bc0c74d9858ca8f6caed9 MD5 | raw file
Possible License(s): GPL-2.0
  1. // -*- C++ -*-
  2. //=============================================================================
  3. /**
  4. * @file os_if.h
  5. *
  6. * sockets local interfaces
  7. *
  8. * $Id: os_if.h 88719 2010-01-26 12:55:03Z sowayaa $
  9. *
  10. * @author Don Hinton <dhinton@dresystems.com>
  11. * @author This code was originally in various places including ace/OS.h.
  12. */
  13. //=============================================================================
  14. #ifndef ACE_OS_INCLUDE_NET_OS_IF_H
  15. #define ACE_OS_INCLUDE_NET_OS_IF_H
  16. #include /**/ "ace/pre.h"
  17. #include /**/ "ace/config-all.h"
  18. #if !defined (ACE_LACKS_PRAGMA_ONCE)
  19. # pragma once
  20. #endif /* ACE_LACKS_PRAGMA_ONCE */
  21. #if !defined (ACE_LACKS_NET_IF_H)
  22. # include /**/ <net/if.h>
  23. # if defined (ACE_HAS_NET_IF_DL_H)
  24. # include /**/ <net/if_dl.h>
  25. # endif /* ACE_HAS_NET_IF_DL_H */
  26. # if defined (HPUX) && defined (IOR)
  27. /* HP-UX 11.11 defines IOR in /usr/include/pa/inline.h
  28. and we don't want that definition. See IOP_IORC.h.
  29. Thanks to Torsten Kopper <tkue_0931@fastmail.fm> for this patch.*/
  30. # undef IOR
  31. # endif /* HPUX && IOR */
  32. #endif /* !ACE_LACKS_NET_IF_H */
  33. #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
  34. # include /**/ <ws2tcpip.h>
  35. #endif /* ACE_HAS_WINSOCK2 */
  36. // Place all additions (especially function declarations) within extern "C" {}
  37. #ifdef __cplusplus
  38. extern "C"
  39. {
  40. #endif /* __cplusplus */
  41. #if defined (ACE_HAS_BROKEN_IF_HEADER)
  42. struct ifafilt;
  43. #endif /* ACE_HAS_BROKEN_IF_HEADER */
  44. #if defined (ACE_LACKS_IFREQ)
  45. struct ifreq {
  46. #define IFNAMSIZ 16
  47. char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
  48. union {
  49. struct sockaddr ifru_addr;
  50. struct sockaddr ifru_dstaddr;
  51. struct sockaddr ifru_broadaddr;
  52. short ifru_flags;
  53. int ifru_metric;
  54. int ifru_mtu;
  55. int ifru_phys;
  56. int ifru_media;
  57. caddr_t ifru_data;
  58. int (*ifru_tap)(struct ifnet *, struct ether_header *, struct mbuf *);
  59. } ifr_ifru;
  60. #define ifr_addr ifr_ifru.ifru_addr /* address */
  61. #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
  62. #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
  63. #define ifr_flags ifr_ifru.ifru_flags /* flags */
  64. #define ifr_metric ifr_ifru.ifru_metric /* metric */
  65. #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
  66. #define ifr_phys ifr_ifru.ifru_phys /* physical wire */
  67. #define ifr_media ifr_ifru.ifru_media /* physical media */
  68. #define ifr_data ifr_ifru.ifru_data /* for use by interface */
  69. #define ifr_tap ifr_ifru.ifru_tap /* tap function */
  70. };
  71. #endif /* ACE_LACKS_IFREQ */
  72. #if defined (ACE_LACKS_IFCONF)
  73. struct ifconf {
  74. int ifc_len;
  75. union {
  76. caddr_t ifcu_buf;
  77. struct ifreq *ifcu_req;
  78. } ifc_ifcu;
  79. #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
  80. #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
  81. };
  82. #endif /* ACE_LACKS_IFCONF */
  83. #if !defined (IFF_UP)
  84. # define IFF_UP 0x1
  85. #endif /* IFF_UP */
  86. #if !defined (IFF_LOOPBACK)
  87. # define IFF_LOOPBACK 0x8
  88. #endif /* IFF_LOOPBACK */
  89. #if !defined (IFF_BROADCAST)
  90. # define IFF_BROADCAST 0x2
  91. #endif /* IFF_BROADCAST */
  92. #ifdef __cplusplus
  93. }
  94. #endif /* __cplusplus */
  95. #include /**/ "ace/post.h"
  96. #endif /* ACE_OS_INCLUDE_NET_OS_IF_H */