1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/sctp/src/user_ip6_var.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,126 @@ 1.4 +/*- 1.5 + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 1.6 + * 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 the following conditions 1.10 + * are met: 1.11 + * 1. Redistributions of source code must retain the above copyright 1.12 + * notice, this list of conditions and the following disclaimer. 1.13 + * 2. Redistributions in binary form must reproduce the above copyright 1.14 + * notice, this list of conditions and the following disclaimer in the 1.15 + * documentation and/or other materials provided with the distribution. 1.16 + * 3. Neither the name of the project nor the names of its contributors 1.17 + * may be used to endorse or promote products derived from this software 1.18 + * without specific prior written permission. 1.19 + * 1.20 + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 1.21 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1.23 + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 1.24 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1.25 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1.26 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1.27 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1.28 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1.29 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.30 + * SUCH DAMAGE. 1.31 + * 1.32 + */ 1.33 +/*- 1.34 + * Copyright (c) 1982, 1986, 1993 1.35 + * The Regents of the University of California. All rights reserved. 1.36 + * 1.37 + * Redistribution and use in source and binary forms, with or without 1.38 + * modification, are permitted provided that the following conditions 1.39 + * are met: 1.40 + * 1. Redistributions of source code must retain the above copyright 1.41 + * notice, this list of conditions and the following disclaimer. 1.42 + * 2. Redistributions in binary form must reproduce the above copyright 1.43 + * notice, this list of conditions and the following disclaimer in the 1.44 + * documentation and/or other materials provided with the distribution. 1.45 + * 4. Neither the name of the University nor the names of its contributors 1.46 + * may be used to endorse or promote products derived from this software 1.47 + * without specific prior written permission. 1.48 + * 1.49 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1.50 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1.51 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1.52 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 1.53 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1.54 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1.55 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1.56 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1.57 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1.58 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.59 + * SUCH DAMAGE. 1.60 + * 1.61 + */ 1.62 + 1.63 +#ifndef _USER_IP6_VAR_H_ 1.64 +#define _USER_IP6_VAR_H_ 1.65 + 1.66 +#if defined(__Userspace_os_Windows) 1.67 +struct ip6_hdr { 1.68 + union { 1.69 + struct ip6_hdrctl { 1.70 + u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */ 1.71 + u_int16_t ip6_un1_plen; /* payload length */ 1.72 + u_int8_t ip6_un1_nxt; /* next header */ 1.73 + u_int8_t ip6_un1_hlim; /* hop limit */ 1.74 + } ip6_un1; 1.75 + u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */ 1.76 + } ip6_ctlun; 1.77 + struct in6_addr ip6_src; /* source address */ 1.78 + struct in6_addr ip6_dst; /* destination address */ 1.79 +}; 1.80 +#define ip6_vfc ip6_ctlun.ip6_un2_vfc 1.81 +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow 1.82 +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen 1.83 +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt 1.84 +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim 1.85 +#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim 1.86 + 1.87 +#define IPV6_VERSION 0x60 1.88 +#endif 1.89 + 1.90 +#if defined(__Userspace_os_Windows) 1.91 +#define s6_addr16 u.Word 1.92 +#endif 1.93 +#if !defined(__Userspace_os_Windows) 1.94 +#if !defined(__Userspace_os_Linux) 1.95 +#define s6_addr8 __u6_addr.__u6_addr8 1.96 +#define s6_addr16 __u6_addr.__u6_addr16 1.97 +#define s6_addr32 __u6_addr.__u6_addr32 1.98 +#endif 1.99 +#endif 1.100 + 1.101 +#if !defined(__Userspace_os_FreeBSD) && !defined(__Userspace_os_OpenBSD) && !defined(__Userspace_os_DragonFly) 1.102 +struct route_in6 { 1.103 + struct rtentry *ro_rt; 1.104 + struct llentry *ro_lle; 1.105 + struct in6_addr *ro_ia6; 1.106 + int ro_flags; 1.107 + struct sockaddr_in6 ro_dst; 1.108 +}; 1.109 +#endif 1.110 +#define IP6_EXTHDR_GET(val, typ, m, off, len) \ 1.111 +do { \ 1.112 + struct mbuf *t; \ 1.113 + int tmp; \ 1.114 + if ((m)->m_len >= (off) + (len)) \ 1.115 + (val) = (typ)(mtod((m), caddr_t) + (off)); \ 1.116 + else { \ 1.117 + t = m_pulldown((m), (off), (len), &tmp); \ 1.118 + if (t) { \ 1.119 + KASSERT(t->m_len >= tmp + (len), \ 1.120 + ("m_pulldown malfunction")); \ 1.121 + (val) = (typ)(mtod(t, caddr_t) + tmp); \ 1.122 + } else { \ 1.123 + (val) = (typ)NULL; \ 1.124 + (m) = NULL; \ 1.125 + } \ 1.126 + } \ 1.127 +} while (0) 1.128 + 1.129 +#endif /* !_USER_IP6_VAR_H_ */