os/boardsupport/emulator/emulatorbsp/wpdpack/include/ip6_misc.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/boardsupport/emulator/emulatorbsp/wpdpack/include/ip6_misc.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,165 @@
     1.4 +/*
     1.5 + * Copyright (c) 1993, 1994, 1997
     1.6 + *	The Regents of the University of California.  All rights reserved.
     1.7 + *
     1.8 + * Redistribution and use in source and binary forms, with or without
     1.9 + * modification, are permitted provided that: (1) source code distributions
    1.10 + * retain the above copyright notice and this paragraph in its entirety, (2)
    1.11 + * distributions including binary code include the above copyright notice and
    1.12 + * this paragraph in its entirety in the documentation or other materials
    1.13 + * provided with the distribution, and (3) all advertising materials mentioning
    1.14 + * features or use of this software display the following acknowledgement:
    1.15 + * ``This product includes software developed by the University of California,
    1.16 + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
    1.17 + * the University nor the names of its contributors may be used to endorse
    1.18 + * or promote products derived from this software without specific prior
    1.19 + * written permission.
    1.20 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
    1.21 + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
    1.22 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    1.23 + *
    1.24 + * @(#) $Header: /tcpdump/master/libpcap/Win32/Include/ip6_misc.h,v 1.4.2.1 2006/01/22 18:13:47 gianluca Exp $ (LBL)
    1.25 + */
    1.26 +
    1.27 +/*
    1.28 + * This file contains a collage of declarations for IPv6 from FreeBSD not present in Windows
    1.29 + */
    1.30 +
    1.31 +#include <winsock2.h>
    1.32 +
    1.33 +#ifndef __MINGW32__
    1.34 +#include <ws2tcpip.h>
    1.35 +#endif /* __MINGW32__ */
    1.36 +
    1.37 +#ifndef __MINGW32__
    1.38 +#define	IN_MULTICAST(a)		IN_CLASSD(a)
    1.39 +#endif
    1.40 +
    1.41 +#define	IN_EXPERIMENTAL(a)	((((u_int32_t) (a)) & 0xf0000000) == 0xf0000000)
    1.42 +
    1.43 +#define	IN_LOOPBACKNET		127
    1.44 +
    1.45 +#ifdef __MINGW32__
    1.46 +/* IPv6 address */
    1.47 +struct in6_addr
    1.48 +  {
    1.49 +    union
    1.50 +      {
    1.51 +	u_int8_t		u6_addr8[16];
    1.52 +	u_int16_t	u6_addr16[8];
    1.53 +	u_int32_t	u6_addr32[4];
    1.54 +      } in6_u;
    1.55 +#define s6_addr			in6_u.u6_addr8
    1.56 +#define s6_addr16		in6_u.u6_addr16
    1.57 +#define s6_addr32		in6_u.u6_addr32
    1.58 +#define s6_addr64		in6_u.u6_addr64
    1.59 +  };
    1.60 +
    1.61 +#define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
    1.62 +#define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }
    1.63 +#endif /* __MINGW32__ */
    1.64 +
    1.65 +
    1.66 +#if (defined WIN32) || (defined __MINGW32__)
    1.67 +typedef unsigned short	sa_family_t;
    1.68 +#endif
    1.69 +
    1.70 +
    1.71 +#ifdef __MINGW32__
    1.72 +
    1.73 +#define	__SOCKADDR_COMMON(sa_prefix) \
    1.74 +  sa_family_t sa_prefix##family
    1.75 +
    1.76 +/* Ditto, for IPv6.  */
    1.77 +struct sockaddr_in6
    1.78 +  {
    1.79 +    __SOCKADDR_COMMON (sin6_);
    1.80 +    u_int16_t sin6_port;		/* Transport layer port # */
    1.81 +    u_int32_t sin6_flowinfo;	/* IPv6 flow information */
    1.82 +    struct in6_addr sin6_addr;	/* IPv6 address */
    1.83 +  };
    1.84 +
    1.85 +#define IN6_IS_ADDR_V4MAPPED(a) \
    1.86 +	((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \
    1.87 +	 (((u_int32_t *) (a))[2] == htonl (0xffff)))
    1.88 +
    1.89 +#define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff)
    1.90 +
    1.91 +#define IN6_IS_ADDR_LINKLOCAL(a) \
    1.92 +	((((u_int32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000))
    1.93 +
    1.94 +#define IN6_IS_ADDR_LOOPBACK(a) \
    1.95 +	(((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \
    1.96 +	 ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1))
    1.97 +#endif /* __MINGW32__ */
    1.98 +
    1.99 +#define ip6_vfc   ip6_ctlun.ip6_un2_vfc
   1.100 +#define ip6_flow  ip6_ctlun.ip6_un1.ip6_un1_flow
   1.101 +#define ip6_plen  ip6_ctlun.ip6_un1.ip6_un1_plen
   1.102 +#define ip6_nxt   ip6_ctlun.ip6_un1.ip6_un1_nxt
   1.103 +#define ip6_hlim  ip6_ctlun.ip6_un1.ip6_un1_hlim
   1.104 +#define ip6_hops  ip6_ctlun.ip6_un1.ip6_un1_hlim
   1.105 +
   1.106 +#define nd_rd_type               nd_rd_hdr.icmp6_type
   1.107 +#define nd_rd_code               nd_rd_hdr.icmp6_code
   1.108 +#define nd_rd_cksum              nd_rd_hdr.icmp6_cksum
   1.109 +#define nd_rd_reserved           nd_rd_hdr.icmp6_data32[0]
   1.110 +
   1.111 +/*
   1.112 + *	IPV6 extension headers
   1.113 + */
   1.114 +#define IPPROTO_HOPOPTS		0	/* IPv6 hop-by-hop options	*/
   1.115 +#define IPPROTO_IPV6		41  /* IPv6 header.  */
   1.116 +#define IPPROTO_ROUTING		43	/* IPv6 routing header		*/
   1.117 +#define IPPROTO_FRAGMENT	44	/* IPv6 fragmentation header	*/
   1.118 +#define IPPROTO_ESP		50	/* encapsulating security payload */
   1.119 +#define IPPROTO_AH		51	/* authentication header	*/
   1.120 +#define IPPROTO_ICMPV6		58	/* ICMPv6			*/
   1.121 +#define IPPROTO_NONE		59	/* IPv6 no next header		*/
   1.122 +#define IPPROTO_DSTOPTS		60	/* IPv6 destination options	*/
   1.123 +#define IPPROTO_PIM			103 /* Protocol Independent Multicast.  */
   1.124 +
   1.125 +#define	 IPV6_RTHDR_TYPE_0 0
   1.126 +
   1.127 +/* Option types and related macros */
   1.128 +#define IP6OPT_PAD1		0x00	/* 00 0 00000 */
   1.129 +#define IP6OPT_PADN		0x01	/* 00 0 00001 */
   1.130 +#define IP6OPT_JUMBO		0xC2	/* 11 0 00010 = 194 */
   1.131 +#define IP6OPT_JUMBO_LEN	6
   1.132 +#define IP6OPT_ROUTER_ALERT	0x05	/* 00 0 00101 */
   1.133 +
   1.134 +#define IP6OPT_RTALERT_LEN	4
   1.135 +#define IP6OPT_RTALERT_MLD	0	/* Datagram contains an MLD message */
   1.136 +#define IP6OPT_RTALERT_RSVP	1	/* Datagram contains an RSVP message */
   1.137 +#define IP6OPT_RTALERT_ACTNET	2 	/* contains an Active Networks msg */
   1.138 +#define IP6OPT_MINLEN		2
   1.139 +
   1.140 +#define IP6OPT_BINDING_UPDATE	0xc6	/* 11 0 00110 */
   1.141 +#define IP6OPT_BINDING_ACK	0x07	/* 00 0 00111 */
   1.142 +#define IP6OPT_BINDING_REQ	0x08	/* 00 0 01000 */
   1.143 +#define IP6OPT_HOME_ADDRESS	0xc9	/* 11 0 01001 */
   1.144 +#define IP6OPT_EID		0x8a	/* 10 0 01010 */
   1.145 +
   1.146 +#define IP6OPT_TYPE(o)		((o) & 0xC0)
   1.147 +#define IP6OPT_TYPE_SKIP	0x00
   1.148 +#define IP6OPT_TYPE_DISCARD	0x40
   1.149 +#define IP6OPT_TYPE_FORCEICMP	0x80
   1.150 +#define IP6OPT_TYPE_ICMP	0xC0
   1.151 +
   1.152 +#define IP6OPT_MUTABLE		0x20
   1.153 +
   1.154 +
   1.155 +#ifdef __MINGW32__
   1.156 +#ifndef EAI_ADDRFAMILY
   1.157 +struct addrinfo {
   1.158 +	int	ai_flags;	/* AI_PASSIVE, AI_CANONNAME */
   1.159 +	int	ai_family;	/* PF_xxx */
   1.160 +	int	ai_socktype;	/* SOCK_xxx */
   1.161 +	int	ai_protocol;	/* 0 or IPPROTO_xxx for IPv4 and IPv6 */
   1.162 +	size_t	ai_addrlen;	/* length of ai_addr */
   1.163 +	char	*ai_canonname;	/* canonical name for hostname */
   1.164 +	struct sockaddr *ai_addr;	/* binary address */
   1.165 +	struct addrinfo *ai_next;	/* next structure in linked list */
   1.166 +};
   1.167 +#endif
   1.168 +#endif /* __MINGW32__ */