ip6_misc.h.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?xml version='1.0' encoding='iso-8859-1'?>
  2. <!doctype html public '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  3. <html xmlns='http://www.w3c.org/1999/xhtml' lang='en-us'>
  4. <head>
  5. <title>
  6. ip6_misc.h
  7. </title>
  8. <meta http-equiv='content-type' content='text/html;iso-8859-1'/>
  9. <meta name='generator' content='motley-tools 1.9.4 13:40:33 Feb 18 2015'/>
  10. <meta name='author' content='cmaier@cmassoc.net'/>
  11. <meta name='robots' content='noindex,nofollow'/>
  12. <link href='toolkit.css' rel='stylesheet' type='text/css'/>
  13. </head>
  14. <body>
  15. <div class='headerlink'>
  16. [<a href='inttypes.h.html' title=' inttypes.h '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='keys.h.html' title=' keys.h '>NEXT</a>]
  19. </div>
  20. <pre>
  21. /*
  22. * Copyright (c) 1993, 1994, 1997
  23. * The Regents of the University of California. All rights reserved.
  24. *
  25. * Redistribution and use in source and binary forms, with or without
  26. * modification, are permitted provided that: (1) source code distributions
  27. * retain the above copyright notice and this paragraph in its entirety, (2)
  28. * distributions including binary code include the above copyright notice and
  29. * this paragraph in its entirety in the documentation or other materials
  30. * provided with the distribution, and (3) all advertising materials mentioning
  31. * features or use of this software display the following acknowledgement:
  32. * ``This product includes software developed by the University of California,
  33. * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
  34. * the University nor the names of its contributors may be used to endorse
  35. * or promote products derived from this software without specific prior
  36. * written permission.
  37. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  38. * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  39. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  40. *
  41. * @(#) $Header: /tcpdump/master/libpcap/Win32/Include/ip6_misc.h,v 1.5 2006-01-22 18:02:18 gianluca Exp $ (LBL)
  42. */
  43. /*
  44. * This file contains a collage of declarations for IPv6 from FreeBSD not present in Windows
  45. */
  46. #include &lt;winsock2.h&gt;
  47. #include &lt;ws2tcpip.h&gt;
  48. #ifndef __MINGW32__
  49. #define IN_MULTICAST(a) IN_CLASSD(a)
  50. #endif
  51. #define IN_EXPERIMENTAL(a) ((((u_int32_t) (a)) &amp; 0xf0000000) == 0xf0000000)
  52. #define IN_LOOPBACKNET 127
  53. #if defined(__MINGW32__) &amp;&amp; defined(DEFINE_ADDITIONAL_IPV6_STUFF)
  54. /* IPv6 address */
  55. struct in6_addr
  56. {
  57. union
  58. {
  59. u_int8_t u6_addr8[16];
  60. u_int16_t u6_addr16[8];
  61. u_int32_t u6_addr32[4];
  62. } in6_u;
  63. #define s6_addr in6_u.u6_addr8
  64. #define s6_addr16 in6_u.u6_addr16
  65. #define s6_addr32 in6_u.u6_addr32
  66. #define s6_addr64 in6_u.u6_addr64
  67. };
  68. #define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
  69. #define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }
  70. #endif /* __MINGW32__ */
  71. #if (defined _MSC_VER) || (defined(__MINGW32__) &amp;&amp; defined(DEFINE_ADDITIONAL_IPV6_STUFF))
  72. typedef unsigned short sa_family_t;
  73. #endif
  74. #if defined(__MINGW32__) &amp;&amp; defined(DEFINE_ADDITIONAL_IPV6_STUFF)
  75. #define __SOCKADDR_COMMON(sa_prefix) \
  76. sa_family_t sa_prefix##family
  77. /* Ditto, for IPv6. */
  78. struct sockaddr_in6
  79. {
  80. __SOCKADDR_COMMON (sin6_);
  81. u_int16_t sin6_port; /* Transport layer port # */
  82. u_int32_t sin6_flowinfo; /* IPv6 flow information */
  83. struct in6_addr sin6_addr; /* IPv6 address */
  84. };
  85. #define IN6_IS_ADDR_V4MAPPED(a) \
  86. ((((u_int32_t *) (a))[0] == 0) &amp;&amp; (((u_int32_t *) (a))[1] == 0) &amp;&amp; \
  87. (((u_int32_t *) (a))[2] == htonl (0xffff)))
  88. #define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff)
  89. #define IN6_IS_ADDR_LINKLOCAL(a) \
  90. ((((u_int32_t *) (a))[0] &amp; htonl (0xffc00000)) == htonl (0xfe800000))
  91. #define IN6_IS_ADDR_LOOPBACK(a) \
  92. (((u_int32_t *) (a))[0] == 0 &amp;&amp; ((u_int32_t *) (a))[1] == 0 &amp;&amp; \
  93. ((u_int32_t *) (a))[2] == 0 &amp;&amp; ((u_int32_t *) (a))[3] == htonl (1))
  94. #endif /* __MINGW32__ */
  95. #define ip6_vfc ip6_ctlun.ip6_un2_vfc
  96. #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
  97. #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
  98. #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
  99. #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
  100. #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
  101. #define nd_rd_type nd_rd_hdr.icmp6_type
  102. #define nd_rd_code nd_rd_hdr.icmp6_code
  103. #define nd_rd_cksum nd_rd_hdr.icmp6_cksum
  104. #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
  105. /*
  106. * IPV6 extension headers
  107. */
  108. #define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */
  109. #define IPPROTO_IPV6 41 /* IPv6 header. */
  110. #define IPPROTO_ROUTING 43 /* IPv6 routing header */
  111. #define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
  112. #define IPPROTO_ESP 50 /* encapsulating security payload */
  113. #define IPPROTO_AH 51 /* authentication header */
  114. #define IPPROTO_ICMPV6 58 /* ICMPv6 */
  115. #define IPPROTO_NONE 59 /* IPv6 no next header */
  116. #define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
  117. #define IPPROTO_PIM 103 /* Protocol Independent Multicast. */
  118. #define IPV6_RTHDR_TYPE_0 0
  119. /* Option types and related macros */
  120. #define IP6OPT_PAD1 0x00 /* 00 0 00000 */
  121. #define IP6OPT_PADN 0x01 /* 00 0 00001 */
  122. #define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */
  123. #define IP6OPT_JUMBO_LEN 6
  124. #define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */
  125. #define IP6OPT_RTALERT_LEN 4
  126. #define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */
  127. #define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */
  128. #define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */
  129. #define IP6OPT_MINLEN 2
  130. #define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */
  131. #define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */
  132. #define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */
  133. #define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */
  134. #define IP6OPT_EID 0x8a /* 10 0 01010 */
  135. #define IP6OPT_TYPE(o) ((o) &amp; 0xC0)
  136. #define IP6OPT_TYPE_SKIP 0x00
  137. #define IP6OPT_TYPE_DISCARD 0x40
  138. #define IP6OPT_TYPE_FORCEICMP 0x80
  139. #define IP6OPT_TYPE_ICMP 0xC0
  140. #define IP6OPT_MUTABLE 0x20
  141. #if defined(__MINGW32__) &amp;&amp; defined(DEFINE_ADDITIONAL_IPV6_STUFF)
  142. #ifndef EAI_ADDRFAMILY
  143. struct addrinfo {
  144. int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
  145. int ai_family; /* PF_xxx */
  146. int ai_socktype; /* SOCK_xxx */
  147. int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
  148. size_t ai_addrlen; /* length of ai_addr */
  149. char *ai_canonname; /* canonical name for hostname */
  150. struct sockaddr *ai_addr; /* binary address */
  151. struct addrinfo *ai_next; /* next structure in linked list */
  152. };
  153. #endif
  154. #endif /* __MINGW32__ */
  155. </pre>
  156. <div class='footerlink'>
  157. [<a href='inttypes.h.html' title=' inttypes.h '>PREV</a>]
  158. [<a href='toolkit.html' title=' Index '>HOME</a>]
  159. [<a href='keys.h.html' title=' keys.h '>NEXT</a>]
  160. </div>
  161. </body>
  162. </html>