PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://github.com/eilwin/TrinityCore
C Header | 108 lines | 76 code | 15 blank | 17 comment | 5 complexity | 7fc9470eeadc72d76dfdf228f12d1c34 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, CC-BY-SA-3.0
  1. // -*- C++ -*-
  2. //=============================================================================
  3. /**
  4. * @file os_if.h
  5. *
  6. * sockets local interfaces
  7. *
  8. * $Id: os_if.h 91688 2010-09-09 11:21:50Z johnnyw $
  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_LACKS_IFREQ)
  42. struct ifreq {
  43. #define IFNAMSIZ 16
  44. char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
  45. union {
  46. struct sockaddr ifru_addr;
  47. struct sockaddr ifru_dstaddr;
  48. struct sockaddr ifru_broadaddr;
  49. short ifru_flags;
  50. int ifru_metric;
  51. int ifru_mtu;
  52. int ifru_phys;
  53. int ifru_media;
  54. caddr_t ifru_data;
  55. int (*ifru_tap)(struct ifnet *, struct ether_header *, struct mbuf *);
  56. } ifr_ifru;
  57. #define ifr_addr ifr_ifru.ifru_addr /* address */
  58. #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
  59. #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
  60. #define ifr_flags ifr_ifru.ifru_flags /* flags */
  61. #define ifr_metric ifr_ifru.ifru_metric /* metric */
  62. #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
  63. #define ifr_phys ifr_ifru.ifru_phys /* physical wire */
  64. #define ifr_media ifr_ifru.ifru_media /* physical media */
  65. #define ifr_data ifr_ifru.ifru_data /* for use by interface */
  66. #define ifr_tap ifr_ifru.ifru_tap /* tap function */
  67. };
  68. #endif /* ACE_LACKS_IFREQ */
  69. #if defined (ACE_LACKS_IFCONF)
  70. struct ifconf {
  71. int ifc_len;
  72. union {
  73. caddr_t ifcu_buf;
  74. struct ifreq *ifcu_req;
  75. } ifc_ifcu;
  76. #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
  77. #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
  78. };
  79. #endif /* ACE_LACKS_IFCONF */
  80. #if !defined (IFF_UP)
  81. # define IFF_UP 0x1
  82. #endif /* IFF_UP */
  83. #if !defined (IFF_LOOPBACK)
  84. # define IFF_LOOPBACK 0x8
  85. #endif /* IFF_LOOPBACK */
  86. #if !defined (IFF_BROADCAST)
  87. # define IFF_BROADCAST 0x2
  88. #endif /* IFF_BROADCAST */
  89. #ifdef __cplusplus
  90. }
  91. #endif /* __cplusplus */
  92. #include /**/ "ace/post.h"
  93. #endif /* ACE_OS_INCLUDE_NET_OS_IF_H */