Wed, 31 Dec 2014 06:55:46 +0100
Added tag TORBROWSER_REPLICA for changeset 6474c204b198
michael@0 | 1 | /*- |
michael@0 | 2 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
michael@0 | 3 | * All rights reserved. |
michael@0 | 4 | * |
michael@0 | 5 | * Redistribution and use in source and binary forms, with or without |
michael@0 | 6 | * modification, are permitted provided that the following conditions |
michael@0 | 7 | * are met: |
michael@0 | 8 | * 1. Redistributions of source code must retain the above copyright |
michael@0 | 9 | * notice, this list of conditions and the following disclaimer. |
michael@0 | 10 | * 2. Redistributions in binary form must reproduce the above copyright |
michael@0 | 11 | * notice, this list of conditions and the following disclaimer in the |
michael@0 | 12 | * documentation and/or other materials provided with the distribution. |
michael@0 | 13 | * 3. Neither the name of the project nor the names of its contributors |
michael@0 | 14 | * may be used to endorse or promote products derived from this software |
michael@0 | 15 | * without specific prior written permission. |
michael@0 | 16 | * |
michael@0 | 17 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND |
michael@0 | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
michael@0 | 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
michael@0 | 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE |
michael@0 | 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
michael@0 | 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
michael@0 | 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
michael@0 | 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
michael@0 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
michael@0 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@0 | 27 | * SUCH DAMAGE. |
michael@0 | 28 | * |
michael@0 | 29 | */ |
michael@0 | 30 | /*- |
michael@0 | 31 | * Copyright (c) 1982, 1986, 1993 |
michael@0 | 32 | * The Regents of the University of California. All rights reserved. |
michael@0 | 33 | * |
michael@0 | 34 | * Redistribution and use in source and binary forms, with or without |
michael@0 | 35 | * modification, are permitted provided that the following conditions |
michael@0 | 36 | * are met: |
michael@0 | 37 | * 1. Redistributions of source code must retain the above copyright |
michael@0 | 38 | * notice, this list of conditions and the following disclaimer. |
michael@0 | 39 | * 2. Redistributions in binary form must reproduce the above copyright |
michael@0 | 40 | * notice, this list of conditions and the following disclaimer in the |
michael@0 | 41 | * documentation and/or other materials provided with the distribution. |
michael@0 | 42 | * 4. Neither the name of the University nor the names of its contributors |
michael@0 | 43 | * may be used to endorse or promote products derived from this software |
michael@0 | 44 | * without specific prior written permission. |
michael@0 | 45 | * |
michael@0 | 46 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
michael@0 | 47 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
michael@0 | 48 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
michael@0 | 49 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
michael@0 | 50 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
michael@0 | 51 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
michael@0 | 52 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
michael@0 | 53 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
michael@0 | 54 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
michael@0 | 55 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@0 | 56 | * SUCH DAMAGE. |
michael@0 | 57 | * |
michael@0 | 58 | */ |
michael@0 | 59 | |
michael@0 | 60 | #ifndef _USER_IP6_VAR_H_ |
michael@0 | 61 | #define _USER_IP6_VAR_H_ |
michael@0 | 62 | |
michael@0 | 63 | #if defined(__Userspace_os_Windows) |
michael@0 | 64 | struct ip6_hdr { |
michael@0 | 65 | union { |
michael@0 | 66 | struct ip6_hdrctl { |
michael@0 | 67 | u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */ |
michael@0 | 68 | u_int16_t ip6_un1_plen; /* payload length */ |
michael@0 | 69 | u_int8_t ip6_un1_nxt; /* next header */ |
michael@0 | 70 | u_int8_t ip6_un1_hlim; /* hop limit */ |
michael@0 | 71 | } ip6_un1; |
michael@0 | 72 | u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */ |
michael@0 | 73 | } ip6_ctlun; |
michael@0 | 74 | struct in6_addr ip6_src; /* source address */ |
michael@0 | 75 | struct in6_addr ip6_dst; /* destination address */ |
michael@0 | 76 | }; |
michael@0 | 77 | #define ip6_vfc ip6_ctlun.ip6_un2_vfc |
michael@0 | 78 | #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow |
michael@0 | 79 | #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen |
michael@0 | 80 | #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt |
michael@0 | 81 | #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim |
michael@0 | 82 | #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim |
michael@0 | 83 | |
michael@0 | 84 | #define IPV6_VERSION 0x60 |
michael@0 | 85 | #endif |
michael@0 | 86 | |
michael@0 | 87 | #if defined(__Userspace_os_Windows) |
michael@0 | 88 | #define s6_addr16 u.Word |
michael@0 | 89 | #endif |
michael@0 | 90 | #if !defined(__Userspace_os_Windows) |
michael@0 | 91 | #if !defined(__Userspace_os_Linux) |
michael@0 | 92 | #define s6_addr8 __u6_addr.__u6_addr8 |
michael@0 | 93 | #define s6_addr16 __u6_addr.__u6_addr16 |
michael@0 | 94 | #define s6_addr32 __u6_addr.__u6_addr32 |
michael@0 | 95 | #endif |
michael@0 | 96 | #endif |
michael@0 | 97 | |
michael@0 | 98 | #if !defined(__Userspace_os_FreeBSD) && !defined(__Userspace_os_OpenBSD) && !defined(__Userspace_os_DragonFly) |
michael@0 | 99 | struct route_in6 { |
michael@0 | 100 | struct rtentry *ro_rt; |
michael@0 | 101 | struct llentry *ro_lle; |
michael@0 | 102 | struct in6_addr *ro_ia6; |
michael@0 | 103 | int ro_flags; |
michael@0 | 104 | struct sockaddr_in6 ro_dst; |
michael@0 | 105 | }; |
michael@0 | 106 | #endif |
michael@0 | 107 | #define IP6_EXTHDR_GET(val, typ, m, off, len) \ |
michael@0 | 108 | do { \ |
michael@0 | 109 | struct mbuf *t; \ |
michael@0 | 110 | int tmp; \ |
michael@0 | 111 | if ((m)->m_len >= (off) + (len)) \ |
michael@0 | 112 | (val) = (typ)(mtod((m), caddr_t) + (off)); \ |
michael@0 | 113 | else { \ |
michael@0 | 114 | t = m_pulldown((m), (off), (len), &tmp); \ |
michael@0 | 115 | if (t) { \ |
michael@0 | 116 | KASSERT(t->m_len >= tmp + (len), \ |
michael@0 | 117 | ("m_pulldown malfunction")); \ |
michael@0 | 118 | (val) = (typ)(mtod(t, caddr_t) + tmp); \ |
michael@0 | 119 | } else { \ |
michael@0 | 120 | (val) = (typ)NULL; \ |
michael@0 | 121 | (m) = NULL; \ |
michael@0 | 122 | } \ |
michael@0 | 123 | } \ |
michael@0 | 124 | } while (0) |
michael@0 | 125 | |
michael@0 | 126 | #endif /* !_USER_IP6_VAR_H_ */ |