mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 01:29:33 +00:00
Allow the 6lowpan code to handle packets larger than 256 bytes
This commit is contained in:
parent
bec721d313
commit
f26e35cffa
@ -200,7 +200,7 @@ static uint8_t rime_hdr_len;
|
||||
* headers (can be the IP payload if the IP header only is 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
|
||||
@ -999,9 +999,10 @@ uncompress_hdr_hc06(uint16_t ip_len)
|
||||
|
||||
/* IP length field. */
|
||||
if(ip_len == 0) {
|
||||
int len = packetbuf_datalen() - rime_hdr_len + uncomp_hdr_len - UIP_IPH_LEN;
|
||||
/* This is not a fragmented packet */
|
||||
SICSLOWPAN_IP_BUF->len[0] = 0;
|
||||
SICSLOWPAN_IP_BUF->len[1] = packetbuf_datalen() - rime_hdr_len + uncomp_hdr_len - UIP_IPH_LEN;
|
||||
SICSLOWPAN_IP_BUF->len[0] = len >> 8;
|
||||
SICSLOWPAN_IP_BUF->len[1] = len & 0x00FF;
|
||||
} else {
|
||||
/* This is a 1st fragment */
|
||||
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. */
|
||||
if(ip_len == 0) {
|
||||
int len = packetbuf_datalen() - rime_hdr_len + uncomp_hdr_len - UIP_IPH_LEN;
|
||||
/* This is not a fragmented packet */
|
||||
SICSLOWPAN_IP_BUF->len[0] = 0;
|
||||
SICSLOWPAN_IP_BUF->len[1] = packetbuf_datalen() - rime_hdr_len + uncomp_hdr_len - UIP_IPH_LEN;
|
||||
SICSLOWPAN_IP_BUF->len[0] = len >> 8;
|
||||
SICSLOWPAN_IP_BUF->len[1] = len & 0x00FF;
|
||||
} else {
|
||||
/* This is a 1st fragment */
|
||||
SICSLOWPAN_IP_BUF->len[0] = (ip_len - UIP_IPH_LEN) >> 8;
|
||||
@ -1480,7 +1482,7 @@ output(uip_lladdr_t *localdest)
|
||||
|
||||
/* Copy payload and send */
|
||||
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);
|
||||
memcpy(rime_ptr + rime_hdr_len,
|
||||
(uint8_t *)UIP_IP_BUF + uncomp_hdr_len, rime_payload_len);
|
||||
@ -1516,7 +1518,7 @@ output(uip_lladdr_t *localdest)
|
||||
/* uip_htons((SICSLOWPAN_DISPATCH_FRAGN << 8) | uip_len); */
|
||||
SET16(RIME_FRAG_PTR, RIME_FRAG_DISPATCH_SIZE,
|
||||
((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) {
|
||||
PRINTFO("sicslowpan output: fragment ");
|
||||
RIME_FRAG_PTR[RIME_FRAG_OFFSET] = processed_ip_out_len >> 3;
|
||||
|
Loading…
Reference in New Issue
Block a user