summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-10-20 02:31:22 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-10-20 18:49:25 -0400
commit6350047eb8dbd3dcf0ff29a637ece96db8f59d8d (patch)
treef6cd61e1ddf0b7602e1d73c0e929dbf5958a7cbd /include/net
parent607b0bd3f2b9ac118f2c67dbd18c55f1f5aefeb1 (diff)
6lowpan: move IPHC functionality defines
This patch removes the IPHC related defines for doing bit manipulation from global 6lowpan header to the iphc file which should the only one implementation which use these defines. Also move next header compression defines to their nhc implementation. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/6lowpan.h123
1 files changed, 0 insertions, 123 deletions
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
index 4afdbb3ab6d8..f127a92d1b94 100644
--- a/include/net/6lowpan.h
+++ b/include/net/6lowpan.h
@@ -56,11 +56,6 @@
56#include <net/ipv6.h> 56#include <net/ipv6.h>
57#include <net/net_namespace.h> 57#include <net/net_namespace.h>
58 58
59#define UIP_802154_SHORTADDR_LEN 2 /* compressed ipv6 address length */
60#define UIP_IPH_LEN 40 /* ipv6 fixed header size */
61#define UIP_PROTO_UDP 17 /* ipv6 next header value for UDP */
62#define UIP_FRAGH_LEN 8 /* ipv6 fragment header size */
63
64#define EUI64_ADDR_LEN 8 59#define EUI64_ADDR_LEN 8
65 60
66#define LOWPAN_NHC_MAX_ID_LEN 1 61#define LOWPAN_NHC_MAX_ID_LEN 1
@@ -79,61 +74,6 @@
79 LOWPAN_IPHC_MAX_HEADER_LEN + \ 74 LOWPAN_IPHC_MAX_HEADER_LEN + \
80 LOWPAN_NHC_MAX_HDR_LEN) 75 LOWPAN_NHC_MAX_HDR_LEN)
81 76
82/*
83 * ipv6 address based on mac
84 * second bit-flip (Universe/Local) is done according RFC2464
85 */
86#define is_addr_mac_addr_based(a, m) \
87 ((((a)->s6_addr[8]) == (((m)[0]) ^ 0x02)) && \
88 (((a)->s6_addr[9]) == (m)[1]) && \
89 (((a)->s6_addr[10]) == (m)[2]) && \
90 (((a)->s6_addr[11]) == (m)[3]) && \
91 (((a)->s6_addr[12]) == (m)[4]) && \
92 (((a)->s6_addr[13]) == (m)[5]) && \
93 (((a)->s6_addr[14]) == (m)[6]) && \
94 (((a)->s6_addr[15]) == (m)[7]))
95
96/*
97 * check whether we can compress the IID to 16 bits,
98 * it's possible for unicast adresses with first 49 bits are zero only.
99 */
100#define lowpan_is_iid_16_bit_compressable(a) \
101 ((((a)->s6_addr16[4]) == 0) && \
102 (((a)->s6_addr[10]) == 0) && \
103 (((a)->s6_addr[11]) == 0xff) && \
104 (((a)->s6_addr[12]) == 0xfe) && \
105 (((a)->s6_addr[13]) == 0))
106
107/* check whether the 112-bit gid of the multicast address is mappable to: */
108
109/* 48 bits, FFXX::00XX:XXXX:XXXX */
110#define lowpan_is_mcast_addr_compressable48(a) \
111 ((((a)->s6_addr16[1]) == 0) && \
112 (((a)->s6_addr16[2]) == 0) && \
113 (((a)->s6_addr16[3]) == 0) && \
114 (((a)->s6_addr16[4]) == 0) && \
115 (((a)->s6_addr[10]) == 0))
116
117/* 32 bits, FFXX::00XX:XXXX */
118#define lowpan_is_mcast_addr_compressable32(a) \
119 ((((a)->s6_addr16[1]) == 0) && \
120 (((a)->s6_addr16[2]) == 0) && \
121 (((a)->s6_addr16[3]) == 0) && \
122 (((a)->s6_addr16[4]) == 0) && \
123 (((a)->s6_addr16[5]) == 0) && \
124 (((a)->s6_addr[12]) == 0))
125
126/* 8 bits, FF02::00XX */
127#define lowpan_is_mcast_addr_compressable8(a) \
128 ((((a)->s6_addr[1]) == 2) && \
129 (((a)->s6_addr16[1]) == 0) && \
130 (((a)->s6_addr16[2]) == 0) && \
131 (((a)->s6_addr16[3]) == 0) && \
132 (((a)->s6_addr16[4]) == 0) && \
133 (((a)->s6_addr16[5]) == 0) && \
134 (((a)->s6_addr16[6]) == 0) && \
135 (((a)->s6_addr[14]) == 0))
136
137#define lowpan_is_addr_broadcast(a) \ 77#define lowpan_is_addr_broadcast(a) \
138 ((((a)[0]) == 0xFF) && \ 78 ((((a)[0]) == 0xFF) && \
139 (((a)[1]) == 0xFF) && \ 79 (((a)[1]) == 0xFF) && \
@@ -158,69 +98,6 @@ static inline bool lowpan_is_iphc(u8 dispatch)
158 return (dispatch & LOWPAN_DISPATCH_IPHC_MASK) == LOWPAN_DISPATCH_IPHC; 98 return (dispatch & LOWPAN_DISPATCH_IPHC_MASK) == LOWPAN_DISPATCH_IPHC;
159} 99}
160 100
161#define LOWPAN_FRAG_TIMEOUT (HZ * 60) /* time-out 60 sec */
162
163#define LOWPAN_FRAG1_HEAD_SIZE 0x4
164#define LOWPAN_FRAGN_HEAD_SIZE 0x5
165
166/*
167 * Values of fields within the IPHC encoding first byte
168 * (C stands for compressed and I for inline)
169 */
170#define LOWPAN_IPHC_TF 0x18
171
172#define LOWPAN_IPHC_FL_C 0x10
173#define LOWPAN_IPHC_TC_C 0x08
174#define LOWPAN_IPHC_NH_C 0x04
175#define LOWPAN_IPHC_TTL_1 0x01
176#define LOWPAN_IPHC_TTL_64 0x02
177#define LOWPAN_IPHC_TTL_255 0x03
178#define LOWPAN_IPHC_TTL_I 0x00
179
180
181/* Values of fields within the IPHC encoding second byte */
182#define LOWPAN_IPHC_CID 0x80
183
184#define LOWPAN_IPHC_ADDR_00 0x00
185#define LOWPAN_IPHC_ADDR_01 0x01
186#define LOWPAN_IPHC_ADDR_02 0x02
187#define LOWPAN_IPHC_ADDR_03 0x03
188
189#define LOWPAN_IPHC_SAC 0x40
190#define LOWPAN_IPHC_SAM 0x30
191
192#define LOWPAN_IPHC_SAM_BIT 4
193
194#define LOWPAN_IPHC_M 0x08
195#define LOWPAN_IPHC_DAC 0x04
196#define LOWPAN_IPHC_DAM_00 0x00
197#define LOWPAN_IPHC_DAM_01 0x01
198#define LOWPAN_IPHC_DAM_10 0x02
199#define LOWPAN_IPHC_DAM_11 0x03
200
201#define LOWPAN_IPHC_DAM_BIT 0
202/*
203 * LOWPAN_UDP encoding (works together with IPHC)
204 */
205#define LOWPAN_NHC_UDP_MASK 0xF8
206#define LOWPAN_NHC_UDP_ID 0xF0
207#define LOWPAN_NHC_UDP_CHECKSUMC 0x04
208#define LOWPAN_NHC_UDP_CHECKSUMI 0x00
209
210#define LOWPAN_NHC_UDP_4BIT_PORT 0xF0B0
211#define LOWPAN_NHC_UDP_4BIT_MASK 0xFFF0
212#define LOWPAN_NHC_UDP_8BIT_PORT 0xF000
213#define LOWPAN_NHC_UDP_8BIT_MASK 0xFF00
214
215/* values for port compression, _with checksum_ ie bit 5 set to 0 */
216#define LOWPAN_NHC_UDP_CS_P_00 0xF0 /* all inline */
217#define LOWPAN_NHC_UDP_CS_P_01 0xF1 /* source 16bit inline,
218 dest = 0xF0 + 8 bit inline */
219#define LOWPAN_NHC_UDP_CS_P_10 0xF2 /* source = 0xF0 + 8bit inline,
220 dest = 16 bit inline */
221#define LOWPAN_NHC_UDP_CS_P_11 0xF3 /* source & dest = 0xF0B + 4bit inline */
222#define LOWPAN_NHC_UDP_CS_C 0x04 /* checksum elided */
223
224#define LOWPAN_PRIV_SIZE(llpriv_size) \ 101#define LOWPAN_PRIV_SIZE(llpriv_size) \
225 (sizeof(struct lowpan_priv) + llpriv_size) 102 (sizeof(struct lowpan_priv) + llpriv_size)
226 103