Merge branch 'contiki' into osd
This commit is contained in:
commit
a02be51f08
274 changed files with 1159 additions and 1285 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, Fraunhofer Heinrich-Hertz-Institut.
|
||||
* Copyright (c) 2010, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -26,6 +26,8 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -78,6 +80,12 @@ struct hdr {
|
|||
uint8_t len;
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
hdr_length(void)
|
||||
{
|
||||
return DECORATED_FRAMER.length() + sizeof(struct hdr);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
create(void)
|
||||
|
@ -172,6 +180,7 @@ parse(void)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
const struct framer contikimac_framer = {
|
||||
hdr_length,
|
||||
create,
|
||||
create_and_secure,
|
||||
parse
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, Fraunhofer Heinrich-Hertz-Institut.
|
||||
* Copyright (c) 2010, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -26,6 +26,8 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -522,7 +522,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
|
|||
/* If NETSTACK_CONF_BRIDGE_MODE is set, assume PACKETBUF_ADDR_SENDER is already set. */
|
||||
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr);
|
||||
#endif
|
||||
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) {
|
||||
if(packetbuf_holds_broadcast()) {
|
||||
is_broadcast = 1;
|
||||
PRINTDEBUG("contikimac: send broadcast\n");
|
||||
|
||||
|
@ -530,7 +530,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
|
|||
return MAC_TX_COLLISION;
|
||||
}
|
||||
} else {
|
||||
#if UIP_CONF_IPV6
|
||||
#if NETSTACK_CONF_WITH_IPV6
|
||||
PRINTDEBUG("contikimac: send unicast to %02x%02x:%02x%02x:%02x%02x:%02x%02x\n",
|
||||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0],
|
||||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1],
|
||||
|
@ -540,11 +540,11 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
|
|||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[5],
|
||||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[6],
|
||||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[7]);
|
||||
#else /* UIP_CONF_IPV6 */
|
||||
#else /* NETSTACK_CONF_WITH_IPV6 */
|
||||
PRINTDEBUG("contikimac: send unicast to %u.%u\n",
|
||||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0],
|
||||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]);
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
||||
}
|
||||
is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
||||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);
|
||||
|
@ -878,8 +878,7 @@ input_packet(void)
|
|||
packetbuf_totlen() > 0 &&
|
||||
(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
|
||||
&linkaddr_node_addr) ||
|
||||
linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
|
||||
&linkaddr_null))) {
|
||||
packetbuf_holds_broadcast())) {
|
||||
/* This is a regular packet that is destined to us or to the
|
||||
broadcast address. */
|
||||
|
||||
|
|
|
@ -433,11 +433,11 @@ send_packet(void)
|
|||
/* If NETSTACK_CONF_BRIDGE_MODE is set, assume PACKETBUF_ADDR_SENDER is already set. */
|
||||
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr);
|
||||
#endif
|
||||
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) {
|
||||
if(packetbuf_holds_broadcast()) {
|
||||
is_broadcast = 1;
|
||||
PRINTDEBUG("cxmac: send broadcast\n");
|
||||
} else {
|
||||
#if UIP_CONF_IPV6
|
||||
#if NETSTACK_CONF_WITH_IPV6
|
||||
PRINTDEBUG("cxmac: send unicast to %02x%02x:%02x%02x:%02x%02x:%02x%02x\n",
|
||||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0],
|
||||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1],
|
||||
|
@ -451,7 +451,7 @@ send_packet(void)
|
|||
PRINTDEBUG("cxmac: send unicast to %u.%u\n",
|
||||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0],
|
||||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]);
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
||||
}
|
||||
/* is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
||||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);*/
|
||||
|
|
|
@ -104,7 +104,7 @@ create_frame(int type, int do_create)
|
|||
/* Build the FCF. */
|
||||
params.fcf.frame_type = packetbuf_attr(PACKETBUF_ATTR_FRAME_TYPE);
|
||||
params.fcf.frame_pending = packetbuf_attr(PACKETBUF_ATTR_PENDING);
|
||||
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) {
|
||||
if(packetbuf_holds_broadcast()) {
|
||||
params.fcf.ack_required = 0;
|
||||
} else {
|
||||
params.fcf.ack_required = packetbuf_attr(PACKETBUF_ATTR_MAC_ACK);
|
||||
|
@ -159,11 +159,7 @@ create_frame(int type, int do_create)
|
|||
}
|
||||
params.dest_pid = mac_dst_pan_id;
|
||||
|
||||
/*
|
||||
* If the output address is NULL in the Rime buf, then it is broadcast
|
||||
* on the 802.15.4 network.
|
||||
*/
|
||||
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) {
|
||||
if(packetbuf_holds_broadcast()) {
|
||||
/* Broadcast requires short address mode. */
|
||||
params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE;
|
||||
params.dest_addr[0] = 0xFF;
|
||||
|
|
|
@ -132,8 +132,7 @@ send_one_packet(mac_callback_t sent, void *ptr)
|
|||
|
||||
NETSTACK_RADIO.prepare(packetbuf_hdrptr(), packetbuf_totlen());
|
||||
|
||||
is_broadcast = linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
|
||||
&linkaddr_null);
|
||||
is_broadcast = packetbuf_holds_broadcast();
|
||||
|
||||
if(NETSTACK_RADIO.receiving_packet() ||
|
||||
(!is_broadcast && NETSTACK_RADIO.pending_packet())) {
|
||||
|
@ -282,8 +281,7 @@ packet_input(void)
|
|||
#if NULLRDC_ADDRESS_FILTER
|
||||
} else if(!linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
|
||||
&linkaddr_node_addr) &&
|
||||
!linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
|
||||
&linkaddr_null)) {
|
||||
!packetbuf_holds_broadcast()) {
|
||||
PRINTF("nullrdc: not for us\n");
|
||||
#endif /* NULLRDC_ADDRESS_FILTER */
|
||||
} else {
|
||||
|
|
|
@ -123,11 +123,7 @@ send_packet(mac_callback_t sent, void *ptr)
|
|||
params.fcf.src_addr_mode = FRAME802154_LONGADDRMODE;
|
||||
params.dest_pid = mac_dst_pan_id;
|
||||
|
||||
/*
|
||||
* If the output address is NULL in the Rime buf, then it is broadcast
|
||||
* on the 802.15.4 network.
|
||||
*/
|
||||
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) {
|
||||
if(packetbuf_holds_broadcast()) {
|
||||
/* Broadcast requires short address mode. */
|
||||
params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE;
|
||||
params.dest_addr[0] = 0xFF;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue