mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-28 16:01:18 +01:00
global buffer is now thread safe, ns compression bug solved
This commit is contained in:
parent
4da698855f
commit
dcf45b08a7
@ -1,6 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <vtimer.h>
|
||||
#include <mutex.h>
|
||||
#include "msg.h"
|
||||
#include "sixlowip.h"
|
||||
#include "sixlowmac.h"
|
||||
@ -14,6 +15,8 @@ uint8_t ipv6_ext_hdr_len;
|
||||
uint8_t *nextheader;
|
||||
iface_t iface;
|
||||
|
||||
//mutex_t buf_mutex;
|
||||
|
||||
struct ipv6_hdr_t* get_ipv6_buf(void){
|
||||
return ((struct ipv6_hdr_t*)&(buffer[LL_HDR_LEN]));
|
||||
}
|
||||
@ -55,7 +58,7 @@ void sixlowpan_send(ipv6_addr_t *addr, uint8_t *payload, uint16_t p_len){
|
||||
|
||||
packet_length = IPV6_HDR_LEN + p_len;
|
||||
|
||||
output((ieee_802154_long_t*)&(ipv6_buf->destaddr.uint16[4]),(uint8_t*)ipv6_buf);
|
||||
lowpan_init((ieee_802154_long_t*)&(ipv6_buf->destaddr.uint16[4]),(uint8_t*)ipv6_buf);
|
||||
}
|
||||
|
||||
void ipv6_process(void){
|
||||
@ -67,9 +70,7 @@ void ipv6_process(void){
|
||||
|
||||
ipv6_buf = get_ipv6_buf();
|
||||
ipv6_buf = (struct ipv6_hdr_t*) m.content.ptr;
|
||||
|
||||
//printf("INFO: packet received, source: ");
|
||||
//ipv6_print_addr(&ipv6_buf->srcaddr);
|
||||
|
||||
/* identifiy packet */
|
||||
nextheader = &ipv6_buf->nextheader;
|
||||
|
||||
@ -98,6 +99,10 @@ void ipv6_process(void){
|
||||
case(ICMP_NBR_SOL):{
|
||||
printf("INFO: packet type: icmp neighbor solicitation\n");
|
||||
recv_nbr_sol();
|
||||
break;
|
||||
}
|
||||
case(ICMP_NBR_ADV):{
|
||||
printf("INFO: packet type: icmp neighbor advertisment\n");
|
||||
}
|
||||
default:
|
||||
break;
|
||||
@ -107,6 +112,7 @@ void ipv6_process(void){
|
||||
case(PROTO_NUM_NONE):{
|
||||
//printf("Packet with no Header following the IPv6 Header received\n");
|
||||
uint8_t *ptr = get_payload_buf(ipv6_ext_hdr_len);
|
||||
printf("hello\n");
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
||||
@ -28,7 +28,7 @@ extern uint8_t opt_hdr_len;
|
||||
extern uint16_t packet_length;
|
||||
extern uint8_t packet_dispatch;
|
||||
extern uint8_t iface_addr_list_count;
|
||||
//extern mutex_t buf_mutex;
|
||||
extern mutex_t buf_mutex;
|
||||
|
||||
extern double start;
|
||||
|
||||
|
||||
@ -24,6 +24,8 @@ uint16_t packet_length;
|
||||
static uint8_t macdsn;
|
||||
//static uint8_t macbsn;
|
||||
|
||||
mutex_t buf_mutex;
|
||||
|
||||
static radio_packet_t p;
|
||||
static msg mesg;
|
||||
int transceiver_type;
|
||||
@ -94,7 +96,6 @@ void recv_ieee802154_frame(void){
|
||||
ieee802154_frame_t frame;
|
||||
|
||||
msg_init_queue(msg_q, RADIO_RCV_BUF_SIZE);
|
||||
|
||||
|
||||
while (1) {
|
||||
msg_receive(&m);
|
||||
@ -105,7 +106,7 @@ void recv_ieee802154_frame(void){
|
||||
length = p->length - hdrlen;
|
||||
|
||||
/* deliver packet to network(6lowpan)-layer */
|
||||
input(frame.payload, length, (ieee_802154_long_t*)&frame.src_addr,
|
||||
lowpan_read(frame.payload, length, (ieee_802154_long_t*)&frame.src_addr,
|
||||
(ieee_802154_long_t*)&frame.dest_addr);
|
||||
|
||||
p->processing--;
|
||||
@ -146,7 +147,6 @@ void send_ieee802154_frame(ieee_802154_long_t *addr, uint8_t *payload,
|
||||
mesg.type = SND_PKT;
|
||||
mesg.content.ptr = (char*) &tcmd;
|
||||
|
||||
|
||||
tcmd.transceivers = transceiver_type;
|
||||
tcmd.data = &p;
|
||||
|
||||
@ -157,32 +157,21 @@ void send_ieee802154_frame(ieee_802154_long_t *addr, uint8_t *payload,
|
||||
IEEE_802154_LONG_ADDR_M);
|
||||
set_ieee802154_frame_values(&frame);
|
||||
|
||||
/* ONLY FOR TESTING */
|
||||
memcpy(&(frame.dest_addr[0]), &(addr->uint8[0]), 8);
|
||||
//frame.dest_addr[0] = *addr & 0xff;
|
||||
//frame.dest_addr[1] = (*addr >> 8) & 0xff;
|
||||
memcpy(&(frame.src_addr[0]), &(iface.laddr.uint8[0]), 8);
|
||||
//frame.src_addr[0] = 0;
|
||||
//frame.src_addr[1] = r_src_addr;
|
||||
|
||||
/* check if destination address is NULL => broadcast */
|
||||
//if(addr[0] == 0 && addr[1] == 0){
|
||||
// frame.dest_addr[0] = 0xff;
|
||||
// frame.dest_addr[1] = 0xff;
|
||||
//}
|
||||
|
||||
daddr = HTONS(addr->uint16[3]);
|
||||
//memcpy(&daddr, &addr->uint8[6], 2);
|
||||
//printf("blub: %02x\n", addr->uint8[6]);
|
||||
//uint8_t test = 30;
|
||||
frame.payload = payload;
|
||||
frame.payload_len = length;
|
||||
//printf("length: %x\n",frame.payload_len);
|
||||
uint8_t hdrlen = get_802154_hdr_len(&frame);
|
||||
|
||||
memset(&buf,0,PAYLOAD_SIZE);
|
||||
init_802154_frame(&frame,(uint8_t*)&buf);
|
||||
memcpy(&buf[hdrlen],frame.payload,frame.payload_len);
|
||||
|
||||
/* mutex unlock */
|
||||
mutex_unlock(&buf_mutex, 0);
|
||||
|
||||
p.length = hdrlen + frame.payload_len;
|
||||
if(mcast == 0){
|
||||
p.dst = daddr;
|
||||
@ -190,13 +179,10 @@ void send_ieee802154_frame(ieee_802154_long_t *addr, uint8_t *payload,
|
||||
p.dst = 0;
|
||||
}
|
||||
|
||||
// TODO: geeignete ring-bufferung nötig
|
||||
p.data = buf;
|
||||
//p.data = snd_buffer[i % RADIO_SND_BUF_SIZE];
|
||||
msg_send(&mesg, transceiver_pid, 1);
|
||||
|
||||
hwtimer_wait(5000);
|
||||
//switch_to_rx();
|
||||
}
|
||||
|
||||
void sixlowmac_init(transceiver_type_t type){
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
#include "sixlowip.h"
|
||||
#include "sixlownd.h"
|
||||
#include "sixlowmac.h"
|
||||
#include "sixlowpan.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <debug.h>
|
||||
#include <vtimer.h>
|
||||
|
||||
#define ENABLE_DEBUG
|
||||
|
||||
/* extern variables */
|
||||
uint8_t opt_hdr_len = 0;
|
||||
uint8_t ipv6_ext_hdr_len = 0;
|
||||
@ -87,7 +90,9 @@ static struct opt_aro_t* get_opt_aro_buf(uint8_t ext_len, uint8_t opt_len){
|
||||
void init_rtr_sol(uint8_t sllao){
|
||||
ipv6_buf = get_ipv6_buf();
|
||||
icmp_buf = get_icmpv6_buf(ipv6_ext_hdr_len);
|
||||
|
||||
packet_length = 0;
|
||||
|
||||
icmp_buf->type = ICMP_RTR_SOL;
|
||||
icmp_buf->code = 0;
|
||||
ipv6_buf->version_trafficclass = IPV6_VER;
|
||||
@ -118,9 +123,11 @@ void init_rtr_sol(uint8_t sllao){
|
||||
icmp_buf->checksum = 0;
|
||||
icmp_buf->checksum = ~icmpv6_csum(PROTO_NUM_ICMPV6);
|
||||
|
||||
#ifdef ENABLE_DEBUG
|
||||
printf("INFO: send router solicitation to: ");
|
||||
ipv6_print_addr(&ipv6_buf->destaddr);
|
||||
output((ieee_802154_long_t*)&(ipv6_buf->destaddr.uint16[4]),(uint8_t*)ipv6_buf);
|
||||
#endif
|
||||
lowpan_init((ieee_802154_long_t*)&(ipv6_buf->destaddr.uint16[4]),(uint8_t*)ipv6_buf);
|
||||
}
|
||||
|
||||
void recv_rtr_sol(void){
|
||||
@ -155,9 +162,11 @@ void recv_rtr_sol(void){
|
||||
|
||||
/* send solicited router advertisment */
|
||||
init_rtr_adv(&ipv6_buf->srcaddr, 0, 0, OPT_PI, 0, 0);
|
||||
#ifdef ENABLE_DEBUG
|
||||
printf("INFO: send router advertisment to: ");
|
||||
ipv6_print_addr(&ipv6_buf->destaddr);
|
||||
output((ieee_802154_long_t*)&(ipv6_buf->destaddr.uint16[4]),(uint8_t*)ipv6_buf);
|
||||
#endif
|
||||
lowpan_init((ieee_802154_long_t*)&(ipv6_buf->destaddr.uint16[4]),(uint8_t*)ipv6_buf);
|
||||
|
||||
}
|
||||
|
||||
@ -241,7 +250,6 @@ void init_rtr_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8_t pi,
|
||||
/* calculate checksum */
|
||||
icmp_buf->checksum = 0;
|
||||
icmp_buf->checksum = ~icmpv6_csum(PROTO_NUM_ICMPV6);
|
||||
//printf("%x\n",icmp_buf->checksum);
|
||||
}
|
||||
|
||||
void recv_rtr_adv(void){
|
||||
@ -280,7 +288,6 @@ void recv_rtr_adv(void){
|
||||
/* read options */
|
||||
while(packet_length > IPV6HDR_ICMPV6HDR_LEN + opt_hdr_len){
|
||||
opt_buf = get_opt_buf(ipv6_ext_hdr_len, opt_hdr_len);
|
||||
timex_t tmp;
|
||||
|
||||
switch(opt_buf->type){
|
||||
case(OPT_SLLAO_TYPE):{
|
||||
@ -372,9 +379,11 @@ void recv_rtr_adv(void){
|
||||
init_nbr_sol(NULL, &(ipv6_buf->srcaddr), &(ipv6_buf->srcaddr),
|
||||
OPT_SLLAO,OPT_ARO);
|
||||
}
|
||||
#ifdef ENABLE_DEBUG
|
||||
printf("INFO: send neighbor solicitation to: ");
|
||||
ipv6_print_addr(&(ipv6_buf->destaddr));
|
||||
output((ieee_802154_long_t*)&(ipv6_buf->destaddr.uint16[4]), (uint8_t*)ipv6_buf);
|
||||
#endif
|
||||
lowpan_init((ieee_802154_long_t*)&(ipv6_buf->destaddr.uint16[4]), (uint8_t*)ipv6_buf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -405,7 +414,7 @@ void init_nbr_sol(ipv6_addr_t *src, ipv6_addr_t *dest, ipv6_addr_t *targ,
|
||||
|
||||
packet_length = IPV6_HDR_LEN + ICMPV6_HDR_LEN + NBR_SOL_LEN;
|
||||
|
||||
if(ipv6_iface_addr_match(&targ) == NULL){
|
||||
if(ipv6_iface_addr_match(targ) == NULL){
|
||||
if(src == NULL){
|
||||
ipv6_get_saddr(&(ipv6_buf->srcaddr),&(ipv6_buf->destaddr));
|
||||
} else{
|
||||
@ -506,7 +515,8 @@ void recv_nbr_sol(void){
|
||||
nbr_cache_add(&ipv6_buf->srcaddr,
|
||||
NULL ,0, NBR_STATUS_STALE,
|
||||
NBR_CACHE_TYPE_TEN,
|
||||
NBR_CACHE_LTIME_TEN, &llao[2]);
|
||||
NBR_CACHE_LTIME_TEN,
|
||||
(ieee_802154_short_t*)&llao[2]);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -594,9 +604,11 @@ void recv_nbr_sol(void){
|
||||
uint8_t flags = (NBR_ADV_FLAG_O | NBR_ADV_FLAG_S);
|
||||
init_nbr_adv(&(ipv6_buf->srcaddr), &(ipv6_buf->destaddr),
|
||||
&(alist_targ->addr), flags, 0, OPT_ARO, aro_state);
|
||||
#ifdef ENABLE_DEBUG
|
||||
printf("INFO: send neighbor advertisment to: ");
|
||||
ipv6_print_addr(&ipv6_buf->destaddr);
|
||||
output((ieee_802154_long_t*)&(ipv6_buf->destaddr.uint16[4]),(uint8_t*)ipv6_buf);
|
||||
#endif
|
||||
lowpan_init((ieee_802154_long_t*)&(ipv6_buf->destaddr.uint16[4]),(uint8_t*)ipv6_buf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -916,14 +928,3 @@ void plist_add(ipv6_addr_t *addr, uint8_t size, uint32_t val_ltime,
|
||||
prefix_count++;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t plist_search(ipv6_addr_t *addr){
|
||||
int i;
|
||||
for(i = 0; i < OPT_PI_LIST_LEN; i++){
|
||||
if(memcmp(&(plist[i].addr.uint8[0]), &addr->uint8[0], 16) == 0){
|
||||
return &plist[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -165,6 +165,7 @@ typedef struct __attribute__ ((packed)) def_rtr_lst_t {
|
||||
|
||||
void init_rtr_sol(uint8_t sllao);
|
||||
void recv_rtr_sol(void);
|
||||
void recv_rtr_adv(void);
|
||||
void init_rtr_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8_t pi,
|
||||
uint8_t sixco, uint8_t abro);
|
||||
uint8_t plist_search(ipv6_addr_t *addr);
|
||||
@ -185,6 +186,8 @@ void def_rtr_lst_add(ipv6_addr_t *ipaddr, uint32_t rtr_ltime);
|
||||
void def_rtr_lst_rem(def_rtr_lst_t *entry);
|
||||
void init_nbr_sol(ipv6_addr_t *src, ipv6_addr_t *dest, ipv6_addr_t *targ,
|
||||
uint8_t slloa, uint8_t aro);
|
||||
void init_nbr_adv(ipv6_addr_t *src, ipv6_addr_t *dst, ipv6_addr_t *tgt,
|
||||
uint8_t rso, uint8_t sllao, uint8_t aro, uint8_t aro_state);
|
||||
void plist_add(ipv6_addr_t *addr, uint8_t size, uint32_t val_ltime,
|
||||
uint32_t pref_ltime, uint8_t adv_opt, uint8_t l_a_reserved1);
|
||||
void recv_nbr_sol(void);
|
||||
|
||||
@ -16,7 +16,6 @@ uint8_t iface_addr_list_count = 0;
|
||||
uint16_t packet_length;
|
||||
uint8_t packet_dispatch;
|
||||
uint16_t tag;
|
||||
uint8_t packet_size = 0;
|
||||
uint8_t header_size = 0;
|
||||
uint8_t max_frame = 0;
|
||||
uint8_t max_frag_initial = 0;
|
||||
@ -46,7 +45,7 @@ char nc_buf[NC_STACKSIZE];
|
||||
lowpan_context_t contexts[LOWPAN_CONTEXT_MAX];
|
||||
|
||||
/* deliver packet to mac*/
|
||||
void output(ieee_802154_long_t *addr, uint8_t *data){
|
||||
void lowpan_init(ieee_802154_long_t *addr, uint8_t *data){
|
||||
ipv6_buf = get_ipv6_buf();
|
||||
uint8_t mcast = 0;
|
||||
|
||||
@ -57,21 +56,19 @@ void output(ieee_802154_long_t *addr, uint8_t *data){
|
||||
mcast = 1;
|
||||
}
|
||||
|
||||
//#ifdef LOWPAN_IPHC
|
||||
lowpan_iphc_encoding(&laddr);
|
||||
|
||||
data = &comp_buf[0];
|
||||
packet_length = comp_len;
|
||||
//lowpan_ipv6_set_dispatch(data);
|
||||
|
||||
//#endif
|
||||
//#ifndef LOWPAN_IPHC
|
||||
// lowpan_ipv6_set_dispatch(data);
|
||||
//#endif
|
||||
|
||||
//printf("comp len: %hu\n", comp_len);
|
||||
|
||||
packet_size = (uint8_t)packet_length;
|
||||
/* check if packet needs to be fragmented */
|
||||
if(packet_size + header_size > PAYLOAD_SIZE - IEEE_802154_MAX_HDR_LEN){
|
||||
// printf(" packet is to large, fragmentation started. size:"
|
||||
// " %hu byte\n", packet_length);
|
||||
|
||||
uint8_t fragbuf[packet_size + header_size];
|
||||
if(packet_length + header_size > PAYLOAD_SIZE - IEEE_802154_MAX_HDR_LEN){
|
||||
uint8_t fragbuf[packet_length + header_size];
|
||||
uint8_t remaining;
|
||||
uint8_t i = 2;
|
||||
/* first fragment */
|
||||
@ -87,15 +84,14 @@ void output(ieee_802154_long_t *addr, uint8_t *data){
|
||||
|
||||
send_ieee802154_frame(&laddr,(uint8_t*)&fragbuf,
|
||||
max_frag_initial + header_size + 4, mcast);
|
||||
// printf(" frag 1 size: %d byte\n", max_frag_initial);
|
||||
/* subsequent fragments */
|
||||
position = max_frag_initial;
|
||||
max_frag = ((max_frame - 5) / 8) * 8;
|
||||
|
||||
data += position;
|
||||
|
||||
while(packet_size - position > max_frame - 5){
|
||||
memset(&fragbuf,0,packet_size + header_size);
|
||||
while(packet_length - position > max_frame - 5){
|
||||
memset(&fragbuf,0,packet_length + header_size);
|
||||
memcpy(fragbuf + 5, data, max_frag);
|
||||
|
||||
fragbuf[0] = (((0xe0 << 8) | packet_length) >> 8) & 0xff;
|
||||
@ -112,9 +108,9 @@ void output(ieee_802154_long_t *addr, uint8_t *data){
|
||||
i++;
|
||||
}
|
||||
|
||||
remaining = packet_size - position;
|
||||
remaining = packet_length - position;
|
||||
|
||||
memset(&fragbuf,0,packet_size + header_size);
|
||||
memset(&fragbuf,0,packet_length + header_size);
|
||||
memcpy(fragbuf + 5, data, remaining);
|
||||
|
||||
fragbuf[0] = (((0xe0 << 8) | packet_length) >> 8) & 0xff;
|
||||
@ -125,13 +121,13 @@ void output(ieee_802154_long_t *addr, uint8_t *data){
|
||||
|
||||
send_ieee802154_frame(&laddr, (uint8_t*)&fragbuf, remaining + 5, mcast);
|
||||
} else {
|
||||
send_ieee802154_frame(&laddr, data, packet_size, mcast);
|
||||
send_ieee802154_frame(&laddr, data, packet_length, mcast);
|
||||
}
|
||||
|
||||
tag++;
|
||||
}
|
||||
|
||||
void input(uint8_t *data, uint8_t length, ieee_802154_long_t *s_laddr,
|
||||
void lowpan_read(uint8_t *data, uint8_t length, ieee_802154_long_t *s_laddr,
|
||||
ieee_802154_long_t *d_laddr){
|
||||
/* check if packet is fragmented */
|
||||
msg m;
|
||||
@ -139,6 +135,7 @@ void input(uint8_t *data, uint8_t length, ieee_802154_long_t *s_laddr,
|
||||
uint8_t datagram_offset = 0;
|
||||
uint16_t datagram_size = 0;
|
||||
uint16_t datagram_tag = 0;
|
||||
|
||||
/* check first 5-bit*/
|
||||
switch(data[0] & 0xf8) {
|
||||
/* first fragment */
|
||||
@ -191,12 +188,16 @@ void input(uint8_t *data, uint8_t length, ieee_802154_long_t *s_laddr,
|
||||
memcpy(reas_buf + byte_offset, data + hdr_length, byte_offset);
|
||||
if((byte_offset + frag_size) == datagram_size){
|
||||
if(reas_buf[0] == LOWPAN_IPV6_DISPATCH) {
|
||||
/* mutex lock here */
|
||||
// mutex_lock(&buf_mutex);
|
||||
ipv6_buf = get_ipv6_buf();
|
||||
memcpy(ipv6_buf, reas_buf + 1, datagram_size - 1);
|
||||
m.content.ptr = (char*) ipv6_buf;
|
||||
packet_length = datagram_size - 1;
|
||||
msg_send(&m,ip_process_pid, 1);
|
||||
} else if((reas_buf[0] & 0xe0) == LOWPAN_IPHC_DISPATCH) {
|
||||
/* mutex lock */
|
||||
// mutex_lock(&buf_mutex);
|
||||
lowpan_iphc_decoding(reas_buf, datagram_size, s_laddr, d_laddr);
|
||||
ipv6_buf = get_ipv6_buf();
|
||||
m.content.ptr = (char*) ipv6_buf;
|
||||
@ -209,6 +210,8 @@ void input(uint8_t *data, uint8_t length, ieee_802154_long_t *s_laddr,
|
||||
}
|
||||
default:{
|
||||
if(data[0] == LOWPAN_IPV6_DISPATCH){
|
||||
/* mutex lock here */
|
||||
// mutex_lock(&buf_mutex);
|
||||
ipv6_buf = get_ipv6_buf();
|
||||
memcpy(ipv6_buf, data + 1, length - 1);
|
||||
m.content.ptr = (char*) ipv6_buf;
|
||||
@ -216,6 +219,8 @@ void input(uint8_t *data, uint8_t length, ieee_802154_long_t *s_laddr,
|
||||
msg_send(&m,ip_process_pid, 1);
|
||||
break;
|
||||
} else if((data[0] & 0xe0) == LOWPAN_IPHC_DISPATCH){
|
||||
/* mutex lock here */
|
||||
// mutex_lock(&buf_mutex);
|
||||
lowpan_iphc_decoding(data, length, s_laddr, d_laddr);
|
||||
ipv6_buf = get_ipv6_buf();
|
||||
m.content.ptr = (char*) ipv6_buf;
|
||||
@ -383,7 +388,7 @@ void lowpan_iphc_encoding(ieee_802154_long_t *dest){
|
||||
}
|
||||
} else {
|
||||
/* full address carried inline */
|
||||
memcpy(&ipv6_hdr_fields[hdr_pos], &(ipv6_buf->srcaddr.uint8[0]), 8);
|
||||
memcpy(&ipv6_hdr_fields[hdr_pos], &(ipv6_buf->srcaddr.uint8[0]), 16);
|
||||
hdr_pos += 16;
|
||||
}
|
||||
|
||||
@ -512,6 +517,9 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length,
|
||||
uint8_t sci = 0;
|
||||
uint8_t dci = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
uint8_t ll_prefix[2] = {0xfe, 0x80};
|
||||
uint8_t m_prefix[2] = {0xff, 0x02};
|
||||
lowpan_context_t *con;
|
||||
@ -823,7 +831,6 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length,
|
||||
|
||||
/* ipv6 length */
|
||||
ipv6_buf->length = length - hdr_pos;
|
||||
|
||||
packet_length = IPV6_HDR_LEN + ipv6_buf->length;
|
||||
}
|
||||
|
||||
@ -856,10 +863,10 @@ void sixlowpan_init(transceiver_type_t trans, uint8_t r_addr){
|
||||
set_radio_address(r_addr);
|
||||
init_802154_short_addr(&(iface.saddr));
|
||||
init_802154_long_addr(&(iface.laddr));
|
||||
/* init global buffer mutex */
|
||||
mutex_init(&buf_mutex);
|
||||
//create_link_local_prefix(&(iface.ipaddr));
|
||||
//memcpy(&(iface.ipaddr.uint8[8]), &iface.laddr, 8);
|
||||
|
||||
/* init link-local address and network prefix */
|
||||
ipv6_set_ll_prefix(&loaddr);
|
||||
ipv6_addr_t prefix, tmp;
|
||||
ipv6_init_address(&tmp, 0xabcd,0,0,0,0,0,0,0);
|
||||
@ -870,13 +877,10 @@ void sixlowpan_init(transceiver_type_t trans, uint8_t r_addr){
|
||||
ipv6_iface_add_addr(&loaddr, ADDR_STATE_PREFERRED, 0, 0,
|
||||
ADDR_CONFIGURED_AUTO);
|
||||
|
||||
//ipv6_print_addr(&loaddr);
|
||||
|
||||
ip_process_pid = thread_create(ip_process_buf, IP_PROCESS_STACKSIZE,
|
||||
PRIORITY_MAIN-1, CREATE_STACKTEST,
|
||||
ipv6_process, "ip_process");
|
||||
nd_nbr_cache_rem_pid = thread_create(nc_buf, NC_STACKSIZE,
|
||||
PRIORITY_MAIN-1, CREATE_STACKTEST,
|
||||
nbr_cache_auto_rem, "nbr_cache_rem");
|
||||
//send_ieee802154_frame(); */
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
#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
|
||||
|
||||
@ -30,8 +29,8 @@ typedef struct lowpan_context_t {
|
||||
} lowpan_context_t;
|
||||
|
||||
void sixlowpan_init(transceiver_type_t trans, uint8_t r_addr);
|
||||
void output(ieee_802154_long_t *addr, uint8_t *data);
|
||||
void input(uint8_t *data, uint8_t length, ieee_802154_long_t *s_laddr,
|
||||
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,
|
||||
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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user