Merge pull request #432 from adamdunkels/push/154-len
Allow the 802.15.4/6lowpan code to operate on packets larger than 256 bytes
This commit is contained in:
commit
0e24fb0bc0
|
@ -345,7 +345,7 @@ frame802154_parse(uint8_t *data, int len, frame802154_t *pf)
|
||||||
/* header length */
|
/* header length */
|
||||||
c = p - data;
|
c = p - data;
|
||||||
/* payload length */
|
/* payload length */
|
||||||
pf->payload_len = (uint8_t)(0xff & (len - c));
|
pf->payload_len = (len - c);
|
||||||
/* payload */
|
/* payload */
|
||||||
pf->payload = p;
|
pf->payload = p;
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ typedef struct {
|
||||||
uint8_t src_addr[8]; /**< Source address */
|
uint8_t src_addr[8]; /**< Source address */
|
||||||
frame802154_aux_hdr_t aux_hdr; /**< Aux security header */
|
frame802154_aux_hdr_t aux_hdr; /**< Aux security header */
|
||||||
uint8_t *payload; /**< Pointer to 802.15.4 frame payload */
|
uint8_t *payload; /**< Pointer to 802.15.4 frame payload */
|
||||||
uint8_t payload_len; /**< Length of payload field */
|
int payload_len; /**< Length of payload field */
|
||||||
} frame802154_t;
|
} frame802154_t;
|
||||||
|
|
||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
|
|
|
@ -200,7 +200,7 @@ static uint8_t rime_hdr_len;
|
||||||
* headers (can be the IP payload if the IP header only is compressed
|
* headers (can be the IP payload if the IP header only is compressed
|
||||||
* or the UDP payload if the UDP header is also compressed)
|
* or the UDP payload if the UDP header is also compressed)
|
||||||
*/
|
*/
|
||||||
static uint8_t rime_payload_len;
|
static int rime_payload_len;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* uncomp_hdr_len is the length of the headers before compression (if HC2
|
* uncomp_hdr_len is the length of the headers before compression (if HC2
|
||||||
|
@ -999,9 +999,10 @@ uncompress_hdr_hc06(uint16_t ip_len)
|
||||||
|
|
||||||
/* IP length field. */
|
/* IP length field. */
|
||||||
if(ip_len == 0) {
|
if(ip_len == 0) {
|
||||||
|
int len = packetbuf_datalen() - rime_hdr_len + uncomp_hdr_len - UIP_IPH_LEN;
|
||||||
/* This is not a fragmented packet */
|
/* This is not a fragmented packet */
|
||||||
SICSLOWPAN_IP_BUF->len[0] = 0;
|
SICSLOWPAN_IP_BUF->len[0] = len >> 8;
|
||||||
SICSLOWPAN_IP_BUF->len[1] = packetbuf_datalen() - rime_hdr_len + uncomp_hdr_len - UIP_IPH_LEN;
|
SICSLOWPAN_IP_BUF->len[1] = len & 0x00FF;
|
||||||
} else {
|
} else {
|
||||||
/* This is a 1st fragment */
|
/* This is a 1st fragment */
|
||||||
SICSLOWPAN_IP_BUF->len[0] = (ip_len - UIP_IPH_LEN) >> 8;
|
SICSLOWPAN_IP_BUF->len[0] = (ip_len - UIP_IPH_LEN) >> 8;
|
||||||
|
@ -1246,9 +1247,10 @@ uncompress_hdr_hc1(uint16_t ip_len)
|
||||||
|
|
||||||
/* IP length field. */
|
/* IP length field. */
|
||||||
if(ip_len == 0) {
|
if(ip_len == 0) {
|
||||||
|
int len = packetbuf_datalen() - rime_hdr_len + uncomp_hdr_len - UIP_IPH_LEN;
|
||||||
/* This is not a fragmented packet */
|
/* This is not a fragmented packet */
|
||||||
SICSLOWPAN_IP_BUF->len[0] = 0;
|
SICSLOWPAN_IP_BUF->len[0] = len >> 8;
|
||||||
SICSLOWPAN_IP_BUF->len[1] = packetbuf_datalen() - rime_hdr_len + uncomp_hdr_len - UIP_IPH_LEN;
|
SICSLOWPAN_IP_BUF->len[1] = len & 0x00FF;
|
||||||
} else {
|
} else {
|
||||||
/* This is a 1st fragment */
|
/* This is a 1st fragment */
|
||||||
SICSLOWPAN_IP_BUF->len[0] = (ip_len - UIP_IPH_LEN) >> 8;
|
SICSLOWPAN_IP_BUF->len[0] = (ip_len - UIP_IPH_LEN) >> 8;
|
||||||
|
@ -1480,7 +1482,7 @@ output(const uip_lladdr_t *localdest)
|
||||||
|
|
||||||
/* Copy payload and send */
|
/* Copy payload and send */
|
||||||
rime_hdr_len += SICSLOWPAN_FRAG1_HDR_LEN;
|
rime_hdr_len += SICSLOWPAN_FRAG1_HDR_LEN;
|
||||||
rime_payload_len = (MAC_MAX_PAYLOAD - framer_hdrlen - rime_hdr_len) & 0xf8;
|
rime_payload_len = (MAC_MAX_PAYLOAD - framer_hdrlen - rime_hdr_len) & 0xfffffff8;
|
||||||
PRINTFO("(len %d, tag %d)\n", rime_payload_len, my_tag);
|
PRINTFO("(len %d, tag %d)\n", rime_payload_len, my_tag);
|
||||||
memcpy(rime_ptr + rime_hdr_len,
|
memcpy(rime_ptr + rime_hdr_len,
|
||||||
(uint8_t *)UIP_IP_BUF + uncomp_hdr_len, rime_payload_len);
|
(uint8_t *)UIP_IP_BUF + uncomp_hdr_len, rime_payload_len);
|
||||||
|
@ -1516,7 +1518,7 @@ output(const uip_lladdr_t *localdest)
|
||||||
/* uip_htons((SICSLOWPAN_DISPATCH_FRAGN << 8) | uip_len); */
|
/* uip_htons((SICSLOWPAN_DISPATCH_FRAGN << 8) | uip_len); */
|
||||||
SET16(RIME_FRAG_PTR, RIME_FRAG_DISPATCH_SIZE,
|
SET16(RIME_FRAG_PTR, RIME_FRAG_DISPATCH_SIZE,
|
||||||
((SICSLOWPAN_DISPATCH_FRAGN << 8) | uip_len));
|
((SICSLOWPAN_DISPATCH_FRAGN << 8) | uip_len));
|
||||||
rime_payload_len = (MAC_MAX_PAYLOAD - framer_hdrlen - rime_hdr_len) & 0xf8;
|
rime_payload_len = (MAC_MAX_PAYLOAD - framer_hdrlen - rime_hdr_len) & 0xfffffff8;
|
||||||
while(processed_ip_out_len < uip_len) {
|
while(processed_ip_out_len < uip_len) {
|
||||||
PRINTFO("sicslowpan output: fragment ");
|
PRINTFO("sicslowpan output: fragment ");
|
||||||
RIME_FRAG_PTR[RIME_FRAG_OFFSET] = processed_ip_out_len >> 3;
|
RIME_FRAG_PTR[RIME_FRAG_OFFSET] = processed_ip_out_len >> 3;
|
||||||
|
|
Loading…
Reference in a new issue