6lowpan_i.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef __IEEE802154_6LOWPAN_I_H__
  2. #define __IEEE802154_6LOWPAN_I_H__
  3. #include <linux/list.h>
  4. #include <net/ieee802154_netdev.h>
  5. #include <net/inet_frag.h>
  6. #include <net/6lowpan.h>
  7. typedef unsigned __bitwise__ lowpan_rx_result;
  8. #define RX_CONTINUE ((__force lowpan_rx_result) 0u)
  9. #define RX_DROP_UNUSABLE ((__force lowpan_rx_result) 1u)
  10. #define RX_DROP ((__force lowpan_rx_result) 2u)
  11. #define RX_QUEUED ((__force lowpan_rx_result) 3u)
  12. #define LOWPAN_DISPATCH_FRAG1 0xc0
  13. #define LOWPAN_DISPATCH_FRAGN 0xe0
  14. struct lowpan_create_arg {
  15. u16 tag;
  16. u16 d_size;
  17. const struct ieee802154_addr *src;
  18. const struct ieee802154_addr *dst;
  19. };
  20. /* Equivalent of ipv4 struct ip
  21. */
  22. struct lowpan_frag_queue {
  23. struct inet_frag_queue q;
  24. u16 tag;
  25. u16 d_size;
  26. struct ieee802154_addr saddr;
  27. struct ieee802154_addr daddr;
  28. };
  29. static inline u32 ieee802154_addr_hash(const struct ieee802154_addr *a)
  30. {
  31. switch (a->mode) {
  32. case IEEE802154_ADDR_LONG:
  33. return (((__force u64)a->extended_addr) >> 32) ^
  34. (((__force u64)a->extended_addr) & 0xffffffff);
  35. case IEEE802154_ADDR_SHORT:
  36. return (__force u32)(a->short_addr + (a->pan_id << 16));
  37. default:
  38. return 0;
  39. }
  40. }
  41. int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type);
  42. void lowpan_net_frag_exit(void);
  43. int lowpan_net_frag_init(void);
  44. void lowpan_rx_init(void);
  45. void lowpan_rx_exit(void);
  46. int lowpan_header_create(struct sk_buff *skb, struct net_device *dev,
  47. unsigned short type, const void *_daddr,
  48. const void *_saddr, unsigned int len);
  49. netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *dev);
  50. int lowpan_iphc_decompress(struct sk_buff *skb);
  51. lowpan_rx_result lowpan_rx_h_ipv6(struct sk_buff *skb);
  52. #endif /* __IEEE802154_6LOWPAN_I_H__ */