michael@0: /*- michael@0: * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. michael@0: * All rights reserved. michael@0: * michael@0: * Redistribution and use in source and binary forms, with or without michael@0: * modification, are permitted provided that the following conditions michael@0: * are met: michael@0: * 1. Redistributions of source code must retain the above copyright michael@0: * notice, this list of conditions and the following disclaimer. michael@0: * 2. Redistributions in binary form must reproduce the above copyright michael@0: * notice, this list of conditions and the following disclaimer in the michael@0: * documentation and/or other materials provided with the distribution. michael@0: * 3. Neither the name of the project nor the names of its contributors michael@0: * may be used to endorse or promote products derived from this software michael@0: * without specific prior written permission. michael@0: * michael@0: * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND michael@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE michael@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE michael@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE michael@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL michael@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS michael@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) michael@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT michael@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY michael@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@0: * SUCH DAMAGE. michael@0: * michael@0: */ michael@0: /*- michael@0: * Copyright (c) 1982, 1986, 1993 michael@0: * The Regents of the University of California. All rights reserved. michael@0: * michael@0: * Redistribution and use in source and binary forms, with or without michael@0: * modification, are permitted provided that the following conditions michael@0: * are met: michael@0: * 1. Redistributions of source code must retain the above copyright michael@0: * notice, this list of conditions and the following disclaimer. michael@0: * 2. Redistributions in binary form must reproduce the above copyright michael@0: * notice, this list of conditions and the following disclaimer in the michael@0: * documentation and/or other materials provided with the distribution. michael@0: * 4. Neither the name of the University nor the names of its contributors michael@0: * may be used to endorse or promote products derived from this software michael@0: * without specific prior written permission. michael@0: * michael@0: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND michael@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE michael@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE michael@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE michael@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL michael@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS michael@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) michael@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT michael@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY michael@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@0: * SUCH DAMAGE. michael@0: * michael@0: */ michael@0: michael@0: #ifndef _USER_IP6_VAR_H_ michael@0: #define _USER_IP6_VAR_H_ michael@0: michael@0: #if defined(__Userspace_os_Windows) michael@0: struct ip6_hdr { michael@0: union { michael@0: struct ip6_hdrctl { michael@0: u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */ michael@0: u_int16_t ip6_un1_plen; /* payload length */ michael@0: u_int8_t ip6_un1_nxt; /* next header */ michael@0: u_int8_t ip6_un1_hlim; /* hop limit */ michael@0: } ip6_un1; michael@0: u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */ michael@0: } ip6_ctlun; michael@0: struct in6_addr ip6_src; /* source address */ michael@0: struct in6_addr ip6_dst; /* destination address */ michael@0: }; michael@0: #define ip6_vfc ip6_ctlun.ip6_un2_vfc michael@0: #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow michael@0: #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen michael@0: #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt michael@0: #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim michael@0: #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim michael@0: michael@0: #define IPV6_VERSION 0x60 michael@0: #endif michael@0: michael@0: #if defined(__Userspace_os_Windows) michael@0: #define s6_addr16 u.Word michael@0: #endif michael@0: #if !defined(__Userspace_os_Windows) michael@0: #if !defined(__Userspace_os_Linux) michael@0: #define s6_addr8 __u6_addr.__u6_addr8 michael@0: #define s6_addr16 __u6_addr.__u6_addr16 michael@0: #define s6_addr32 __u6_addr.__u6_addr32 michael@0: #endif michael@0: #endif michael@0: michael@0: #if !defined(__Userspace_os_FreeBSD) && !defined(__Userspace_os_OpenBSD) && !defined(__Userspace_os_DragonFly) michael@0: struct route_in6 { michael@0: struct rtentry *ro_rt; michael@0: struct llentry *ro_lle; michael@0: struct in6_addr *ro_ia6; michael@0: int ro_flags; michael@0: struct sockaddr_in6 ro_dst; michael@0: }; michael@0: #endif michael@0: #define IP6_EXTHDR_GET(val, typ, m, off, len) \ michael@0: do { \ michael@0: struct mbuf *t; \ michael@0: int tmp; \ michael@0: if ((m)->m_len >= (off) + (len)) \ michael@0: (val) = (typ)(mtod((m), caddr_t) + (off)); \ michael@0: else { \ michael@0: t = m_pulldown((m), (off), (len), &tmp); \ michael@0: if (t) { \ michael@0: KASSERT(t->m_len >= tmp + (len), \ michael@0: ("m_pulldown malfunction")); \ michael@0: (val) = (typ)(mtod(t, caddr_t) + tmp); \ michael@0: } else { \ michael@0: (val) = (typ)NULL; \ michael@0: (m) = NULL; \ michael@0: } \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #endif /* !_USER_IP6_VAR_H_ */