Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
cipv6.h
00001 /* 00002 * Copyright (c) 2013-2017, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 #ifndef _CIPV6_H 00018 #define _CIPV6_H 00019 00020 /* MTU defined in RFC 4944 */ 00021 #ifndef LOWPAN_MTU 00022 #define LOWPAN_MTU 1280 00023 #endif 00024 00025 /* The max MTU we'll obey from a Router Advertisement */ 00026 #ifndef LOWPAN_MAX_MTU 00027 #define LOWPAN_MAX_MTU LOWPAN_HARD_MTU_LIMIT 00028 #endif 00029 00030 /* The "physical" limit - due to the datagram_size field in the FRAG headers */ 00031 #ifndef LOWPAN_HARD_MTU_LIMIT 00032 #define LOWPAN_HARD_MTU_LIMIT 2047 00033 #endif 00034 00035 buffer_t *lowpan_up(buffer_t *buf); 00036 buffer_t *lowpan_down(buffer_t *buf); 00037 00038 /* Bits in IPHC header, first byte (RFC 6282) 00039 * 0 1 00040 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 00041 * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 00042 * | 0 | 1 | 1 | TF |NH | HLIM |CID|SAC| SAM | M |DAC| DAM | 00043 * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 00044 * 00045 */ 00046 #define HC_LOWPAN_DISPATCH LOWPAN_DISPATCH_IPHC /* 0x60 */ 00047 00048 #define HC_TF_MASK 0x18 00049 #define HC_TF_ECN_DSCP_FLOW_LABEL 0x00 00050 #define HC_TF_ECN_FLOW_LABEL 0x08 00051 #define HC_TF_ECN_DSCP 0x10 00052 #define HC_TF_ELIDED 0x18 00053 00054 #define HC_NEXT_HEADER_MASK 0x04 00055 00056 #define HC_HOP_LIMIT_MASK 0x03 00057 #define HC_HOP_LIMIT_CARRIED_IN_LINE 0x00 00058 #define HC_HOP_LIMIT_1 0x01 00059 #define HC_HOP_LIMIT_64 0x02 00060 #define HC_HOP_LIMIT_255 0x03 00061 00062 /* Bits in IPHC Dispatch header, second byte */ 00063 #define HC_CIDE_COMP 0x80 00064 #define HC_SRCADR_COMP 0x40 00065 #define HC_SRC_ADR_MODE_MASK 0x30 00066 #define HC_SRC_ADR_128_BIT 0x00 00067 #define HC_SRC_ADR_64_BIT 0x10 00068 #define HC_SRC_ADR_16_BIT 0x20 00069 #define HC_SRC_ADR_FROM_MAC 0x30 00070 00071 #define HC_MULTICAST_COMP 0x08 00072 #define HC_DSTADR_COMP 0x04 00073 #define HC_DST_ADR_MODE_MASK 0x03 00074 #define HC_DST_ADR_128_BIT 0x00 00075 #define HC_DST_ADR_64_BIT 0x01 00076 #define HC_DST_ADR_16_BIT 0x02 00077 #define HC_DST_ADR_FROM_MAC 0x03 00078 00079 #define HC_128BIT_MULTICAST 0x00 00080 #define HC_48BIT_MULTICAST 0x01 //FFxx::xx:xxxx:xxxx 00081 #define HC_32BIT_MULTICAST 0x02 //FFxx::xx:xxxx 00082 #define HC_8BIT_MULTICAST 0x03 //FF02::xx 00083 #define HC_48BIT_CONTEXT_MULTICAST 0x04 //FFxx:xxLL:PPPP:PPPP:PPPP:PPPP:xxxx:xxxx 00084 00085 00086 /* 6LoWPAN Types 00087 * 00088 * Pattern Header Type 00089 * +------------+-----------------------------------------------+ 00090 * | 00 xxxxxx | NALP - Not a LoWPAN frame | 00091 * | 01 000000 | ESC - Additional Dispatch byte follows | 00092 * | 01 000001 | IPv6 - Uncompressed IPv6 Addresses | 00093 * | 01 000010 | LOWPAN_HC1 - LOWPAN_HC1 compressed IPv6 | 00094 * | 01 000011 | LOWPAN_DFF - Depth-First Forwarding (RFC6971) | 00095 * | 01 000100 | reserved - Reserved for future use | 00096 * | ... | reserved - Reserved for future use | 00097 * | 01 001111 | reserved - Reserved for future use | 00098 * | 01 010000 | LOWPAN_BC0 - LOWPAN_BC0 broadcast | 00099 * | 01 010001 | reserved - Reserved for future use | 00100 * | ... | reserved - Reserved for future use | 00101 * | 01 011111 | reserved - Reserved for future use | 00102 * | 01 1xxxxx | LOWPAN_IPHC- RFC 6282 IPv6 Header Compression | 00103 * | 10 xxxxxx | MESH - Mesh Header | 00104 * | 11 000xxx | FRAG1 - Fragmentation Header (first) | 00105 * | 11 001000 | reserved - Reserved for future use | 00106 * | ... | reserved - Reserved for future use | 00107 * | 11 011111 | reserved - Reserved for future use | 00108 * | 11 100xxx | FRAGN - Fragmentation Header (subsequent)| 00109 * | 11 101000 | reserved - Reserved for future use | 00110 * | ... | reserved - Reserved for future use | 00111 * | 11 111111 | reserved - Reserved for future use | 00112 * +------------+-----------------------------------------------+ 00113 * 00114 */ 00115 #define LOWPAN_NALP 0x00 /* 00 xxxxxx Not LoWPAN */ 00116 #define LOWPAN_NALP_MASK 0xC0 00117 #define LOWPAN_DISPATCH_ESC 0x40 /* RFC 6282 supercedes RFC 4944 */ 00118 #define LOWPAN_DISPATCH_IPV6 0x41 00119 #define LOWPAN_DISPATCH_HC1 0x42 00120 #define LOWPAN_DISPATCH_DFF 0x43 /* RFC 6971 */ 00121 #define LOWPAN_DISPATCH_BC0 0x50 00122 #define LOWPAN_DISPATCH_IPHC 0x60 /* 01 1xxxxx IPHC */ 00123 #define LOWPAN_DISPATCH_IPHC_MASK 0xE0 00124 #define LOWPAN_MESH 0x80 /* 10 xxxxxx MESH */ 00125 #define LOWPAN_MESH_MASK 0xC0 00126 #define LOWPAN_FRAG1 0xC0 /* 11 000xxx FRAG1 */ 00127 #define LOWPAN_FRAG1_MASK 0xF8 00128 #define LOWPAN_FRAGN 0xE0 /* 11 100xxx FRAGN */ 00129 #define LOWPAN_FRAGN_MASK 0xF8 00130 #define LOWPAN_FRAGN_BIT 0x20 /* xx 1xxxxx distinguish FRAGN */ 00131 #define LOWPAN_FRAG 0xC0 /* 11 x00xxx FRAG1/FRAGN */ 00132 #define LOWPAN_FRAG_MASK 0xD8 00133 00134 /* 00135 * 6LoWPAN Next Header Compression codes 00136 * 00137 * 00000000 to 11011111: (unassigned) 00138 * 1110000N: IPv6 Hop-by-Hop Options Header [RFC6282] 00139 * 1110001N: IPv6 Routing Header [RFC6282] 00140 * 1110010N: IPv6 Fragment Header [RFC6282] 00141 * 1110011N: IPv6 Destination Options Header [RFC6282] 00142 * 1110100N: IPv6 Mobility Header [RFC6282] 00143 * 1110111N: IPv6 Header [RFC6282] 00144 * 11110CPP: UDP Header [RFC6282] 00145 * 11111000 to 11111110: (unassigned) 00146 * 00147 * XXX cipv6_up() currently relies on IPv6 Next Header values and NHC codes 00148 * being disjoint - it does not distinguish the two code spaces. 00149 */ 00150 #define NHC_EXT_HEADER 0xE0 /* 1110xxxx */ 00151 #define NHC_EXT_HEADER_MASK 0xF0 00152 #define NHC_UDP 0xF0 /* 11110xxx */ 00153 #define NHC_UDP_MASK 0xF8 00154 00155 #define NHC_EXT_NH 0x01 00156 #define NHC_EXT_ID_MASK 0xFE 00157 #define NHC_EXT_HOP_BY_HOP 0xE0 00158 #define NHC_EXT_ROUTING 0xE2 00159 #define NHC_EXT_FRAG 0xE4 00160 #define NHC_EXT_DEST_OPT 0xE6 00161 #define NHC_EXT_MOBILITY 0xE8 00162 #define NHC_EXT_IPV6 0xEE 00163 00164 /* 00165 * RFC 6282 00166 * 00167 * 4.3.3. UDP LOWPAN_NHC Format 00168 * 00169 * 00170 * 0 1 2 3 4 5 6 7 00171 * +---+---+---+---+---+---+---+---+ 00172 * | 1 | 1 | 1 | 1 | 0 | C | P | 00173 * +---+---+---+---+---+---+---+---+ 00174 * 00175 * Figure 14: UDP Header Encoding 00176 */ 00177 #define NHC_UDP_PORT_COMPRESS_NONE 0 00178 #define NHC_UDP_PORT_COMPRESS_DST 1 00179 #define NHC_UDP_PORT_COMPRESS_SRC 2 00180 #define NHC_UDP_PORT_COMPRESS_BOTH 3 00181 #define NHC_UDP_PORT_COMPRESS_MASK 3 00182 #define NHC_UDP_CKSUM_COMPRESS 4 00183 00184 #endif
Generated on Tue Jul 12 2022 12:43:39 by
