PageRenderTime 51ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/dep/ACE_wrappers/ace/os_include/netinet/os_in.h

http://github.com/skyne/NeoCore
C Header | 186 lines | 125 code | 34 blank | 27 comment | 22 complexity | 03b86dc4bf4f955e680fabab329686ae MD5 | raw file
Possible License(s): GPL-2.0, CC-BY-SA-3.0, LGPL-2.1
  1. // -*- C++ -*-
  2. //=============================================================================
  3. /**
  4. * @file os_in.h
  5. *
  6. * Internet address family
  7. *
  8. * $Id: os_in.h 80826 2008-03-04 14:51:23Z wotte $
  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_NETINET_OS_IN_H
  15. #define ACE_OS_INCLUDE_NETINET_OS_IN_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. #include "ace/os_include/os_inttypes.h"
  22. #include "ace/os_include/sys/os_socket.h"
  23. #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
  24. # include /**/ <ws2tcpip.h>
  25. #endif /* ACE_HAS_WINSOCK2 */
  26. #if !defined (ACE_LACKS_NETINET_IN_H)
  27. # if defined (ACE_HAS_STL_QUEUE_CONFLICT)
  28. # define queue _Queue_
  29. # endif /* ACE_HAS_STL_QUEUE_CONFLICT */
  30. extern "C" {
  31. # include /**/ <netinet/in.h>
  32. }
  33. # if defined (ACE_HAS_STL_QUEUE_CONFLICT)
  34. # undef queue
  35. # endif /* ACE_HAS_STL_QUEUE_CONFLICT */
  36. #endif /* !ACE_LACKS_NETINET_IN_H */
  37. // Place all additions (especially function declarations) within extern "C" {}
  38. #ifdef __cplusplus
  39. extern "C"
  40. {
  41. #endif /* __cplusplus */
  42. # if defined (ACE_HAS_PHARLAP_RT)
  43. # define ACE_IPPROTO_TCP SOL_SOCKET
  44. # else
  45. # define ACE_IPPROTO_TCP IPPROTO_TCP
  46. # endif /* ACE_HAS_PHARLAP_RT */
  47. # if !defined (ACE_HAS_IP_MULTICAST) && defined (ACE_LACKS_IP_ADD_MEMBERSHIP)
  48. // Even if ACE_HAS_IP_MULTICAST is not defined, if IP_ADD_MEMBERSHIP
  49. // is defined, assume that the ip_mreq struct is also defined
  50. // (presumably in netinet/in.h).
  51. struct ip_mreq
  52. {
  53. /// IP multicast address of group
  54. struct in_addr imr_multiaddr;
  55. /// Local IP address of interface
  56. struct in_addr imr_interface;
  57. };
  58. # endif /* ! ACE_HAS_IP_MULTICAST && ACE_LACKS_IP_ADD_MEMBERSHIP */
  59. # if defined (ACE_LACKS_IN_ADDR)
  60. struct in_addr
  61. {
  62. u_long s_addr;
  63. };
  64. # endif /* ACE_LACKS_IN_ADDR */
  65. # if defined (ACE_LACKS_SOCKADDR_IN)
  66. struct sockaddr_in
  67. {
  68. short sin_family; // e.g. AF_INET
  69. unsigned short sin_port; // e.g. htons(3490)
  70. struct in_addr sin_addr; // see struct in_addr, below
  71. char sin_zero[8]; // zero this if you want to
  72. };
  73. # endif /* ACE_LACKS_SOCKADDR_IN */
  74. # if defined (ACE_LACKS_SOCKADDR_UN)
  75. struct sockaddr_un {
  76. u_char sun_len; /* sockaddr len including null */
  77. u_char sun_family; /* AF_UNIX */
  78. char sun_path[104]; /* path name (gag) */
  79. };
  80. #endif /* ACE_LACKS_SOCKADDR_UN */
  81. # if defined (ACE_LACKS_IP_MREQ)
  82. struct ip_mreq
  83. {
  84. struct in_addr imr_multiaddr; /* IP multicast address of group */
  85. struct in_addr imr_interface; /* local IP address of interface */
  86. };
  87. # endif /* ACE_LACKS_IP_MREQ */
  88. #if !defined (IPPORT_RESERVED)
  89. # define IPPORT_RESERVED 1024
  90. #endif /* !IPPORT_RESERVED */
  91. #if !defined (IPPORT_USERRESERVED)
  92. # define IPPORT_USERRESERVED 5000
  93. #endif /* !IPPORT_USERRESERVED */
  94. // Define INET loopback address constant if it hasn't been defined
  95. // Dotted Decimal 127.0.0.1 == Hexidecimal 0x7f000001
  96. #if !defined (INADDR_LOOPBACK)
  97. # define INADDR_LOOPBACK ((ACE_UINT32) 0x7f000001)
  98. #endif /* INADDR_LOOPBACK */
  99. // The INADDR_NONE address is generally 255.255.255.255.
  100. #if !defined (INADDR_NONE)
  101. # define INADDR_NONE ((ACE_UINT32) 0xffffffff)
  102. #endif /* INADDR_NONE */
  103. // Define INET string length constants if they haven't been defined
  104. //
  105. // for IPv4 dotted-decimal
  106. #if !defined (INET_ADDRSTRLEN)
  107. # define INET_ADDRSTRLEN 16
  108. #endif /* INET_ADDRSTRLEN */
  109. //
  110. // for IPv6 hex string
  111. #if !defined (INET6_ADDRSTRLEN)
  112. # define INET6_ADDRSTRLEN 46
  113. #endif /* INET6_ADDRSTRLEN */
  114. # if !defined (IP_DROP_MEMBERSHIP)
  115. # define IP_DROP_MEMBERSHIP 0
  116. # endif /* IP_DROP_MEMBERSHIP */
  117. # if !defined (IP_ADD_MEMBERSHIP)
  118. # define IP_ADD_MEMBERSHIP 0
  119. # define ACE_LACKS_IP_ADD_MEMBERSHIP
  120. # endif /* IP_ADD_MEMBERSHIP */
  121. # if !defined (IP_DEFAULT_MULTICAST_TTL)
  122. # define IP_DEFAULT_MULTICAST_TTL 0
  123. # endif /* IP_DEFAULT_MULTICAST_TTL */
  124. # if !defined (IP_DEFAULT_MULTICAST_LOOP)
  125. # define IP_DEFAULT_MULTICAST_LOOP 0
  126. # endif /* IP_DEFAULT_MULTICAST_LOOP */
  127. # if !defined (IP_MULTICAST_IF)
  128. # define IP_MULTICAST_IF 0
  129. # endif /* IP_MULTICAST_IF */
  130. # if !defined (IP_MULTICAST_TTL)
  131. # define IP_MULTICAST_TTL 1
  132. # endif /* IP_MULTICAST_TTL */
  133. # if !defined (IP_MULTICAST_LOOP)
  134. # define IP_MULTICAST_LOOP 2
  135. # endif /* IP_MULTICAST_LOOP */
  136. # if !defined (IP_MAX_MEMBERSHIPS)
  137. # define IP_MAX_MEMBERSHIPS 0
  138. # endif /* IP_MAX_MEMBERSHIP */
  139. # if !defined (IPPROTO_IP)
  140. # define IPPROTO_IP 0
  141. # endif /* IPPROTO_IP */
  142. # if !defined (IPPROTO_TCP)
  143. # define IPPROTO_TCP 6
  144. # endif /* IPPROTO_TCP */
  145. # if !defined (INADDR_ANY)
  146. # define INADDR_ANY (u_long)0x00000000
  147. # endif /* INADDR_ANY */
  148. #ifdef __cplusplus
  149. }
  150. #endif /* __cplusplus */
  151. #include /**/ "ace/post.h"
  152. #endif /* ACE_OS_INCLUDE_NETINET_OS_IN_H */