ip6.h (63024) | ip6.h (78064) |
---|---|
1/* $FreeBSD: head/sys/netinet/ip6.h 63024 2000-07-12 16:39:13Z itojun $ */ 2/* $KAME: ip6.h,v 1.9 2000/07/02 21:01:32 itojun Exp $ */ | 1/* $FreeBSD: head/sys/netinet/ip6.h 78064 2001-06-11 12:39:29Z ume $ */ 2/* $KAME: ip6.h,v 1.18 2001/03/29 05:34:30 itojun Exp $ */ |
3 4/* 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: --- 69 unchanged lines hidden (view full) --- 80 u_int16_t ip6_un1_plen; /* payload length */ 81 u_int8_t ip6_un1_nxt; /* next header */ 82 u_int8_t ip6_un1_hlim; /* hop limit */ 83 } ip6_un1; 84 u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */ 85 } ip6_ctlun; 86 struct in6_addr ip6_src; /* source address */ 87 struct in6_addr ip6_dst; /* destination address */ | 3 4/* 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: --- 69 unchanged lines hidden (view full) --- 80 u_int16_t ip6_un1_plen; /* payload length */ 81 u_int8_t ip6_un1_nxt; /* next header */ 82 u_int8_t ip6_un1_hlim; /* hop limit */ 83 } ip6_un1; 84 u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */ 85 } ip6_ctlun; 86 struct in6_addr ip6_src; /* source address */ 87 struct in6_addr ip6_dst; /* destination address */ |
88}; | 88} __attribute__((__packed__)); |
89 90#define ip6_vfc ip6_ctlun.ip6_un2_vfc 91#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow 92#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen 93#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt 94#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim 95#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim 96 --- 4 unchanged lines hidden (view full) --- 101#define IPV6_FLOWINFO_MASK 0x0fffffff /* flow info (28 bits) */ 102#define IPV6_FLOWLABEL_MASK 0x000fffff /* flow label (20 bits) */ 103#else 104#if BYTE_ORDER == LITTLE_ENDIAN 105#define IPV6_FLOWINFO_MASK 0xffffff0f /* flow info (28 bits) */ 106#define IPV6_FLOWLABEL_MASK 0xffff0f00 /* flow label (20 bits) */ 107#endif /* LITTLE_ENDIAN */ 108#endif | 89 90#define ip6_vfc ip6_ctlun.ip6_un2_vfc 91#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow 92#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen 93#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt 94#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim 95#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim 96 --- 4 unchanged lines hidden (view full) --- 101#define IPV6_FLOWINFO_MASK 0x0fffffff /* flow info (28 bits) */ 102#define IPV6_FLOWLABEL_MASK 0x000fffff /* flow label (20 bits) */ 103#else 104#if BYTE_ORDER == LITTLE_ENDIAN 105#define IPV6_FLOWINFO_MASK 0xffffff0f /* flow info (28 bits) */ 106#define IPV6_FLOWLABEL_MASK 0xffff0f00 /* flow label (20 bits) */ 107#endif /* LITTLE_ENDIAN */ 108#endif |
109#if 1 |
|
109/* ECN bits proposed by Sally Floyd */ 110#define IP6TOS_CE 0x01 /* congestion experienced */ 111#define IP6TOS_ECT 0x02 /* ECN-capable transport */ | 110/* ECN bits proposed by Sally Floyd */ 111#define IP6TOS_CE 0x01 /* congestion experienced */ 112#define IP6TOS_ECT 0x02 /* ECN-capable transport */ |
113#endif |
|
112 113/* 114 * Extension Headers 115 */ 116 117struct ip6_ext { | 114 115/* 116 * Extension Headers 117 */ 118 119struct ip6_ext { |
118 u_char ip6e_nxt; 119 u_char ip6e_len; 120}; | 120 u_int8_t ip6e_nxt; 121 u_int8_t ip6e_len; 122} __attribute__((__packed__)); |
121 122/* Hop-by-Hop options header */ 123/* XXX should we pad it to force alignment on an 8-byte boundary? */ 124struct ip6_hbh { 125 u_int8_t ip6h_nxt; /* next header */ 126 u_int8_t ip6h_len; /* length in units of 8 octets */ 127 /* followed by options */ | 123 124/* Hop-by-Hop options header */ 125/* XXX should we pad it to force alignment on an 8-byte boundary? */ 126struct ip6_hbh { 127 u_int8_t ip6h_nxt; /* next header */ 128 u_int8_t ip6h_len; /* length in units of 8 octets */ 129 /* followed by options */ |
128}; | 130} __attribute__((__packed__)); |
129 130/* Destination options header */ 131/* XXX should we pad it to force alignment on an 8-byte boundary? */ 132struct ip6_dest { 133 u_int8_t ip6d_nxt; /* next header */ 134 u_int8_t ip6d_len; /* length in units of 8 octets */ 135 /* followed by options */ | 131 132/* Destination options header */ 133/* XXX should we pad it to force alignment on an 8-byte boundary? */ 134struct ip6_dest { 135 u_int8_t ip6d_nxt; /* next header */ 136 u_int8_t ip6d_len; /* length in units of 8 octets */ 137 /* followed by options */ |
136}; | 138} __attribute__((__packed__)); |
137 138/* Option types and related macros */ 139#define IP6OPT_PAD1 0x00 /* 00 0 00000 */ 140#define IP6OPT_PADN 0x01 /* 00 0 00001 */ 141#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ | 139 140/* Option types and related macros */ 141#define IP6OPT_PAD1 0x00 /* 00 0 00000 */ 142#define IP6OPT_PADN 0x01 /* 00 0 00001 */ 143#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ |
142#define IP6OPT_JUMBO_LEN 6 143#define IP6OPT_RTALERT 0x05 /* 00 0 00101 */ | 144#define IP6OPT_NSAP_ADDR 0xC3 /* 11 0 00011 */ 145#define IP6OPT_TUNNEL_LIMIT 0x04 /* 00 0 00100 */ 146#define IP6OPT_RTALERT 0x05 /* 00 0 00101 (KAME definition) */ 147 |
144#define IP6OPT_RTALERT_LEN 4 145#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ 146#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ 147#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ 148#define IP6OPT_MINLEN 2 149 | 148#define IP6OPT_RTALERT_LEN 4 149#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ 150#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ 151#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ 152#define IP6OPT_MINLEN 2 153 |
154#define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */ 155#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */ 156#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */ 157#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */ 158#define IP6OPT_EID 0x8a /* 10 0 01010 */ 159 |
|
150#define IP6OPT_TYPE(o) ((o) & 0xC0) 151#define IP6OPT_TYPE_SKIP 0x00 152#define IP6OPT_TYPE_DISCARD 0x40 153#define IP6OPT_TYPE_FORCEICMP 0x80 154#define IP6OPT_TYPE_ICMP 0xC0 155 156#define IP6OPT_MUTABLE 0x20 157 | 160#define IP6OPT_TYPE(o) ((o) & 0xC0) 161#define IP6OPT_TYPE_SKIP 0x00 162#define IP6OPT_TYPE_DISCARD 0x40 163#define IP6OPT_TYPE_FORCEICMP 0x80 164#define IP6OPT_TYPE_ICMP 0xC0 165 166#define IP6OPT_MUTABLE 0x20 167 |
168#define IP6OPT_JUMBO_LEN 6 169 |
|
158/* Routing header */ 159struct ip6_rthdr { 160 u_int8_t ip6r_nxt; /* next header */ 161 u_int8_t ip6r_len; /* length in units of 8 octets */ 162 u_int8_t ip6r_type; /* routing type */ 163 u_int8_t ip6r_segleft; /* segments left */ 164 /* followed by routing type specific data */ | 170/* Routing header */ 171struct ip6_rthdr { 172 u_int8_t ip6r_nxt; /* next header */ 173 u_int8_t ip6r_len; /* length in units of 8 octets */ 174 u_int8_t ip6r_type; /* routing type */ 175 u_int8_t ip6r_segleft; /* segments left */ 176 /* followed by routing type specific data */ |
165}; | 177} __attribute__((__packed__)); |
166 167/* Type 0 Routing header */ 168struct ip6_rthdr0 { 169 u_int8_t ip6r0_nxt; /* next header */ 170 u_int8_t ip6r0_len; /* length in units of 8 octets */ 171 u_int8_t ip6r0_type; /* always zero */ 172 u_int8_t ip6r0_segleft; /* segments left */ 173 u_int8_t ip6r0_reserved; /* reserved field */ 174 u_int8_t ip6r0_slmap[3]; /* strict/loose bit map */ 175 struct in6_addr ip6r0_addr[1]; /* up to 23 addresses */ | 178 179/* Type 0 Routing header */ 180struct ip6_rthdr0 { 181 u_int8_t ip6r0_nxt; /* next header */ 182 u_int8_t ip6r0_len; /* length in units of 8 octets */ 183 u_int8_t ip6r0_type; /* always zero */ 184 u_int8_t ip6r0_segleft; /* segments left */ 185 u_int8_t ip6r0_reserved; /* reserved field */ 186 u_int8_t ip6r0_slmap[3]; /* strict/loose bit map */ 187 struct in6_addr ip6r0_addr[1]; /* up to 23 addresses */ |
176}; | 188} __attribute__((__packed__)); |
177 178/* Fragment header */ 179struct ip6_frag { 180 u_int8_t ip6f_nxt; /* next header */ 181 u_int8_t ip6f_reserved; /* reserved field */ 182 u_int16_t ip6f_offlg; /* offset, reserved, and flag */ 183 u_int32_t ip6f_ident; /* identification */ | 189 190/* Fragment header */ 191struct ip6_frag { 192 u_int8_t ip6f_nxt; /* next header */ 193 u_int8_t ip6f_reserved; /* reserved field */ 194 u_int16_t ip6f_offlg; /* offset, reserved, and flag */ 195 u_int32_t ip6f_ident; /* identification */ |
184}; | 196} __attribute__((__packed__)); |
185 186#if BYTE_ORDER == BIG_ENDIAN 187#define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */ 188#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */ 189#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */ 190#else /* BYTE_ORDER == LITTLE_ENDIAN */ 191#define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */ 192#define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */ --- 104 unchanged lines hidden --- | 197 198#if BYTE_ORDER == BIG_ENDIAN 199#define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */ 200#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */ 201#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */ 202#else /* BYTE_ORDER == LITTLE_ENDIAN */ 203#define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */ 204#define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */ --- 104 unchanged lines hidden --- |