xref: /OK3568_Linux_fs/kernel/include/net/6lowpan.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright 2011, Siemens AG
3*4882a593Smuzhiyun  * written by Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
4*4882a593Smuzhiyun  */
5*4882a593Smuzhiyun 
6*4882a593Smuzhiyun /*
7*4882a593Smuzhiyun  * Based on patches from Jon Smirl <jonsmirl@gmail.com>
8*4882a593Smuzhiyun  * Copyright (c) 2011 Jon Smirl <jonsmirl@gmail.com>
9*4882a593Smuzhiyun  *
10*4882a593Smuzhiyun  * This program is free software; you can redistribute it and/or modify
11*4882a593Smuzhiyun  * it under the terms of the GNU General Public License version 2
12*4882a593Smuzhiyun  * as published by the Free Software Foundation.
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  * This program is distributed in the hope that it will be useful,
15*4882a593Smuzhiyun  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16*4882a593Smuzhiyun  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*4882a593Smuzhiyun  * GNU General Public License for more details.
18*4882a593Smuzhiyun  *
19*4882a593Smuzhiyun  * You should have received a copy of the GNU General Public License along
20*4882a593Smuzhiyun  * with this program; if not, write to the Free Software Foundation, Inc.,
21*4882a593Smuzhiyun  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22*4882a593Smuzhiyun  */
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun /* Jon's code is based on 6lowpan implementation for Contiki which is:
25*4882a593Smuzhiyun  * Copyright (c) 2008, Swedish Institute of Computer Science.
26*4882a593Smuzhiyun  * All rights reserved.
27*4882a593Smuzhiyun  *
28*4882a593Smuzhiyun  * Redistribution and use in source and binary forms, with or without
29*4882a593Smuzhiyun  * modification, are permitted provided that the following conditions
30*4882a593Smuzhiyun  * are met:
31*4882a593Smuzhiyun  * 1. Redistributions of source code must retain the above copyright
32*4882a593Smuzhiyun  *    notice, this list of conditions and the following disclaimer.
33*4882a593Smuzhiyun  * 2. Redistributions in binary form must reproduce the above copyright
34*4882a593Smuzhiyun  *    notice, this list of conditions and the following disclaimer in the
35*4882a593Smuzhiyun  *    documentation and/or other materials provided with the distribution.
36*4882a593Smuzhiyun  * 3. Neither the name of the Institute nor the names of its contributors
37*4882a593Smuzhiyun  *    may be used to endorse or promote products derived from this software
38*4882a593Smuzhiyun  *    without specific prior written permission.
39*4882a593Smuzhiyun  *
40*4882a593Smuzhiyun  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
41*4882a593Smuzhiyun  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42*4882a593Smuzhiyun  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43*4882a593Smuzhiyun  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
44*4882a593Smuzhiyun  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45*4882a593Smuzhiyun  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46*4882a593Smuzhiyun  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47*4882a593Smuzhiyun  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48*4882a593Smuzhiyun  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49*4882a593Smuzhiyun  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50*4882a593Smuzhiyun  * SUCH DAMAGE.
51*4882a593Smuzhiyun  */
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun #ifndef __6LOWPAN_H__
54*4882a593Smuzhiyun #define __6LOWPAN_H__
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun #include <linux/debugfs.h>
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun #include <net/ipv6.h>
59*4882a593Smuzhiyun #include <net/net_namespace.h>
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun /* special link-layer handling */
62*4882a593Smuzhiyun #include <net/mac802154.h>
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun #define EUI64_ADDR_LEN		8
65*4882a593Smuzhiyun 
66*4882a593Smuzhiyun #define LOWPAN_NHC_MAX_ID_LEN	1
67*4882a593Smuzhiyun /* Maximum next header compression length which we currently support inclusive
68*4882a593Smuzhiyun  * possible inline data.
69*4882a593Smuzhiyun  */
70*4882a593Smuzhiyun #define LOWPAN_NHC_MAX_HDR_LEN	(sizeof(struct udphdr))
71*4882a593Smuzhiyun /* Max IPHC Header len without IPv6 hdr specific inline data.
72*4882a593Smuzhiyun  * Useful for getting the "extra" bytes we need at worst case compression.
73*4882a593Smuzhiyun  *
74*4882a593Smuzhiyun  * LOWPAN_IPHC + CID + LOWPAN_NHC_MAX_ID_LEN
75*4882a593Smuzhiyun  */
76*4882a593Smuzhiyun #define LOWPAN_IPHC_MAX_HEADER_LEN	(2 + 1 + LOWPAN_NHC_MAX_ID_LEN)
77*4882a593Smuzhiyun /* Maximum worst case IPHC header buffer size */
78*4882a593Smuzhiyun #define LOWPAN_IPHC_MAX_HC_BUF_LEN	(sizeof(struct ipv6hdr) +	\
79*4882a593Smuzhiyun 					 LOWPAN_IPHC_MAX_HEADER_LEN +	\
80*4882a593Smuzhiyun 					 LOWPAN_NHC_MAX_HDR_LEN)
81*4882a593Smuzhiyun /* SCI/DCI is 4 bit width, so we have maximum 16 entries */
82*4882a593Smuzhiyun #define LOWPAN_IPHC_CTX_TABLE_SIZE	(1 << 4)
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun #define LOWPAN_DISPATCH_IPV6		0x41 /* 01000001 = 65 */
85*4882a593Smuzhiyun #define LOWPAN_DISPATCH_IPHC		0x60 /* 011xxxxx = ... */
86*4882a593Smuzhiyun #define LOWPAN_DISPATCH_IPHC_MASK	0xe0
87*4882a593Smuzhiyun 
lowpan_is_ipv6(u8 dispatch)88*4882a593Smuzhiyun static inline bool lowpan_is_ipv6(u8 dispatch)
89*4882a593Smuzhiyun {
90*4882a593Smuzhiyun 	return dispatch == LOWPAN_DISPATCH_IPV6;
91*4882a593Smuzhiyun }
92*4882a593Smuzhiyun 
lowpan_is_iphc(u8 dispatch)93*4882a593Smuzhiyun static inline bool lowpan_is_iphc(u8 dispatch)
94*4882a593Smuzhiyun {
95*4882a593Smuzhiyun 	return (dispatch & LOWPAN_DISPATCH_IPHC_MASK) == LOWPAN_DISPATCH_IPHC;
96*4882a593Smuzhiyun }
97*4882a593Smuzhiyun 
98*4882a593Smuzhiyun #define LOWPAN_PRIV_SIZE(llpriv_size)	\
99*4882a593Smuzhiyun 	(sizeof(struct lowpan_dev) + llpriv_size)
100*4882a593Smuzhiyun 
101*4882a593Smuzhiyun enum lowpan_lltypes {
102*4882a593Smuzhiyun 	LOWPAN_LLTYPE_BTLE,
103*4882a593Smuzhiyun 	LOWPAN_LLTYPE_IEEE802154,
104*4882a593Smuzhiyun };
105*4882a593Smuzhiyun 
106*4882a593Smuzhiyun enum lowpan_iphc_ctx_flags {
107*4882a593Smuzhiyun 	LOWPAN_IPHC_CTX_FLAG_ACTIVE,
108*4882a593Smuzhiyun 	LOWPAN_IPHC_CTX_FLAG_COMPRESSION,
109*4882a593Smuzhiyun };
110*4882a593Smuzhiyun 
111*4882a593Smuzhiyun struct lowpan_iphc_ctx {
112*4882a593Smuzhiyun 	u8 id;
113*4882a593Smuzhiyun 	struct in6_addr pfx;
114*4882a593Smuzhiyun 	u8 plen;
115*4882a593Smuzhiyun 	unsigned long flags;
116*4882a593Smuzhiyun };
117*4882a593Smuzhiyun 
118*4882a593Smuzhiyun struct lowpan_iphc_ctx_table {
119*4882a593Smuzhiyun 	spinlock_t lock;
120*4882a593Smuzhiyun 	const struct lowpan_iphc_ctx_ops *ops;
121*4882a593Smuzhiyun 	struct lowpan_iphc_ctx table[LOWPAN_IPHC_CTX_TABLE_SIZE];
122*4882a593Smuzhiyun };
123*4882a593Smuzhiyun 
lowpan_iphc_ctx_is_active(const struct lowpan_iphc_ctx * ctx)124*4882a593Smuzhiyun static inline bool lowpan_iphc_ctx_is_active(const struct lowpan_iphc_ctx *ctx)
125*4882a593Smuzhiyun {
126*4882a593Smuzhiyun 	return test_bit(LOWPAN_IPHC_CTX_FLAG_ACTIVE, &ctx->flags);
127*4882a593Smuzhiyun }
128*4882a593Smuzhiyun 
129*4882a593Smuzhiyun static inline bool
lowpan_iphc_ctx_is_compression(const struct lowpan_iphc_ctx * ctx)130*4882a593Smuzhiyun lowpan_iphc_ctx_is_compression(const struct lowpan_iphc_ctx *ctx)
131*4882a593Smuzhiyun {
132*4882a593Smuzhiyun 	return test_bit(LOWPAN_IPHC_CTX_FLAG_COMPRESSION, &ctx->flags);
133*4882a593Smuzhiyun }
134*4882a593Smuzhiyun 
135*4882a593Smuzhiyun struct lowpan_dev {
136*4882a593Smuzhiyun 	enum lowpan_lltypes lltype;
137*4882a593Smuzhiyun 	struct dentry *iface_debugfs;
138*4882a593Smuzhiyun 	struct lowpan_iphc_ctx_table ctx;
139*4882a593Smuzhiyun 
140*4882a593Smuzhiyun 	/* must be last */
141*4882a593Smuzhiyun 	u8 priv[] __aligned(sizeof(void *));
142*4882a593Smuzhiyun };
143*4882a593Smuzhiyun 
144*4882a593Smuzhiyun struct lowpan_802154_neigh {
145*4882a593Smuzhiyun 	__le16 short_addr;
146*4882a593Smuzhiyun };
147*4882a593Smuzhiyun 
148*4882a593Smuzhiyun static inline
lowpan_802154_neigh(void * neigh_priv)149*4882a593Smuzhiyun struct lowpan_802154_neigh *lowpan_802154_neigh(void *neigh_priv)
150*4882a593Smuzhiyun {
151*4882a593Smuzhiyun 	return neigh_priv;
152*4882a593Smuzhiyun }
153*4882a593Smuzhiyun 
154*4882a593Smuzhiyun static inline
lowpan_dev(const struct net_device * dev)155*4882a593Smuzhiyun struct lowpan_dev *lowpan_dev(const struct net_device *dev)
156*4882a593Smuzhiyun {
157*4882a593Smuzhiyun 	return netdev_priv(dev);
158*4882a593Smuzhiyun }
159*4882a593Smuzhiyun 
160*4882a593Smuzhiyun /* private device info */
161*4882a593Smuzhiyun struct lowpan_802154_dev {
162*4882a593Smuzhiyun 	struct net_device	*wdev; /* wpan device ptr */
163*4882a593Smuzhiyun 	u16			fragment_tag;
164*4882a593Smuzhiyun };
165*4882a593Smuzhiyun 
166*4882a593Smuzhiyun static inline struct
lowpan_802154_dev(const struct net_device * dev)167*4882a593Smuzhiyun lowpan_802154_dev *lowpan_802154_dev(const struct net_device *dev)
168*4882a593Smuzhiyun {
169*4882a593Smuzhiyun 	return (struct lowpan_802154_dev *)lowpan_dev(dev)->priv;
170*4882a593Smuzhiyun }
171*4882a593Smuzhiyun 
172*4882a593Smuzhiyun struct lowpan_802154_cb {
173*4882a593Smuzhiyun 	u16 d_tag;
174*4882a593Smuzhiyun 	unsigned int d_size;
175*4882a593Smuzhiyun 	u8 d_offset;
176*4882a593Smuzhiyun };
177*4882a593Smuzhiyun 
178*4882a593Smuzhiyun static inline
lowpan_802154_cb(const struct sk_buff * skb)179*4882a593Smuzhiyun struct lowpan_802154_cb *lowpan_802154_cb(const struct sk_buff *skb)
180*4882a593Smuzhiyun {
181*4882a593Smuzhiyun 	BUILD_BUG_ON(sizeof(struct lowpan_802154_cb) > sizeof(skb->cb));
182*4882a593Smuzhiyun 	return (struct lowpan_802154_cb *)skb->cb;
183*4882a593Smuzhiyun }
184*4882a593Smuzhiyun 
lowpan_iphc_uncompress_eui64_lladdr(struct in6_addr * ipaddr,const void * lladdr)185*4882a593Smuzhiyun static inline void lowpan_iphc_uncompress_eui64_lladdr(struct in6_addr *ipaddr,
186*4882a593Smuzhiyun 						       const void *lladdr)
187*4882a593Smuzhiyun {
188*4882a593Smuzhiyun 	/* fe:80::XXXX:XXXX:XXXX:XXXX
189*4882a593Smuzhiyun 	 *        \_________________/
190*4882a593Smuzhiyun 	 *              hwaddr
191*4882a593Smuzhiyun 	 */
192*4882a593Smuzhiyun 	ipaddr->s6_addr[0] = 0xFE;
193*4882a593Smuzhiyun 	ipaddr->s6_addr[1] = 0x80;
194*4882a593Smuzhiyun 	memcpy(&ipaddr->s6_addr[8], lladdr, EUI64_ADDR_LEN);
195*4882a593Smuzhiyun 	/* second bit-flip (Universe/Local)
196*4882a593Smuzhiyun 	 * is done according RFC2464
197*4882a593Smuzhiyun 	 */
198*4882a593Smuzhiyun 	ipaddr->s6_addr[8] ^= 0x02;
199*4882a593Smuzhiyun }
200*4882a593Smuzhiyun 
lowpan_iphc_uncompress_eui48_lladdr(struct in6_addr * ipaddr,const void * lladdr)201*4882a593Smuzhiyun static inline void lowpan_iphc_uncompress_eui48_lladdr(struct in6_addr *ipaddr,
202*4882a593Smuzhiyun 						       const void *lladdr)
203*4882a593Smuzhiyun {
204*4882a593Smuzhiyun 	/* fe:80::XXXX:XXff:feXX:XXXX
205*4882a593Smuzhiyun 	 *        \_________________/
206*4882a593Smuzhiyun 	 *              hwaddr
207*4882a593Smuzhiyun 	 */
208*4882a593Smuzhiyun 	ipaddr->s6_addr[0] = 0xFE;
209*4882a593Smuzhiyun 	ipaddr->s6_addr[1] = 0x80;
210*4882a593Smuzhiyun 	memcpy(&ipaddr->s6_addr[8], lladdr, 3);
211*4882a593Smuzhiyun 	ipaddr->s6_addr[11] = 0xFF;
212*4882a593Smuzhiyun 	ipaddr->s6_addr[12] = 0xFE;
213*4882a593Smuzhiyun 	memcpy(&ipaddr->s6_addr[13], lladdr + 3, 3);
214*4882a593Smuzhiyun }
215*4882a593Smuzhiyun 
216*4882a593Smuzhiyun #ifdef DEBUG
217*4882a593Smuzhiyun /* print data in line */
raw_dump_inline(const char * caller,char * msg,const unsigned char * buf,int len)218*4882a593Smuzhiyun static inline void raw_dump_inline(const char *caller, char *msg,
219*4882a593Smuzhiyun 				   const unsigned char *buf, int len)
220*4882a593Smuzhiyun {
221*4882a593Smuzhiyun 	if (msg)
222*4882a593Smuzhiyun 		pr_debug("%s():%s: ", caller, msg);
223*4882a593Smuzhiyun 
224*4882a593Smuzhiyun 	print_hex_dump_debug("", DUMP_PREFIX_NONE, 16, 1, buf, len, false);
225*4882a593Smuzhiyun }
226*4882a593Smuzhiyun 
227*4882a593Smuzhiyun /* print data in a table format:
228*4882a593Smuzhiyun  *
229*4882a593Smuzhiyun  * addr: xx xx xx xx xx xx
230*4882a593Smuzhiyun  * addr: xx xx xx xx xx xx
231*4882a593Smuzhiyun  * ...
232*4882a593Smuzhiyun  */
raw_dump_table(const char * caller,char * msg,const unsigned char * buf,int len)233*4882a593Smuzhiyun static inline void raw_dump_table(const char *caller, char *msg,
234*4882a593Smuzhiyun 				  const unsigned char *buf, int len)
235*4882a593Smuzhiyun {
236*4882a593Smuzhiyun 	if (msg)
237*4882a593Smuzhiyun 		pr_debug("%s():%s:\n", caller, msg);
238*4882a593Smuzhiyun 
239*4882a593Smuzhiyun 	print_hex_dump_debug("\t", DUMP_PREFIX_OFFSET, 16, 1, buf, len, false);
240*4882a593Smuzhiyun }
241*4882a593Smuzhiyun #else
raw_dump_table(const char * caller,char * msg,const unsigned char * buf,int len)242*4882a593Smuzhiyun static inline void raw_dump_table(const char *caller, char *msg,
243*4882a593Smuzhiyun 				  const unsigned char *buf, int len) { }
raw_dump_inline(const char * caller,char * msg,const unsigned char * buf,int len)244*4882a593Smuzhiyun static inline void raw_dump_inline(const char *caller, char *msg,
245*4882a593Smuzhiyun 				   const unsigned char *buf, int len) { }
246*4882a593Smuzhiyun #endif
247*4882a593Smuzhiyun 
248*4882a593Smuzhiyun /**
249*4882a593Smuzhiyun  * lowpan_fetch_skb - getting inline data from 6LoWPAN header
250*4882a593Smuzhiyun  *
251*4882a593Smuzhiyun  * This function will pull data from sk buffer and put it into data to
252*4882a593Smuzhiyun  * remove the 6LoWPAN inline data. This function returns true if the
253*4882a593Smuzhiyun  * sk buffer is too small to pull the amount of data which is specified
254*4882a593Smuzhiyun  * by len.
255*4882a593Smuzhiyun  *
256*4882a593Smuzhiyun  * @skb: the buffer where the inline data should be pulled from.
257*4882a593Smuzhiyun  * @data: destination buffer for the inline data.
258*4882a593Smuzhiyun  * @len: amount of data which should be pulled in bytes.
259*4882a593Smuzhiyun  */
lowpan_fetch_skb(struct sk_buff * skb,void * data,unsigned int len)260*4882a593Smuzhiyun static inline bool lowpan_fetch_skb(struct sk_buff *skb, void *data,
261*4882a593Smuzhiyun 				    unsigned int len)
262*4882a593Smuzhiyun {
263*4882a593Smuzhiyun 	if (unlikely(!pskb_may_pull(skb, len)))
264*4882a593Smuzhiyun 		return true;
265*4882a593Smuzhiyun 
266*4882a593Smuzhiyun 	skb_copy_from_linear_data(skb, data, len);
267*4882a593Smuzhiyun 	skb_pull(skb, len);
268*4882a593Smuzhiyun 
269*4882a593Smuzhiyun 	return false;
270*4882a593Smuzhiyun }
271*4882a593Smuzhiyun 
lowpan_802154_is_valid_src_short_addr(__le16 addr)272*4882a593Smuzhiyun static inline bool lowpan_802154_is_valid_src_short_addr(__le16 addr)
273*4882a593Smuzhiyun {
274*4882a593Smuzhiyun 	/* First bit of addr is multicast, reserved or 802.15.4 specific */
275*4882a593Smuzhiyun 	return !(addr & cpu_to_le16(0x8000));
276*4882a593Smuzhiyun }
277*4882a593Smuzhiyun 
lowpan_push_hc_data(u8 ** hc_ptr,const void * data,const size_t len)278*4882a593Smuzhiyun static inline void lowpan_push_hc_data(u8 **hc_ptr, const void *data,
279*4882a593Smuzhiyun 				       const size_t len)
280*4882a593Smuzhiyun {
281*4882a593Smuzhiyun 	memcpy(*hc_ptr, data, len);
282*4882a593Smuzhiyun 	*hc_ptr += len;
283*4882a593Smuzhiyun }
284*4882a593Smuzhiyun 
285*4882a593Smuzhiyun int lowpan_register_netdevice(struct net_device *dev,
286*4882a593Smuzhiyun 			      enum lowpan_lltypes lltype);
287*4882a593Smuzhiyun int lowpan_register_netdev(struct net_device *dev,
288*4882a593Smuzhiyun 			   enum lowpan_lltypes lltype);
289*4882a593Smuzhiyun void lowpan_unregister_netdevice(struct net_device *dev);
290*4882a593Smuzhiyun void lowpan_unregister_netdev(struct net_device *dev);
291*4882a593Smuzhiyun 
292*4882a593Smuzhiyun /**
293*4882a593Smuzhiyun  * lowpan_header_decompress - replace 6LoWPAN header with IPv6 header
294*4882a593Smuzhiyun  *
295*4882a593Smuzhiyun  * This function replaces the IPHC 6LoWPAN header which should be pointed at
296*4882a593Smuzhiyun  * skb->data and skb_network_header, with the IPv6 header.
297*4882a593Smuzhiyun  * It would be nice that the caller have the necessary headroom of IPv6 header
298*4882a593Smuzhiyun  * and greatest Transport layer header, this would reduce the overhead for
299*4882a593Smuzhiyun  * reallocate headroom.
300*4882a593Smuzhiyun  *
301*4882a593Smuzhiyun  * @skb: the buffer which should be manipulate.
302*4882a593Smuzhiyun  * @dev: the lowpan net device pointer.
303*4882a593Smuzhiyun  * @daddr: destination lladdr of mac header which is used for compression
304*4882a593Smuzhiyun  *	methods.
305*4882a593Smuzhiyun  * @saddr: source lladdr of mac header which is used for compression
306*4882a593Smuzhiyun  *	methods.
307*4882a593Smuzhiyun  */
308*4882a593Smuzhiyun int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev,
309*4882a593Smuzhiyun 			     const void *daddr, const void *saddr);
310*4882a593Smuzhiyun 
311*4882a593Smuzhiyun /**
312*4882a593Smuzhiyun  * lowpan_header_compress - replace IPv6 header with 6LoWPAN header
313*4882a593Smuzhiyun  *
314*4882a593Smuzhiyun  * This function replaces the IPv6 header which should be pointed at
315*4882a593Smuzhiyun  * skb->data and skb_network_header, with the IPHC 6LoWPAN header.
316*4882a593Smuzhiyun  * The caller need to be sure that the sk buffer is not shared and at have
317*4882a593Smuzhiyun  * at least a headroom which is smaller or equal LOWPAN_IPHC_MAX_HEADER_LEN,
318*4882a593Smuzhiyun  * which is the IPHC "more bytes than IPv6 header" at worst case.
319*4882a593Smuzhiyun  *
320*4882a593Smuzhiyun  * @skb: the buffer which should be manipulate.
321*4882a593Smuzhiyun  * @dev: the lowpan net device pointer.
322*4882a593Smuzhiyun  * @daddr: destination lladdr of mac header which is used for compression
323*4882a593Smuzhiyun  *	methods.
324*4882a593Smuzhiyun  * @saddr: source lladdr of mac header which is used for compression
325*4882a593Smuzhiyun  *	methods.
326*4882a593Smuzhiyun  */
327*4882a593Smuzhiyun int lowpan_header_compress(struct sk_buff *skb, const struct net_device *dev,
328*4882a593Smuzhiyun 			   const void *daddr, const void *saddr);
329*4882a593Smuzhiyun 
330*4882a593Smuzhiyun #endif /* __6LOWPAN_H__ */
331