This is an initial commit of an implementation of the Chameleon

architecture for the Rime stack for Contiki. The Chameleon
architecture separates the header processing from the Rime protocol
logic. Instead of having each protocol create its own part of the
packet header, protocols use packet attributes. Before sending a
packet, a special Chameleon header processing module creates a packet
header from the packet attributes. The same Chameleon module parses
incoming packets and creates packet attributes from the header.

The details are in our SenSys 2007 paper:

Adam Dunkels, Fredrik Osterlind, Zhitao He. An Adaptive Communication
Architecture for Wireless Sensor Networks. In Proceedings of the Fifth
ACM Conference on Networked Embedded Sensor Systems (SenSys 2007),
Sydney, Australia, November 2007.

http://www.sics.se/~adam/dunkels07adaptive.pdf

This is a rewrite of the code that was developed for the paper.
This commit is contained in:
adamdunkels 2008-02-25 02:14:34 +00:00
parent 39abed8672
commit 412facb831
29 changed files with 1357 additions and 159 deletions

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: xmac.c,v 1.17 2008/02/24 22:10:30 adamdunkels Exp $
* $Id: xmac.c,v 1.18 2008/02/25 02:14:35 adamdunkels Exp $
*/
/**
@ -58,20 +58,10 @@
#endif
#define WITH_TIMETABLE 0
#define WITH_CHANNEL_CHECK 0 /* Seems to work bad when enabled */
#define WITH_CHANNEL_CHECK 0 /* Seems to work badly when enabled */
#define WITH_TIMESYNCH 0
#define WITH_RECEIVER 1
#define WITH_QUEUE 0
#if !CHAMELEON
#if WITH_RECEIVER
extern
#else
static
#endif
rimeaddr_t uc_receiver;
#endif /* !CHAMELEON */
struct xmac_hdr {
rimeaddr_t sender;
rimeaddr_t receiver;
@ -306,11 +296,7 @@ send_packet(void)
rimebuf_hdralloc(sizeof(struct xmac_hdr));
hdr = rimebuf_hdrptr();
rimeaddr_copy(&hdr->sender, &rimeaddr_node_addr);
#if CHAMELEON
rimeaddr_copy(&hdr->receiver, packattr_aget(PACKATTR_RECEIVER));
#else
rimeaddr_copy(&hdr->receiver, &uc_receiver);
#endif
rimeaddr_copy(&hdr->receiver, rimebuf_addr(RIMEBUF_ADDR_RECEIVER));
rimebuf_compact();
t0 = RTIMER_NOW();
@ -336,11 +322,7 @@ send_packet(void)
t = RTIMER_NOW();
rimeaddr_copy(&msg.sender, &rimeaddr_node_addr);
#if CHAMELEON
rimeaddr_copy(&msg.receiver, packattr_aget(PACKATTR_RECEIVER));
#else
rimeaddr_copy(&msg.receiver, &uc_receiver);
#endif
rimeaddr_copy(&msg.receiver, rimebuf_addr(RIMEBUF_ADDR_RECEIVER));
#if WITH_TIMETABLE
if(rimeaddr_cmp(&msg.receiver, &rimeaddr_null)) {