aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154/6lowpan.h
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2013-12-11 10:05:34 -0500
committerMarcel Holtmann <marcel@holtmann.org>2013-12-11 15:57:54 -0500
commit8df8c56a5abc70af5862aa7cac2875aeeb17a42b (patch)
treefa21c03bc3bd3bc9778894aa39c234e291f1d850 /net/ieee802154/6lowpan.h
parent71fb419724fadab4efdf98210aa3fe053bd81d29 (diff)
6lowpan: Moving generic compression code into 6lowpan_iphc.c
Because the IEEE 802154 and Bluetooth share the IP header compression and uncompression code, the common code is moved to 6lowpan_iphc.c file. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Acked-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/ieee802154/6lowpan.h')
-rw-r--r--net/ieee802154/6lowpan.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/net/ieee802154/6lowpan.h b/net/ieee802154/6lowpan.h
index 2869c0526dad..535606d45c39 100644
--- a/net/ieee802154/6lowpan.h
+++ b/net/ieee802154/6lowpan.h
@@ -232,6 +232,28 @@
232 dest = 16 bit inline */ 232 dest = 16 bit inline */
233#define LOWPAN_NHC_UDP_CS_P_11 0xF3 /* source & dest = 0xF0B + 4bit inline */ 233#define LOWPAN_NHC_UDP_CS_P_11 0xF3 /* source & dest = 0xF0B + 4bit inline */
234 234
235static inline int lowpan_fetch_skb_u8(struct sk_buff *skb, u8 *val)
236{
237 if (unlikely(!pskb_may_pull(skb, 1)))
238 return -EINVAL;
239
240 *val = skb->data[0];
241 skb_pull(skb, 1);
242
243 return 0;
244}
245
246static inline int lowpan_fetch_skb_u16(struct sk_buff *skb, u16 *val)
247{
248 if (unlikely(!pskb_may_pull(skb, 2)))
249 return -EINVAL;
250
251 *val = (skb->data[0] << 8) | skb->data[1];
252 skb_pull(skb, 2);
253
254 return 0;
255}
256
235static inline bool lowpan_fetch_skb(struct sk_buff *skb, 257static inline bool lowpan_fetch_skb(struct sk_buff *skb,
236 void *data, const unsigned int len) 258 void *data, const unsigned int len)
237{ 259{
@@ -244,4 +266,14 @@ static inline bool lowpan_fetch_skb(struct sk_buff *skb,
244 return false; 266 return false;
245} 267}
246 268
269typedef int (*skb_delivery_cb)(struct sk_buff *skb, struct net_device *dev);
270
271int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
272 const u8 *saddr, const u8 saddr_type, const u8 saddr_len,
273 const u8 *daddr, const u8 daddr_type, const u8 daddr_len,
274 u8 iphc0, u8 iphc1, skb_delivery_cb skb_deliver);
275int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
276 unsigned short type, const void *_daddr,
277 const void *_saddr, unsigned int len);
278
247#endif /* __6LOWPAN_H__ */ 279#endif /* __6LOWPAN_H__ */