2011-01-07 13:02:27 +01:00
|
|
|
#ifndef SIXLOWPAN_H
|
|
|
|
#define SIXLOWPAN_H
|
|
|
|
|
2011-01-07 23:38:42 +01:00
|
|
|
#define IP_PROCESS_STACKSIZE 2048
|
2011-01-24 22:41:32 +01:00
|
|
|
#define NC_STACKSIZE 512
|
2011-06-24 01:48:41 +02:00
|
|
|
#define CON_STACKSIZE 512
|
2011-01-07 23:38:42 +01:00
|
|
|
|
2011-01-07 13:02:27 +01:00
|
|
|
/* fragment size in bytes*/
|
|
|
|
#define FRAG_PART_ONE_HDR_LEN 4
|
|
|
|
#define FRAG_PART_N_HDR_LEN 5
|
|
|
|
|
2011-01-24 22:41:32 +01:00
|
|
|
#define LOWPAN_IPHC_DISPATCH 0x60
|
|
|
|
#define LOWPAN_IPHC_FL_C 0x10
|
|
|
|
#define LOWPAN_IPHC_TC_C 0x08
|
|
|
|
#define LOWPAN_IPHC_CID 0x80
|
|
|
|
#define LOWPAN_IPHC_SAC 0x40
|
|
|
|
#define LOWPAN_IPHC_SAM 0x30
|
|
|
|
#define LOWPAN_IPHC_DAC 0x04
|
|
|
|
#define LOWPAN_IPHC_DAM 0x03
|
|
|
|
#define LOWPAN_IPHC_M 0x08
|
|
|
|
#define LOWPAN_IPHC_NH 0x04
|
|
|
|
#define LOWPAN_IPV6_DISPATCH 0x41
|
|
|
|
#define LOWPAN_CONTEXT_MAX 16
|
2010-10-06 17:15:05 +02:00
|
|
|
|
2011-01-24 22:41:32 +01:00
|
|
|
#include "transceiver.h"
|
2011-06-18 18:04:02 +02:00
|
|
|
#include "sixlowip.h"
|
2011-06-14 22:28:56 +02:00
|
|
|
#include <vtimer.h>
|
2011-06-24 01:48:41 +02:00
|
|
|
#include <mutex.h>
|
|
|
|
|
|
|
|
extern mutex_t lowpan_context_mutex;
|
2010-10-06 17:55:31 +02:00
|
|
|
|
2011-01-24 22:41:32 +01:00
|
|
|
typedef struct lowpan_context_t {
|
|
|
|
uint8_t num;
|
2011-06-18 18:04:02 +02:00
|
|
|
ipv6_addr_t prefix;
|
2011-06-14 22:28:56 +02:00
|
|
|
uint8_t length;
|
|
|
|
uint8_t comp;
|
2011-06-24 01:48:41 +02:00
|
|
|
uint16_t lifetime;
|
2011-01-24 22:41:32 +01:00
|
|
|
} lowpan_context_t;
|
2011-01-07 13:02:27 +01:00
|
|
|
|
2011-07-09 19:19:31 +02:00
|
|
|
void sixlowpan_init(transceiver_type_t trans, uint8_t r_addr, int as_edge);
|
2011-06-22 12:36:26 +02:00
|
|
|
void sixlowpan_adhoc_init(transceiver_type_t trans, ipv6_addr_t *prefix, uint8_t r_addr);
|
2011-05-16 14:26:42 +02:00
|
|
|
void lowpan_init(ieee_802154_long_t *addr, uint8_t *data);
|
|
|
|
void lowpan_read(uint8_t *data, uint8_t length, ieee_802154_long_t *s_laddr,
|
2011-01-24 22:41:32 +01:00
|
|
|
ieee_802154_long_t *d_laddr);
|
|
|
|
void lowpan_iphc_encoding(ieee_802154_long_t *dest);
|
|
|
|
void lowpan_iphc_decoding(uint8_t *data, uint8_t length,
|
|
|
|
ieee_802154_long_t *s_laddr,
|
|
|
|
ieee_802154_long_t *d_laddr);
|
2011-06-14 22:28:56 +02:00
|
|
|
uint8_t lowpan_context_len();
|
2011-06-18 18:04:02 +02:00
|
|
|
lowpan_context_t * lowpan_context_update(
|
|
|
|
uint8_t num, const ipv6_addr_t *prefix,
|
2011-06-14 22:28:56 +02:00
|
|
|
uint8_t length, uint8_t comp,
|
|
|
|
uint16_t lifetime);
|
2011-06-14 22:52:24 +02:00
|
|
|
lowpan_context_t * lowpan_context_get();
|
2011-01-24 22:41:32 +01:00
|
|
|
lowpan_context_t * lowpan_context_lookup(ipv6_addr_t *addr);
|
|
|
|
lowpan_context_t * lowpan_context_num_lookup(uint8_t num);
|
|
|
|
void lowpan_ipv6_set_dispatch(uint8_t *data);
|
2010-12-13 11:14:41 +01:00
|
|
|
#endif
|