1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 14:33:52 +01:00

Merge pull request #1056 from thomaseichinger/pkg-openwsn

pkg: openwsn: update with iot-lab_M3 support and split patch files
This commit is contained in:
Thomas Eichinger 2014-05-14 15:11:42 +02:00
commit e8e7f3ab6e
157 changed files with 19231 additions and 38442 deletions

View File

@ -21,13 +21,14 @@ endif
.PHONY: all clean
all: $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/
$(info *INFO* Building OpenWSN pkg)
make -C $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)
$(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/: $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT)
$(AD)rm -rf $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)
$(AD)$(UNPACK) $< -d $(PKG_NAME)-$(PKG_VERSION)
$(AD)$(UNPACK) -q $< -d $(PKG_NAME)-$(PKG_VERSION)
$(AD)cd $@ && sh ../structure_changes.sh
$(AD)cd $@ && patch -p0 -N -i ../patch.txt
$(AD)cd $@ && sh ../apply_patches.sh
$(CURDIR)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT):
# Get PKG_VERSION of package from PKG_URL

View File

@ -0,0 +1 @@
export INCLUDES += -I${RIOTBASE}/drivers/include/

View File

@ -1,8 +1,32 @@
# OpenWSN on RIOT
This port of OpenWSN to RIOT is based on release RB-1.4 with backported support
for the iot-lab_M3 board from the develop branch.
# Compatibility
This port of the openwsn stack is compatible with the TelosB board only for now.
This port of the openwsn stack is compatible with the iot-lab_M3 board only for now.
The TelosB board support was temporarily dropped but will return soon again.
The hardware dependency will be reduced in the future and thous running on more
hardware platforms.
# Usage
A test can be found in the [projects repository](https://github.com/RIOT-OS/projects/)
named ```test_openwsn_pkg``` with an example ```Makefile```.
named ```test_openwsn_pkg``` with an example ```Makefile```.
Build using
```Bash
$> export BOARD=iot-lab_M3
$> export PORT=/dev/ttyTHEPORTOFYOURIOTLAB
$> make -B clean flash
```
To use OpenWSN with RIOT it has to be added to the used packages variable
```Makefile
USEPKG += openwsn
```
On the first build the archive will be fetched, patched and built.
**WARNING** A call of `make clean` also cleans the OpenWSN tree right now so
changes to the source code will be lost in the next build.

View File

@ -0,0 +1,14 @@
#!/usr/bin/env sh
set -o nounset # Treat unset variables as an error
if [[ $QUIET == "1" ]]; then
for i in `ls ../patches`; do
patch -p1 -N -i ../patches/$i > /dev/null
done
else
for i in `ls ../patches`; do
patch -p1 -N -i ../patches/$i
done
fi
exit 0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,235 @@
*** stock_iot-lab_M3/openwsn/02a-MAClow/IEEE802154.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02a-MAClow/IEEE802154.c Thu Mar 27 11:10:40 2014
***************
*** 16,35 ****
Note that we are writing the field from the end of the header to the beginning.
! \param msg [in,out] The message to append the header to.
! \param frameType [in] Type of IEEE802.15.4 frame.
! \param securityEnabled [in] Is security enabled on this frame?
! \param nextHop [in] Address of the next hop
*/
void ieee802154_prependHeader(OpenQueueEntry_t* msg,
uint8_t frameType,
bool securityEnabled,
uint8_t sequenceNumber,
open_addr_t* nextHop) {
uint8_t temp_8b;
// previousHop address (always 64-bit)
! packetfunctions_writeAddress(msg,idmanager_getMyID(ADDR_64B),LITTLE_ENDIAN);
// nextHop address
if (packetfunctions_isBroadcastMulticast(nextHop)) {
//broadcast address is always 16-bit
--- 16,42 ----
Note that we are writing the field from the end of the header to the beginning.
! \param[in,out] msg The message to append the header to.
! \param[in] frameType Type of IEEE802.15.4 frame.
! \param[in] ielistpresent Is the IE list present¿
! \param[in] frameVersion IEEE802.15.4 frame version.
! \param[in] securityEnabled Is security enabled on this frame?
! \param[in] sequenceNumber Sequence number of this frame.
! \param[in] nextHop Address of the next hop
*/
void ieee802154_prependHeader(OpenQueueEntry_t* msg,
uint8_t frameType,
+ uint8_t ielistpresent,
+ uint8_t frameversion,
bool securityEnabled,
uint8_t sequenceNumber,
open_addr_t* nextHop) {
uint8_t temp_8b;
+ //General IEs here (those that are carried in all packets) -- None by now.
+
// previousHop address (always 64-bit)
! packetfunctions_writeAddress(msg,idmanager_getMyID(ADDR_64B),OW_LITTLE_ENDIAN);
// nextHop address
if (packetfunctions_isBroadcastMulticast(nextHop)) {
//broadcast address is always 16-bit
***************
*** 41,47 ****
switch (nextHop->type) {
case ADDR_16B:
case ADDR_64B:
! packetfunctions_writeAddress(msg,nextHop,LITTLE_ENDIAN);
break;
default:
openserial_printCritical(COMPONENT_IEEE802154,ERR_WRONG_ADDR_TYPE,
--- 48,54 ----
switch (nextHop->type) {
case ADDR_16B:
case ADDR_64B:
! packetfunctions_writeAddress(msg,nextHop,OW_LITTLE_ENDIAN);
break;
default:
openserial_printCritical(COMPONENT_IEEE802154,ERR_WRONG_ADDR_TYPE,
***************
*** 51,57 ****
}
// destpan
! packetfunctions_writeAddress(msg,idmanager_getMyID(ADDR_PANID),LITTLE_ENDIAN);
//dsn
packetfunctions_reserveHeaderSize(msg,sizeof(uint8_t));
*((uint8_t*)(msg->payload)) = sequenceNumber;
--- 58,64 ----
}
// destpan
! packetfunctions_writeAddress(msg,idmanager_getMyID(ADDR_PANID),OW_LITTLE_ENDIAN);
//dsn
packetfunctions_reserveHeaderSize(msg,sizeof(uint8_t));
*((uint8_t*)(msg->payload)) = sequenceNumber;
***************
*** 72,77 ****
--- 79,88 ----
}
}
temp_8b |= IEEE154_ADDR_EXT << IEEE154_FCF_SRC_ADDR_MODE;
+ //poipoi xv IE list present
+ temp_8b |= ielistpresent << IEEE154_FCF_IELIST_PRESENT;
+ temp_8b |= frameversion << IEEE154_FCF_FRAME_VERSION;
+
*((uint8_t*)(msg->payload)) = temp_8b;
//fcf (1st byte)
packetfunctions_reserveHeaderSize(msg,sizeof(uint8_t));
***************
*** 93,100 ****
Note We are writing the fields from the begnning of the header to the end.
! \param msg [in,out] The message just received.
! \param ieee802514_header [out] The internal header to write the data to.
*/
void ieee802154_retrieveHeader(OpenQueueEntry_t* msg,
ieee802154_header_iht* ieee802514_header) {
--- 104,111 ----
Note We are writing the fields from the begnning of the header to the end.
! \param[in,out] msg The message just received.
! \param[out] ieee802514_header The internal header to write the data to.
*/
void ieee802154_retrieveHeader(OpenQueueEntry_t* msg,
ieee802154_header_iht* ieee802514_header) {
***************
*** 117,122 ****
--- 128,141 ----
// fcf, byte 2
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
temp_8b = *((uint8_t*)(msg->payload)+ieee802514_header->headerLength);
+ //poipoi xv IE list present
+ ieee802514_header->ieListPresent = (temp_8b >> IEEE154_FCF_IELIST_PRESENT ) & 0x01;//1b
+ ieee802514_header->frameVersion = (temp_8b >> IEEE154_FCF_FRAME_VERSION ) & 0x03;//2b
+
+ if (ieee802514_header->ieListPresent==TRUE && ieee802514_header->frameVersion!=IEEE154_FRAMEVERSION){
+ return; //invalid packet accordint to p.64 IEEE15.4e
+ }
+
switch ( (temp_8b >> IEEE154_FCF_DEST_ADDR_MODE ) & 0x03 ) {
case IEEE154_ADDR_NONE:
ieee802514_header->dest.type = ADDR_NONE;
***************
*** 159,165 ****
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
ADDR_PANID,
&ieee802514_header->panid,
! LITTLE_ENDIAN);
ieee802514_header->headerLength += 2;
// dest
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
--- 178,184 ----
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
ADDR_PANID,
&ieee802514_header->panid,
! OW_LITTLE_ENDIAN);
ieee802514_header->headerLength += 2;
// dest
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
***************
*** 171,177 ****
((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
ADDR_16B,
&ieee802514_header->dest,
! LITTLE_ENDIAN
);
ieee802514_header->headerLength += 2;
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
--- 190,196 ----
((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
ADDR_16B,
&ieee802514_header->dest,
! OW_LITTLE_ENDIAN
);
ieee802514_header->headerLength += 2;
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
***************
*** 180,186 ****
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
ADDR_64B,
&ieee802514_header->dest,
! LITTLE_ENDIAN);
ieee802514_header->headerLength += 8;
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
break;
--- 199,205 ----
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
ADDR_64B,
&ieee802514_header->dest,
! OW_LITTLE_ENDIAN);
ieee802514_header->headerLength += 8;
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
break;
***************
*** 194,200 ****
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
ADDR_16B,
&ieee802514_header->src,
! LITTLE_ENDIAN);
ieee802514_header->headerLength += 2;
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
break;
--- 213,219 ----
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
ADDR_16B,
&ieee802514_header->src,
! OW_LITTLE_ENDIAN);
ieee802514_header->headerLength += 2;
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
break;
***************
*** 202,213 ****
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
ADDR_64B,
&ieee802514_header->src,
! LITTLE_ENDIAN);
ieee802514_header->headerLength += 8;
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
break;
// no need for a default, since case would have been caught above
}
// apply topology filter
if (topology_isAcceptablePacket(ieee802514_header)==FALSE) {
// the topology filter does accept this packet, return
--- 221,237 ----
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
ADDR_64B,
&ieee802514_header->src,
! OW_LITTLE_ENDIAN);
ieee802514_header->headerLength += 8;
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
break;
// no need for a default, since case would have been caught above
}
+
+ if (ieee802514_header->ieListPresent==TRUE && ieee802514_header->frameVersion!=IEEE154_FRAMEVERSION){
+ return; //invalid packet accordint to p.64 IEEE15.4e
+ }
+
// apply topology filter
if (topology_isAcceptablePacket(ieee802514_header)==FALSE) {
// the topology filter does accept this packet, return

View File

@ -0,0 +1,93 @@
*** stock_iot-lab_M3/openwsn/02a-MAClow/IEEE802154.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02a-MAClow/IEEE802154.h Thu Apr 24 16:55:54 2014
***************
*** 2,8 ****
#define __IEEE802154_H
/**
! \addtogroup helpers
\{
\addtogroup IEEE802154
\{
--- 2,8 ----
#define __IEEE802154_H
/**
! \addtogroup MAClow
\{
\addtogroup IEEE802154
\{
***************
*** 18,27 ****
--- 18,36 ----
IEEE154_FCF_FRAME_PENDING = 4,
IEEE154_FCF_ACK_REQ = 5,
IEEE154_FCF_INTRAPAN = 6,
+ IEEE154_FCF_IELIST_PRESENT = 1,
IEEE154_FCF_DEST_ADDR_MODE = 2,
+ IEEE154_FCF_FRAME_VERSION = 4,
IEEE154_FCF_SRC_ADDR_MODE = 6,
};
+
+ enum IEEE802154_fcf_frameversion_enums {
+ IEEE154_FRAMEVERSION_2003 = 0, //ieee154-2003
+ IEEE154_FRAMEVERSION_2006 = 1, //ieee154-2006
+ IEEE154_FRAMEVERSION = 2, //ieee154
+ };
+
enum IEEE802154_fcf_type_enums {
IEEE154_TYPE_BEACON = 0,
IEEE154_TYPE_DATA = 1,
***************
*** 35,40 ****
--- 44,54 ----
IEEE154_SEC_YES_SECURITY = 1,
};
+ enum IEEE802154_fcf_ielist_enums {
+ IEEE154_IELIST_NO = 0,
+ IEEE154_IELIST_YES = 1,
+ };
+
enum IEEE802154_fcf_pending_enums {
IEEE154_PENDING_NO_FRAMEPENDING = 0,
IEEE154_PENDING_YES_FRAMEPENDING = 1,
***************
*** 66,71 ****
--- 80,87 ----
bool framePending;
bool ackRequested;
bool panIDCompression;
+ bool ieListPresent;
+ uint8_t frameVersion;
uint8_t dsn;
open_addr_t panid;
open_addr_t dest;
***************
*** 78,88 ****
//=========================== prototypes ======================================
! void ieee802154_prependHeader (OpenQueueEntry_t* msg,
! uint8_t frameType,
! bool securityEnabled,
! uint8_t sequenceNumber,
! open_addr_t* nextHop);
void ieee802154_retrieveHeader (OpenQueueEntry_t* msg,
ieee802154_header_iht* ieee802514_header);
--- 94,107 ----
//=========================== prototypes ======================================
! void ieee802154_prependHeader(OpenQueueEntry_t* msg,
! uint8_t frameType,
! uint8_t ielistpresent,
! uint8_t frameversion,
! bool securityEnabled,
! uint8_t sequenceNumber,
! open_addr_t* nextHop);
!
void ieee802154_retrieveHeader (OpenQueueEntry_t* msg,
ieee802154_header_iht* ieee802514_header);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,265 @@
*** stock_iot-lab_M3/openwsn/02a-MAClow/IEEE802154E.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02a-MAClow/IEEE802154E.h Thu Apr 24 16:55:54 2014
***************
*** 10,21 ****
#include "openwsn.h"
#include "board_info.h"
//=========================== debug define ====================================
//=========================== define ==========================================
! #define SYNCHRONIZING_CHANNEL 20 // channel the mote listens on to synchronize
#define TXRETRIES 3 // number of MAC retries before declaring failed
#define TX_POWER 31 // 1=-25dBm, 31=0dBm (max value)
#define RESYNCHRONIZATIONGUARD 5 // in 32kHz ticks. min distance to the end of the slot to succesfully synchronize
--- 10,22 ----
#include "openwsn.h"
#include "board_info.h"
+ #include "schedule.h"
//=========================== debug define ====================================
//=========================== define ==========================================
! #define SYNCHRONIZING_CHANNEL 0x1a // channel the mote listens on to synchronize
#define TXRETRIES 3 // number of MAC retries before declaring failed
#define TX_POWER 31 // 1=-25dBm, 31=0dBm (max value)
#define RESYNCHRONIZATIONGUARD 5 // in 32kHz ticks. min distance to the end of the slot to succesfully synchronize
***************
*** 25,30 ****
--- 26,79 ----
#define LIMITLARGETIMECORRECTION 5 // threshold number of ticks to declare a timeCorrection "large"
#define LENGTH_IEEE154_MAX 128 // max length of a valid radio packet
+ //15.4e information elements related
+ #define IEEE802154E_PAYLOAD_DESC_LEN_SHIFT 0x04
+ #define IEEE802154E_PAYLOAD_DESC_GROUP_ID_MLME (0x01 << 1) //includes shift 1
+ #define IEEE802154E_DESC_TYPE_LONG 0x01
+ #define IEEE802154E_DESC_TYPE_SHORT 0x00
+
+ #define IEEE802154E_DESC_TYPE_HEADER_IE 0x00
+ #define IEEE802154E_DESC_TYPE_PAYLOAD_IE 0x01
+ //len field on PAYLOAD/HEADER DESC
+ #define IEEE802154E_DESC_LEN_HEADER_IE_MASK 0xFE00
+ #define IEEE802154E_DESC_LEN_PAYLOAD_IE_MASK 0xFFE0
+
+ #define IEEE802154E_DESC_LEN_HEADER_IE_SHIFT 9
+ #define IEEE802154E_DESC_LEN_PAYLOAD_IE_SHIFT 5
+
+ //groupID/elementID field on PAYLOAD/HEADER DESC
+ #define IEEE802154E_DESC_ELEMENTID_HEADER_IE_MASK 0x01FE
+ #define IEEE802154E_DESC_GROUPID_PAYLOAD_IE_MASK 0x001E
+
+ #define IEEE802154E_DESC_ELEMENTID_HEADER_IE_SHIFT 1
+ #define IEEE802154E_DESC_GROUPID_PAYLOAD_IE_SHIFT 1
+
+ //MLME Sub IE LONG page 83
+ #define IEEE802154E_DESC_LEN_LONG_MLME_IE_MASK 0xFFE0
+ #define IEEE802154E_DESC_SUBID_LONG_MLME_IE_MASK 0x001E
+
+ #define IEEE802154E_DESC_LEN_LONG_MLME_IE_SHIFT 5
+ #define IEEE802154E_DESC_SUBID_LONG_MLME_IE_SHIFT 1
+
+ //MLME Sub IE SHORT page 82
+ #define IEEE802154E_DESC_LEN_SHORT_MLME_IE_MASK 0xFF00
+ #define IEEE802154E_DESC_SUBID_SHORT_MLME_IE_MASK 0x00FE
+
+ #define IEEE802154E_DESC_LEN_SHORT_MLME_IE_SHIFT 8
+ #define IEEE802154E_DESC_SUBID_SHORT_MLME_IE_SHIFT 1
+
+
+ #define IEEE802154E_MLME_SYNC_IE_SUBID 0x1A
+ #define IEEE802154E_MLME_SYNC_IE_SUBID_SHIFT 1
+ #define IEEE802154E_MLME_SLOTFRAME_LINK_IE_SUBID 0x1B
+ #define IEEE802154E_MLME_SLOTFRAME_LINK_IE_SUBID_SHIFT 1
+ #define IEEE802154E_MLME_TIMESLOT_IE_SUBID 0x1c
+ #define IEEE802154E_MLME_TIMESLOT_IE_SUBID_SHIFT 1
+
+ #define IEEE802154E_MLME_IE_GROUPID 0x01
+ #define IEEE802154E_ACK_NACK_TIMECORRECTION_ELEMENTID 0x1E
+
+ #define IEEE802154E_
/**
When a packet is received, it is written inside the OpenQueueEntry_t->packet
buffer, starting at the byte defined below. When a packet is relayed, it
***************
*** 81,86 ****
--- 130,136 ----
TsLongGT = 43, // 1300us
TsTxAckDelay = 151, // 4606us
TsShortGT = 16, // 500us
+ // TsShortGT = 30, // 900us, stm32 can work well with this value
TsSlotDuration = PORT_TsSlotDuration, // 15000us
// execution speed related
maxTxDataPrepare = PORT_maxTxDataPrepare,
***************
*** 97,102 ****
--- 147,159 ----
};
+ //shift of bytes in the linkOption bitmap
+ enum ieee154e_linkOption_enum {
+ FLAG_TX_S = 7,
+ FLAG_RX_S = 6,
+ FLAG_SHARED_S = 5,
+ FLAG_TIMEKEEPING_S = 4,
+ };
// FSM timer durations (combinations of atomic durations)
// TX
***************
*** 125,150 ****
PORT_SIGNED_INT_WIDTH timeCorrection;
} IEEE802154E_ACK_ht;
! #define ADV_PAYLOAD_LENGTH 5
! //=========================== variables =======================================
//=========================== prototypes ======================================
// admin
! void ieee154e_init();
// public
! PORT_TIMER_WIDTH ieee154e_asnDiff(asn_t* someASN);
! bool ieee154e_isSynch();
! void asnWriteToPkt(OpenQueueEntry_t* frame);
! void asnWriteToSerial(uint8_t* array);
// events
! void ieee154e_startOfFrame(PORT_TIMER_WIDTH capturedTime);
! void ieee154e_endOfFrame(PORT_TIMER_WIDTH capturedTime);
// misc
! bool debugPrint_asn();
! bool debugPrint_isSync();
! bool debugPrint_macStats();
/**
\}
--- 182,304 ----
PORT_SIGNED_INT_WIDTH timeCorrection;
} IEEE802154E_ACK_ht;
! //includes payload header IE short + MLME short Header + Sync IE
! #define ADV_PAYLOAD_LENGTH sizeof(payload_IE_descriptor_t) + \
! sizeof(MLME_IE_subHeader_t) + \
! sizeof(synch_IE_t)
!
!
!
!
! //=========================== module variables ================================
!
! typedef struct {
! // misc
! asn_t asn; // current absolute slot number
! slotOffset_t slotOffset; // current slot offset
! slotOffset_t nextActiveSlotOffset; // next active slot offset
! PORT_RADIOTIMER_WIDTH deSyncTimeout; // how many slots left before looses sync
! bool isSync; // TRUE iff mote is synchronized to network
! // as shown on the chronogram
! ieee154e_state_t state; // state of the FSM
! OpenQueueEntry_t* dataToSend; // pointer to the data to send
! OpenQueueEntry_t* dataReceived; // pointer to the data received
! OpenQueueEntry_t* ackToSend; // pointer to the ack to send
! OpenQueueEntry_t* ackReceived; // pointer to the ack received
! PORT_RADIOTIMER_WIDTH lastCapturedTime; // last captured time
! PORT_RADIOTIMER_WIDTH syncCapturedTime; // captured time used to sync
! //channel hopping
! uint8_t freq; // frequency of the current slot
! uint8_t asnOffset; // offset inside the frame
!
! PORT_RADIOTIMER_WIDTH radioOnInit; //when within the slot the radio turns on
! PORT_RADIOTIMER_WIDTH radioOnTics;//how many tics within the slot the radio is on
! bool radioOnThisSlot; //to control if the radio has been turned on in a slot.
! } ieee154e_vars_t;
!
! PRAGMA(pack(1));
! typedef struct {
! uint8_t numSyncPkt; // how many times synchronized on a non-ACK packet
! uint8_t numSyncAck; // how many times synchronized on an ACK
! PORT_SIGNED_INT_WIDTH minCorrection; // minimum time correction
! PORT_SIGNED_INT_WIDTH maxCorrection; // maximum time correction
! uint8_t numDeSync; // number of times a desync happened
! float dutyCycle; // mac dutyCycle at each superframe
! } ieee154e_stats_t;
! PRAGMA(pack());
! typedef struct {
! PORT_RADIOTIMER_WIDTH num_newSlot;
! PORT_RADIOTIMER_WIDTH num_timer;
! PORT_RADIOTIMER_WIDTH num_startOfFrame;
! PORT_RADIOTIMER_WIDTH num_endOfFrame;
! } ieee154e_dbg_t;
!
!
! //=========================== IEs =============================================
! //the header for all header IEs
! typedef struct{
! uint16_t length_elementid_type;
! }header_IE_descriptor_t;
! //header descriptor. elementid will be 0 as described in 15.4e pag. 81
! //type is 0 as described on p. 80
!
!
! //the content for ack ie -- it is a header IE with values - element id =0x1e len=2 type=0
! PRAGMA(pack(1));
! typedef struct {
! int16_t timesync_info;
! }ack_timecorrection_IE_t;
! PRAGMA(pack());
! //the header for all payload IEs
!
!
! typedef struct{//11b len 4b gid 1b type
! uint16_t length_groupid_type; //bytes on the IE content- that is the embedded MLME or Header IE.
! //groupid == 0x01 MLME | type long = 1
! }payload_IE_descriptor_t; // payload descriptor. groupid will be 1 as described in 15.4e pag. 81
!
! //MLME sub id header appended to payload descriptor. we use group id=1 type=1
! typedef struct{
! uint16_t length_subID_type;
! }MLME_IE_subHeader_t;
!
! //the Synchronization IE. it is a payload IE with values - subid=0x1a type=0 (short) len=6
! PRAGMA(pack(1));
! typedef struct {
! uint8_t asn[5];
! uint8_t join_priority;
! }synch_IE_t;
! PRAGMA(pack());
!
! //the Slotframe and Link IE
! typedef struct {
! uint8_t slotframehandle;
! uint16_t slotframesize;
! uint8_t numlinks;
! }slotframelink_IE_t;
!
! typedef struct {
! uint16_t tsNum;
! uint16_t choffset;
! uint8_t linkoptions;
! }linkInfo_subIE_t;
//=========================== prototypes ======================================
// admin
! void ieee154e_init(void);
// public
! PORT_RADIOTIMER_WIDTH ieee154e_asnDiff(asn_t* someASN);
! bool ieee154e_isSynch(void);
! void ieee154e_getAsn(uint8_t* array);
// events
! void ieee154e_startOfFrame(PORT_RADIOTIMER_WIDTH capturedTime);
! void ieee154e_endOfFrame(PORT_RADIOTIMER_WIDTH capturedTime);
// misc
! bool debugPrint_asn(void);
! bool debugPrint_isSync(void);
! bool debugPrint_macStats(void);
/**
\}

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/02a-MAClow/Makefile Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02a-MAClow/Makefile Mon May 12 13:09:51 2014
***************
*** 0 ****
--- 1,32 ----
+ SUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBMOD)
+
+ $(BINDIR)$(SUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,10 @@
*** stock_iot-lab_M3/openwsn/02a-MAClow/stupidmac/Makefile Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02a-MAClow/stupidmac/Makefile Thu Apr 24 16:55:54 2014
***************
*** 0 ****
--- 1,4 ----
+ MODULE:=$(shell basename $(CURDIR))
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+
+ include $(RIOTBASE)/Makefile.base
\ No newline at end of file

View File

@ -0,0 +1,132 @@
*** stock_iot-lab_M3/openwsn/02a-MAClow/stupidmac/stupidmac.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02a-MAClow/stupidmac/stupidmac.c Thu Apr 24 16:55:54 2014
***************
*** 31,44 ****
//=========================== prototypes ======================================
#include "IEEE802154_common.c"
! void packetReceived();
! void armRandomBackoffTimer();
void change_state(uint8_t newstate);
//======= from upper layer
//in stupidMAC, the radio is always on, listening
! void stupidmac_init() {
radio_rxOn(openwsn_frequency_channel);
change_state(S_IDLE_LISTENING);
stupidmac_dataFrameToSend = NULL;
--- 31,44 ----
//=========================== prototypes ======================================
#include "IEEE802154_common.c"
! void packetReceived(void);
! void armRandomBackoffTimer(void);
void change_state(uint8_t newstate);
//======= from upper layer
//in stupidMAC, the radio is always on, listening
! void stupidmac_init(void) {
radio_rxOn(openwsn_frequency_channel);
change_state(S_IDLE_LISTENING);
stupidmac_dataFrameToSend = NULL;
***************
*** 238,244 ****
//=========================== private =========================================
! void packetReceived() {
if (stupidmac_dataFrameReceived->length>0) {
//packet contains payload destined to an upper layer
nores_receive(stupidmac_dataFrameReceived);
--- 238,244 ----
//=========================== private =========================================
! void packetReceived(void) {
if (stupidmac_dataFrameReceived->length>0) {
//packet contains payload destined to an upper layer
nores_receive(stupidmac_dataFrameReceived);
***************
*** 249,255 ****
stupidmac_dataFrameReceived = NULL;
}
! void armRandomBackoffTimer() {
timer_startOneShot(TIMER_MAC_BACKOFF,MINBACKOFF); //TODO randomize
}
--- 249,255 ----
stupidmac_dataFrameReceived = NULL;
}
! void armRandomBackoffTimer(void) {
timer_startOneShot(TIMER_MAC_BACKOFF,MINBACKOFF); //TODO randomize
}
***************
*** 271,284 ****
}
}
! bool stupidmac_debugPrint() {
return FALSE;
}
//======= timers firing
//periodic timer used to transmit, and to trigger serial input/output
! void timer_mac_periodic_fired() {
#ifndef SERIALINSCHEDULER
openserial_stop();
#endif
--- 271,284 ----
}
}
! bool stupidmac_debugPrint(void) {
return FALSE;
}
//======= timers firing
//periodic timer used to transmit, and to trigger serial input/output
! void timer_mac_periodic_fired(void) {
#ifndef SERIALINSCHEDULER
openserial_stop();
#endif
***************
*** 297,303 ****
//this function is the one which really initiates the transmission of a packet.
//It only does so if the MAC layer is in S_IDLE_LISTENING stupidmac_state, otherwise it defers
! void timer_mac_backoff_fired() {
if (stupidmac_state==S_IDLE_LISTENING) {
if (stupidmac_dataFrameToSend!=NULL) {
openserial_printError(COMPONENT_MAC,ERR_DATAFRAMETOSEND_ERROR,
--- 297,303 ----
//this function is the one which really initiates the transmission of a packet.
//It only does so if the MAC layer is in S_IDLE_LISTENING stupidmac_state, otherwise it defers
! void timer_mac_backoff_fired(void) {
if (stupidmac_state==S_IDLE_LISTENING) {
if (stupidmac_dataFrameToSend!=NULL) {
openserial_printError(COMPONENT_MAC,ERR_DATAFRAMETOSEND_ERROR,
***************
*** 326,332 ****
}
}
! void timer_mac_watchdog_fired() {
switch (stupidmac_state) {
case S_TX_RXACK:
//I'm a transmitter, didn't receive ACK (end of TX sequence).
--- 326,332 ----
}
}
! void timer_mac_watchdog_fired(void) {
switch (stupidmac_state) {
case S_TX_RXACK:
//I'm a transmitter, didn't receive ACK (end of TX sequence).

View File

@ -0,0 +1,33 @@
*** stock_iot-lab_M3/openwsn/02a-MAClow/stupidmac/stupidmac.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02a-MAClow/stupidmac/stupidmac.h Thu Apr 24 16:53:29 2014
***************
*** 47,60 ****
ACK_WAIT_TIME = 327, // 10ms
};
! void stupidmac_init();
! error_t stupidmac_send(OpenQueueEntry_t* msg);
! void stupidmac_sendDone(OpenQueueEntry_t* msg, error_t error);
void stupidmac_packet_received(OpenQueueEntry_t* pkt);
! void stupidmac_sendDone(OpenQueueEntry_t* packetReceived, error_t error);
! void timer_mac_backoff_fired();
! void timer_mac_watchdog_fired();
! void timer_mac_periodic_fired();
! bool stupidmac_debugPrint();
#endif
--- 47,60 ----
ACK_WAIT_TIME = 327, // 10ms
};
! void stupidmac_init(void);
! owerror_t stupidmac_send(OpenQueueEntry_t* msg);
! void stupidmac_sendDone(OpenQueueEntry_t* msg, owerror_t error);
void stupidmac_packet_received(OpenQueueEntry_t* pkt);
! void stupidmac_sendDone(OpenQueueEntry_t* packetReceived, owerror_t error);
! void timer_mac_backoff_fired(void);
! void timer_mac_watchdog_fired(void);
! void timer_mac_periodic_fired(void);
! bool stupidmac_debugPrint(void);
#endif

View File

@ -0,0 +1,52 @@
*** stock_iot-lab_M3/openwsn/02a-MAClow/topology.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02a-MAClow/topology.c Thu Apr 24 16:55:54 2014
***************
*** 4,13 ****
//=========================== defines =========================================
! #define TOPOLOGY_MOTE1 0x6f
! #define TOPOLOGY_MOTE2 0xb9
! #define TOPOLOGY_MOTE3 0x3b
!
//=========================== variables =======================================
//=========================== prototypes ======================================
--- 4,13 ----
//=========================== defines =========================================
! #define TOPOLOGY_MOTE1 0x01
! #define TOPOLOGY_MOTE2 0x02
! #define TOPOLOGY_MOTE3 0x03
! #define TOPOLOGY_MOTE4 0x04
//=========================== variables =======================================
//=========================== prototypes ======================================
***************
*** 32,39 ****
returnVal=FALSE;
}
break;
! case TOPOLOGY_MOTE3:
! if (ieee802514_header->src.addr_64b[7]==TOPOLOGY_MOTE2) {
returnVal=TRUE;
} else {
returnVal=FALSE;
--- 32,47 ----
returnVal=FALSE;
}
break;
! case TOPOLOGY_MOTE3:
! if (ieee802514_header->src.addr_64b[7]==TOPOLOGY_MOTE2 ||
! ieee802514_header->src.addr_64b[7]==TOPOLOGY_MOTE4) {
! returnVal=TRUE;
! } else {
! returnVal=FALSE;
! }
! break;
! case TOPOLOGY_MOTE4:
! if (ieee802514_header->src.addr_64b[7]==TOPOLOGY_MOTE3) {
returnVal=TRUE;
} else {
returnVal=FALSE;

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/02b-MAChigh/Makefile Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02b-MAChigh/Makefile Mon May 12 13:09:50 2014
***************
*** 0 ****
--- 1,32 ----
+ SUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBMOD)
+
+ $(BINDIR)$(SUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,430 @@
*** stock_iot-lab_M3/openwsn/02b-MAChigh/neighbors.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02b-MAChigh/neighbors.c Thu Apr 24 16:55:54 2014
***************
*** 8,20 ****
//=========================== variables =======================================
- typedef struct {
- neighborRow_t neighbors[MAXNUMNEIGHBORS];
- dagrank_t myDAGrank;
- uint8_t debugRow;
- icmpv6rpl_dio_ht* dio; //keep it global to be able to debug correctly.
- } neighbors_vars_t;
-
neighbors_vars_t neighbors_vars;
//=========================== prototypes ======================================
--- 8,13 ----
***************
*** 22,28 ****
void registerNewNeighbor(
open_addr_t* neighborID,
int8_t rssi,
! asn_t* asnTimestamp
);
bool isNeighbor(open_addr_t* neighbor);
void removeNeighbor(uint8_t neighborIndex);
--- 15,23 ----
void registerNewNeighbor(
open_addr_t* neighborID,
int8_t rssi,
! asn_t* asnTimestamp,
! bool joinPrioPresent,
! uint8_t joinPrio
);
bool isNeighbor(open_addr_t* neighbor);
void removeNeighbor(uint8_t neighborIndex);
***************
*** 36,42 ****
/**
\brief Initializes this module.
*/
! void neighbors_init() {
// clear module variables
memset(&neighbors_vars,0,sizeof(neighbors_vars_t));
--- 31,37 ----
/**
\brief Initializes this module.
*/
! void neighbors_init(void) {
// clear module variables
memset(&neighbors_vars,0,sizeof(neighbors_vars_t));
***************
*** 56,62 ****
\returns This mote's current DAG rank.
*/
! dagrank_t neighbors_getMyDAGrank() {
return neighbors_vars.myDAGrank;
}
--- 51,57 ----
\returns This mote's current DAG rank.
*/
! dagrank_t neighbors_getMyDAGrank(void) {
return neighbors_vars.myDAGrank;
}
***************
*** 65,71 ****
\returns The number of neighbors this mote's currently knows of.
*/
! uint8_t neighbors_getNumNeighbors() {
uint8_t i;
uint8_t returnVal;
--- 60,66 ----
\returns The number of neighbors this mote's currently knows of.
*/
! uint8_t neighbors_getNumNeighbors(void) {
uint8_t i;
uint8_t returnVal;
***************
*** 81,87 ****
/**
\brief Retrieve my preferred parent's EUI64 address.
! \param [out] addressToWrite Where to write the preferred parent's address to.
*/
bool neighbors_getPreferredParentEui64(open_addr_t* addressToWrite) {
uint8_t i;
--- 76,82 ----
/**
\brief Retrieve my preferred parent's EUI64 address.
! \param[out] addressToWrite Where to write the preferred parent's address to.
*/
bool neighbors_getPreferredParentEui64(open_addr_t* addressToWrite) {
uint8_t i;
***************
*** 140,146 ****
\returns A pointer to the neighbor's address, or NULL if no KA is needed.
*/
! open_addr_t* neighbors_getKANeighbor() {
uint8_t i;
uint16_t timeSinceHeard;
open_addr_t* addrPreferred;
--- 135,141 ----
\returns A pointer to the neighbor's address, or NULL if no KA is needed.
*/
! open_addr_t* neighbors_getKANeighbor(void) {
uint8_t i;
uint16_t timeSinceHeard;
open_addr_t* addrPreferred;
***************
*** 185,191 ****
/**
\brief Indicate whether some neighbor is a stable neighbor
! \param address [in] The address of the neighbor, a full 128-bit IPv6 addres.
\returns TRUE if that neighbor is stable, FALSE otherwise.
*/
--- 180,186 ----
/**
\brief Indicate whether some neighbor is a stable neighbor
! \param[in] address The address of the neighbor, a full 128-bit IPv6 addres.
\returns TRUE if that neighbor is stable, FALSE otherwise.
*/
***************
*** 224,230 ****
/**
\brief Indicate whether some neighbor is a preferred neighbor.
! \param address [in] The EUI64 address of the neighbor.
\returns TRUE if that neighbor is preferred, FALSE otherwise.
*/
--- 219,225 ----
/**
\brief Indicate whether some neighbor is a preferred neighbor.
! \param[in] address The EUI64 address of the neighbor.
\returns TRUE if that neighbor is preferred, FALSE otherwise.
*/
***************
*** 253,259 ****
/**
\brief Indicate whether some neighbor has a lower DAG rank that me.
! \param index [in] The index of that neighbor in the neighbor table.
\returns TRUE if that neighbor has a lower DAG rank than me, FALSE otherwise.
*/
--- 248,254 ----
/**
\brief Indicate whether some neighbor has a lower DAG rank that me.
! \param[in] index The index of that neighbor in the neighbor table.
\returns TRUE if that neighbor has a lower DAG rank than me, FALSE otherwise.
*/
***************
*** 274,280 ****
/**
\brief Indicate whether some neighbor has a lower DAG rank that me.
! \param index [in] The index of that neighbor in the neighbor table.
\returns TRUE if that neighbor has a lower DAG rank than me, FALSE otherwise.
*/
--- 269,275 ----
/**
\brief Indicate whether some neighbor has a lower DAG rank that me.
! \param[in] index The index of that neighbor in the neighbor table.
\returns TRUE if that neighbor has a lower DAG rank than me, FALSE otherwise.
*/
***************
*** 306,319 ****
- stableNeighbor
- switchStabilityCounter
! \param l2_src [in] MAC source address of the packet, i.e. the neighbor who sent
! the packet just received.
! \param rssi [in] RSSI with which this packet was received.
! \param asnTs [in] ASN at which this packet was received.
*/
void neighbors_indicateRx(open_addr_t* l2_src,
int8_t rssi,
! asn_t* asnTs) {
uint8_t i;
bool newNeighbor;
--- 301,316 ----
- stableNeighbor
- switchStabilityCounter
! \param[in] l2_src MAC source address of the packet, i.e. the neighbor who sent
! the packet just received.
! \param[in] rssi RSSI with which this packet was received.
! \param[in] asnTs ASN at which this packet was received.
*/
void neighbors_indicateRx(open_addr_t* l2_src,
int8_t rssi,
! asn_t* asnTs,
! bool joinPrioPresent,
! uint8_t joinPrio) {
uint8_t i;
bool newNeighbor;
***************
*** 329,334 ****
--- 326,335 ----
neighbors_vars.neighbors[i].numRx++;
neighbors_vars.neighbors[i].rssi=rssi;
memcpy(&neighbors_vars.neighbors[i].asn,asnTs,sizeof(asn_t));
+ //update jp
+ if (joinPrioPresent==TRUE){
+ neighbors_vars.neighbors[i].joinPrio=joinPrio;
+ }
// update stableNeighbor, switchStabilityCounter
if (neighbors_vars.neighbors[i].stableNeighbor==FALSE) {
***************
*** 360,366 ****
// register new neighbor
if (newNeighbor==TRUE) {
! registerNewNeighbor(l2_src, rssi, asnTs);
}
}
--- 361,367 ----
// register new neighbor
if (newNeighbor==TRUE) {
! registerNewNeighbor(l2_src, rssi, asnTs, joinPrioPresent,joinPrio);
}
}
***************
*** 375,386 ****
- numTxACK
- asn
! \param l2_dest [in] MAC destination address of the packet, i.e. the neighbor
! who I just sent the packet to.
! \param numTxAttempts [in] Number of transmission attempts to this neighbor.
! \param was_finally_acked [in] TRUE iff the packet was ACK'ed by the neighbor
! on final transmission attempt.
! \param asnTs [in] ASN of the last transmission attempt.
*/
void neighbors_indicateTx(open_addr_t* l2_dest,
uint8_t numTxAttempts,
--- 376,387 ----
- numTxACK
- asn
! \param[in] l2_dest MAC destination address of the packet, i.e. the neighbor
! who I just sent the packet to.
! \param[in] numTxAttempts Number of transmission attempts to this neighbor.
! \param[in] was_finally_acked TRUE iff the packet was ACK'ed by the neighbor
! on final transmission attempt.
! \param[in] asnTs ASN of the last transmission attempt.
*/
void neighbors_indicateTx(open_addr_t* l2_dest,
uint8_t numTxAttempts,
***************
*** 423,430 ****
The fields which are updated are:
- DAGrank
! \param msg [in] The received message with msg->payload pointing to the DIO
! header.
*/
void neighbors_indicateRxDIO(OpenQueueEntry_t* msg) {
uint8_t i;
--- 424,431 ----
The fields which are updated are:
- DAGrank
! \param[in] msg The received message with msg->payload pointing to the DIO
! header.
*/
void neighbors_indicateRxDIO(OpenQueueEntry_t* msg) {
uint8_t i;
***************
*** 438,448 ****
for (i=0;i<MAXNUMNEIGHBORS;i++) {
if (isThisRowMatching(&(msg->l2_nextORpreviousHop),i)) {
if (
! neighbors_vars.dio->rank>neighbors_vars.neighbors[i].DAGrank &&
! neighbors_vars.dio->rank - neighbors_vars.neighbors[i].DAGrank>DEFAULTLINKCOST
) {
// the new DAGrank looks suspiciously high, only increment a bit
! neighbors_vars.neighbors[i].DAGrank += DEFAULTLINKCOST;
openserial_printError(COMPONENT_NEIGHBORS,ERR_LARGE_DAGRANK,
(errorparameter_t)neighbors_vars.dio->rank,
(errorparameter_t)neighbors_vars.neighbors[i].DAGrank);
--- 439,449 ----
for (i=0;i<MAXNUMNEIGHBORS;i++) {
if (isThisRowMatching(&(msg->l2_nextORpreviousHop),i)) {
if (
! neighbors_vars.dio->rank > neighbors_vars.neighbors[i].DAGrank &&
! neighbors_vars.dio->rank - neighbors_vars.neighbors[i].DAGrank >(DEFAULTLINKCOST*2*MINHOPRANKINCREASE)
) {
// the new DAGrank looks suspiciously high, only increment a bit
! neighbors_vars.neighbors[i].DAGrank += (DEFAULTLINKCOST*2*MINHOPRANKINCREASE);
openserial_printError(COMPONENT_NEIGHBORS,ERR_LARGE_DAGRANK,
(errorparameter_t)neighbors_vars.dio->rank,
(errorparameter_t)neighbors_vars.neighbors[i].DAGrank);
***************
*** 490,498 ****
very low DAGrank, I may want to change by routing parent.
- I became a DAGroot, so my DAGrank should be 0.
*/
! void neighbors_updateMyDAGrankAndNeighborPreference() {
uint8_t i;
! uint8_t linkCost;
uint32_t tentativeDAGrank; // 32-bit since is used to sum
uint8_t prefParentIdx;
bool prefParentFound;
--- 491,499 ----
very low DAGrank, I may want to change by routing parent.
- I became a DAGroot, so my DAGrank should be 0.
*/
! void neighbors_updateMyDAGrankAndNeighborPreference(void) {
uint8_t i;
! uint16_t rankIncrease;
uint32_t tentativeDAGrank; // 32-bit since is used to sum
uint8_t prefParentIdx;
bool prefParentFound;
***************
*** 517,527 ****
neighbors_vars.neighbors[i].parentPreference=0;
// calculate link cost to this neighbor
if (neighbors_vars.neighbors[i].numTxACK==0) {
! linkCost = DEFAULTLINKCOST;
} else {
! linkCost = (uint8_t)((((float)neighbors_vars.neighbors[i].numTx)/((float)neighbors_vars.neighbors[i].numTxACK))*10.0);
}
! tentativeDAGrank = neighbors_vars.neighbors[i].DAGrank+linkCost;
if ( tentativeDAGrank<neighbors_vars.myDAGrank &&
tentativeDAGrank<MAXDAGRANK) {
// found better parent, lower my DAGrank
--- 518,529 ----
neighbors_vars.neighbors[i].parentPreference=0;
// calculate link cost to this neighbor
if (neighbors_vars.neighbors[i].numTxACK==0) {
! rankIncrease = DEFAULTLINKCOST*2*MINHOPRANKINCREASE;
} else {
! //6TiSCH minimal draft using OF0 for rank computation
! rankIncrease = (uint16_t)((((float)neighbors_vars.neighbors[i].numTx)/((float)neighbors_vars.neighbors[i].numTxACK))*2*MINHOPRANKINCREASE);
}
! tentativeDAGrank = neighbors_vars.neighbors[i].DAGrank+rankIncrease;
if ( tentativeDAGrank<neighbors_vars.myDAGrank &&
tentativeDAGrank<MAXDAGRANK) {
// found better parent, lower my DAGrank
***************
*** 550,556 ****
\returns TRUE if this function printed something, FALSE otherwise.
*/
! bool debugPrint_neighbors() {
debugNeighborEntry_t temp;
neighbors_vars.debugRow=(neighbors_vars.debugRow+1)%MAXNUMNEIGHBORS;
temp.row=neighbors_vars.debugRow;
--- 552,558 ----
\returns TRUE if this function printed something, FALSE otherwise.
*/
! bool debugPrint_neighbors(void) {
debugNeighborEntry_t temp;
neighbors_vars.debugRow=(neighbors_vars.debugRow+1)%MAXNUMNEIGHBORS;
temp.row=neighbors_vars.debugRow;
***************
*** 584,590 ****
void registerNewNeighbor(open_addr_t* address,
int8_t rssi,
! asn_t* asnTimestamp) {
uint8_t i,j;
bool iHaveAPreferedParent;
// filter errors
--- 586,594 ----
void registerNewNeighbor(open_addr_t* address,
int8_t rssi,
! asn_t* asnTimestamp,
! bool joinPrioPresent,
! uint8_t joinPrio) {
uint8_t i,j;
bool iHaveAPreferedParent;
// filter errors
***************
*** 613,619 ****
neighbors_vars.neighbors[i].numTx = 0;
neighbors_vars.neighbors[i].numTxACK = 0;
memcpy(&neighbors_vars.neighbors[i].asn,asnTimestamp,sizeof(asn_t));
! // do I already have a preferred parent ?
iHaveAPreferedParent = FALSE;
for (j=0;j<MAXNUMNEIGHBORS;j++) {
if (neighbors_vars.neighbors[j].parentPreference==MAXPREFERENCE) {
--- 617,629 ----
neighbors_vars.neighbors[i].numTx = 0;
neighbors_vars.neighbors[i].numTxACK = 0;
memcpy(&neighbors_vars.neighbors[i].asn,asnTimestamp,sizeof(asn_t));
! //update jp
! if (joinPrioPresent==TRUE){
! neighbors_vars.neighbors[i].joinPrio=joinPrio;
! }
!
!
! // do I already have a preferred parent ? -- TODO change to use JP
iHaveAPreferedParent = FALSE;
for (j=0;j<MAXNUMNEIGHBORS;j++) {
if (neighbors_vars.neighbors[j].parentPreference==MAXPREFERENCE) {

View File

@ -0,0 +1,108 @@
*** stock_iot-lab_M3/openwsn/02b-MAChigh/neighbors.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02b-MAChigh/neighbors.h Thu Apr 24 16:55:54 2014
***************
*** 21,26 ****
--- 21,27 ----
#define MAXDAGRANK 0xffff
#define DEFAULTDAGRANK MAXDAGRANK
+ #define MINHOPRANKINCREASE 256 //default value in RPL and Minimal 6TiSCH draft
//=========================== typedef =========================================
***************
*** 38,43 ****
--- 39,45 ----
uint8_t numTxACK;
uint8_t numWraps;//number of times the tx counter wraps. can be removed if memory is a restriction. also check openvisualizer then.
asn_t asn;
+ uint8_t joinPrio;
} neighborRow_t;
PRAGMA(pack());
***************
*** 58,73 ****
} netDebugNeigborEntry_t;
PRAGMA(pack());
! //=========================== variables =======================================
//=========================== prototypes ======================================
! void neighbors_init();
// getters
! dagrank_t neighbors_getMyDAGrank();
! uint8_t neighbors_getNumNeighbors();
bool neighbors_getPreferredParentEui64(open_addr_t* addressToWrite);
! open_addr_t* neighbors_getKANeighbor();
// interrogators
bool neighbors_isStableNeighbor(open_addr_t* address);
bool neighbors_isPreferredParent(open_addr_t* address);
--- 60,83 ----
} netDebugNeigborEntry_t;
PRAGMA(pack());
! //=========================== module variables ================================
!
! typedef struct {
! neighborRow_t neighbors[MAXNUMNEIGHBORS];
! dagrank_t myDAGrank;
! uint8_t debugRow;
! icmpv6rpl_dio_ht* dio; //keep it global to be able to debug correctly.
! } neighbors_vars_t;
//=========================== prototypes ======================================
! void neighbors_init(void);
// getters
! dagrank_t neighbors_getMyDAGrank(void);
! uint8_t neighbors_getNumNeighbors(void);
bool neighbors_getPreferredParentEui64(open_addr_t* addressToWrite);
! open_addr_t* neighbors_getKANeighbor(void);
!
// interrogators
bool neighbors_isStableNeighbor(open_addr_t* address);
bool neighbors_isPreferredParent(open_addr_t* address);
***************
*** 78,85 ****
void neighbors_indicateRx(
open_addr_t* l2_src,
int8_t rssi,
! asn_t* asnTimestamp
);
void neighbors_indicateTx(
open_addr_t* dest,
uint8_t numTxAttempts,
--- 88,98 ----
void neighbors_indicateRx(
open_addr_t* l2_src,
int8_t rssi,
! asn_t* asnTimestamp,
! bool joinPrioPresent,
! uint8_t joinPrio
);
+
void neighbors_indicateTx(
open_addr_t* dest,
uint8_t numTxAttempts,
***************
*** 90,98 ****
// get addresses
void neighbors_getNeighbor(open_addr_t* address,uint8_t addr_type,uint8_t index);
// managing routing info
! void neighbors_updateMyDAGrankAndNeighborPreference();
// debug
! bool debugPrint_neighbors();
void debugNetPrint_neighbors(netDebugNeigborEntry_t* schlist);
/**
--- 103,111 ----
// get addresses
void neighbors_getNeighbor(open_addr_t* address,uint8_t addr_type,uint8_t index);
// managing routing info
! void neighbors_updateMyDAGrankAndNeighborPreference(void);
// debug
! bool debugPrint_neighbors(void);
void debugNetPrint_neighbors(netDebugNeigborEntry_t* schlist);
/**

View File

@ -0,0 +1,437 @@
*** stock_iot-lab_M3/openwsn/02b-MAChigh/res.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02b-MAChigh/res.c Thu Apr 24 16:55:54 2014
***************
*** 9,38 ****
#include "openrandom.h"
#include "scheduler.h"
#include "opentimers.h"
! #include "debugpins.h"
! //=========================== variables =======================================
! typedef struct {
! uint16_t periodMaintenance;
! bool busySendingKa; // TRUE when busy sending a keep-alive
! bool busySendingAdv; // TRUE when busy sending an advertisement
! uint8_t dsn; // current data sequence number
! uint8_t MacMgtTaskCounter; // counter to determine what management task to do
! opentimer_id_t timerId;
! } res_vars_t;
res_vars_t res_vars;
//=========================== prototypes ======================================
! error_t res_send_internal(OpenQueueEntry_t* msg);
! void sendAdv();
! void sendKa();
! void res_timer_cb();
//=========================== public ==========================================
! void res_init() {
res_vars.periodMaintenance = 872+(openrandom_get16b()&0xff); // fires every 1 sec on average
res_vars.busySendingKa = FALSE;
res_vars.busySendingAdv = FALSE;
--- 9,38 ----
#include "openrandom.h"
#include "scheduler.h"
#include "opentimers.h"
! //#include "debugpins.h"
!
! #include "thread.h"
!
! #define ENABLE_DEBUG (0)
! #include "debug.h"
!
! //=========================== variables =======================================
res_vars_t res_vars;
+ //static char openwsn_res_stack[KERNEL_CONF_STACKSIZE_MAIN];
//=========================== prototypes ======================================
! owerror_t res_send_internal(OpenQueueEntry_t* msg, uint8_t iePresent,uint8_t frameVersion);
! void sendAdv(void);
! void sendKa(void);
! void res_timer_cb(void);
! uint8_t res_copySlotFrameAndLinkIE(OpenQueueEntry_t* adv);//returns reserved size
//=========================== public ==========================================
! void res_init(void) {
res_vars.periodMaintenance = 872+(openrandom_get16b()&0xff); // fires every 1 sec on average
res_vars.busySendingKa = FALSE;
res_vars.busySendingAdv = FALSE;
***************
*** 51,74 ****
\returns TRUE if this function printed something, FALSE otherwise.
*/
! bool debugPrint_myDAGrank() {
! uint8_t output=0;
output = neighbors_getMyDAGrank();
! openserial_printStatus(STATUS_DAGRANK,(uint8_t*)&output,sizeof(uint8_t));
return TRUE;
}
//======= from upper layer
! error_t res_send(OpenQueueEntry_t *msg) {
msg->owner = COMPONENT_RES;
msg->l2_frameType = IEEE154_TYPE_DATA;
! return res_send_internal(msg);
}
//======= from lower layer
! void task_resNotifSendDone() {
OpenQueueEntry_t* msg;
// get recently-sent packet from openqueue
msg = openqueue_resGetSentPacket();
--- 51,75 ----
\returns TRUE if this function printed something, FALSE otherwise.
*/
! // TODO: was bool but complained "conflicting types"
! uint8_t debugPrint_myDAGrank(void) {
! uint16_t output=0;
output = neighbors_getMyDAGrank();
! openserial_printStatus(STATUS_DAGRANK,(uint8_t*)&output,sizeof(uint16_t));
return TRUE;
}
//======= from upper layer
! owerror_t res_send(OpenQueueEntry_t *msg) {
msg->owner = COMPONENT_RES;
msg->l2_frameType = IEEE154_TYPE_DATA;
! return res_send_internal(msg,IEEE154_IELIST_NO,IEEE154_FRAMEVERSION_2006);
}
//======= from lower layer
! void task_resNotifSendDone(void) {
OpenQueueEntry_t* msg;
// get recently-sent packet from openqueue
msg = openqueue_resGetSentPacket();
***************
*** 120,126 ****
}
}
! void task_resNotifReceive() {
OpenQueueEntry_t* msg;
// get received packet from openqueue
--- 121,127 ----
}
}
! void task_resNotifReceive(void) {
OpenQueueEntry_t* msg;
// get received packet from openqueue
***************
*** 140,146 ****
// indicate reception (to update statistics)
neighbors_indicateRx(&(msg->l2_nextORpreviousHop),
msg->l1_rssi,
! &msg->l2_asn);
// send the packet up the stack, if it qualifies
switch (msg->l2_frameType) {
--- 141,151 ----
// indicate reception (to update statistics)
neighbors_indicateRx(&(msg->l2_nextORpreviousHop),
msg->l1_rssi,
! &msg->l2_asn,
! msg->l2_joinPriorityPresent,
! msg->l2_joinPriority);
!
! msg->l2_joinPriorityPresent=FALSE; //reset it to avoid race conditions with this var.
// send the packet up the stack, if it qualifies
switch (msg->l2_frameType) {
***************
*** 177,188 ****
The body of this function executes one of the MAC management task.
*/
! void timers_res_fired() {
res_vars.MacMgtTaskCounter = (res_vars.MacMgtTaskCounter+1)%10;
if (res_vars.MacMgtTaskCounter==0) {
sendAdv(); // called every 10s
} else {
sendKa(); // called every second, except once every 10s
}
}
--- 182,194 ----
The body of this function executes one of the MAC management task.
*/
! void timers_res_fired(void) {
res_vars.MacMgtTaskCounter = (res_vars.MacMgtTaskCounter+1)%10;
if (res_vars.MacMgtTaskCounter==0) {
sendAdv(); // called every 10s
} else {
sendKa(); // called every second, except once every 10s
+ //leds_debug_toggle();
}
}
***************
*** 196,206 ****
virtual component COMPONENT_RES_TO_IEEE802154E. Whenever it gets a change,
IEEE802154E will handle the packet.
! \param [in] msg The packet to the transmitted
\returns E_SUCCESS iff successful.
*/
! error_t res_send_internal(OpenQueueEntry_t* msg) {
// assign a number of retries
if (packetfunctions_isBroadcastMulticast(&(msg->l2_nextORpreviousHop))==TRUE) {
msg->l2_retriesLeft = 1;
--- 202,212 ----
virtual component COMPONENT_RES_TO_IEEE802154E. Whenever it gets a change,
IEEE802154E will handle the packet.
! \param[in] msg The packet to the transmitted
\returns E_SUCCESS iff successful.
*/
! owerror_t res_send_internal(OpenQueueEntry_t* msg, uint8_t iePresent, uint8_t frameVersion) {
// assign a number of retries
if (packetfunctions_isBroadcastMulticast(&(msg->l2_nextORpreviousHop))==TRUE) {
msg->l2_retriesLeft = 1;
***************
*** 218,223 ****
--- 224,231 ----
// add a IEEE802.15.4 header
ieee802154_prependHeader(msg,
msg->l2_frameType,
+ iePresent,
+ frameVersion,
IEEE154_SEC_NO_SECURITY,
msg->l2_dsn,
&(msg->l2_nextORpreviousHop)
***************
*** 236,243 ****
timers_res_fired() function, but is declared as a separate function for better
readability of the code.
*/
! port_INLINE void sendAdv() {
OpenQueueEntry_t* adv;
if (ieee154e_isSynch()==FALSE) {
// I'm not sync'ed
--- 244,254 ----
timers_res_fired() function, but is declared as a separate function for better
readability of the code.
*/
! port_INLINE void sendAdv(void) {
OpenQueueEntry_t* adv;
+ payload_IE_descriptor_t payload_IE_desc;
+ MLME_IE_subHeader_t mlme_subHeader;
+ uint8_t slotframeIElen=0;
if (ieee154e_isSynch()==FALSE) {
// I'm not sync'ed
***************
*** 272,281 ****
adv->owner = COMPONENT_RES;
// reserve space for ADV-specific header
! packetfunctions_reserveHeaderSize(adv, ADV_PAYLOAD_LENGTH);
! // the actual value of the current ASN will be written by the
// IEEE802.15.4e when transmitting
!
// some l2 information about this packet
adv->l2_frameType = IEEE154_TYPE_BEACON;
adv->l2_nextORpreviousHop.type = ADDR_16B;
--- 283,315 ----
adv->owner = COMPONENT_RES;
// reserve space for ADV-specific header
! // xv poipoi -- reserving for IEs -- reverse order.
! //TODO reserve here for slotframe and link IE with minimal schedule information
! slotframeIElen = res_copySlotFrameAndLinkIE(adv);
! //create Sync IE with JP and ASN
! packetfunctions_reserveHeaderSize(adv, sizeof(synch_IE_t));//the asn + jp
! adv->l2_ASNpayload = adv->payload; //keep a pointer to where the ASN should be.
! // the actual value of the current ASN and JP will be written by the
// IEEE802.15.4e when transmitting
! packetfunctions_reserveHeaderSize(adv, sizeof(MLME_IE_subHeader_t));//the MLME header
! //copy mlme sub-header
! mlme_subHeader.length_subID_type=sizeof(synch_IE_t) << IEEE802154E_DESC_LEN_SHORT_MLME_IE_SHIFT;
! mlme_subHeader.length_subID_type |= (IEEE802154E_MLME_SYNC_IE_SUBID << IEEE802154E_MLME_SYNC_IE_SUBID_SHIFT) | IEEE802154E_DESC_TYPE_SHORT;
! //little endian
! adv->payload[0]= mlme_subHeader.length_subID_type & 0xFF;
! adv->payload[1]= (mlme_subHeader.length_subID_type >> 8) & 0xFF;
!
! packetfunctions_reserveHeaderSize(adv, sizeof(payload_IE_descriptor_t));//the payload IE header
! //prepare IE headers and copy them to the ADV
!
! payload_IE_desc.length_groupid_type = (sizeof(MLME_IE_subHeader_t)+sizeof(synch_IE_t)+slotframeIElen)<<IEEE802154E_DESC_LEN_PAYLOAD_IE_SHIFT;
! payload_IE_desc.length_groupid_type |= (IEEE802154E_PAYLOAD_DESC_GROUP_ID_MLME | IEEE802154E_DESC_TYPE_LONG); //
!
! //copy header into the packet
! //little endian
! adv->payload[0]= payload_IE_desc.length_groupid_type & 0xFF;
! adv->payload[1]= (payload_IE_desc.length_groupid_type >> 8) & 0xFF;
!
// some l2 information about this packet
adv->l2_frameType = IEEE154_TYPE_BEACON;
adv->l2_nextORpreviousHop.type = ADDR_16B;
***************
*** 283,294 ****
adv->l2_nextORpreviousHop.addr_16b[1] = 0xff;
// put in queue for MAC to handle
! res_send_internal(adv);
// I'm now busy sending an ADV
res_vars.busySendingAdv = TRUE;
}
/**
\brief Send an keep-alive message, if nessary.
--- 317,401 ----
adv->l2_nextORpreviousHop.addr_16b[1] = 0xff;
// put in queue for MAC to handle
! res_send_internal(adv,IEEE154_IELIST_YES,IEEE154_FRAMEVERSION);
// I'm now busy sending an ADV
res_vars.busySendingAdv = TRUE;
}
+ port_INLINE uint8_t res_copySlotFrameAndLinkIE(OpenQueueEntry_t* adv){
+ MLME_IE_subHeader_t mlme_subHeader;
+ uint8_t len=0;
+ uint8_t linkOption=0;
+ uint16_t slot=SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS+SCHEDULE_MINIMAL_6TISCH_EB_CELLS;
+
+ //reverse order and little endian. --
+
+ //for each link in the schedule (in basic configuration)
+ //copy to adv 1B linkOption bitmap
+ //copy to adv 2B ch.offset
+ //copy to adv 2B timeslot
+
+ //shared cells
+ linkOption = (1<<FLAG_TX_S)|(1<<FLAG_RX_S)|(1<<FLAG_SHARED_S);
+ while(slot>SCHEDULE_MINIMAL_6TISCH_EB_CELLS){
+ packetfunctions_reserveHeaderSize(adv,5);
+ //ts
+ adv->payload[0]= slot & 0xFF;
+ adv->payload[1]= (slot >> 8) & 0xFF;
+ //ch.offset as minimal draft
+ adv->payload[2]= 0x00;
+ adv->payload[3]= 0x00;
+ //linkOption
+ adv->payload[4]= linkOption;
+ len+=5;
+ slot--;
+ }
+
+ //eb slot
+ linkOption = (1<<FLAG_TX_S)|(1<<FLAG_RX_S)|(1<<FLAG_SHARED_S)|(1<<FLAG_TIMEKEEPING_S);
+ packetfunctions_reserveHeaderSize(adv,5);
+ len+=5;
+ //ts
+ adv->payload[0]= SCHEDULE_MINIMAL_6TISCH_EB_CELLS & 0xFF;
+ adv->payload[1]= (SCHEDULE_MINIMAL_6TISCH_EB_CELLS >> 8) & 0xFF;
+ //ch.offset as minimal draft
+ adv->payload[2]= 0x00;
+ adv->payload[3]= 0x00;
+
+ adv->payload[4]= linkOption;
+ //now slotframe ie general fields
+ //1B number of links == 6
+ //Slotframe Size 2B = 101 timeslots
+ //1B slotframe handle (id)
+ packetfunctions_reserveHeaderSize(adv,5);//
+ len+=5;
+
+ adv->payload[0]= SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_NUMBER;
+ adv->payload[1]= SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_HANDLE;
+ adv->payload[2]= SCHEDULE_MINIMAL_6TISCH_SLOTFRAME_SIZE & 0xFF;
+ adv->payload[3]= (SCHEDULE_MINIMAL_6TISCH_SLOTFRAME_SIZE >> 8) & 0xFF;
+ adv->payload[4]= 0x06; //number of links
+
+ //MLME sub IE header
+ //1b -15 short ==0x00
+ //7b -8-14 Sub-ID=0x1b
+ //8b - Length = 2 mlme-header + 5 slotframe general header +(6links*5bytes each)
+ packetfunctions_reserveHeaderSize(adv, sizeof(MLME_IE_subHeader_t));//the MLME header
+
+
+ //copy mlme sub-header
+ mlme_subHeader.length_subID_type = len << IEEE802154E_DESC_LEN_SHORT_MLME_IE_SHIFT;
+ mlme_subHeader.length_subID_type |= (IEEE802154E_MLME_SLOTFRAME_LINK_IE_SUBID << IEEE802154E_MLME_SYNC_IE_SUBID_SHIFT) | IEEE802154E_DESC_TYPE_SHORT;
+
+ //little endian
+ adv->payload[0]= mlme_subHeader.length_subID_type & 0xFF;
+ adv->payload[1]= (mlme_subHeader.length_subID_type >> 8) & 0xFF;
+ len+=2;//count len of mlme header
+
+ return len;
+ }
+
/**
\brief Send an keep-alive message, if nessary.
***************
*** 296,302 ****
timers_res_fired() function, but is declared as a separate function for better
readability of the code.
*/
! port_INLINE void sendKa() {
OpenQueueEntry_t* kaPkt;
open_addr_t* kaNeighAddr;
--- 403,409 ----
timers_res_fired() function, but is declared as a separate function for better
readability of the code.
*/
! port_INLINE void sendKa(void) {
OpenQueueEntry_t* kaPkt;
open_addr_t* kaNeighAddr;
***************
*** 344,355 ****
memcpy(&(kaPkt->l2_nextORpreviousHop),kaNeighAddr,sizeof(open_addr_t));
// put in queue for MAC to handle
! res_send_internal(kaPkt);
// I'm now busy sending a KA
res_vars.busySendingKa = TRUE;
}
! void res_timer_cb() {
scheduler_push_task(timers_res_fired,TASKPRIO_RES);
}
\ No newline at end of file
--- 451,466 ----
memcpy(&(kaPkt->l2_nextORpreviousHop),kaNeighAddr,sizeof(open_addr_t));
// put in queue for MAC to handle
! res_send_internal(kaPkt,IEEE154_IELIST_NO,IEEE154_FRAMEVERSION_2006);
// I'm now busy sending a KA
res_vars.busySendingKa = TRUE;
}
! void res_timer_cb(void) {
! DEBUG(__PRETTY_FUNCTION__);
scheduler_push_task(timers_res_fired,TASKPRIO_RES);
+ /*thread_create(openwsn_res_stack, KERNEL_CONF_STACKSIZE_MAIN,
+ PRIORITY_OPENWSN_RES, CREATE_STACKTEST,
+ timers_res_fired, "timers res fired");*/
}
\ No newline at end of file

View File

@ -0,0 +1,59 @@
*** stock_iot-lab_M3/openwsn/02b-MAChigh/res.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02b-MAChigh/res.h Thu Apr 24 16:55:54 2014
***************
*** 7,28 ****
\addtogroup RES
\{
*/
//=========================== define ==========================================
//=========================== typedef =========================================
! //=========================== variables =======================================
//=========================== prototypes ======================================
! void res_init();
! bool debugPrint_myDAGrank();
// from upper layer
! error_t res_send(OpenQueueEntry_t *msg);
// from lower layer
! void task_resNotifSendDone();
! void task_resNotifReceive();
/**
\}
--- 7,38 ----
\addtogroup RES
\{
*/
+ #include "opentimers.h"
//=========================== define ==========================================
//=========================== typedef =========================================
! //=========================== module variables ================================
!
! typedef struct {
! uint16_t periodMaintenance;
! bool busySendingKa; // TRUE when busy sending a keep-alive
! bool busySendingAdv; // TRUE when busy sending an advertisement
! uint8_t dsn; // current data sequence number
! uint8_t MacMgtTaskCounter; // counter to determine what management task to do
! opentimer_id_t timerId;
! } res_vars_t;
//=========================== prototypes ======================================
! void res_init(void);
! uint8_t debugPrint_myDAGrank(void); // TODO: was bool but complained "conflicting types"
// from upper layer
! owerror_t res_send(OpenQueueEntry_t *msg);
// from lower layer
! void task_resNotifSendDone(void);
! void task_resNotifReceive(void);
/**
\}

View File

@ -0,0 +1,579 @@
*** stock_iot-lab_M3/openwsn/02b-MAChigh/schedule.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02b-MAChigh/schedule.c Thu Apr 24 16:55:54 2014
***************
*** 2,26 ****
#include "schedule.h"
#include "openserial.h"
#include "openrandom.h"
//=========================== variables =======================================
- typedef struct {
- scheduleEntry_t scheduleBuf[MAXACTIVESLOTS];
- scheduleEntry_t* currentScheduleEntry;
- uint16_t frameLength;
- uint8_t backoffExponent;
- uint8_t backoff;
- slotOffset_t debugPrintRow;
- } schedule_vars_t;
-
schedule_vars_t schedule_vars;
-
- typedef struct {
- uint8_t numActiveSlotsCur;
- uint8_t numActiveSlotsMax;
- } schedule_dbg_t;
-
schedule_dbg_t schedule_dbg;
//=========================== prototypes ======================================
--- 2,12 ----
#include "schedule.h"
#include "openserial.h"
#include "openrandom.h"
+ #include "packetfunctions.h"
//=========================== variables =======================================
schedule_vars_t schedule_vars;
schedule_dbg_t schedule_dbg;
//=========================== prototypes ======================================
***************
*** 31,44 ****
//=== admin
! void schedule_init() {
uint8_t i;
slotOffset_t running_slotOffset;
open_addr_t temp_neighbor;
// reset local variables
memset(&schedule_vars,0,sizeof(schedule_vars_t));
! for (i=0;i<MAXACTIVESLOTS;i++){
schedule_resetEntry(&schedule_vars.scheduleBuf[i]);
}
schedule_vars.backoffExponent = MINBE-1;
--- 17,30 ----
//=== admin
! void schedule_init(void) {
uint8_t i;
slotOffset_t running_slotOffset;
open_addr_t temp_neighbor;
// reset local variables
memset(&schedule_vars,0,sizeof(schedule_vars_t));
! for (i=0;i<MAXACTIVESLOTS;i++) {
schedule_resetEntry(&schedule_vars.scheduleBuf[i]);
}
schedule_vars.backoffExponent = MINBE-1;
***************
*** 58,64 ****
CELLTYPE_ADV, // type of slot
FALSE, // shared?
0, // channel offset
! &temp_neighbor // neighbor
);
running_slotOffset++;
}
--- 44,51 ----
CELLTYPE_ADV, // type of slot
FALSE, // shared?
0, // channel offset
! &temp_neighbor, // neighbor
! FALSE //no update but insert
);
running_slotOffset++;
}
***************
*** 72,78 ****
CELLTYPE_TXRX, // type of slot
TRUE, // shared?
0, // channel offset
! &temp_neighbor // neighbor
);
running_slotOffset++;
}
--- 59,66 ----
CELLTYPE_TXRX, // type of slot
TRUE, // shared?
0, // channel offset
! &temp_neighbor, // neighbor
! FALSE //no update but insert
);
running_slotOffset++;
}
***************
*** 84,90 ****
CELLTYPE_SERIALRX, // type of slot
FALSE, // shared?
0, // channel offset
! &temp_neighbor // neighbor
);
running_slotOffset++;
/*
--- 72,79 ----
CELLTYPE_SERIALRX, // type of slot
FALSE, // shared?
0, // channel offset
! &temp_neighbor, // neighbor
! FALSE //no update but insert
);
running_slotOffset++;
/*
***************
*** 109,132 ****
\returns TRUE if this function printed something, FALSE otherwise.
*/
! bool debugPrint_schedule() {
debugScheduleEntry_t temp;
! schedule_vars.debugPrintRow = (schedule_vars.debugPrintRow+1)%MAXACTIVESLOTS;
! temp.row = schedule_vars.debugPrintRow;
! //copy element by element to the struct that will be serialized. we don't want to sent the pointer through the serial port.
! temp.scheduleEntry.channelOffset = schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].channelOffset;
! temp.scheduleEntry.numRx = schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].numRx;
! temp.scheduleEntry.numTx=schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].numTx;
! temp.scheduleEntry.numTxACK=schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].numTxACK;
! temp.scheduleEntry.lastUsedAsn=schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].lastUsedAsn;
! temp.scheduleEntry.neighbor=schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].neighbor;
! temp.scheduleEntry.shared=schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].shared;
! temp.scheduleEntry.slotOffset=schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].slotOffset;
! temp.scheduleEntry.type=schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].type;
!
openserial_printStatus(STATUS_SCHEDULE,
(uint8_t*)&temp,
! sizeof(debugScheduleEntry_t));
return TRUE;
}
--- 98,139 ----
\returns TRUE if this function printed something, FALSE otherwise.
*/
! bool debugPrint_schedule(void) {
debugScheduleEntry_t temp;
!
! schedule_vars.debugPrintRow = (schedule_vars.debugPrintRow+1)%MAXACTIVESLOTS;
!
! temp.row = schedule_vars.debugPrintRow;
! temp.slotOffset = \
! schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].slotOffset;
! temp.type = \
! schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].type;
! temp.shared = \
! schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].shared;
! temp.channelOffset = \
! schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].channelOffset;
! memcpy(
! &temp.neighbor,
! &schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].neighbor,
! sizeof(open_addr_t)
! );
! temp.numRx = \
! schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].numRx;
! temp.numTx = \
! schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].numTx;
! temp.numTxACK = \
! schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].numTxACK;
! memcpy(
! &temp.lastUsedAsn,
! &schedule_vars.scheduleBuf[schedule_vars.debugPrintRow].lastUsedAsn,
! sizeof(asn_t)
! );
!
openserial_printStatus(STATUS_SCHEDULE,
(uint8_t*)&temp,
! sizeof(debugScheduleEntry_t)
! );
!
return TRUE;
}
***************
*** 138,144 ****
\returns TRUE if this function printed something, FALSE otherwise.
*/
! bool debugPrint_backoff() {
uint8_t temp[2];
temp[0] = schedule_vars.backoffExponent;
temp[1] = schedule_vars.backoff;
--- 145,151 ----
\returns TRUE if this function printed something, FALSE otherwise.
*/
! bool debugPrint_backoff(void) {
uint8_t temp[2];
temp[0] = schedule_vars.backoffExponent;
temp[1] = schedule_vars.backoff;
***************
*** 163,194 ****
}
/**
\brief Add a new active slot into the schedule.
! \param newFrameLength The new frame length.
*/
! void schedule_addActiveSlot(slotOffset_t slotOffset,
cellType_t type,
bool shared,
! uint8_t channelOffset,
! open_addr_t* neighbor) {
scheduleEntry_t* slotContainer;
scheduleEntry_t* previousSlotWalker;
scheduleEntry_t* nextSlotWalker;
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
!
// find an empty schedule entry container
slotContainer = &schedule_vars.scheduleBuf[0];
while (slotContainer->type!=CELLTYPE_OFF &&
slotContainer<=&schedule_vars.scheduleBuf[MAXACTIVESLOTS-1]) {
! slotContainer++;
}
if (slotContainer>&schedule_vars.scheduleBuf[MAXACTIVESLOTS-1]) {
// schedule has overflown
openserial_printCritical(COMPONENT_SCHEDULE,ERR_SCHEDULE_OVERFLOWN,
(errorparameter_t)0,
(errorparameter_t)0);
}
// fill that schedule entry with parameters passed
slotContainer->slotOffset = slotOffset;
--- 170,274 ----
}
/**
+ \brief get the information of a spcific slot.
+
+ \param slotOffset
+ \param neighbor
+ \param info
+ */
+ void schedule_getSlotInfo(
+ slotOffset_t slotOffset,
+ open_addr_t* neighbor,
+ slotinfo_element_t* info
+ ){
+
+ scheduleEntry_t* slotContainer;
+
+ // find an empty schedule entry container
+ slotContainer = &schedule_vars.scheduleBuf[0];
+ while (slotContainer->type!=CELLTYPE_OFF && slotContainer<=&schedule_vars.scheduleBuf[MAXACTIVESLOTS-1]) {
+ //check that this entry for that neighbour and timeslot is not already scheduled.
+ if (packetfunctions_sameAddress(neighbor,&(slotContainer->neighbor))&& (slotContainer->slotOffset==slotOffset)){
+ //it exists so this is an update.
+ info->link_type = slotContainer->type;
+ info->shared =slotContainer->shared;
+ info->channelOffset = slotContainer->channelOffset;
+ return; //as this is an update. No need to re-insert as it is in the same position on the list.
+ }
+ slotContainer++;
+ }
+ //return cell type off.
+ info->link_type = CELLTYPE_OFF;
+ info->shared = FALSE;
+ info->channelOffset = 0;//set to zero if not set.
+ }
+
+ /**
\brief Add a new active slot into the schedule.
! If udpate param is set then update it in case it exists.
!
! \param slotOffset
! \param type
! \param shared
! \param channelOffset
! \param neighbor
! \param isUpdate
*/
! owerror_t schedule_addActiveSlot(
! slotOffset_t slotOffset,
cellType_t type,
bool shared,
! channelOffset_t channelOffset,
! open_addr_t* neighbor,
! bool isUpdate
! ) {
!
! owerror_t outcome;
!
scheduleEntry_t* slotContainer;
scheduleEntry_t* previousSlotWalker;
scheduleEntry_t* nextSlotWalker;
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
!
!
// find an empty schedule entry container
slotContainer = &schedule_vars.scheduleBuf[0];
while (slotContainer->type!=CELLTYPE_OFF &&
slotContainer<=&schedule_vars.scheduleBuf[MAXACTIVESLOTS-1]) {
!
! //check that this entry for that neighbour and timeslot is not already scheduled.
! if (type!=CELLTYPE_SERIALRX && type!=CELLTYPE_MORESERIALRX &&
! (packetfunctions_sameAddress(neighbor,&(slotContainer->neighbor))||
! (slotContainer->neighbor.type==ADDR_ANYCAST && isUpdate==TRUE))
! &&(slotContainer->slotOffset==slotOffset)){
! //it exists so this is an update.
! slotContainer->type = type;
! slotContainer->shared = shared;
! slotContainer->channelOffset = channelOffset;
! memcpy(&slotContainer->neighbor,neighbor,sizeof(open_addr_t));//update the address too!
! schedule_dbg.numUpdatedSlotsCur++;
! ENABLE_INTERRUPTS();
! return E_SUCCESS; //as this is an update. No need to re-insert as it is in the same position on the list.
! }
!
! slotContainer++;
! }
!
! if (isUpdate==TRUE) {
! //we are trying to update an item that is not in the schedule list.
! ENABLE_INTERRUPTS();
! return E_FAIL;
}
if (slotContainer>&schedule_vars.scheduleBuf[MAXACTIVESLOTS-1]) {
// schedule has overflown
+ outcome=E_FAIL;
openserial_printCritical(COMPONENT_SCHEDULE,ERR_SCHEDULE_OVERFLOWN,
(errorparameter_t)0,
(errorparameter_t)0);
+
+
}
// fill that schedule entry with parameters passed
slotContainer->slotOffset = slotOffset;
***************
*** 242,250 ****
--- 322,399 ----
if (schedule_dbg.numActiveSlotsCur>schedule_dbg.numActiveSlotsMax) {
schedule_dbg.numActiveSlotsMax = schedule_dbg.numActiveSlotsCur;
}
+ outcome=E_SUCCESS;
ENABLE_INTERRUPTS();
+ return outcome;
+ }
+
+
+
+ owerror_t schedule_removeActiveSlot(slotOffset_t slotOffset, open_addr_t* neighbor){
+
+ owerror_t outcome;
+
+ scheduleEntry_t* slotContainer;
+ scheduleEntry_t* previousSlotWalker;
+
+ INTERRUPT_DECLARATION();
+ DISABLE_INTERRUPTS();
+
+
+ // find the schedule entry
+ slotContainer = &schedule_vars.scheduleBuf[0];
+ while (slotContainer->type!=CELLTYPE_OFF && slotContainer<=&schedule_vars.scheduleBuf[MAXACTIVESLOTS-1]) {
+ //check that this entry for that neighbour and timeslot is not already scheduled.
+ if (packetfunctions_sameAddress(neighbor,&(slotContainer->neighbor))&& (slotContainer->slotOffset==slotOffset)){
+ break;
+ }
+ slotContainer++;
+ }
+
+ if (slotContainer->next==slotContainer) {
+ // this is the last active slot
+
+ // the next slot of this slot is NULL
+ slotContainer->next = NULL;
+
+ // current slot points to this slot
+ schedule_vars.currentScheduleEntry = NULL;
+ } else {
+ // this is NOT the last active slot
+
+ // find the previous in the schedule
+ previousSlotWalker = schedule_vars.currentScheduleEntry;
+
+ while (1) {
+ if ((previousSlotWalker->next=slotContainer)){
+ break;
+ }
+ previousSlotWalker = previousSlotWalker->next;
+ }
+ // remove this element from the linked list
+ previousSlotWalker->next = slotContainer->next;//my next;
+ slotContainer->next = NULL;
+ }
+
+ // clear that schedule entry
+ slotContainer->slotOffset = 0;
+ slotContainer->type = CELLTYPE_OFF;
+ slotContainer->shared = FALSE;
+ slotContainer->channelOffset = 0;
+ memset(&slotContainer->neighbor,0,sizeof(open_addr_t));
+
+ // maintain debug stats
+ schedule_dbg.numActiveSlotsCur--;
+
+ outcome=E_SUCCESS;
+ ENABLE_INTERRUPTS();
+
+ return outcome;
}
+
+
+
//=== from IEEE802154E: reading the schedule and updating statistics
void schedule_syncSlotOffset(slotOffset_t targetSlotOffset) {
***************
*** 256,262 ****
ENABLE_INTERRUPTS();
}
! void schedule_advanceSlot() {
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
// advance to next active slot
--- 405,411 ----
ENABLE_INTERRUPTS();
}
! void schedule_advanceSlot(void) {
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
// advance to next active slot
***************
*** 264,270 ****
ENABLE_INTERRUPTS();
}
! slotOffset_t schedule_getNextActiveSlotOffset() {
slotOffset_t res;
INTERRUPT_DECLARATION();
--- 413,419 ----
ENABLE_INTERRUPTS();
}
! slotOffset_t schedule_getNextActiveSlotOffset(void) {
slotOffset_t res;
INTERRUPT_DECLARATION();
***************
*** 281,287 ****
\returns The frame length.
*/
! frameLength_t schedule_getFrameLength() {
frameLength_t res;
INTERRUPT_DECLARATION();
--- 430,436 ----
\returns The frame length.
*/
! frameLength_t schedule_getFrameLength(void) {
frameLength_t res;
INTERRUPT_DECLARATION();
***************
*** 297,303 ****
\returns The type of the current schedule entry.
*/
! cellType_t schedule_getType() {
cellType_t res;
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
--- 446,452 ----
\returns The type of the current schedule entry.
*/
! cellType_t schedule_getType(void) {
cellType_t res;
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
***************
*** 323,329 ****
\returns The channel offset of the current schedule entry.
*/
! channelOffset_t schedule_getChannelOffset() {
channelOffset_t res;
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
--- 472,478 ----
\returns The channel offset of the current schedule entry.
*/
! channelOffset_t schedule_getChannelOffset(void) {
channelOffset_t res;
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
***************
*** 344,350 ****
\returns TRUE if it is OK to send on this slot, FALSE otherwise.
*/
! bool schedule_getOkToSend() {
bool returnVal;
INTERRUPT_DECLARATION();
--- 493,499 ----
\returns TRUE if it is OK to send on this slot, FALSE otherwise.
*/
! bool schedule_getOkToSend(void) {
bool returnVal;
INTERRUPT_DECLARATION();
***************
*** 377,383 ****
/**
\brief Reset the backoff and backoffExponent.
*/
! void schedule_resetBackoff() {
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
--- 526,532 ----
/**
\brief Reset the backoff and backoffExponent.
*/
! void schedule_resetBackoff(void) {
INTERRUPT_DECLARATION();
DISABLE_INTERRUPTS();
***************
*** 459,472 ****
pScheduleEntry->type = CELLTYPE_OFF;
pScheduleEntry->shared = FALSE;
pScheduleEntry->channelOffset = 0;
pScheduleEntry->neighbor.type = ADDR_NONE;
! pScheduleEntry->neighbor.addr_64b[0] = 0x14;
! pScheduleEntry->neighbor.addr_64b[1] = 0x15;
! pScheduleEntry->neighbor.addr_64b[2] = 0x92;
! pScheduleEntry->neighbor.addr_64b[3] = 0x09;
! pScheduleEntry->neighbor.addr_64b[4] = 0x02;
! pScheduleEntry->neighbor.addr_64b[5] = 0x2c;
! pScheduleEntry->neighbor.addr_64b[6] = 0x00;
pScheduleEntry->numRx = 0;
pScheduleEntry->numTx = 0;
pScheduleEntry->numTxACK = 0;
--- 608,617 ----
pScheduleEntry->type = CELLTYPE_OFF;
pScheduleEntry->shared = FALSE;
pScheduleEntry->channelOffset = 0;
+
pScheduleEntry->neighbor.type = ADDR_NONE;
! memset(&pScheduleEntry->neighbor.addr_64b[0], 0x00, sizeof(pScheduleEntry->neighbor.addr_64b));
!
pScheduleEntry->numRx = 0;
pScheduleEntry->numTx = 0;
pScheduleEntry->numTxACK = 0;

View File

@ -0,0 +1,215 @@
*** stock_iot-lab_M3/openwsn/02b-MAChigh/schedule.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/02b-MAChigh/schedule.h Thu Apr 24 16:55:54 2014
***************
*** 17,26 ****
The superframe repears over time and can be arbitrarly long.
*/
! #define SUPERFRAME_LENGTH 9
#define NUMADVSLOTS 1
! #define NUMSHAREDTXRX 4
#define NUMSERIALRX 3
/**
--- 17,26 ----
The superframe repears over time and can be arbitrarly long.
*/
! #define SUPERFRAME_LENGTH 11 //should be 101
#define NUMADVSLOTS 1
! #define NUMSHAREDTXRX 5
#define NUMSERIALRX 3
/**
***************
*** 50,56 ****
See MINBE for an explanation of backoff.
*/
#define MAXBE 4
!
//=========================== typedef =========================================
--- 50,61 ----
See MINBE for an explanation of backoff.
*/
#define MAXBE 4
! //6tisch minimal draft
! #define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS 5
! #define SCHEDULE_MINIMAL_6TISCH_EB_CELLS 1
! #define SCHEDULE_MINIMAL_6TISCH_SLOTFRAME_SIZE 101
! #define SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_HANDLE 1 //id of slotframe
! #define SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_NUMBER 1 //1 slotframe by default.
//=========================== typedef =========================================
***************
*** 84,94 ****
} scheduleEntry_t;
//PRAGMA(pack());
! //copy of the previous one but without the pointer and packed
PRAGMA(pack(1));
typedef struct {
slotOffset_t slotOffset;
! cellType_t type;
bool shared;
uint8_t channelOffset;
open_addr_t neighbor;
--- 89,109 ----
} scheduleEntry_t;
//PRAGMA(pack());
! //used to debug through ipv6 pkt.
!
! PRAGMA(pack(1));
! typedef struct {
! uint8_t last_addr_byte;//last byte of the address; poipoi could be [0]; endianness
! uint8_t slotOffset;
! channelOffset_t channelOffset;
! }netDebugScheduleEntry_t;
! PRAGMA(pack());
!
PRAGMA(pack(1));
typedef struct {
+ uint8_t row;
slotOffset_t slotOffset;
! uint8_t type;
bool shared;
uint8_t channelOffset;
open_addr_t neighbor;
***************
*** 96,148 ****
uint8_t numTx;
uint8_t numTxACK;
asn_t lastUsedAsn;
! } scheduleEntryDebug_t;
PRAGMA(pack());
! //used to debug through ipv6 pkt.
!
! PRAGMA(pack(1));
typedef struct {
! uint8_t last_addr_byte;//last byte of the address; poipoi could be [0]; endianness
! uint8_t slotOffset;
! uint8_t channelOffset;
! }netDebugScheduleEntry_t;
PRAGMA(pack());
- PRAGMA(pack(1));
typedef struct {
! uint8_t row;
! scheduleEntryDebug_t scheduleEntry;
! } debugScheduleEntry_t;
! PRAGMA(pack());
! //=========================== variables =======================================
//=========================== prototypes ======================================
// admin
! void schedule_init();
! bool debugPrint_schedule();
! bool debugPrint_backoff();
// from uRES
void schedule_setFrameLength(frameLength_t newFrameLength);
! void schedule_addActiveSlot(
slotOffset_t slotOffset,
cellType_t type,
bool shared,
uint8_t channelOffset,
! open_addr_t* neighbor
! );
// from IEEE802154E
void schedule_syncSlotOffset(slotOffset_t targetSlotOffset);
! void schedule_advanceSlot();
! slotOffset_t schedule_getNextActiveSlotOffset();
! frameLength_t schedule_getFrameLength();
! cellType_t schedule_getType();
void schedule_getNeighbor(open_addr_t* addrToWrite);
! channelOffset_t schedule_getChannelOffset();
! bool schedule_getOkToSend();
! void schedule_resetBackoff();
void schedule_indicateRx(asn_t* asnTimestamp);
void schedule_indicateTx(
asn_t* asnTimestamp,
--- 111,179 ----
uint8_t numTx;
uint8_t numTxACK;
asn_t lastUsedAsn;
! } debugScheduleEntry_t;
PRAGMA(pack());
! PRAGMA(pack(1)); //elements for slot info
typedef struct {
! uint8_t address[LENGTH_ADDR64b];//
! cellType_t link_type;// rx,tx etc...
! bool shared;
! slotOffset_t slotOffset;
! channelOffset_t channelOffset;
! }slotinfo_element_t;
PRAGMA(pack());
+ //=========================== variables =======================================
typedef struct {
! scheduleEntry_t scheduleBuf[MAXACTIVESLOTS];
! scheduleEntry_t* currentScheduleEntry;
! uint16_t frameLength;
! uint8_t backoffExponent;
! uint8_t backoff;
! slotOffset_t debugPrintRow;
! } schedule_vars_t;
! typedef struct {
! uint8_t numActiveSlotsCur;
! uint8_t numActiveSlotsMax;
! uint8_t numUpdatedSlotsCur;
! } schedule_dbg_t;
//=========================== prototypes ======================================
// admin
! void schedule_init(void);
! bool debugPrint_schedule(void);
! bool debugPrint_backoff(void);
// from uRES
void schedule_setFrameLength(frameLength_t newFrameLength);
! owerror_t schedule_addActiveSlot(
slotOffset_t slotOffset,
cellType_t type,
bool shared,
uint8_t channelOffset,
! open_addr_t* neighbor,
! bool isUpdate);
!
! void schedule_getSlotInfo(slotOffset_t slotOffset,
! open_addr_t* neighbor,
! slotinfo_element_t* info);
!
! owerror_t schedule_removeActiveSlot(slotOffset_t slotOffset,
! open_addr_t* neighbor);
!
!
// from IEEE802154E
void schedule_syncSlotOffset(slotOffset_t targetSlotOffset);
! void schedule_advanceSlot(void);
! slotOffset_t schedule_getNextActiveSlotOffset(void);
! frameLength_t schedule_getFrameLength(void);
! cellType_t schedule_getType(void);
void schedule_getNeighbor(open_addr_t* addrToWrite);
! channelOffset_t schedule_getChannelOffset(void);
! bool schedule_getOkToSend(void);
! void schedule_resetBackoff(void);
void schedule_indicateRx(asn_t* asnTimestamp);
void schedule_indicateTx(
asn_t* asnTimestamp,
***************
*** 154,158 ****
\}
\}
*/
-
#endif
--- 185,188 ----

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/03a-IPHC/Makefile Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/03a-IPHC/Makefile Mon May 12 13:09:49 2014
***************
*** 0 ****
--- 1,32 ----
+ SUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBMOD)
+
+ $(BINDIR)$(SUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,643 @@
*** stock_iot-lab_M3/openwsn/03a-IPHC/iphc.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/03a-IPHC/iphc.c Thu Apr 24 16:55:54 2014
***************
*** 12,18 ****
//=========================== prototypes ======================================
! error_t prependIPv6Header(
OpenQueueEntry_t* msg,
uint8_t tf,
uint32_t value_flowLabel,
--- 12,18 ----
//=========================== prototypes ======================================
! owerror_t prependIPv6Header(
OpenQueueEntry_t* msg,
uint8_t tf,
uint32_t value_flowLabel,
***************
*** 31,44 ****
uint8_t fw_SendOrfw_Rcv
);
ipv6_header_iht retrieveIPv6Header(OpenQueueEntry_t* msg);
!
//=========================== public ==========================================
! void iphc_init() {
}
//send from upper layer: I need to add 6LoWPAN header
! error_t iphc_sendFromForwarding(OpenQueueEntry_t *msg, ipv6_header_iht ipv6_header, uint8_t fw_SendOrfw_Rcv) {
open_addr_t temp_dest_prefix;
open_addr_t temp_dest_mac64b;
open_addr_t* p_dest;
--- 31,46 ----
uint8_t fw_SendOrfw_Rcv
);
ipv6_header_iht retrieveIPv6Header(OpenQueueEntry_t* msg);
! //hop by hop header
! void prependIPv6HopByHopHeader(OpenQueueEntry_t* msg,uint8_t nextheader, bool nh, rpl_hopoption_ht *hopbyhop_option);
! void retrieveIPv6HopByHopHeader(OpenQueueEntry_t* msg, ipv6_hopbyhop_ht *hopbyhop_header, rpl_hopoption_ht *rpl_option);
//=========================== public ==========================================
! void iphc_init(void) {
}
//send from upper layer: I need to add 6LoWPAN header
! owerror_t iphc_sendFromForwarding(OpenQueueEntry_t *msg, ipv6_header_iht ipv6_header, rpl_hopoption_ht *hopbyhop_option, uint8_t fw_SendOrfw_Rcv) {
open_addr_t temp_dest_prefix;
open_addr_t temp_dest_mac64b;
open_addr_t* p_dest;
***************
*** 48,54 ****
uint8_t sam;
uint8_t dam;
uint8_t nh;
!
// take ownership over the packet
msg->owner = COMPONENT_IPHC;
--- 50,58 ----
uint8_t sam;
uint8_t dam;
uint8_t nh;
! uint8_t next_header;
! //option header
!
// take ownership over the packet
msg->owner = COMPONENT_IPHC;
***************
*** 85,90 ****
--- 89,95 ----
if (fw_SendOrfw_Rcv==PCKTFORWARD){
sam = IPHC_SAM_64B; //case forwarding a packet
p_src = &temp_src_mac64b;
+ //poipoi xv forcing elided addresses on src routing, this needs to be fixed so any type of address should be supported supported.
} else if (fw_SendOrfw_Rcv==PCKTSEND){
sam = IPHC_SAM_ELIDED;
p_src = NULL;
***************
*** 92,100 ****
openserial_printCritical(COMPONENT_IPHC,ERR_INVALID_FWDMODE,
(errorparameter_t)0,
(errorparameter_t)0);
! }
! dam = IPHC_DAM_ELIDED;
! p_dest = NULL;
} else {
//else, not a direct neighbour use 64B address
sam = IPHC_SAM_64B;
--- 97,105 ----
openserial_printCritical(COMPONENT_IPHC,ERR_INVALID_FWDMODE,
(errorparameter_t)0,
(errorparameter_t)0);
! }
! dam = IPHC_DAM_ELIDED;
! p_dest = NULL;
} else {
//else, not a direct neighbour use 64B address
sam = IPHC_SAM_64B;
***************
*** 113,119 ****
}else{
//source routing
sam = IPHC_SAM_128B;
! dam = IPHC_DAM_ELIDED;
p_dest = NULL;
p_src = &(msg->l3_sourceAdd);
}
--- 118,124 ----
}else{
//source routing
sam = IPHC_SAM_128B;
! dam = IPHC_DAM_ELIDED; //poipoi xv not true, should not be elided.
p_dest = NULL;
p_src = &(msg->l3_sourceAdd);
}
***************
*** 125,135 ****
// decrement the packet's hop limit
ipv6_header.hop_limit--;
if (prependIPv6Header(msg,
IPHC_TF_ELIDED,
0, // value_flowlabel is not copied
nh,
! msg->l4_protocol,
IPHC_HLIM_INLINE,
ipv6_header.hop_limit,
IPHC_CID_NO,
--- 130,149 ----
// decrement the packet's hop limit
ipv6_header.hop_limit--;
+ //prepend Option hop by hop header except when src routing and dst is not 0xffff -- this is a little trick as src routing is using an option header set to 0x00
+ next_header=msg->l4_protocol;
+ if (hopbyhop_option->optionType==RPL_HOPBYHOP_HEADER_OPTION_TYPE
+ && packetfunctions_isBroadcastMulticast(&(msg->l3_destinationAdd))==FALSE ){
+ prependIPv6HopByHopHeader(msg, msg->l4_protocol, nh, hopbyhop_option);
+ //change nh to point to the newly added header
+ next_header=IANA_IPv6HOPOPT;// use 0x00 as NH to indicate option header -- see rfc 2460
+ }
+ //then regular header
if (prependIPv6Header(msg,
IPHC_TF_ELIDED,
0, // value_flowlabel is not copied
nh,
! next_header,
IPHC_HLIM_INLINE,
ipv6_header.hop_limit,
IPHC_CID_NO,
***************
*** 144,149 ****
--- 158,164 ----
)==E_FAIL) {
return E_FAIL;
}
+
return res_send(msg);
}
***************
*** 147,154 ****
return res_send(msg);
}
//send from bridge: 6LoWPAN header already added by OpenLBR, send as is
! error_t iphc_sendFromBridge(OpenQueueEntry_t *msg) {
msg->owner = COMPONENT_IPHC;
// error checking
if (idmanager_getIsBridge()==FALSE) {
--- 162,172 ----
return res_send(msg);
}
+
+
+
//send from bridge: 6LoWPAN header already added by OpenLBR, send as is
! owerror_t iphc_sendFromBridge(OpenQueueEntry_t *msg) {
msg->owner = COMPONENT_IPHC;
// error checking
if (idmanager_getIsBridge()==FALSE) {
***************
*** 160,166 ****
return res_send(msg);
}
! void iphc_sendDone(OpenQueueEntry_t* msg, error_t error) {
msg->owner = COMPONENT_IPHC;
if (msg->creator==COMPONENT_OPENBRIDGE) {
openbridge_sendDone(msg,error);
--- 178,184 ----
return res_send(msg);
}
! void iphc_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
msg->owner = COMPONENT_IPHC;
if (msg->creator==COMPONENT_OPENBRIDGE) {
openbridge_sendDone(msg,error);
***************
*** 171,182 ****
void iphc_receive(OpenQueueEntry_t* msg) {
ipv6_header_iht ipv6_header;
msg->owner = COMPONENT_IPHC;
ipv6_header = retrieveIPv6Header(msg);
if (idmanager_getIsBridge()==FALSE ||
packetfunctions_isBroadcastMulticast(&(ipv6_header.dest))) {
packetfunctions_tossHeader(msg,ipv6_header.header_length);
! forwarding_receive(msg,ipv6_header); //up the internal stack
} else {
openbridge_receive(msg); //out to the OpenVisualizer
}
--- 189,214 ----
void iphc_receive(OpenQueueEntry_t* msg) {
ipv6_header_iht ipv6_header;
+ ipv6_hopbyhop_ht ipv6_hop_header;
+ rpl_hopoption_ht hop_by_hop_option;
+
msg->owner = COMPONENT_IPHC;
+
+ //then regular header
ipv6_header = retrieveIPv6Header(msg);
+
+
if (idmanager_getIsBridge()==FALSE ||
packetfunctions_isBroadcastMulticast(&(ipv6_header.dest))) {
packetfunctions_tossHeader(msg,ipv6_header.header_length);
!
! if (ipv6_header.next_header==IANA_IPv6HOPOPT){
! //retrieve hop by hop header
! retrieveIPv6HopByHopHeader(msg,&ipv6_hop_header,&hop_by_hop_option);
! //toss the header + option +tlv on it if any
! packetfunctions_tossHeader(msg,IPv6HOP_HDR_LEN+ipv6_hop_header.HdrExtLen);
! }
! forwarding_receive(msg,ipv6_header,ipv6_hop_header,hop_by_hop_option); //up the internal stack
} else {
openbridge_receive(msg); //out to the OpenVisualizer
}
***************
*** 184,190 ****
//=========================== private =========================================
! error_t prependIPv6Header(
OpenQueueEntry_t* msg,
uint8_t tf,
uint32_t value_flowLabel,
--- 216,256 ----
//=========================== private =========================================
!
! void prependIPv6HopByHopHeader(OpenQueueEntry_t *msg,uint8_t nextheader, bool nh, rpl_hopoption_ht *hopbyhop_option){
!
! //copy them in reverse order, first option later header
! packetfunctions_reserveHeaderSize(msg,sizeof(rpl_hopoption_ht));
! memcpy(msg->payload,hopbyhop_option,sizeof(rpl_hopoption_ht));
!
! //hdr len as defined by rfc6282 sect 4.2
! packetfunctions_reserveHeaderSize(msg,sizeof(uint8_t));
! *((uint8_t*)(msg->payload)) = sizeof(rpl_hopoption_ht);
!
! //next header
! switch (nh) {
! case IPHC_NH_INLINE:
! //add the next header inline
! packetfunctions_reserveHeaderSize(msg,sizeof(uint8_t));
! *((uint8_t*)(msg->payload)) = nextheader;
!
! //append NHC field on the extension header should be 1110 0000 -- see rfc 6282 sect 4.2
! packetfunctions_reserveHeaderSize(msg,sizeof(uint8_t));
! *((uint8_t*)(msg->payload)) = NHC_IPv6EXT_ID;
! break;
! case IPHC_NH_COMPRESSED:
! packetfunctions_reserveHeaderSize(msg,sizeof(uint8_t));
! *((uint8_t*)(msg->payload)) = NHC_IPv6EXT_ID | 0x01; //mark last bit as 1 -- see rfc 6282 sect 4.2
! break;
! default:
! openserial_printCritical(COMPONENT_IPHC,ERR_6LOWPAN_UNSUPPORTED,
! (errorparameter_t)3,
! (errorparameter_t)nh);
! }
!
! }
!
! owerror_t prependIPv6Header(
OpenQueueEntry_t* msg,
uint8_t tf,
uint32_t value_flowLabel,
***************
*** 216,222 ****
(errorparameter_t)0);
return E_FAIL;
};
! packetfunctions_writeAddress(msg,value_dest,BIG_ENDIAN);
break;
case IPHC_DAM_64B:
if (value_dest->type!=ADDR_64B) {
--- 282,288 ----
(errorparameter_t)0);
return E_FAIL;
};
! packetfunctions_writeAddress(msg,value_dest,OW_BIG_ENDIAN);
break;
case IPHC_DAM_64B:
if (value_dest->type!=ADDR_64B) {
***************
*** 225,231 ****
(errorparameter_t)1);
return E_FAIL;
};
! packetfunctions_writeAddress(msg,value_dest,BIG_ENDIAN);
break;
case IPHC_DAM_128B:
if (value_dest->type!=ADDR_128B) {
--- 291,297 ----
(errorparameter_t)1);
return E_FAIL;
};
! packetfunctions_writeAddress(msg,value_dest,OW_BIG_ENDIAN);
break;
case IPHC_DAM_128B:
if (value_dest->type!=ADDR_128B) {
***************
*** 234,240 ****
(errorparameter_t)2);
return E_FAIL;
};
! packetfunctions_writeAddress(msg,value_dest,BIG_ENDIAN);
break;
default:
openserial_printCritical(COMPONENT_IPHC,ERR_6LOWPAN_UNSUPPORTED,
--- 300,306 ----
(errorparameter_t)2);
return E_FAIL;
};
! packetfunctions_writeAddress(msg,value_dest,OW_BIG_ENDIAN);
break;
default:
openserial_printCritical(COMPONENT_IPHC,ERR_6LOWPAN_UNSUPPORTED,
***************
*** 249,255 ****
case IPHC_SAM_16B:
if(fw_SendOrfw_Rcv==PCKTSEND)
{
! packetfunctions_writeAddress(msg, (idmanager_getMyID(ADDR_16B)),BIG_ENDIAN);
}
if(fw_SendOrfw_Rcv==PCKTFORWARD)
{
--- 315,321 ----
case IPHC_SAM_16B:
if(fw_SendOrfw_Rcv==PCKTSEND)
{
! packetfunctions_writeAddress(msg, (idmanager_getMyID(ADDR_16B)),OW_BIG_ENDIAN);
}
if(fw_SendOrfw_Rcv==PCKTFORWARD)
{
***************
*** 259,271 ****
(errorparameter_t)0);
return E_FAIL;
}
! packetfunctions_writeAddress(msg,value_src,BIG_ENDIAN);
}
break;
case IPHC_SAM_64B:
if(fw_SendOrfw_Rcv==PCKTSEND)
{
! packetfunctions_writeAddress(msg, (idmanager_getMyID(ADDR_64B)),BIG_ENDIAN);
}
if(fw_SendOrfw_Rcv==PCKTFORWARD)
{
--- 325,337 ----
(errorparameter_t)0);
return E_FAIL;
}
! packetfunctions_writeAddress(msg,value_src,OW_BIG_ENDIAN);
}
break;
case IPHC_SAM_64B:
if(fw_SendOrfw_Rcv==PCKTSEND)
{
! packetfunctions_writeAddress(msg, (idmanager_getMyID(ADDR_64B)),OW_BIG_ENDIAN);
}
if(fw_SendOrfw_Rcv==PCKTFORWARD)
{
***************
*** 275,288 ****
(errorparameter_t)1);
return E_FAIL;
}
! packetfunctions_writeAddress(msg, value_src,BIG_ENDIAN);
}
break;
case IPHC_SAM_128B:
if(fw_SendOrfw_Rcv==PCKTSEND)
{
! packetfunctions_writeAddress(msg, (idmanager_getMyID(ADDR_64B)),BIG_ENDIAN);
! packetfunctions_writeAddress(msg, (idmanager_getMyID(ADDR_PREFIX)),BIG_ENDIAN);
}
if(fw_SendOrfw_Rcv==PCKTFORWARD)
{
--- 341,354 ----
(errorparameter_t)1);
return E_FAIL;
}
! packetfunctions_writeAddress(msg, value_src,OW_BIG_ENDIAN);
}
break;
case IPHC_SAM_128B:
if(fw_SendOrfw_Rcv==PCKTSEND)
{
! packetfunctions_writeAddress(msg, (idmanager_getMyID(ADDR_64B)),OW_BIG_ENDIAN);
! packetfunctions_writeAddress(msg, (idmanager_getMyID(ADDR_PREFIX)),OW_BIG_ENDIAN);
}
if(fw_SendOrfw_Rcv==PCKTFORWARD)
{
***************
*** 292,298 ****
(errorparameter_t)2);
return E_FAIL;
}
! packetfunctions_writeAddress(msg,value_src,BIG_ENDIAN);
}
break;
default:
--- 358,364 ----
(errorparameter_t)2);
return E_FAIL;
}
! packetfunctions_writeAddress(msg,value_src,OW_BIG_ENDIAN);
}
break;
default:
***************
*** 374,379 ****
--- 440,506 ----
return E_SUCCESS;
}
+
+
+ void retrieveIPv6HopByHopHeader(OpenQueueEntry_t *msg,ipv6_hopbyhop_ht *hopbyhop_header, rpl_hopoption_ht *rpl_option){
+ uint8_t temp_8b;
+
+ hopbyhop_header->headerlen=0;
+
+ hopbyhop_header->lowpan_nhc = *((uint8_t*)(msg->payload)+ hopbyhop_header->headerlen);
+ hopbyhop_header->headerlen += sizeof(uint8_t);
+
+ //next header
+ switch ( hopbyhop_header->lowpan_nhc & NHC_HOP_NH_MASK) {
+ case IPHC_NH_INLINE:
+ // Full 8 bits for Next Header are carried in-line
+ hopbyhop_header->next_header_compressed = FALSE;
+ hopbyhop_header->nextHeader = *((uint8_t*)(msg->payload)+hopbyhop_header->headerlen);
+ hopbyhop_header->headerlen+= sizeof(uint8_t);
+ break;
+ case IPHC_NH_COMPRESSED:
+ // the Next header field is compressed and the next header is encoded
+ // using LOWPAN_NHC, which is discussed in Section 4.1 of RFC6282
+ // we don't parse anything here, but will look at the (compressed)
+ // next header after having parsed all address fields.
+ hopbyhop_header->next_header_compressed = TRUE;
+ break;
+ default:
+ openserial_printError(COMPONENT_IPHC,ERR_6LOWPAN_UNSUPPORTED,
+ (errorparameter_t)7,
+ (errorparameter_t)hopbyhop_header->lowpan_nhc);
+ break;
+ }
+
+ //len of options
+ hopbyhop_header->HdrExtLen =*((uint8_t*)(msg->payload)+hopbyhop_header->headerlen);
+ hopbyhop_header->headerlen+= sizeof(uint8_t);
+ //copy the options
+ memcpy(rpl_option,((uint8_t*)(msg->payload)+hopbyhop_header->headerlen),sizeof(rpl_hopoption_ht));
+ hopbyhop_header->headerlen+= sizeof(rpl_hopoption_ht);
+
+ //now in case nh compressed:
+ /*
+ During the parsing of the nh field, we found that the next header was
+ compressed. We now identify which next (compressed) header this is, and
+ populate the hopbyhop_header.nextHeader field accordingly. It's the role of the
+ appropriate transport module to decompress the header.
+ */
+ if (hopbyhop_header->next_header_compressed==TRUE) {
+ temp_8b = *((uint8_t*)(msg->payload)+ hopbyhop_header->headerlen);
+ if ( (temp_8b & NHC_UDP_MASK) == NHC_UDP_ID) {
+ hopbyhop_header->nextHeader = IANA_UDP;
+ }else {
+ // the next header could be an IPv6 extension header, or misformed
+ hopbyhop_header->nextHeader = IANA_UNDEFINED;
+ openserial_printError(COMPONENT_IPHC,ERR_6LOWPAN_UNSUPPORTED,
+ (errorparameter_t)14,
+ (errorparameter_t)hopbyhop_header->nextHeader);
+ }
+ }
+ }
+
+
ipv6_header_iht retrieveIPv6Header(OpenQueueEntry_t* msg) {
uint8_t temp_8b;
open_addr_t temp_addr_16b;
***************
*** 446,451 ****
--- 573,579 ----
ipv6_header.next_header_compressed = FALSE;
ipv6_header.next_header = *((uint8_t*)(msg->payload)+ipv6_header.header_length);
ipv6_header.header_length += sizeof(uint8_t);
+
break;
case IPHC_NH_COMPRESSED:
// the Next header field is compressed and the next header is encoded
***************
*** 487,504 ****
packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),&(msg->l2_nextORpreviousHop),&ipv6_header.src);
break;
case IPHC_SAM_16B:
! packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header.header_length)),ADDR_16B,&temp_addr_16b,BIG_ENDIAN);
ipv6_header.header_length += 2*sizeof(uint8_t);
packetfunctions_mac16bToMac64b(&temp_addr_16b,&temp_addr_64b);
packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),&temp_addr_64b,&ipv6_header.src);
break;
case IPHC_SAM_64B:
! packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header.header_length)),ADDR_64B,&temp_addr_64b,BIG_ENDIAN);
ipv6_header.header_length += 8*sizeof(uint8_t);
packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),&temp_addr_64b,&ipv6_header.src);
break;
case IPHC_SAM_128B:
! packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header.header_length)),ADDR_128B,&ipv6_header.src,BIG_ENDIAN);
ipv6_header.header_length += 16*sizeof(uint8_t);
break;
default:
--- 615,632 ----
packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),&(msg->l2_nextORpreviousHop),&ipv6_header.src);
break;
case IPHC_SAM_16B:
! packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header.header_length)),ADDR_16B,&temp_addr_16b,OW_BIG_ENDIAN);
ipv6_header.header_length += 2*sizeof(uint8_t);
packetfunctions_mac16bToMac64b(&temp_addr_16b,&temp_addr_64b);
packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),&temp_addr_64b,&ipv6_header.src);
break;
case IPHC_SAM_64B:
! packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header.header_length)),ADDR_64B,&temp_addr_64b,OW_BIG_ENDIAN);
ipv6_header.header_length += 8*sizeof(uint8_t);
packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),&temp_addr_64b,&ipv6_header.src);
break;
case IPHC_SAM_128B:
! packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header.header_length)),ADDR_128B,&ipv6_header.src,OW_BIG_ENDIAN);
ipv6_header.header_length += 16*sizeof(uint8_t);
break;
default:
***************
*** 513,530 ****
packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),idmanager_getMyID(ADDR_64B),&(ipv6_header.dest));
break;
case IPHC_DAM_16B:
! packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header.header_length)),ADDR_16B,&temp_addr_16b,BIG_ENDIAN);
ipv6_header.header_length += 2*sizeof(uint8_t);
packetfunctions_mac16bToMac64b(&temp_addr_16b,&temp_addr_64b);
packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),&temp_addr_64b,&ipv6_header.dest);
break;
case IPHC_DAM_64B:
! packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header.header_length)),ADDR_64B,&temp_addr_64b,BIG_ENDIAN);
ipv6_header.header_length += 8*sizeof(uint8_t);
packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),&temp_addr_64b,&ipv6_header.dest);
break;
case IPHC_DAM_128B:
! packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header.header_length)),ADDR_128B,&ipv6_header.dest,BIG_ENDIAN);
ipv6_header.header_length += 16*sizeof(uint8_t);
break;
default:
--- 641,658 ----
packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),idmanager_getMyID(ADDR_64B),&(ipv6_header.dest));
break;
case IPHC_DAM_16B:
! packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header.header_length)),ADDR_16B,&temp_addr_16b,OW_BIG_ENDIAN);
ipv6_header.header_length += 2*sizeof(uint8_t);
packetfunctions_mac16bToMac64b(&temp_addr_16b,&temp_addr_64b);
packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),&temp_addr_64b,&ipv6_header.dest);
break;
case IPHC_DAM_64B:
! packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header.header_length)),ADDR_64B,&temp_addr_64b,OW_BIG_ENDIAN);
ipv6_header.header_length += 8*sizeof(uint8_t);
packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),&temp_addr_64b,&ipv6_header.dest);
break;
case IPHC_DAM_128B:
! packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header.header_length)),ADDR_128B,&ipv6_header.dest,OW_BIG_ENDIAN);
ipv6_header.header_length += 16*sizeof(uint8_t);
break;
default:
***************
*** 543,560 ****
temp_8b = *((uint8_t*)(msg->payload)+ipv6_header.header_length);
if ( (temp_8b & NHC_UDP_MASK) == NHC_UDP_ID) {
ipv6_header.next_header = IANA_UDP;
! } else {
// the next header could be an IPv6 extension header, or misformed
ipv6_header.next_header = IANA_UNDEFINED;
openserial_printError(COMPONENT_IPHC,ERR_6LOWPAN_UNSUPPORTED,
! (errorparameter_t)11,
(errorparameter_t)ipv6_header.next_header);
}
}
! // this is a temporary workaround for allowing multicast RAs to go through
! //poipoi xv -- TODO -- check if this still needed. NO RAs anymore after RPL implementation.
! /*if (m==1 && dam==IPHC_DAM_ELIDED) {
! ipv6_header.header_length += sizeof(uint8_t);
! }*/
return ipv6_header;
}
--- 671,695 ----
temp_8b = *((uint8_t*)(msg->payload)+ipv6_header.header_length);
if ( (temp_8b & NHC_UDP_MASK) == NHC_UDP_ID) {
ipv6_header.next_header = IANA_UDP;
! }else if ( (temp_8b & NHC_IPv6EXT_MASK) == NHC_IPv6EXT_ID){
! if( (temp_8b & NHC_IPv6HOP_MASK) == NHC_IPv6HOP_VAL){
! //it is hop by hop header
! ipv6_header.next_header = IANA_IPv6HOPOPT;
! }else{
! // the next header could be another IPv6 extension header
! ipv6_header.next_header = IANA_UNDEFINED;
! openserial_printError(COMPONENT_IPHC,ERR_6LOWPAN_UNSUPPORTED,
! (errorparameter_t)11,
! (errorparameter_t)ipv6_header.next_header);
! }
! }else {
// the next header could be an IPv6 extension header, or misformed
ipv6_header.next_header = IANA_UNDEFINED;
openserial_printError(COMPONENT_IPHC,ERR_6LOWPAN_UNSUPPORTED,
! (errorparameter_t)12,
(errorparameter_t)ipv6_header.next_header);
}
}
!
return ipv6_header;
}

View File

@ -0,0 +1,106 @@
*** stock_iot-lab_M3/openwsn/03a-IPHC/iphc.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/03a-IPHC/iphc.h Thu Apr 24 16:55:54 2014
***************
*** 8,16 ****
--- 8,18 ----
\{
*/
+ #include "openwsn.h"
//=========================== define ==========================================
#define IPHC_DEFAULT_HOP_LIMIT 65
+ #define IPv6HOP_HDR_LEN 3
enum IPHC_enums {
IPHC_DISPATCH = 5,
***************
*** 50,55 ****
--- 52,64 ----
NHC_UDP_ID = 0xf0, // b1111 0000
};
+ enum NHC_IPv6HOP_enums {
+ NHC_IPv6HOP_MASK = 0x0e,
+ NHC_IPv6HOP_VAL = 0x0e,
+ NHC_HOP_NH_MASK = 0x01,
+ };
+
+
enum NHC_UDP_enums {
NHC_UDP_C_MASK = 0x40,
NHC_UDP_PORTS_MASK = 0x03,
***************
*** 116,130 ****
uint8_t header_length; ///< needed to toss the header
} ipv6_header_iht; //iht for "internal header type"
//=========================== variables =======================================
//=========================== prototypes ======================================
! void iphc_init();
! error_t iphc_sendFromForwarding(OpenQueueEntry_t *msg, ipv6_header_iht ipv6_header, uint8_t fw_SendOrfw_Rcv);
! error_t iphc_sendFromBridge(OpenQueueEntry_t *msg);
! void iphc_sendDone(OpenQueueEntry_t* msg, error_t error);
! void iphc_receive(OpenQueueEntry_t* msg);
/**
\}
--- 125,180 ----
uint8_t header_length; ///< needed to toss the header
} ipv6_header_iht; //iht for "internal header type"
+
+ /*
+ The Hop-by-Hop Options header is used to carry optional information
+ that must be examined by every node along a packet's delivery path.
+ The Hop-by-Hop Options header is identified by a Next Header value of
+ 0 in the IPv6 header, and has the following format:
+ */
+ typedef struct {
+ /*see rfc 6282 section 4.2 The first 7 bits serve as an identifier for the IPv6 Extension Header immediately
+ following the LOWPAN_NHC octet. The remaining bit indicates whether
+ or not the following header utilizes LOWPAN_NHC encoding. */
+ uint8_t headerlen;// counter for internal use
+ bool next_header_compressed;
+ uint8_t lowpan_nhc;
+ uint8_t nextHeader;//IPv6 hop by hop header field see rfc 2460 section 4.3
+ uint8_t HdrExtLen; //IPv6 hop by hop header field see rfc 6282 section 4.2
+ /*
+ The Length field contained in a compressed IPv6 Extension Header
+ indicates the number of octets that pertain to the (compressed)
+ extension header following the Length field. Note that this changes
+ the Length field definition in [RFC2460] from indicating the header
+ size in 8-octet units, not including the first 8 octets. Changing
+ the Length field to be in units of octets removes wasteful internal
+ fragmentation.*/
+
+ } ipv6_hopbyhop_ht;
+
+ PRAGMA(pack(1));
+ typedef struct {
+ //RPL hop by hop option header as described by RFC 6553 p.3
+ uint8_t optionType; ///0x63.
+ uint8_t optionLen; /////8-bit field indicating the length of the option, in octets, excluding the Option Type and Opt Data Len fields.
+ uint8_t flags; //ORF00000.
+ uint8_t rplInstanceID; //instanceid
+ uint16_t senderRank; //sender rank
+ } rpl_hopoption_ht;
+ PRAGMA(pack());
//=========================== variables =======================================
//=========================== prototypes ======================================
! void iphc_init(void);
! owerror_t iphc_sendFromForwarding(OpenQueueEntry_t *msg,
! ipv6_header_iht ipv6_header,
! rpl_hopoption_ht *hopbyhop_option,
! uint8_t fw_SendOrfw_Rcv);
!
! owerror_t iphc_sendFromBridge(OpenQueueEntry_t *msg);
! void iphc_sendDone(OpenQueueEntry_t *msg, owerror_t error);
! void iphc_receive(OpenQueueEntry_t *msg);
/**
\}

View File

@ -0,0 +1,104 @@
*** stock_iot-lab_M3/openwsn/03a-IPHC/openbridge.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/03a-IPHC/openbridge.c Thu Apr 24 16:55:54 2014
***************
*** 9,41 ****
//=========================== variables =======================================
//=========================== prototypes ======================================
-
//=========================== public ==========================================
! void openbridge_init() {
}
! void openbridge_triggerData() {
uint8_t input_buffer[136];//worst case: 8B of next hop + 128B of data
OpenQueueEntry_t* pkt;
uint8_t numDataBytes;
!
numDataBytes = openserial_getNumDataBytes();
! openserial_getInputBuffer(&(input_buffer[0]),numDataBytes);
!
//poipoi xv
//this is a temporal workaround as we are never supposed to get chunks of data
//longer than input buffer size.. I assume that HDLC will solve that.
!
! if (numDataBytes>136){
openserial_printError(COMPONENT_OPENBRIDGE,ERR_INPUTBUFFER_LENGTH,
! (errorparameter_t)0,
! (errorparameter_t)numDataBytes);
! //return;
! //poipoi xv test that..
! numDataBytes=sizeof(input_buffer);
}
!
if (idmanager_getIsBridge()==TRUE && numDataBytes>0) {
pkt = openqueue_getFreePacketBuffer(COMPONENT_OPENBRIDGE);
if (pkt==NULL) {
--- 9,41 ----
//=========================== variables =======================================
//=========================== prototypes ======================================
//=========================== public ==========================================
! void openbridge_init(void) {
}
! void openbridge_triggerData(void) {
uint8_t input_buffer[136];//worst case: 8B of next hop + 128B of data
OpenQueueEntry_t* pkt;
uint8_t numDataBytes;
!
numDataBytes = openserial_getNumDataBytes();
!
//poipoi xv
//this is a temporal workaround as we are never supposed to get chunks of data
//longer than input buffer size.. I assume that HDLC will solve that.
! // MAC header is 13B + 8 next hop so we cannot accept packets that are longer than 118B
! if (numDataBytes>(136 - 21) || numDataBytes<8){
! //to prevent too short or too long serial frames to kill the stack
openserial_printError(COMPONENT_OPENBRIDGE,ERR_INPUTBUFFER_LENGTH,
! (errorparameter_t)numDataBytes,
! (errorparameter_t)0);
! return;
}
!
! //copying the buffer once we know it is not too big
! openserial_getInputBuffer(&(input_buffer[0]),numDataBytes);
!
if (idmanager_getIsBridge()==TRUE && numDataBytes>0) {
pkt = openqueue_getFreePacketBuffer(COMPONENT_OPENBRIDGE);
if (pkt==NULL) {
***************
*** 53,58 ****
--- 53,65 ----
//payload
packetfunctions_reserveHeaderSize(pkt,numDataBytes-8);
memcpy(pkt->payload,&(input_buffer[8]),numDataBytes-8);
+
+ //this is to catch the too short packet. remove it after fw-103 is solved.
+ if (numDataBytes<16){
+ openserial_printError(COMPONENT_OPENBRIDGE,ERR_INVALIDSERIALFRAME,
+ (errorparameter_t)0,
+ (errorparameter_t)0);
+ }
//send
if ((iphc_sendFromBridge(pkt))==E_FAIL) {
openqueue_freePacketBuffer(pkt);
***************
*** 60,66 ****
}
}
! void openbridge_sendDone(OpenQueueEntry_t* msg, error_t error) {
msg->owner = COMPONENT_OPENBRIDGE;
if (msg->creator!=COMPONENT_OPENBRIDGE) {
openserial_printError(COMPONENT_OPENBRIDGE,ERR_UNEXPECTED_SENDDONE,
--- 67,73 ----
}
}
! void openbridge_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
msg->owner = COMPONENT_OPENBRIDGE;
if (msg->creator!=COMPONENT_OPENBRIDGE) {
openserial_printError(COMPONENT_OPENBRIDGE,ERR_UNEXPECTED_SENDDONE,

View File

@ -0,0 +1,23 @@
*** stock_iot-lab_M3/openwsn/03a-IPHC/openbridge.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/03a-IPHC/openbridge.h Thu Apr 24 16:53:29 2014
***************
*** 16,24 ****
//=========================== prototypes ======================================
! void openbridge_init();
! void openbridge_triggerData();
! void openbridge_sendDone(OpenQueueEntry_t* msg, error_t error);
void openbridge_receive(OpenQueueEntry_t* msg);
/**
--- 16,24 ----
//=========================== prototypes ======================================
! void openbridge_init(void);
! void openbridge_triggerData(void);
! void openbridge_sendDone(OpenQueueEntry_t* msg, owerror_t error);
void openbridge_receive(OpenQueueEntry_t* msg);
/**

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/03b-IPv6/Makefile Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/03b-IPv6/Makefile Mon May 12 13:09:48 2014
***************
*** 0 ****
--- 1,32 ----
+ SUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBMOD)
+
+ $(BINDIR)$(SUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,530 @@
*** stock_iot-lab_M3/openwsn/03b-IPv6/forwarding.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/03b-IPv6/forwarding.c Thu Apr 24 16:55:54 2014
***************
*** 7,31 ****
#include "packetfunctions.h"
#include "neighbors.h"
#include "icmpv6.h"
#include "openudp.h"
#include "opentcp.h"
//=========================== variables =======================================
//=========================== prototypes ======================================
! error_t fowarding_send_internal_RoutingTable(OpenQueueEntry_t *msg, ipv6_header_iht ipv6_header, uint8_t fw_SendOrfw_Rcv);
void forwarding_getNextHop_RoutingTable(open_addr_t* destination, open_addr_t* addressToWrite);
! error_t fowarding_send_internal_SourceRouting(OpenQueueEntry_t *msg, ipv6_header_iht ipv6_header);
//=========================== public ==========================================
/**
\brief Initialize this module.
*/
! void forwarding_init() {
}
/**
\brief Send a packet originating at this mote.
--- 7,36 ----
#include "packetfunctions.h"
#include "neighbors.h"
#include "icmpv6.h"
+ #include "icmpv6rpl.h"
#include "openudp.h"
#include "opentcp.h"
+ //#include "debugpins.h"
+ #include "scheduler.h"
//=========================== variables =======================================
//=========================== prototypes ======================================
! owerror_t forwarding_send_internal_RoutingTable(OpenQueueEntry_t *msg, ipv6_header_iht ipv6_header, rpl_hopoption_ht hopbyhop_header, uint8_t fw_SendOrfw_Rcv);
void forwarding_getNextHop_RoutingTable(open_addr_t* destination, open_addr_t* addressToWrite);
! owerror_t forwarding_send_internal_SourceRouting(OpenQueueEntry_t *msg, ipv6_header_iht ipv6_header);
! void forwarding_createHopByHopOption(rpl_hopoption_ht *hopbyhop_opt, uint8_t flags);
//=========================== public ==========================================
/**
\brief Initialize this module.
*/
! void forwarding_init(void) {
}
+
/**
\brief Send a packet originating at this mote.
***************
*** 34,41 ****
\param[in,out] msg Packet to send.
*/
! error_t forwarding_send(OpenQueueEntry_t* msg) {
ipv6_header_iht ipv6_header;
open_addr_t* myprefix;
open_addr_t* myadd64;
--- 39,48 ----
\param[in,out] msg Packet to send.
*/
! owerror_t forwarding_send(OpenQueueEntry_t* msg) {
ipv6_header_iht ipv6_header;
+ rpl_hopoption_ht hopbyhop_opt;
+
open_addr_t* myprefix;
open_addr_t* myadd64;
***************
*** 58,65 ****
//this is done here as send_internal is used by forwarding of packets as well which
//carry a hlim. This value is required to be set to a value as the following function can decrement it
ipv6_header.hop_limit = IPHC_DEFAULT_HOP_LIMIT;
! return fowarding_send_internal_RoutingTable(msg,ipv6_header,PCKTSEND);
}
/**
--- 65,74 ----
//this is done here as send_internal is used by forwarding of packets as well which
//carry a hlim. This value is required to be set to a value as the following function can decrement it
ipv6_header.hop_limit = IPHC_DEFAULT_HOP_LIMIT;
+ //create hop by hop option
+ forwarding_createHopByHopOption(&hopbyhop_opt, 0x00); //flags are 0x00 -- TODO check and define macro
! return forwarding_send_internal_RoutingTable(msg,ipv6_header,hopbyhop_opt,PCKTSEND);
}
/**
***************
*** 68,74 ****
\param[in,out] msg The packet just sent.
\param[in] error The outcome of sending it.
*/
! void forwarding_sendDone(OpenQueueEntry_t* msg, error_t error) {
// take ownership
msg->owner = COMPONENT_FORWARDING;
--- 77,83 ----
\param[in,out] msg The packet just sent.
\param[in] error The outcome of sending it.
*/
! void forwarding_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
// take ownership
msg->owner = COMPONENT_FORWARDING;
***************
*** 108,126 ****
\param[in,out] msg The packet just sent.
\param[in] ipv6_header The information contained in the 6LoWPAN header.
*/
! void forwarding_receive(OpenQueueEntry_t* msg, ipv6_header_iht ipv6_header) {
// take ownership
msg->owner = COMPONENT_FORWARDING;
- // populate packets metadata with l4 information
- msg->l4_protocol = ipv6_header.next_header;
- msg->l4_protocol_compressed = ipv6_header.next_header_compressed;
! // populate packets metadata with l3 information
memcpy(&(msg->l3_destinationAdd),&ipv6_header.dest,sizeof(open_addr_t));
memcpy(&(msg->l3_sourceAdd), &ipv6_header.src, sizeof(open_addr_t));
if (
(
idmanager_isMyAddress(&ipv6_header.dest)
--- 117,152 ----
\param[in,out] msg The packet just sent.
\param[in] ipv6_header The information contained in the 6LoWPAN header.
*/
! void forwarding_receive(OpenQueueEntry_t* msg,
! ipv6_header_iht ipv6_header,
! ipv6_hopbyhop_ht ipv6_hop_header,
! rpl_hopoption_ht hop_by_hop_option) {
!
! uint8_t temp_flags;
// take ownership
msg->owner = COMPONENT_FORWARDING;
! //contains a
! if (ipv6_header.next_header==IANA_IPv6HOPOPT){
! // populate packets metadata with l4 information
! msg->l4_protocol = ipv6_hop_header.nextHeader;
! msg->l4_protocol_compressed = ipv6_hop_header.next_header_compressed; // rfc 6282
!
! //process HOP BY HOP header
!
!
! }else{
! msg->l4_protocol = ipv6_header.next_header;
! msg->l4_protocol_compressed = ipv6_header.next_header_compressed; // rfc 6282
! }
!
! // populate packets metadata with l3 information
memcpy(&(msg->l3_destinationAdd),&ipv6_header.dest,sizeof(open_addr_t));
memcpy(&(msg->l3_sourceAdd), &ipv6_header.src, sizeof(open_addr_t));
+
if (
(
idmanager_isMyAddress(&ipv6_header.dest)
***************
*** 128,136 ****
packetfunctions_isBroadcastMulticast(&ipv6_header.dest)
)
&&
ipv6_header.next_header!=IANA_IPv6ROUTE
) {
! // this packet is for me, but no routing header.
// indicate received packet to upper layer
switch(msg->l4_protocol) {
--- 154,163 ----
packetfunctions_isBroadcastMulticast(&ipv6_header.dest)
)
&&
+ //ipv6 header - next header will be IANA_IPv6HOPOPT or IANA_IPv6ROUTE
ipv6_header.next_header!=IANA_IPv6ROUTE
) {
! // this packet is for me, but no src routing header.
// indicate received packet to upper layer
switch(msg->l4_protocol) {
***************
*** 151,178 ****
}
} else {
// this packet is not for me: relay
!
// change the creator of the packet
msg->creator = COMPONENT_FORWARDING;
if (ipv6_header.next_header!=IANA_IPv6ROUTE) {
// no source routing header present
!
// resend as if from upper layer
! if (fowarding_send_internal_RoutingTable(msg, ipv6_header,PCKTFORWARD)==E_FAIL) {
openqueue_freePacketBuffer(msg);
}
} else {
! // source routing header present
!
! if (fowarding_send_internal_SourceRouting(msg, ipv6_header)==E_FAIL) {
! openqueue_freePacketBuffer(msg);
}
}
}
}
! //=========================== private =========================================
/**
\brief Send a packet using the routing table to find the next hop.
--- 178,230 ----
}
} else {
// this packet is not for me: relay
!
// change the creator of the packet
msg->creator = COMPONENT_FORWARDING;
if (ipv6_header.next_header!=IANA_IPv6ROUTE) {
// no source routing header present
!
! //process HOP bY HOP header
! temp_flags = hop_by_hop_option.flags;
! if ((temp_flags & O_FLAG)!=0){
! //error wrong direction
! //what todo? print the error
! openserial_printError(COMPONENT_FORWARDING,ERR_WRONG_DIRECTION,
! (errorparameter_t)1,
! (errorparameter_t)1);
! }
! if (hop_by_hop_option.senderRank < neighbors_getMyDAGrank()){
! //wrong rank relation.. loop detected
! temp_flags |= R_FLAG; //set r flag.
! openserial_printError(COMPONENT_FORWARDING,ERR_LOOP_DETECTED,
! (errorparameter_t) hop_by_hop_option.senderRank,
! (errorparameter_t) neighbors_getMyDAGrank());
! }
!
! //O flag should always be 0 as this is upstream route.
!
! forwarding_createHopByHopOption(&hop_by_hop_option, temp_flags);
!
!
// resend as if from upper layer
! if (forwarding_send_internal_RoutingTable(msg, ipv6_header,hop_by_hop_option,PCKTFORWARD)==E_FAIL) {
openqueue_freePacketBuffer(msg);
}
} else {
! // source routing header present
! if (forwarding_send_internal_SourceRouting(msg, ipv6_header)==E_FAIL) {
! //already freed by send_internal if it fails
! //todo change error type to another that says src_route failure.
! openserial_printError(COMPONENT_FORWARDING,ERR_INVALID_FWDMODE,
! (errorparameter_t)0,
! (errorparameter_t)0);
}
}
}
}
!
/**
\brief Send a packet using the routing table to find the next hop.
***************
*** 182,188 ****
\param[in] fw_SendOrfw_Rcv The packet is originating from this mote
(PCKTSEND), or forwarded (PCKTFORWARD).
*/
! error_t fowarding_send_internal_RoutingTable(OpenQueueEntry_t* msg, ipv6_header_iht ipv6_header, uint8_t fw_SendOrfw_Rcv) {
// retrieve the next hop from the routing table
forwarding_getNextHop_RoutingTable(&(msg->l3_destinationAdd),&(msg->l2_nextORpreviousHop));
--- 234,240 ----
\param[in] fw_SendOrfw_Rcv The packet is originating from this mote
(PCKTSEND), or forwarded (PCKTFORWARD).
*/
! owerror_t forwarding_send_internal_RoutingTable(OpenQueueEntry_t* msg, ipv6_header_iht ipv6_header, rpl_hopoption_ht hopbyhop_opt, uint8_t fw_SendOrfw_Rcv) {
// retrieve the next hop from the routing table
forwarding_getNextHop_RoutingTable(&(msg->l3_destinationAdd),&(msg->l2_nextORpreviousHop));
***************
*** 194,200 ****
}
// send to next lower layer
! return iphc_sendFromForwarding(msg, ipv6_header, fw_SendOrfw_Rcv);
}
/**
--- 246,252 ----
}
// send to next lower layer
! return iphc_sendFromForwarding(msg, ipv6_header, &hopbyhop_opt,fw_SendOrfw_Rcv);
}
/**
***************
*** 208,214 ****
\param[in,out] msg The packet to send.
\param[in] ipv6_header The packet's IPv6 header.
*/
! error_t fowarding_send_internal_SourceRouting(OpenQueueEntry_t *msg, ipv6_header_iht ipv6_header) {
uint8_t local_CmprE;
uint8_t local_CmprI;
uint8_t numAddr;
--- 260,266 ----
\param[in,out] msg The packet to send.
\param[in] ipv6_header The packet's IPv6 header.
*/
! owerror_t forwarding_send_internal_SourceRouting(OpenQueueEntry_t *msg, ipv6_header_iht ipv6_header) {
uint8_t local_CmprE;
uint8_t local_CmprI;
uint8_t numAddr;
***************
*** 218,223 ****
--- 270,279 ----
uint8_t octetsAddressSize;
open_addr_t* prefix;
rpl_routing_ht* rpl_routing_hdr;
+
+ rpl_hopoption_ht hopbyhop_opt;
+
+ memset(&hopbyhop_opt,0,sizeof(rpl_hopoption_ht));//reset everything
// get my prefix
prefix = idmanager_getMyID(ADDR_PREFIX);
***************
*** 270,275 ****
--- 326,332 ----
openserial_printError(COMPONENT_FORWARDING,ERR_WRONG_TRAN_PROTOCOL,
(errorparameter_t)msg->l4_protocol,
(errorparameter_t)1);
+ //not sure that this is correct as iphc will free it?
openqueue_freePacketBuffer(msg);
return E_FAIL;
}
***************
*** 297,304 ****
rpl_routing_hdr->SegmentsLeft--;
// find next hop address in source route
! addressposition = numAddr-(rpl_routing_hdr->SegmentsLeft);
!
// how many octets have the address?
if (rpl_routing_hdr->SegmentsLeft > 1){
octetsAddressSize = LENGTH_ADDR128b - local_CmprI; //max addr length - number of prefix octets that are elided in the internal route elements
--- 354,361 ----
rpl_routing_hdr->SegmentsLeft--;
// find next hop address in source route
! //addressposition = numAddr-(rpl_routing_hdr->SegmentsLeft);
! addressposition = rpl_routing_hdr->SegmentsLeft;
// how many octets have the address?
if (rpl_routing_hdr->SegmentsLeft > 1){
octetsAddressSize = LENGTH_ADDR128b - local_CmprI; //max addr length - number of prefix octets that are elided in the internal route elements
***************
*** 311,324 ****
msg->l2_nextORpreviousHop.type = ADDR_16B;
memcpy(
&(msg->l2_nextORpreviousHop.addr_16b),
! runningPointer+((addressposition-1)*octetsAddressSize),
octetsAddressSize
);
// write next hop
msg->l3_destinationAdd.type = ADDR_16B;
memcpy(
&(msg->l3_destinationAdd.addr_16b),
! runningPointer+((addressposition-1)*octetsAddressSize),
octetsAddressSize
);
break;
--- 368,381 ----
msg->l2_nextORpreviousHop.type = ADDR_16B;
memcpy(
&(msg->l2_nextORpreviousHop.addr_16b),
! runningPointer+((addressposition)*octetsAddressSize),
octetsAddressSize
);
// write next hop
msg->l3_destinationAdd.type = ADDR_16B;
memcpy(
&(msg->l3_destinationAdd.addr_16b),
! runningPointer+((addressposition)*octetsAddressSize),
octetsAddressSize
);
break;
***************
*** 327,333 ****
msg->l2_nextORpreviousHop.type = ADDR_64B;
memcpy(
&(msg->l2_nextORpreviousHop.addr_64b),
! runningPointer+((addressposition-1)*octetsAddressSize),
octetsAddressSize
);
--- 384,390 ----
msg->l2_nextORpreviousHop.type = ADDR_64B;
memcpy(
&(msg->l2_nextORpreviousHop.addr_64b),
! runningPointer+((addressposition)*octetsAddressSize),
octetsAddressSize
);
***************
*** 344,350 ****
memcpy(
&(msg->l3_destinationAdd.addr_128b[8]),
! runningPointer+((addressposition-1)*octetsAddressSize),
octetsAddressSize
);
--- 401,407 ----
memcpy(
&(msg->l3_destinationAdd.addr_128b[8]),
! runningPointer+((addressposition)*octetsAddressSize),
octetsAddressSize
);
***************
*** 354,367 ****
msg->l2_nextORpreviousHop.type = ADDR_128B;
memcpy(
&(msg->l2_nextORpreviousHop.addr_128b),
! runningPointer+((addressposition-1)*octetsAddressSize),
octetsAddressSize
);
// write next hop
msg->l3_destinationAdd.type = ADDR_128B;
memcpy(
&(msg->l3_destinationAdd.addr_128b),
! runningPointer+((addressposition-1)*octetsAddressSize),
octetsAddressSize
);
break;
--- 411,424 ----
msg->l2_nextORpreviousHop.type = ADDR_128B;
memcpy(
&(msg->l2_nextORpreviousHop.addr_128b),
! runningPointer+((addressposition)*octetsAddressSize),
octetsAddressSize
);
// write next hop
msg->l3_destinationAdd.type = ADDR_128B;
memcpy(
&(msg->l3_destinationAdd.addr_128b),
! runningPointer+((addressposition)*octetsAddressSize),
octetsAddressSize
);
break;
***************
*** 378,391 ****
}
// send to next lower layer
! return iphc_sendFromForwarding(msg, ipv6_header, PCKTFORWARD);
}
/**
\brief Retrieve the next hop's address from routing table.
\param[in] destination128b Final IPv6 destination address.
! \param[out]addressToWrite64b Location to write the EUI64 of next hop to.
*/
void forwarding_getNextHop_RoutingTable(open_addr_t* destination128b, open_addr_t* addressToWrite64b) {
uint8_t i;
--- 435,448 ----
}
// send to next lower layer
! return iphc_sendFromForwarding(msg, ipv6_header,&hopbyhop_opt, PCKTFORWARD);
}
/**
\brief Retrieve the next hop's address from routing table.
\param[in] destination128b Final IPv6 destination address.
! \param[out] addressToWrite64b Location to write the EUI64 of next hop to.
*/
void forwarding_getNextHop_RoutingTable(open_addr_t* destination128b, open_addr_t* addressToWrite64b) {
uint8_t i;
***************
*** 403,406 ****
// destination is remote, send to preferred parent
neighbors_getPreferredParentEui64(addressToWrite64b);
}
! }
\ No newline at end of file
--- 460,478 ----
// destination is remote, send to preferred parent
neighbors_getPreferredParentEui64(addressToWrite64b);
}
! }
! /*
! * HOP BY HOP HEADER OPTION
! */
!
!
! void forwarding_createHopByHopOption(rpl_hopoption_ht *hopbyhop_opt, uint8_t flags) {
! //set the rpl hop by hop header
! hopbyhop_opt->optionType = RPL_HOPBYHOP_HEADER_OPTION_TYPE;
! //8-bit field indicating the length of the option, in
! //octets, excluding the Option Type and Opt Data Len fields.
! hopbyhop_opt->optionLen = 0x04; //4-bytes, flags+instanceID+senderrank - no sub-tlvs
! hopbyhop_opt->flags = flags;
! hopbyhop_opt->rplInstanceID = icmpv6rpl_getRPLIntanceID(); //getit..
! hopbyhop_opt->senderRank = neighbors_getMyDAGrank(); //TODO change to DAGRAnk(rank) instead of rank
! }

View File

@ -0,0 +1,54 @@
*** stock_iot-lab_M3/openwsn/03b-IPv6/forwarding.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/03b-IPv6/forwarding.h Thu Apr 24 16:55:54 2014
***************
*** 10,22 ****
--- 10,32 ----
#include "iphc.h"
+
//=========================== define ==========================================
+ #define RPL_HOPBYHOP_HEADER_OPTION_TYPE 0x63
+
enum {
PCKTFORWARD = 1,
PCKTSEND = 2,
};
+ enum {
+ O_FLAG = 0x80,
+ R_FLAG = 0x40,
+ F_FLAG = 0x20,
+ };
+
+
//=========================== typedef =========================================
/**
***************
*** 40,49 ****
//=========================== prototypes ======================================
! void forwarding_init();
! error_t forwarding_send(OpenQueueEntry_t *msg);
! void forwarding_sendDone(OpenQueueEntry_t* msg, error_t error);
! void forwarding_receive(OpenQueueEntry_t* msg, ipv6_header_iht ipv6_header);
/**
\}
--- 50,62 ----
//=========================== prototypes ======================================
! void forwarding_init(void);
! owerror_t forwarding_send(OpenQueueEntry_t *msg);
! void forwarding_sendDone(OpenQueueEntry_t *msg, owerror_t error);
! void forwarding_receive(OpenQueueEntry_t *msg,
! ipv6_header_iht ipv6_header,
! ipv6_hopbyhop_ht ipv6_hop_header,
! rpl_hopoption_ht hop_by_hop_option);
/**
\}

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/03b-IPv6/icmpv6.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/03b-IPv6/icmpv6.c Thu Apr 24 16:55:54 2014
***************
*** 12,27 ****
//=========================== public ==========================================
! void icmpv6_init() {
}
! error_t icmpv6_send(OpenQueueEntry_t* msg) {
msg->owner = COMPONENT_ICMPv6;
msg->l4_protocol = IANA_ICMPv6;
return forwarding_send(msg);
}
! void icmpv6_sendDone(OpenQueueEntry_t* msg, error_t error) {
msg->owner = COMPONENT_ICMPv6;
switch (msg->l4_sourcePortORicmpv6Type) {
case IANA_ICMPv6_ECHO_REQUEST:
--- 12,27 ----
//=========================== public ==========================================
! void icmpv6_init(void) {
}
! owerror_t icmpv6_send(OpenQueueEntry_t* msg) {
msg->owner = COMPONENT_ICMPv6;
msg->l4_protocol = IANA_ICMPv6;
return forwarding_send(msg);
}
! void icmpv6_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
msg->owner = COMPONENT_ICMPv6;
switch (msg->l4_sourcePortORicmpv6Type) {
case IANA_ICMPv6_ECHO_REQUEST:

View File

@ -0,0 +1,23 @@
*** stock_iot-lab_M3/openwsn/03b-IPv6/icmpv6.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/03b-IPv6/icmpv6.h Thu Apr 24 16:53:29 2014
***************
*** 48,56 ****
//=========================== prototypes ======================================
! void icmpv6_init();
! error_t icmpv6_send(OpenQueueEntry_t* msg);
! void icmpv6_sendDone(OpenQueueEntry_t* msg, error_t error);
void icmpv6_receive(OpenQueueEntry_t* msg);
/**
--- 48,56 ----
//=========================== prototypes ======================================
! void icmpv6_init(void);
! owerror_t icmpv6_send(OpenQueueEntry_t* msg);
! void icmpv6_sendDone(OpenQueueEntry_t* msg, owerror_t error);
void icmpv6_receive(OpenQueueEntry_t* msg);
/**

View File

@ -0,0 +1,107 @@
*** stock_iot-lab_M3/openwsn/03b-IPv6/icmpv6echo.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/03b-IPv6/icmpv6echo.c Thu Apr 24 16:55:54 2014
***************
*** 4,33 ****
#include "openserial.h"
#include "openqueue.h"
#include "packetfunctions.h"
//=========================== variables =======================================
- typedef struct {
- bool busySending;
- open_addr_t hisAddress;
- uint16_t seq;
- } icmpv6echo_vars_t;
-
icmpv6echo_vars_t icmpv6echo_vars;
//=========================== prototypes ======================================
//=========================== public ==========================================
! void icmpv6echo_init() {
icmpv6echo_vars.busySending = FALSE;
icmpv6echo_vars.seq = 0;
}
! void icmpv6echo_trigger() {
uint8_t number_bytes_from_input_buffer;
uint8_t input_buffer[16];
OpenQueueEntry_t* msg;
//get command from OpenSerial (16B IPv6 destination address)
number_bytes_from_input_buffer = openserial_getInputBuffer(&(input_buffer[0]),sizeof(input_buffer));
--- 4,29 ----
#include "openserial.h"
#include "openqueue.h"
#include "packetfunctions.h"
+ //#include "debugpins.h"
//=========================== variables =======================================
icmpv6echo_vars_t icmpv6echo_vars;
//=========================== prototypes ======================================
//=========================== public ==========================================
! void icmpv6echo_init(void) {
icmpv6echo_vars.busySending = FALSE;
icmpv6echo_vars.seq = 0;
}
! void icmpv6echo_trigger(void) {
uint8_t number_bytes_from_input_buffer;
uint8_t input_buffer[16];
OpenQueueEntry_t* msg;
+
//get command from OpenSerial (16B IPv6 destination address)
number_bytes_from_input_buffer = openserial_getInputBuffer(&(input_buffer[0]),sizeof(input_buffer));
***************
*** 84,90 ****
}
}
! void icmpv6echo_sendDone(OpenQueueEntry_t* msg, error_t error) {
msg->owner = COMPONENT_ICMPv6ECHO;
if (msg->creator!=COMPONENT_ICMPv6ECHO) {//that was a packet I had not created
openserial_printError(COMPONENT_ICMPv6ECHO,ERR_UNEXPECTED_SENDDONE,
--- 80,86 ----
}
}
! void icmpv6echo_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
msg->owner = COMPONENT_ICMPv6ECHO;
if (msg->creator!=COMPONENT_ICMPv6ECHO) {//that was a packet I had not created
openserial_printError(COMPONENT_ICMPv6ECHO,ERR_UNEXPECTED_SENDDONE,
***************
*** 93,99 ****
}
openqueue_freePacketBuffer(msg);
icmpv6echo_vars.busySending = FALSE;
! }
void icmpv6echo_receive(OpenQueueEntry_t* msg) {
OpenQueueEntry_t* reply;
--- 89,95 ----
}
openqueue_freePacketBuffer(msg);
icmpv6echo_vars.busySending = FALSE;
! }
void icmpv6echo_receive(OpenQueueEntry_t* msg) {
OpenQueueEntry_t* reply;
***************
*** 149,152 ****
}
}
! //=========================== private =========================================
\ No newline at end of file
--- 145,148 ----
}
}
! //=========================== private =========================================

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/03b-IPv6/icmpv6echo.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/03b-IPv6/icmpv6echo.h Thu Apr 24 16:53:29 2014
***************
*** 12,24 ****
//=========================== typedef =========================================
! //=========================== variables =======================================
//=========================== prototypes ======================================
! void icmpv6echo_init();
! void icmpv6echo_trigger();
! void icmpv6echo_sendDone(OpenQueueEntry_t* msg, error_t error);
void icmpv6echo_receive(OpenQueueEntry_t* msg);
/**
--- 12,30 ----
//=========================== typedef =========================================
! //=========================== module variables ================================
!
! typedef struct {
! bool busySending;
! open_addr_t hisAddress;
! uint16_t seq;
! } icmpv6echo_vars_t;
//=========================== prototypes ======================================
! void icmpv6echo_init(void);
! void icmpv6echo_trigger(void);
! void icmpv6echo_sendDone(OpenQueueEntry_t* msg, owerror_t error);
void icmpv6echo_receive(OpenQueueEntry_t* msg);
/**

View File

@ -0,0 +1,369 @@
*** stock_iot-lab_M3/openwsn/03b-IPv6/icmpv6rpl.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/03b-IPv6/icmpv6rpl.c Thu Apr 24 16:55:54 2014
***************
*** 11,56 ****
#include "opentimers.h"
#include "IEEE802154E.h"
! //=========================== variables =======================================
! typedef struct {
! // admin
! bool busySending; ///< currently sending DIO/DAO.
! uint8_t DODAGIDFlagSet; ///< is DODAGID set already?
! // DIO-related
! icmpv6rpl_dio_ht dio; ///< pre-populated DIO packet.
! open_addr_t dioDestination; ///< IPv6 destination address for DIOs.
! uint16_t periodDIO; ///< duration, in ms, of a timerIdDIO timeout.
! opentimer_id_t timerIdDIO; ///< ID of the timer used to send DIOs.
! uint8_t delayDIO; ///< number of timerIdDIO events before actually sending a DIO.
! // DAO-related
! icmpv6rpl_dao_ht dao; ///< pre-populated DAO packet.
! icmpv6rpl_dao_transit_ht dao_transit; ///< pre-populated DAO "Transit Info" option header.
! icmpv6rpl_dao_target_ht dao_target; ///< pre-populated DAO "Transit Info" option header.
! opentimer_id_t timerIdDAO; ///< ID of the timer used to send DAOs.
! uint16_t periodDAO; ///< duration, in ms, of a timerIdDAO timeout.
! uint8_t delayDAO; ///< number of timerIdDIO events before actually sending a DAO.
! } icmpv6rpl_vars_t;
icmpv6rpl_vars_t icmpv6rpl_vars;
//=========================== prototypes ======================================
// DIO-related
! void icmpv6rpl_timer_DIO_cb();
! void icmpv6rpl_timer_DIO_task();
! void sendDIO();
// DAO-related
! void icmpv6rpl_timer_DAO_cb();
! void icmpv6rpl_timer_DAO_task();
! void sendDAO();
//=========================== public ==========================================
/**
\brief Initialize this module.
*/
! void icmpv6rpl_init() {
//===== reset local variables
memset(&icmpv6rpl_vars,0,sizeof(icmpv6rpl_vars_t));
--- 11,41 ----
#include "opentimers.h"
#include "IEEE802154E.h"
! #include "thread.h"
! //=========================== variables =======================================
icmpv6rpl_vars_t icmpv6rpl_vars;
+ //static char openwsn_icmpv6rpl_DAO_stack[KERNEL_CONF_STACKSIZE_MAIN];
+ //static char openwsn_icmpv6rpl_DIO_stack[KERNEL_CONF_STACKSIZE_MAIN];
//=========================== prototypes ======================================
// DIO-related
! void icmpv6rpl_timer_DIO_cb(void);
! void icmpv6rpl_timer_DIO_task(void);
! void sendDIO(void);
// DAO-related
! void icmpv6rpl_timer_DAO_cb(void);
! void icmpv6rpl_timer_DAO_task(void);
! void sendDAO(void);
//=========================== public ==========================================
/**
\brief Initialize this module.
*/
! void icmpv6rpl_init(void) {
//===== reset local variables
memset(&icmpv6rpl_vars,0,sizeof(icmpv6rpl_vars_t));
***************
*** 101,107 ****
D_DAO |
K_DAO;
icmpv6rpl_vars.dao.reserved = 0x00;
! icmpv6rpl_vars.dao.DAOSequance = 0x00;
// DODAGID: to be populated upon receiving DIO
icmpv6rpl_vars.dao_transit.type = OPTION_TRANSIT_INFORMATION_TYPE;
--- 86,92 ----
D_DAO |
K_DAO;
icmpv6rpl_vars.dao.reserved = 0x00;
! icmpv6rpl_vars.dao.DAOSequence = 0x00;
// DODAGID: to be populated upon receiving DIO
icmpv6rpl_vars.dao_transit.type = OPTION_TRANSIT_INFORMATION_TYPE;
***************
*** 133,145 ****
}
/**
\brief Called when DIO/DAO was sent.
\param[in] msg Pointer to the message just sent.
\param[in] error Outcome of the sending.
*/
! void icmpv6rpl_sendDone(OpenQueueEntry_t* msg, error_t error) {
// take ownership over that packet
msg->owner = COMPONENT_ICMPv6RPL;
--- 118,134 ----
}
+ uint8_t icmpv6rpl_getRPLIntanceID(void){
+ return icmpv6rpl_vars.dao.rplinstanceId;
+ }
+
/**
\brief Called when DIO/DAO was sent.
\param[in] msg Pointer to the message just sent.
\param[in] error Outcome of the sending.
*/
! void icmpv6rpl_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
// take ownership over that packet
msg->owner = COMPONENT_ICMPv6RPL;
***************
*** 244,251 ****
\note This function is executed in interrupt context, and should only push a
task.
*/
! void icmpv6rpl_timer_DIO_cb() {
scheduler_push_task(icmpv6rpl_timer_DIO_task,TASKPRIO_RPL);
}
/**
--- 233,243 ----
\note This function is executed in interrupt context, and should only push a
task.
*/
! void icmpv6rpl_timer_DIO_cb(void) {
scheduler_push_task(icmpv6rpl_timer_DIO_task,TASKPRIO_RPL);
+ /*thread_create(openwsn_icmpv6rpl_DIO_stack, KERNEL_CONF_STACKSIZE_MAIN,
+ PRIORITY_OPENWSN_ICMPV6RPL, CREATE_STACKTEST,
+ icmpv6rpl_timer_DIO_task, "icmpv6rpl_timer_DIO_task");*/
}
/**
***************
*** 253,259 ****
\note This function is executed in task context, called by the scheduler.
*/
! void icmpv6rpl_timer_DIO_task() {
// update the delayDIO
icmpv6rpl_vars.delayDIO = (icmpv6rpl_vars.delayDIO+1)%5;
--- 245,251 ----
\note This function is executed in task context, called by the scheduler.
*/
! void icmpv6rpl_timer_DIO_task(void) {
// update the delayDIO
icmpv6rpl_vars.delayDIO = (icmpv6rpl_vars.delayDIO+1)%5;
***************
*** 279,285 ****
/**
\brief Prepare and a send a RPL DIO.
*/
! void sendDIO() {
OpenQueueEntry_t* msg;
// stop if I'm not sync'ed
--- 271,277 ----
/**
\brief Prepare and a send a RPL DIO.
*/
! void sendDIO(void) {
OpenQueueEntry_t* msg;
// stop if I'm not sync'ed
***************
*** 370,377 ****
\note This function is executed in interrupt context, and should only push a
task.
*/
! void icmpv6rpl_timer_DAO_cb() {
! scheduler_push_task(icmpv6rpl_timer_DAO_task,TASKPRIO_RPL);
}
/**
--- 362,372 ----
\note This function is executed in interrupt context, and should only push a
task.
*/
! void icmpv6rpl_timer_DAO_cb(void) {
! scheduler_push_task(icmpv6rpl_timer_DAO_task,TASKPRIO_RPL);
! /*thread_create(openwsn_icmpv6rpl_DAO_stack, KERNEL_CONF_STACKSIZE_MAIN,
! PRIORITY_OPENWSN_ICMPV6RPL, CREATE_STACKTEST,
! icmpv6rpl_timer_DAO_task, "icmpv6rpl_timer_DAO_task");*/
}
/**
***************
*** 379,385 ****
\note This function is executed in task context, called by the scheduler.
*/
! void icmpv6rpl_timer_DAO_task() {
// update the delayDAO
icmpv6rpl_vars.delayDAO = (icmpv6rpl_vars.delayDAO+1)%5;
--- 374,380 ----
\note This function is executed in task context, called by the scheduler.
*/
! void icmpv6rpl_timer_DAO_task(void) {
// update the delayDAO
icmpv6rpl_vars.delayDAO = (icmpv6rpl_vars.delayDAO+1)%5;
***************
*** 405,415 ****
/**
\brief Prepare and a send a RPL DAO.
*/
! void sendDAO() {
OpenQueueEntry_t* msg; // pointer to DAO messages
uint8_t nbrIdx; // running neighbor index
uint8_t numTransitParents,numTargetParents; // the number of parents indicated in transit option
open_addr_t address;
if (ieee154e_isSynch()==FALSE) {
// I'm not sync'ed
--- 400,411 ----
/**
\brief Prepare and a send a RPL DAO.
*/
! void sendDAO(void) {
OpenQueueEntry_t* msg; // pointer to DAO messages
uint8_t nbrIdx; // running neighbor index
uint8_t numTransitParents,numTargetParents; // the number of parents indicated in transit option
open_addr_t address;
+ open_addr_t* prefix;
if (ieee154e_isSynch()==FALSE) {
// I'm not sync'ed
***************
*** 464,499 ****
//===== fill in packet
! //=== transit option -- from RFC 6550, page 55 - 1 transit information header per parent is required.
! numTransitParents = 0;
! for (nbrIdx=0;nbrIdx<MAXNUMNEIGHBORS;nbrIdx++) {
! if ((neighbors_isNeighborWithLowerDAGrank(nbrIdx))==TRUE) {
! // this neighbor is of lower DAGrank as I am
!
! // write it's address in DAO
! //packetfunctions_reserveHeaderSize(msg,LENGTH_ADDR64b);
! neighbors_getNeighbor(&address,ADDR_64B,nbrIdx);
! packetfunctions_writeAddress(msg,&address,BIG_ENDIAN);
!
!
! // update transit info fields
! //size of the whole option in bytes.
! icmpv6rpl_vars.dao_transit.optionLength = LENGTH_ADDR64b + sizeof(icmpv6rpl_dao_transit_ht);
! icmpv6rpl_vars.dao_transit.PathControl=0; //todo. this is to set the preference of this parent.
! icmpv6rpl_vars.dao_transit.type=OPTION_TRANSIT_INFORMATION_TYPE;
! // write transit info in packet
! packetfunctions_reserveHeaderSize(msg,sizeof(icmpv6rpl_dao_transit_ht));
! memcpy(
! ((icmpv6rpl_dao_transit_ht*)(msg->payload)),
! &(icmpv6rpl_vars.dao_transit),
! sizeof(icmpv6rpl_dao_transit_ht)
! );
!
! // remember I found it
! numTransitParents++;
! }
! }
//target information is required. RFC 6550 page 55.
/*
--- 460,490 ----
//===== fill in packet
! //NOTE: limit to preferrred parent only the number of DAO transit addresses to send
!
! //=== transit option -- from RFC 6550, page 55 - 1 transit information header per parent is required.
! //getting only preferred parent as transit
! numTransitParents=0;
! neighbors_getPreferredParentEui64(&address);
! packetfunctions_writeAddress(msg,&address,OW_BIG_ENDIAN);
! prefix=idmanager_getMyID(ADDR_PREFIX);
! packetfunctions_writeAddress(msg,prefix,OW_BIG_ENDIAN);
! // update transit info fields
! // from rfc6550 p.55 -- Variable, depending on whether or not the DODAG ParentAddress subfield is present.
! // poipoi xv: it is not very clear if this includes all fields in the header. or as target info 2 bytes are removed.
! // using the same pattern as in target information.
! icmpv6rpl_vars.dao_transit.optionLength = LENGTH_ADDR128b + sizeof(icmpv6rpl_dao_transit_ht)-2;
! icmpv6rpl_vars.dao_transit.PathControl=0; //todo. this is to set the preference of this parent.
! icmpv6rpl_vars.dao_transit.type=OPTION_TRANSIT_INFORMATION_TYPE;
! // write transit info in packet
! packetfunctions_reserveHeaderSize(msg,sizeof(icmpv6rpl_dao_transit_ht));
! memcpy(
! ((icmpv6rpl_dao_transit_ht*)(msg->payload)),
! &(icmpv6rpl_vars.dao_transit),
! sizeof(icmpv6rpl_dao_transit_ht)
! );
! numTransitParents++;
//target information is required. RFC 6550 page 55.
/*
***************
*** 506,519 ****
// this neighbor is of higher DAGrank as I am. so it is my child
// write it's address in DAO RFC6550 page 80 check point 1.
! neighbors_getNeighbor(&address,ADDR_64B,nbrIdx);
! packetfunctions_writeAddress(msg,&address,BIG_ENDIAN);
// update target info fields
! icmpv6rpl_vars.dao_target.optionLength = LENGTH_ADDR64b + sizeof(icmpv6rpl_dao_target_ht);
icmpv6rpl_vars.dao_target.type = OPTION_TARGET_INFORMATION_TYPE;
icmpv6rpl_vars.dao_target.flags = 0; //must be 0
! icmpv6rpl_vars.dao_target.prefixLength = 0; //no prefix.
// write transit info in packet
packetfunctions_reserveHeaderSize(msg,sizeof(icmpv6rpl_dao_target_ht));
--- 497,514 ----
// this neighbor is of higher DAGrank as I am. so it is my child
// write it's address in DAO RFC6550 page 80 check point 1.
! neighbors_getNeighbor(&address,ADDR_64B,nbrIdx);
! packetfunctions_writeAddress(msg,&address,OW_BIG_ENDIAN);
! prefix=idmanager_getMyID(ADDR_PREFIX);
! packetfunctions_writeAddress(msg,prefix,OW_BIG_ENDIAN);
// update target info fields
! // from rfc6550 p.55 -- Variable, length of the option in octets excluding the Type and Length fields.
! // poipoi xv: assuming that type and length fields refer to the 2 first bytes of the header
! icmpv6rpl_vars.dao_target.optionLength = LENGTH_ADDR128b +sizeof(icmpv6rpl_dao_target_ht) - 2; //no header type and length
icmpv6rpl_vars.dao_target.type = OPTION_TARGET_INFORMATION_TYPE;
icmpv6rpl_vars.dao_target.flags = 0; //must be 0
! icmpv6rpl_vars.dao_target.prefixLength = 128; //128 leading bits -- full address.
// write transit info in packet
packetfunctions_reserveHeaderSize(msg,sizeof(icmpv6rpl_dao_target_ht));
***************
*** 526,531 ****
--- 521,530 ----
// remember I found it
numTargetParents++;
}
+ //limit to MAX_TARGET_PARENTS the number of DAO target addresses to send
+ //section 8.2.1 pag 67 RFC6550 -- using a subset
+ // poipoi TODO base selection on ETX rather than first X.
+ if (numTargetParents>=MAX_TARGET_PARENTS) break;
}

View File

@ -0,0 +1,91 @@
*** stock_iot-lab_M3/openwsn/03b-IPv6/icmpv6rpl.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/03b-IPv6/icmpv6rpl.h Thu Apr 24 16:55:54 2014
***************
*** 8,13 ****
--- 8,15 ----
\{
*/
+ #include "opentimers.h"
+
//=========================== define ==========================================
#define TIMER_DIO_TIMEOUT 1700
***************
*** 47,52 ****
--- 49,58 ----
#define Prf_A_dio_options 0<<4
#define Prf_B_dio_options 0<<3
+ // max number of parents and children to send in DAO
+ //section 8.2.1 pag 67 RFC6550 -- using a subset
+ #define MAX_TARGET_PARENTS 0x01
+
enum{
OPTION_ROUTE_INFORMATION_TYPE = 0x03,
OPTION_DODAG_CONFIGURATION_TYPE = 0x04,
***************
*** 94,100 ****
uint8_t rplinstanceId; ///< set by the DODAG root.
uint8_t K_D_flags;
uint8_t reserved;
! uint8_t DAOSequance;
uint8_t DODAGID[16];
} icmpv6rpl_dao_ht;
PRAGMA(pack());
--- 100,106 ----
uint8_t rplinstanceId; ///< set by the DODAG root.
uint8_t K_D_flags;
uint8_t reserved;
! uint8_t DAOSequence;
uint8_t DODAGID[16];
} icmpv6rpl_dao_ht;
PRAGMA(pack());
***************
*** 125,136 ****
} icmpv6rpl_dao_target_ht;
PRAGMA(pack());
//=========================== prototypes ======================================
! void icmpv6rpl_init();
! void icmpv6rpl_sendDone(OpenQueueEntry_t* msg, error_t error);
void icmpv6rpl_receive(OpenQueueEntry_t* msg);
/**
\}
--- 131,163 ----
} icmpv6rpl_dao_target_ht;
PRAGMA(pack());
+ //=========================== module variables ================================
+
+ typedef struct {
+ // admin
+ bool busySending; ///< currently sending DIO/DAO.
+ uint8_t DODAGIDFlagSet; ///< is DODAGID set already?
+ // DIO-related
+ icmpv6rpl_dio_ht dio; ///< pre-populated DIO packet.
+ open_addr_t dioDestination; ///< IPv6 destination address for DIOs.
+ uint16_t periodDIO; ///< duration, in ms, of a timerIdDIO timeout.
+ opentimer_id_t timerIdDIO; ///< ID of the timer used to send DIOs.
+ uint8_t delayDIO; ///< number of timerIdDIO events before actually sending a DIO.
+ // DAO-related
+ icmpv6rpl_dao_ht dao; ///< pre-populated DAO packet.
+ icmpv6rpl_dao_transit_ht dao_transit; ///< pre-populated DAO "Transit Info" option header.
+ icmpv6rpl_dao_target_ht dao_target; ///< pre-populated DAO "Transit Info" option header.
+ opentimer_id_t timerIdDAO; ///< ID of the timer used to send DAOs.
+ uint16_t periodDAO; ///< duration, in ms, of a timerIdDAO timeout.
+ uint8_t delayDAO; ///< number of timerIdDIO events before actually sending a DAO.
+ } icmpv6rpl_vars_t;
//=========================== prototypes ======================================
! void icmpv6rpl_init(void);
! void icmpv6rpl_sendDone(OpenQueueEntry_t* msg, owerror_t error);
void icmpv6rpl_receive(OpenQueueEntry_t* msg);
+ uint8_t icmpv6rpl_getRPLIntanceID(void);
/**
\}

View File

@ -0,0 +1,47 @@
*** stock_iot-lab_M3/openwsn/04-TRAN/Makefile Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/04-TRAN/Makefile Mon May 12 13:09:47 2014
***************
*** 0 ****
--- 1,42 ----
+ SUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/07-App/ohlone
+ INCLUDES += -I$(CURDIR)/07-App/tcpecho
+ INCLUDES += -I$(CURDIR)/07-App/tcpinject
+ INCLUDES += -I$(CURDIR)/07-App/tcpprint
+ INCLUDES += -I$(CURDIR)/07-App/udpecho
+ INCLUDES += -I$(CURDIR)/07-App/udpinject
+ INCLUDES += -I$(CURDIR)/07-App/udplatency
+ INCLUDES += -I$(CURDIR)/07-App/udpprint
+ INCLUDES += -I$(CURDIR)/07-App/udprand
+ INCLUDES += -I$(CURDIR)/07-App/udpstorm
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBMOD)
+
+ $(BINDIR)$(SUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,389 @@
*** stock_iot-lab_M3/openwsn/04-TRAN/opencoap.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/04-TRAN/opencoap.c Thu Apr 24 16:55:54 2014
***************
*** 9,36 ****
#include "opentimers.h"
#include "scheduler.h"
! //=========================== variables =======================================
! // general variable to the CoAP core
! typedef struct {
! coap_resource_desc_t* resources;
! bool busySending;
! uint8_t delayCounter;
! uint16_t messageID;
! opentimer_id_t timerId;
! } opencoap_vars_t;
opencoap_vars_t opencoap_vars;
//=========================== prototype =======================================
! void icmpv6coap_timer_cb();
//=========================== public ==========================================
//===== from stack
! void opencoap_init() {
// initialize the resource linked list
opencoap_vars.resources = NULL;
--- 9,30 ----
#include "opentimers.h"
#include "scheduler.h"
! #include "thread.h"
! //=========================== variables =======================================
opencoap_vars_t opencoap_vars;
+ //static char openwsn_coap_stack[KERNEL_CONF_STACKSIZE_MAIN];
//=========================== prototype =======================================
! void icmpv6coap_timer_cb(void);
//=========================== public ==========================================
//===== from stack
! void opencoap_init(void) {
// initialize the resource linked list
opencoap_vars.resources = NULL;
***************
*** 52,58 ****
coap_option_t last_option;
coap_resource_desc_t* temp_desc;
bool found;
! error_t outcome;
// local variables passed to the handlers (with msg)
coap_header_iht coap_header;
coap_option_iht coap_options[MAX_COAP_OPTIONS];
--- 46,52 ----
coap_option_t last_option;
coap_resource_desc_t* temp_desc;
bool found;
! owerror_t outcome = 0;
// local variables passed to the handlers (with msg)
coap_header_iht coap_header;
coap_option_iht coap_options[MAX_COAP_OPTIONS];
***************
*** 66,83 ****
index = 0;
coap_header.Ver = (msg->payload[index] & 0xc0) >> 6;
coap_header.T = (coap_type_t)((msg->payload[index] & 0x30) >> 4);
! coap_header.OC = (msg->payload[index] & 0x0f);
index++;
coap_header.Code = (coap_code_t)(msg->payload[index]);
index++;
coap_header.messageID = msg->payload[index]*256+msg->payload[index+1];
index+=2;
// reject unsupported header
! if (
! coap_header.Ver!=COAP_VERSION ||
! coap_header.OC>MAX_COAP_OPTIONS
! ) {
! openserial_printError(COMPONENT_OPENCOAP,ERR_6LOWPAN_UNSUPPORTED,
(errorparameter_t)0,
(errorparameter_t)coap_header.Ver);
openqueue_freePacketBuffer(msg);
--- 60,81 ----
index = 0;
coap_header.Ver = (msg->payload[index] & 0xc0) >> 6;
coap_header.T = (coap_type_t)((msg->payload[index] & 0x30) >> 4);
! coap_header.TKL = (msg->payload[index] & 0x0f);
index++;
coap_header.Code = (coap_code_t)(msg->payload[index]);
index++;
coap_header.messageID = msg->payload[index]*256+msg->payload[index+1];
index+=2;
+
+ //poipoi xv. TKL tells us the length of the token. If we want to support tokens longer
+ //than one token needs to be converted to an array and memcopy here for the length of TKL
+ coap_header.token = (msg->payload[index]);
+ index+=coap_header.TKL;
+
+
// reject unsupported header
! if (coap_header.Ver!=COAP_VERSION || coap_header.TKL>8) {
! openserial_printError(COMPONENT_OPENCOAP,ERR_WRONG_TRAN_PROTOCOL,
(errorparameter_t)0,
(errorparameter_t)coap_header.Ver);
openqueue_freePacketBuffer(msg);
***************
*** 89,102 ****
}
// fill in the coap_options
last_option = COAP_OPTION_NONE;
! for (i=0;i<coap_header.OC;i++) {
coap_options[i].type = (coap_option_t)((uint8_t)last_option+(uint8_t)((msg->payload[index] & 0xf0) >> 4));
last_option = coap_options[i].type;
coap_options[i].length = (msg->payload[index] & 0x0f);
index++;
coap_options[i].pValue = &(msg->payload[index]);
! index += coap_options[i].length;
}
// remove the CoAP header+options
packetfunctions_tossHeader(msg,index);
--- 87,106 ----
}
// fill in the coap_options
last_option = COAP_OPTION_NONE;
! for (i=0;i<MAX_COAP_OPTIONS;i++) {
! if (msg->payload[index]==0xFF){
! //found the payload spacer, options are already parsed.
! index++; //skip it and break.
! break;
! }
coap_options[i].type = (coap_option_t)((uint8_t)last_option+(uint8_t)((msg->payload[index] & 0xf0) >> 4));
last_option = coap_options[i].type;
coap_options[i].length = (msg->payload[index] & 0x0f);
index++;
coap_options[i].pValue = &(msg->payload[index]);
! index += coap_options[i].length; //includes length as well
}
+
// remove the CoAP header+options
packetfunctions_tossHeader(msg,index);
***************
*** 112,119 ****
temp_desc = opencoap_vars.resources;
while (found==FALSE) {
if (
! coap_options[0].type==COAP_OPTION_URIPATH &&
! coap_options[1].type==COAP_OPTION_URIPATH &&
temp_desc->path0len>0 &&
temp_desc->path0val!=NULL &&
temp_desc->path1len>0 &&
--- 116,123 ----
temp_desc = opencoap_vars.resources;
while (found==FALSE) {
if (
! coap_options[0].type==COAP_OPTION_NUM_URIPATH &&
! coap_options[1].type==COAP_OPTION_NUM_URIPATH &&
temp_desc->path0len>0 &&
temp_desc->path0val!=NULL &&
temp_desc->path1len>0 &&
***************
*** 130,136 ****
found = TRUE;
};
} else if (
! coap_options[0].type==COAP_OPTION_URIPATH &&
temp_desc->path0len>0 &&
temp_desc->path0val!=NULL
) {
--- 134,140 ----
found = TRUE;
};
} else if (
! coap_options[0].type==COAP_OPTION_NUM_URIPATH &&
temp_desc->path0len>0 &&
temp_desc->path0val!=NULL
) {
***************
*** 187,193 ****
msg->payload = &(msg->packet[127]);
msg->length = 0;
// set the CoAP header
! coap_header.OC = 0;
coap_header.Code = COAP_CODE_RESP_NOTFOUND;
}
--- 191,197 ----
msg->payload = &(msg->packet[127]);
msg->length = 0;
// set the CoAP header
! coap_header.TKL = 0;
coap_header.Code = COAP_CODE_RESP_NOTFOUND;
}
***************
*** 196,202 ****
msg->payload = &(msg->packet[127]);
msg->length = 0;
// set the CoAP header
! coap_header.OC = 0;
coap_header.Code = COAP_CODE_RESP_METHODNOTALLOWED;
}
--- 200,206 ----
msg->payload = &(msg->packet[127]);
msg->length = 0;
// set the CoAP header
! coap_header.TKL = 0;
coap_header.Code = COAP_CODE_RESP_METHODNOTALLOWED;
}
***************
*** 213,233 ****
msg->l4_destination_port = msg->l4_sourcePortORicmpv6Type;
msg->l4_sourcePortORicmpv6Type = temp_l4_destination_port;
// fill in CoAP header
! packetfunctions_reserveHeaderSize(msg,4);
msg->payload[0] = (COAP_VERSION << 6) |
(COAP_TYPE_ACK << 4) |
! (coap_header.OC << 0);
msg->payload[1] = coap_header.Code;
msg->payload[2] = coap_header.messageID/256;
msg->payload[3] = coap_header.messageID%256;
if ((openudp_send(msg))==E_FAIL) {
openqueue_freePacketBuffer(msg);
}
}
! void opencoap_sendDone(OpenQueueEntry_t* msg, error_t error) {
coap_resource_desc_t* temp_resource;
// take ownership over that packet
--- 217,243 ----
msg->l4_destination_port = msg->l4_sourcePortORicmpv6Type;
msg->l4_sourcePortORicmpv6Type = temp_l4_destination_port;
+ //set destination address as the current source.
+ msg->l3_destinationAdd.type = ADDR_128B;
+ memcpy(&msg->l3_destinationAdd.addr_128b[0],&msg->l3_sourceAdd.addr_128b[0],LENGTH_ADDR128b);
+
+
// fill in CoAP header
! packetfunctions_reserveHeaderSize(msg,5);
msg->payload[0] = (COAP_VERSION << 6) |
(COAP_TYPE_ACK << 4) |
! (coap_header.TKL << 0);
msg->payload[1] = coap_header.Code;
msg->payload[2] = coap_header.messageID/256;
msg->payload[3] = coap_header.messageID%256;
+ msg->payload[4] = coap_header.token; //this will be a memcopy for TKL size
if ((openudp_send(msg))==E_FAIL) {
openqueue_freePacketBuffer(msg);
}
}
! void opencoap_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
coap_resource_desc_t* temp_resource;
// take ownership over that packet
***************
*** 256,262 ****
openqueue_freePacketBuffer(msg);
}
! void timers_coap_fired() {
//do something here if necessary
}
--- 266,272 ----
openqueue_freePacketBuffer(msg);
}
! void timers_coap_fired(void) {
//do something here if necessary
}
***************
*** 288,296 ****
--- 298,316 ----
}
}
+ /**
+ \brief Register a new CoAP resource.
+
+ Registration consists in adding a new resource at the end of the linked list
+ of resources.
+ */
void opencoap_register(coap_resource_desc_t* desc) {
coap_resource_desc_t* last_elem;
+ // since this CoAP resource will be at the end of the list, its next element
+ // should point to NULL, indicating the end of the linked list.
+ desc->next = NULL;
+
if (opencoap_vars.resources==NULL) {
opencoap_vars.resources = desc;
return;
***************
*** 304,313 ****
last_elem->next = desc;
}
! error_t opencoap_send(OpenQueueEntry_t* msg,
coap_type_t type,
coap_code_t code,
! uint8_t numOptions,
coap_resource_desc_t* descSender) {
// change the global messageID
opencoap_vars.messageID = openrandom_get16b();
--- 324,333 ----
last_elem->next = desc;
}
! owerror_t opencoap_send(OpenQueueEntry_t* msg,
coap_type_t type,
coap_code_t code,
! uint8_t TKL,
coap_resource_desc_t* descSender) {
// change the global messageID
opencoap_vars.messageID = openrandom_get16b();
***************
*** 316,335 ****
// metadata
msg->l4_sourcePortORicmpv6Type = WKP_UDP_COAP;
// fill in CoAP header
! packetfunctions_reserveHeaderSize(msg,4);
msg->payload[0] = (COAP_VERSION << 6) |
(type << 4) |
! (numOptions << 0);
msg->payload[1] = code;
msg->payload[2] = (opencoap_vars.messageID>>8) & 0xff;
msg->payload[3] = (opencoap_vars.messageID>>0) & 0xff;
// record the messageID with this sender
descSender->messageID = opencoap_vars.messageID;
return openudp_send(msg);
}
//=========================== private =========================================
! void icmpv6coap_timer_cb() {
! scheduler_push_task(timers_coap_fired,TASKPRIO_COAP);
}
\ No newline at end of file
--- 336,364 ----
// metadata
msg->l4_sourcePortORicmpv6Type = WKP_UDP_COAP;
// fill in CoAP header
! packetfunctions_reserveHeaderSize(msg,5);
msg->payload[0] = (COAP_VERSION << 6) |
(type << 4) |
! (TKL << 0);
msg->payload[1] = code;
msg->payload[2] = (opencoap_vars.messageID>>8) & 0xff;
msg->payload[3] = (opencoap_vars.messageID>>0) & 0xff;
+ //poipoi xv token needs to be defined by the app or here
+ #define TOKEN 123
+ msg->payload[4] = TOKEN; //this will be a memcopy for TKL size
+
// record the messageID with this sender
descSender->messageID = opencoap_vars.messageID;
+ descSender->token = TOKEN;
+
return openudp_send(msg);
}
//=========================== private =========================================
! void icmpv6coap_timer_cb(void) {
! scheduler_push_task(timers_coap_fired,TASKPRIO_COAP);
! /*thread_create(openwsn_coap_stack, KERNEL_CONF_STACKSIZE_MAIN,
! PRIORITY_OPENWSN_COAP, CREATE_STACKTEST,
! timers_coap_fired, "timers coap fired");*/
}
\ No newline at end of file

View File

@ -0,0 +1,215 @@
*** stock_iot-lab_M3/openwsn/04-TRAN/opencoap.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/04-TRAN/opencoap.h Thu Apr 24 16:55:54 2014
***************
*** 8,13 ****
--- 8,15 ----
\{
*/
+ #include "opentimers.h"
+
//=========================== define ==========================================
// IPv6 addresses of servers on the Internet
***************
*** 15,26 ****
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x29};
static const uint8_t ipAddr_motesEecs[] = {0x20, 0x01, 0x04, 0x70, 0x00, 0x66, 0x00, 0x19, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02};
! //static const uint8_t ipAddr_local[] = {0x20, 0x02, 0x80, 0x20, 0x21, 0x47, 0x00, 0x0c, \
0x10, 0xcb, 0xc6, 0x52, 0x44, 0x17, 0xd4, 0x18};
// 2607:f140:400:1036:688e:fa3b:444:6211
//static const uint8_t ipAddr_local[] = {0x26, 0x07, 0xf1, 0x40, 0x04, 0x00, 0x10, 0x36, \
// 0x68, 0x8e, 0xfa, 0x3b, 0x04, 0x44, 0x62, 0x11};
!
static const uint8_t ipAddr_local[] = {0x26, 0x07, 0xf1, 0x40, 0x04, 0x00, 0x10, 0x36, \
0x4d, 0xcd, 0xab, 0x54, 0x81, 0x99, 0xc1, 0xf7};
--- 17,28 ----
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x29};
static const uint8_t ipAddr_motesEecs[] = {0x20, 0x01, 0x04, 0x70, 0x00, 0x66, 0x00, 0x19, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02};
! /*static const uint8_t ipAddr_local[] = {0x20, 0x02, 0x80, 0x20, 0x21, 0x47, 0x00, 0x0c, \
0x10, 0xcb, 0xc6, 0x52, 0x44, 0x17, 0xd4, 0x18};
// 2607:f140:400:1036:688e:fa3b:444:6211
//static const uint8_t ipAddr_local[] = {0x26, 0x07, 0xf1, 0x40, 0x04, 0x00, 0x10, 0x36, \
// 0x68, 0x8e, 0xfa, 0x3b, 0x04, 0x44, 0x62, 0x11};
! */
static const uint8_t ipAddr_local[] = {0x26, 0x07, 0xf1, 0x40, 0x04, 0x00, 0x10, 0x36, \
0x4d, 0xcd, 0xab, 0x54, 0x81, 0x99, 0xc1, 0xf7};
***************
*** 28,34 ****
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02};
/// the maximum number of options in a RX'ed CoAP message
! #define MAX_COAP_OPTIONS 3
#define COAP_VERSION 1
--- 30,36 ----
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02};
/// the maximum number of options in a RX'ed CoAP message
! #define MAX_COAP_OPTIONS 10 //3 before but we want gets with more options
#define COAP_VERSION 1
***************
*** 73,95 ****
} coap_code_t;
typedef enum {
! COAP_OPTION_NONE = 0,
! COAP_OPTION_CONTENTTYPE = 1,
! COAP_OPTION_MAXAGE = 2,
! COAP_OPTION_PROXYURI = 3,
! COAP_OPTION_ETAG = 4,
! COAP_OPTION_URIHOST = 5,
! COAP_OPTION_LOCATIONPATH = 6,
! COAP_OPTION_URIPORT = 7,
! COAP_OPTION_LOCATIONQUERY = 8,
! COAP_OPTION_URIPATH = 9,
! COAP_OPTION_TOKEN = 11,
! COAP_OPTION_ACCEPT = 12,
! COAP_OPTION_IFMATCH = 13,
! COAP_OPTION_URIQUERY = 15,
! COAP_OPTION_IFNONEMATCH = 21,
} coap_option_t;
typedef enum {
COAP_MEDTYPE_TEXTPLAIN = 0,
COAP_MEDTYPE_APPLINKFORMAT = 40,
--- 75,99 ----
} coap_code_t;
typedef enum {
! COAP_OPTION_NONE = 0,
! COAP_OPTION_NUM_IFMATCH = 1,
! COAP_OPTION_NUM_URIHOST = 3,
! COAP_OPTION_NUM_ETAG = 4,
! COAP_OPTION_NUM_IFNONEMATCH = 5,
! COAP_OPTION_NUM_URIPORT = 7,
! COAP_OPTION_NUM_LOCATIONPATH = 8,
! COAP_OPTION_NUM_URIPATH = 11,
! COAP_OPTION_NUM_CONTENTFORMAT = 12,
! COAP_OPTION_NUM_MAXAGE = 14,
! COAP_OPTION_NUM_URIQUERY = 15,
! COAP_OPTION_NUM_ACCEPT = 16,
! COAP_OPTION_NUM_LOCATIONQUERY = 20,
! COAP_OPTION_NUM_PROXYURI = 35,
! COAP_OPTION_NUM_PROXYSCHEME = 39,
} coap_option_t;
+
+
typedef enum {
COAP_MEDTYPE_TEXTPLAIN = 0,
COAP_MEDTYPE_APPLINKFORMAT = 40,
***************
*** 104,112 ****
typedef struct {
uint8_t Ver;
coap_type_t T;
! uint8_t OC;
coap_code_t Code;
uint16_t messageID;
} coap_header_iht;
typedef struct {
--- 108,117 ----
typedef struct {
uint8_t Ver;
coap_type_t T;
! uint8_t TKL;
coap_code_t Code;
uint16_t messageID;
+ uint8_t token; //this might be an array of 8 as tkl can be 8
} coap_header_iht;
typedef struct {
***************
*** 115,125 ****
uint8_t* pValue;
} coap_option_iht;
! typedef error_t (*callbackRx_t)(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
! typedef void (*callbackTimer_t)(void);
! typedef void (*callbackSendDone_t)(OpenQueueEntry_t* msg, error_t error);
typedef struct coap_resource_desc_t coap_resource_desc_t;
--- 120,130 ----
uint8_t* pValue;
} coap_option_iht;
! typedef owerror_t (*callbackRx_cbt)(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
! typedef void (*callbackSendDone_cbt)(OpenQueueEntry_t* msg,
! owerror_t error);
typedef struct coap_resource_desc_t coap_resource_desc_t;
***************
*** 130,153 ****
uint8_t* path1val;
uint8_t componentID;
uint16_t messageID;
! callbackRx_t callbackRx;
! callbackSendDone_t callbackSendDone;
coap_resource_desc_t* next;
};
! //=========================== variables =======================================
//=========================== prototypes ======================================
// from stack
! void opencoap_init();
void opencoap_receive(OpenQueueEntry_t* msg);
! void opencoap_sendDone(OpenQueueEntry_t* msg, error_t error);
// from CoAP resources
void opencoap_writeLinks(OpenQueueEntry_t* msg);
void opencoap_register(coap_resource_desc_t* desc);
! error_t opencoap_send(OpenQueueEntry_t* msg,
coap_type_t type,
coap_code_t code,
uint8_t numOptions,
--- 135,167 ----
uint8_t* path1val;
uint8_t componentID;
uint16_t messageID;
! uint8_t token; //should be 8bytes
! callbackRx_cbt callbackRx;
! callbackSendDone_cbt callbackSendDone;
coap_resource_desc_t* next;
};
! //=========================== module variables ================================
!
! typedef struct {
! coap_resource_desc_t* resources;
! bool busySending;
! uint8_t delayCounter;
! uint16_t messageID;
! opentimer_id_t timerId;
! } opencoap_vars_t;
//=========================== prototypes ======================================
// from stack
! void opencoap_init(void);
void opencoap_receive(OpenQueueEntry_t* msg);
! void opencoap_sendDone(OpenQueueEntry_t* msg, owerror_t error);
// from CoAP resources
void opencoap_writeLinks(OpenQueueEntry_t* msg);
void opencoap_register(coap_resource_desc_t* desc);
! owerror_t opencoap_send(OpenQueueEntry_t* msg,
coap_type_t type,
coap_code_t code,
uint8_t numOptions,

View File

@ -0,0 +1,385 @@
*** stock_iot-lab_M3/openwsn/04-TRAN/opentcp.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/04-TRAN/opentcp.c Thu Apr 24 16:55:54 2014
***************
*** 4,10 ****
#include "openqueue.h"
#include "forwarding.h"
#include "packetfunctions.h"
! #include "bsp_timer.h"
#include "scheduler.h"
#include "opentimers.h"
//TCP applications
--- 4,10 ----
#include "openqueue.h"
#include "forwarding.h"
#include "packetfunctions.h"
! //#include "bsp_timer.h"
#include "scheduler.h"
#include "opentimers.h"
//TCP applications
***************
*** 13,53 ****
#include "tcpinject.h"
#include "tcpprint.h"
! //=========================== variables =======================================
! typedef struct {
! uint8_t state;
! uint32_t mySeqNum;
! uint16_t myPort;
! uint32_t hisNextSeqNum;
! uint16_t hisPort;
! open_addr_t hisIPv6Address;
! OpenQueueEntry_t* dataToSend;
! OpenQueueEntry_t* dataReceived;
! bool timerStarted;
! opentimer_id_t timerId;
! } tcp_vars_t;
tcp_vars_t tcp_vars;
//=========================== prototypes ======================================
void prependTCPHeader(OpenQueueEntry_t* msg, bool ack, bool push, bool rst, bool syn, bool fin);
bool containsControlBits(OpenQueueEntry_t* msg, uint8_t ack, uint8_t rst, uint8_t syn, uint8_t fin);
void tcp_change_state(uint8_t new_state);
! void reset();
! void opentcp_timer_cb();
//=========================== public ==========================================
! void opentcp_init() {
// reset local variables
memset(&tcp_vars,0,sizeof(tcp_vars_t));
// reset state machine
! reset();
}
! error_t opentcp_connect(open_addr_t* dest, uint16_t param_tcp_hisPort, uint16_t param_tcp_myPort) {
//[command] establishment
OpenQueueEntry_t* tempPkt;
if (tcp_vars.state!=TCP_STATE_CLOSED) {
--- 13,43 ----
#include "tcpinject.h"
#include "tcpprint.h"
! #include "thread.h"
! //=========================== variables =======================================
tcp_vars_t tcp_vars;
+ //static char openwsn_opentcp_stack[KERNEL_CONF_STACKSIZE_MAIN];
//=========================== prototypes ======================================
void prependTCPHeader(OpenQueueEntry_t* msg, bool ack, bool push, bool rst, bool syn, bool fin);
bool containsControlBits(OpenQueueEntry_t* msg, uint8_t ack, uint8_t rst, uint8_t syn, uint8_t fin);
void tcp_change_state(uint8_t new_state);
! void opentcp_reset(void);
! void opentcp_timer_cb(void);
//=========================== public ==========================================
! void opentcp_init(void) {
// reset local variables
memset(&tcp_vars,0,sizeof(tcp_vars_t));
// reset state machine
! opentcp_reset();
}
! owerror_t opentcp_connect(open_addr_t* dest, uint16_t param_tcp_hisPort, uint16_t param_tcp_myPort) {
//[command] establishment
OpenQueueEntry_t* tempPkt;
if (tcp_vars.state!=TCP_STATE_CLOSED) {
***************
*** 81,87 ****
return forwarding_send(tempPkt);
}
! error_t opentcp_send(OpenQueueEntry_t* msg) { //[command] data
msg->owner = COMPONENT_OPENTCP;
if (tcp_vars.state!=TCP_STATE_ESTABLISHED) {
openserial_printError(COMPONENT_OPENTCP,ERR_WRONG_TCP_STATE,
--- 71,77 ----
return forwarding_send(tempPkt);
}
! owerror_t opentcp_send(OpenQueueEntry_t* msg) { //[command] data
msg->owner = COMPONENT_OPENTCP;
if (tcp_vars.state!=TCP_STATE_ESTABLISHED) {
openserial_printError(COMPONENT_OPENTCP,ERR_WRONG_TCP_STATE,
***************
*** 114,120 ****
return forwarding_send(tcp_vars.dataToSend);
}
! void opentcp_sendDone(OpenQueueEntry_t* msg, error_t error) {
OpenQueueEntry_t* tempPkt;
msg->owner = COMPONENT_OPENTCP;
switch (tcp_vars.state) {
--- 104,110 ----
return forwarding_send(tcp_vars.dataToSend);
}
! void opentcp_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
OpenQueueEntry_t* tempPkt;
msg->owner = COMPONENT_OPENTCP;
switch (tcp_vars.state) {
***************
*** 196,202 ****
openqueue_freePacketBuffer(msg);
tcp_change_state(TCP_STATE_TIME_WAIT);
//TODO implement waiting timer
! reset();
break;
case TCP_STATE_ALMOST_CLOSE_WAIT: //[sendDone] teardown
--- 186,192 ----
openqueue_freePacketBuffer(msg);
tcp_change_state(TCP_STATE_TIME_WAIT);
//TODO implement waiting timer
! opentcp_reset();
break;
case TCP_STATE_ALMOST_CLOSE_WAIT: //[sendDone] teardown
***************
*** 259,265 ****
}
if (containsControlBits(msg,TCP_ACK_WHATEVER,TCP_RST_YES,TCP_SYN_WHATEVER,TCP_FIN_WHATEVER)) {
//I receive RST[+*], I reset
! reset();
openqueue_freePacketBuffer(msg);
}
switch (tcp_vars.state) {
--- 249,255 ----
}
if (containsControlBits(msg,TCP_ACK_WHATEVER,TCP_RST_YES,TCP_SYN_WHATEVER,TCP_FIN_WHATEVER)) {
//I receive RST[+*], I reset
! opentcp_reset();
openqueue_freePacketBuffer(msg);
}
switch (tcp_vars.state) {
***************
*** 311,317 ****
tcp_change_state(TCP_STATE_ALMOST_SYN_RECEIVED);
forwarding_send(tempPkt);
} else {
! reset();
openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,
(errorparameter_t)tcp_vars.state,
(errorparameter_t)0);
--- 301,307 ----
tcp_change_state(TCP_STATE_ALMOST_SYN_RECEIVED);
forwarding_send(tempPkt);
} else {
! opentcp_reset();
openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,
(errorparameter_t)tcp_vars.state,
(errorparameter_t)0);
***************
*** 366,372 ****
tcp_change_state(TCP_STATE_ALMOST_SYN_RECEIVED);
forwarding_send(tempPkt);
} else {
! reset();
openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,
(errorparameter_t)tcp_vars.state,
(errorparameter_t)1);
--- 356,362 ----
tcp_change_state(TCP_STATE_ALMOST_SYN_RECEIVED);
forwarding_send(tempPkt);
} else {
! opentcp_reset();
openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,
(errorparameter_t)tcp_vars.state,
(errorparameter_t)1);
***************
*** 379,385 ****
//I receive ACK, the virtual circuit is established
tcp_change_state(TCP_STATE_ESTABLISHED);
} else {
! reset();
openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,
(errorparameter_t)tcp_vars.state,
(errorparameter_t)2);
--- 369,375 ----
//I receive ACK, the virtual circuit is established
tcp_change_state(TCP_STATE_ESTABLISHED);
} else {
! opentcp_reset();
openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,
(errorparameter_t)tcp_vars.state,
(errorparameter_t)2);
***************
*** 435,441 ****
tcp_vars.dataReceived = msg;
tcp_change_state(TCP_STATE_ALMOST_DATA_RECEIVED);
} else {
! reset();
openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,
(errorparameter_t)tcp_vars.state,
(errorparameter_t)3);
--- 425,431 ----
tcp_vars.dataReceived = msg;
tcp_change_state(TCP_STATE_ALMOST_DATA_RECEIVED);
} else {
! opentcp_reset();
openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,
(errorparameter_t)tcp_vars.state,
(errorparameter_t)3);
***************
*** 510,516 ****
forwarding_send(tempPkt);
tcp_change_state(TCP_STATE_ALMOST_CLOSE_WAIT);
} else {
! reset();
openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,
(errorparameter_t)tcp_vars.state,
(errorparameter_t)4);
--- 500,506 ----
forwarding_send(tempPkt);
tcp_change_state(TCP_STATE_ALMOST_CLOSE_WAIT);
} else {
! opentcp_reset();
openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,
(errorparameter_t)tcp_vars.state,
(errorparameter_t)4);
***************
*** 567,573 ****
//I receive ACK, I will receive FIN later
tcp_change_state(TCP_STATE_FIN_WAIT_2);
} else {
! reset();
openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,
(errorparameter_t)tcp_vars.state,
(errorparameter_t)5);
--- 557,563 ----
//I receive ACK, I will receive FIN later
tcp_change_state(TCP_STATE_FIN_WAIT_2);
} else {
! opentcp_reset();
openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,
(errorparameter_t)tcp_vars.state,
(errorparameter_t)5);
***************
*** 607,613 ****
//I receive ACK, I do nothing
tcp_change_state(TCP_STATE_TIME_WAIT);
//TODO implement waiting timer
! reset();
}
openqueue_freePacketBuffer(msg);
break;
--- 597,603 ----
//I receive ACK, I do nothing
tcp_change_state(TCP_STATE_TIME_WAIT);
//TODO implement waiting timer
! opentcp_reset();
}
openqueue_freePacketBuffer(msg);
break;
***************
*** 615,621 ****
case TCP_STATE_LAST_ACK: //[receive] teardown
if (containsControlBits(msg,TCP_ACK_YES,TCP_RST_NO,TCP_SYN_NO,TCP_FIN_NO)) {
//I receive ACK, I reset
! reset();
}
openqueue_freePacketBuffer(msg);
break;
--- 605,611 ----
case TCP_STATE_LAST_ACK: //[receive] teardown
if (containsControlBits(msg,TCP_ACK_YES,TCP_RST_NO,TCP_SYN_NO,TCP_FIN_NO)) {
//I receive ACK, I reset
! opentcp_reset();
}
openqueue_freePacketBuffer(msg);
break;
***************
*** 628,634 ****
}
}
! error_t opentcp_close() { //[command] teardown
OpenQueueEntry_t* tempPkt;
if ( tcp_vars.state==TCP_STATE_ALMOST_CLOSE_WAIT ||
tcp_vars.state==TCP_STATE_CLOSE_WAIT ||
--- 618,624 ----
}
}
! owerror_t opentcp_close(void) { //[command] teardown
OpenQueueEntry_t* tempPkt;
if ( tcp_vars.state==TCP_STATE_ALMOST_CLOSE_WAIT ||
tcp_vars.state==TCP_STATE_CLOSE_WAIT ||
***************
*** 660,674 ****
return forwarding_send(tempPkt);
}
! bool tcp_debugPrint() {
return FALSE;
}
//======= timer
//timer used to reset state when TCP state machine is stuck
! void timers_tcp_fired() {
! reset();
}
//=========================== private =========================================
--- 650,664 ----
return forwarding_send(tempPkt);
}
! bool tcp_debugPrint(void) {
return FALSE;
}
//======= timer
//timer used to reset state when TCP state machine is stuck
! void timers_tcp_fired(void) {
! opentcp_reset();
}
//=========================== private =========================================
***************
*** 727,733 ****
return return_value;
}
! void reset() {
tcp_change_state(TCP_STATE_CLOSED);
tcp_vars.mySeqNum = TCP_INITIAL_SEQNUM;
tcp_vars.hisNextSeqNum = 0;
--- 717,723 ----
return return_value;
}
! void opentcp_reset(void) {
tcp_change_state(TCP_STATE_CLOSED);
tcp_vars.mySeqNum = TCP_INITIAL_SEQNUM;
tcp_vars.hisNextSeqNum = 0;
***************
*** 755,760 ****
}
}
! void opentcp_timer_cb() {
! scheduler_push_task(timers_tcp_fired,TASKPRIO_TCP_TIMEOUT);
}
\ No newline at end of file
--- 745,753 ----
}
}
! void opentcp_timer_cb(void) {
! scheduler_push_task(timers_tcp_fired,TASKPRIO_TCP_TIMEOUT);
! /*thread_create(openwsn_opentcp_stack, KERNEL_CONF_STACKSIZE_MAIN,
! PRIORITY_OPENWSN_OPENTCP, CREATE_STACKTEST,
! timers_tcp_fired, "timers tcp fired");*/
}
\ No newline at end of file

View File

@ -0,0 +1,77 @@
*** stock_iot-lab_M3/openwsn/04-TRAN/opentcp.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/04-TRAN/opentcp.h Thu Apr 24 16:53:29 2014
***************
*** 4,13 ****
/**
\addtogroup Transport
\{
! \addtogroup TCP
\{
*/
//=========================== define ==========================================
enum {
--- 4,15 ----
/**
\addtogroup Transport
\{
! \addtogroup OpenTcp
\{
*/
+ #include "opentimers.h"
+
//=========================== define ==========================================
enum {
***************
*** 98,114 ****
uint16_t urgent_pointer;
} tcp_ht;
! //=========================== variables =======================================
//=========================== prototypes ======================================
! void opentcp_init();
! error_t opentcp_connect(open_addr_t* dest, uint16_t param_hisPort, uint16_t param_myPort);
! error_t opentcp_send(OpenQueueEntry_t* msg);
! void opentcp_sendDone(OpenQueueEntry_t* msg, error_t error);
void opentcp_receive(OpenQueueEntry_t* msg);
! error_t opentcp_close();
! bool opentcp_debugPrint();
/**
\}
--- 100,129 ----
uint16_t urgent_pointer;
} tcp_ht;
! //=========================== module variables ================================
!
! typedef struct {
! uint8_t state;
! uint32_t mySeqNum;
! uint16_t myPort;
! uint32_t hisNextSeqNum;
! uint16_t hisPort;
! open_addr_t hisIPv6Address;
! OpenQueueEntry_t* dataToSend;
! OpenQueueEntry_t* dataReceived;
! bool timerStarted;
! opentimer_id_t timerId;
! } tcp_vars_t;
//=========================== prototypes ======================================
! void opentcp_init(void);
! owerror_t opentcp_connect(open_addr_t* dest, uint16_t param_hisPort, uint16_t param_myPort);
! owerror_t opentcp_send(OpenQueueEntry_t* msg);
! void opentcp_sendDone(OpenQueueEntry_t* msg, owerror_t error);
void opentcp_receive(OpenQueueEntry_t* msg);
! owerror_t opentcp_close(void);
! bool opentcp_debugPrint(void);
/**
\}

View File

@ -0,0 +1,77 @@
*** stock_iot-lab_M3/openwsn/04-TRAN/openudp.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/04-TRAN/openudp.c Thu Apr 24 16:55:54 2014
***************
*** 21,30 ****
//=========================== public ==========================================
! void openudp_init() {
}
! error_t openudp_send(OpenQueueEntry_t* msg) {
msg->owner = COMPONENT_OPENUDP;
msg->l4_protocol = IANA_UDP;
msg->l4_payload = msg->payload;
--- 21,30 ----
//=========================== public ==========================================
! void openudp_init(void) {
}
! owerror_t openudp_send(OpenQueueEntry_t* msg) {
msg->owner = COMPONENT_OPENUDP;
msg->l4_protocol = IANA_UDP;
msg->l4_payload = msg->payload;
***************
*** 37,43 ****
return forwarding_send(msg);
}
! void openudp_sendDone(OpenQueueEntry_t* msg, error_t error) {
msg->owner = COMPONENT_OPENUDP;
switch(msg->l4_sourcePortORicmpv6Type) {
case WKP_UDP_COAP:
--- 37,43 ----
return forwarding_send(msg);
}
! void openudp_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
msg->owner = COMPONENT_OPENUDP;
switch(msg->l4_sourcePortORicmpv6Type) {
case WKP_UDP_COAP:
***************
*** 108,115 ****
case NHC_UDP_PORTS_4S_4D:
// source port: 0xf0b + 4 bits in-line
// dest port: 0xf0b + 4 bits in-line
! msg->l4_sourcePortORicmpv6Type = 0xf0b0 + (msg->payload[0] >> 4) & 0x0f;
! msg->l4_destination_port = 0xf0b0 + (msg->payload[0] >> 0) & 0x0f;
packetfunctions_tossHeader(msg,1);
break;
}
--- 108,115 ----
case NHC_UDP_PORTS_4S_4D:
// source port: 0xf0b + 4 bits in-line
// dest port: 0xf0b + 4 bits in-line
! msg->l4_sourcePortORicmpv6Type = 0xf0b0 + ((msg->payload[0] >> 4) & 0x0f);
! msg->l4_destination_port = 0xf0b0 + ((msg->payload[0] >> 0) & 0x0f);
packetfunctions_tossHeader(msg,1);
break;
}
***************
*** 151,157 ****
}
}
! bool openudp_debugPrint() {
return FALSE;
}
--- 151,157 ----
}
}
! bool openudp_debugPrint(void) {
return FALSE;
}

View File

@ -0,0 +1,44 @@
*** stock_iot-lab_M3/openwsn/04-TRAN/openudp.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/04-TRAN/openudp.h Thu Apr 24 16:55:54 2014
***************
*** 4,10 ****
/**
\addtogroup Transport
\{
! \addtogroup UDP
\{
*/
--- 4,10 ----
/**
\addtogroup Transport
\{
! \addtogroup OpenUdp
\{
*/
***************
*** 45,55 ****
//=========================== prototypes ======================================
! void openudp_init();
! error_t openudp_send(OpenQueueEntry_t* msg);
! void openudp_sendDone(OpenQueueEntry_t* msg, error_t error);
void openudp_receive(OpenQueueEntry_t* msg);
! bool openudp_debugPrint();
/**
\}
--- 45,55 ----
//=========================== prototypes ======================================
! void openudp_init(void);
! owerror_t openudp_send(OpenQueueEntry_t* msg);
! void openudp_sendDone(OpenQueueEntry_t* msg, owerror_t error);
void openudp_receive(OpenQueueEntry_t* msg);
! bool openudp_debugPrint(void);
/**
\}

View File

@ -0,0 +1,50 @@
*** stock_iot-lab_M3/openwsn/04-TRAN/rsvp.c Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/04-TRAN/rsvp.c Thu Apr 24 16:55:54 2014
***************
*** 17,27 ****
uint8_t rsvp_timer_id;
}rsvp_vars_t;
! void rsvp_timer_cb();
rsvp_vars_t rsvp_vars;
! void rsvp_init(){
rsvp_vars.rsvp_period = 0;
rsvp_vars.rsvp_timer_id = 0;
}
--- 17,27 ----
uint8_t rsvp_timer_id;
}rsvp_vars_t;
! void rsvp_timer_cb(void);
rsvp_vars_t rsvp_vars;
! void rsvp_init(void){
rsvp_vars.rsvp_period = 0;
rsvp_vars.rsvp_timer_id = 0;
}
***************
*** 35,42 ****
void rsvp_qos_request(uint8_t bandwith, uint16_t refresh_period, open_addr_t dest){
OpenQueueEntry_t* pkt;
! error_t outcome;
uint8_t i,j;
pkt = openqueue_getFreePacketBuffer(COMPONENT_RSVP);
if (pkt==NULL) {
--- 35,46 ----
void rsvp_qos_request(uint8_t bandwith, uint16_t refresh_period, open_addr_t dest){
OpenQueueEntry_t* pkt;
! owerror_t outcome;
uint8_t i,j;
+
+ (void)outcome;
+ (void)i;
+ (void)j;
pkt = openqueue_getFreePacketBuffer(COMPONENT_RSVP);
if (pkt==NULL) {

View File

@ -0,0 +1,19 @@
*** stock_iot-lab_M3/openwsn/04-TRAN/rsvp.h Thu Apr 24 11:01:36 2014
--- riot-openwsn-wip/openwsn/04-TRAN/rsvp.h Thu Apr 24 16:55:54 2014
***************
*** 157,163 ****
! void rsvp_init();
void rsvp_qos_request(uint8_t bandwith, uint16_t refresh_period,open_addr_t dest);
#endif
--- 157,163 ----
! void rsvp_init(void);
void rsvp_qos_request(uint8_t bandwith, uint16_t refresh_period,open_addr_t dest);
#endif

View File

@ -0,0 +1,54 @@
*** stock_iot-lab_M3/openwsn/07-App/Makefile Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/Makefile Mon May 12 13:09:46 2014
***************
*** 0 ****
--- 1,49 ----
+ SUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/07-App/ohlone
+ INCLUDES += -I$(CURDIR)/07-App/tcpecho
+ INCLUDES += -I$(CURDIR)/07-App/tcpinject
+ INCLUDES += -I$(CURDIR)/07-App/tcpprint
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ DIRS += rinfo
+ DIRS += rwellknown
+ DIRS += ohlone
+ DIRS += tcpecho
+ DIRS += tcpinject
+ DIRS += tcpprint
+ DIRS += udpecho
+ DIRS += udpinject
+ DIRS += udplatency
+ DIRS += udpprint
+ DIRS += udprand
+ DIRS += udpstorm
+
+ all: $(BINDIR)$(SUBMOD)
+ @for i in $(DIRS) ; do "$(MAKE)" -C $$i ; done ;
+
+ $(BINDIR)$(SUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ mkdir -p $(BINDIR)
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)"|cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ clean::
+ @for i in $(DIRS) ; do "$(MAKE)" -C $$i clean ; done ;

View File

@ -0,0 +1,47 @@
*** stock_iot-lab_M3/openwsn/07-App/heli/heli.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/heli/heli.h Thu Apr 24 16:53:29 2014
***************
*** 2,13 ****
#define __HELI_H
/**
! \addtogroup App
\{
\addtogroup Heli
\{
*/
//=========================== define ==========================================
//=========================== typedef =========================================
--- 2,15 ----
#define __HELI_H
/**
! \addtogroup AppUdp
\{
\addtogroup Heli
\{
*/
+
+ #include "openwsn.h"
//=========================== define ==========================================
//=========================== typedef =========================================
***************
*** 18,24 ****
void heli_init();
void heli_trigger();
! void heli_sendDone(OpenQueueEntry_t* msg, error_t error);
void heli_receive(OpenQueueEntry_t* msg);
bool heli_debugPrint();
--- 20,26 ----
void heli_init();
void heli_trigger();
! void heli_sendDone(OpenQueueEntry_t* msg, owerror_t error);
void heli_receive(OpenQueueEntry_t* msg);
bool heli_debugPrint();

View File

@ -0,0 +1,19 @@
*** stock_iot-lab_M3/openwsn/07-App/imu/imu.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/imu/imu.c Thu Apr 24 16:53:29 2014
***************
*** 54,60 ****
}
//I just sent a IMU packet, check I need to resend one
! void imu_sendDone(OpenQueueEntry_t* msg, error_t error) {
msg->owner = COMPONENT_IMU;
if (msg->creator!=COMPONENT_IMU) {
openserial_printError(COMPONENT_IMU,ERR_UNEXPECTED_SENDDONE,
--- 54,60 ----
}
//I just sent a IMU packet, check I need to resend one
! void imu_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
msg->owner = COMPONENT_IMU;
if (msg->creator!=COMPONENT_IMU) {
openserial_printError(COMPONENT_IMU,ERR_UNEXPECTED_SENDDONE,

View File

@ -0,0 +1,35 @@
*** stock_iot-lab_M3/openwsn/07-App/imu/imu.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/imu/imu.h Thu Apr 24 16:53:29 2014
***************
*** 2,8 ****
#define __IMU_H
/**
! \addtogroup App
\{
\addtogroup imu
\{
--- 2,8 ----
#define __IMU_H
/**
! \addtogroup AppUdp
\{
\addtogroup imu
\{
***************
*** 18,24 ****
void imu_init();
void imu_trigger();
! void imu_sendDone(OpenQueueEntry_t* msg, error_t error);
void imu_receive(OpenQueueEntry_t* msg);
bool imu_debugPrint();
--- 18,24 ----
void imu_init();
void imu_trigger();
! void imu_sendDone(OpenQueueEntry_t* msg, owerror_t error);
void imu_receive(OpenQueueEntry_t* msg);
bool imu_debugPrint();

View File

@ -0,0 +1,244 @@
*** stock_iot-lab_M3/openwsn/07-App/layerdebug/layerdebug.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/layerdebug/layerdebug.c Thu Apr 24 16:55:54 2014
***************
*** 7,13 ****
#include "openserial.h"
#include "openrandom.h"
#include "scheduler.h"
!
// include layer files to debug
#include "neighbors.h"
--- 7,14 ----
#include "openserial.h"
#include "openrandom.h"
#include "scheduler.h"
! #include "IEEE802154E.h"
! #include "idmanager.h"
// include layer files to debug
#include "neighbors.h"
***************
*** 34,45 ****
//=========================== prototypes ======================================
! error_t layerdebug_schedule_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
! error_t layerdebug_neighbors_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
--- 35,46 ----
//=========================== prototypes ======================================
! owerror_t layerdebug_schedule_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
! owerror_t layerdebug_neighbors_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
***************
*** 50,56 ****
void layerdebug_task_neighbors_cb();
void layerdebug_sendDone(OpenQueueEntry_t* msg,
! error_t error);
//=========================== public ==========================================
--- 51,57 ----
void layerdebug_task_neighbors_cb();
void layerdebug_sendDone(OpenQueueEntry_t* msg,
! owerror_t error);
//=========================== public ==========================================
***************
*** 100,109 ****
//schedule stats
void layerdebug_task_schedule_cb() {
OpenQueueEntry_t* pkt;
! error_t outcome;
uint8_t numOptions;
uint8_t size;
// create a CoAP RD packet
pkt = openqueue_getFreePacketBuffer(COMPONENT_LAYERDEBUG);
if (pkt==NULL) {
--- 101,120 ----
//schedule stats
void layerdebug_task_schedule_cb() {
OpenQueueEntry_t* pkt;
! owerror_t outcome;
uint8_t numOptions;
uint8_t size;
+ // don't run if not synch
+ if (ieee154e_isSynch() == FALSE) return;
+
+ // don't run on dagroot
+ if (idmanager_getIsDAGroot()) {
+ opentimers_stop( layerdebug_vars.schtimerId);
+ opentimers_stop( layerdebug_vars.nbstimerId);
+ return;
+ }
+
// create a CoAP RD packet
pkt = openqueue_getFreePacketBuffer(COMPONENT_LAYERDEBUG);
if (pkt==NULL) {
***************
*** 131,142 ****
packetfunctions_reserveHeaderSize(pkt,sizeof(schedule_layerdebug_path0)-1);
memcpy(&pkt->payload[0],&schedule_layerdebug_path0,sizeof(schedule_layerdebug_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_LOCATIONPATH-COAP_OPTION_CONTENTTYPE) << 4 |
sizeof(schedule_layerdebug_path0)-1;
numOptions++;
// content-type option
packetfunctions_reserveHeaderSize(pkt,2);
! pkt->payload[0] = COAP_OPTION_CONTENTTYPE << 4 |
1;
pkt->payload[1] = COAP_MEDTYPE_APPOCTETSTREAM;
numOptions++;
--- 142,153 ----
packetfunctions_reserveHeaderSize(pkt,sizeof(schedule_layerdebug_path0)-1);
memcpy(&pkt->payload[0],&schedule_layerdebug_path0,sizeof(schedule_layerdebug_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_NUM_URIPATH) << 4 |
sizeof(schedule_layerdebug_path0)-1;
numOptions++;
// content-type option
packetfunctions_reserveHeaderSize(pkt,2);
! pkt->payload[0] = COAP_OPTION_NUM_CONTENTFORMAT << 4 |
1;
pkt->payload[1] = COAP_MEDTYPE_APPOCTETSTREAM;
numOptions++;
***************
*** 162,168 ****
void layerdebug_task_neighbors_cb() {
OpenQueueEntry_t* pkt;
! error_t outcome;
uint8_t numOptions;
uint8_t size;
--- 173,179 ----
void layerdebug_task_neighbors_cb() {
OpenQueueEntry_t* pkt;
! owerror_t outcome;
uint8_t numOptions;
uint8_t size;
***************
*** 195,206 ****
packetfunctions_reserveHeaderSize(pkt,sizeof(neighbors_layerdebug_path0)-1);
memcpy(&pkt->payload[0],&neighbors_layerdebug_path0,sizeof(neighbors_layerdebug_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_LOCATIONPATH-COAP_OPTION_CONTENTTYPE) << 4 |
sizeof(neighbors_layerdebug_path0)-1;
numOptions++;
// content-type option
packetfunctions_reserveHeaderSize(pkt,2);
! pkt->payload[0] = COAP_OPTION_CONTENTTYPE << 4 |
1;
pkt->payload[1] = COAP_MEDTYPE_APPOCTETSTREAM;
numOptions++;
--- 206,217 ----
packetfunctions_reserveHeaderSize(pkt,sizeof(neighbors_layerdebug_path0)-1);
memcpy(&pkt->payload[0],&neighbors_layerdebug_path0,sizeof(neighbors_layerdebug_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_NUM_URIPATH) << 4 |
sizeof(neighbors_layerdebug_path0)-1;
numOptions++;
// content-type option
packetfunctions_reserveHeaderSize(pkt,2);
! pkt->payload[0] = COAP_OPTION_NUM_CONTENTFORMAT << 4 |
1;
pkt->payload[1] = COAP_MEDTYPE_APPOCTETSTREAM;
numOptions++;
***************
*** 222,236 ****
return;
}
! void layerdebug_sendDone(OpenQueueEntry_t* msg, error_t error) {
openqueue_freePacketBuffer(msg);
}
! error_t layerdebug_schedule_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! error_t outcome;
uint8_t size;
--- 233,247 ----
return;
}
! void layerdebug_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
openqueue_freePacketBuffer(msg);
}
! owerror_t layerdebug_schedule_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! owerror_t outcome;
uint8_t size;
***************
*** 250,256 ****
msg->payload[0] = MAXACTIVESLOTS;
// set the CoAP header
- coap_header->OC = 0;
coap_header->Code = COAP_CODE_RESP_CONTENT;
outcome = E_SUCCESS;
--- 261,266 ----
***************
*** 263,272 ****
return outcome;
}
! error_t layerdebug_neighbors_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! error_t outcome;
uint8_t size;
--- 273,282 ----
return outcome;
}
! owerror_t layerdebug_neighbors_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! owerror_t outcome;
uint8_t size;
***************
*** 287,293 ****
msg->payload[0] = size;
// set the CoAP header
- coap_header->OC = 0;
coap_header->Code = COAP_CODE_RESP_CONTENT;
outcome = E_SUCCESS;
--- 297,302 ----

View File

@ -0,0 +1,19 @@
*** stock_iot-lab_M3/openwsn/07-App/layerdebug/layerdebug.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/layerdebug/layerdebug.h Thu Apr 24 16:53:29 2014
***************
*** 2,8 ****
#define __LAYERDEBUG_H
/**
! \addtogroup App
\{
\addtogroup rT
\{
--- 2,8 ----
#define __LAYERDEBUG_H
/**
! \addtogroup AppCoAP
\{
\addtogroup rT
\{

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/07-App/ohlone/Makefile Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/ohlone/Makefile Mon May 12 13:09:46 2014
***************
*** 0 ****
--- 1,32 ----
+ SUBSUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBSUBMOD)
+
+ $(BINDIR)$(SUBSUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,105 @@
*** stock_iot-lab_M3/openwsn/07-App/ohlone/ohlone.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/ohlone/ohlone.c Thu Apr 24 16:55:54 2014
***************
*** 9,42 ****
//=========================== variables =======================================
- typedef struct {
- OpenQueueEntry_t* pkt;
- bool sending;
- uint16_t httpChunk;
- uint8_t getRequest[TCP_DEFAULT_WINDOW_SIZE];
- } ohlone_vars_t;
-
ohlone_vars_t ohlone_vars;
//=========================== prototypes ======================================
! void ohlone_sendpkt();
bool ohlone_check4chars(uint8_t c1[4], uint8_t c2[4]);
//=========================== public ==========================================
! void ohlone_init() {
ohlone_vars.httpChunk = 0;
ohlone_vars.getRequest[0] = '/';
ohlone_vars.getRequest[1] = ' ';
ohlone_webpages_init();
}
! bool ohlone_shouldIlisten() {
return TRUE;
}
! void ohlone_sendpkt() {
uint8_t buffer[TCP_DEFAULT_WINDOW_SIZE];
uint8_t buffer_len;
--- 9,35 ----
//=========================== variables =======================================
ohlone_vars_t ohlone_vars;
//=========================== prototypes ======================================
! void ohlone_sendpkt(void);
bool ohlone_check4chars(uint8_t c1[4], uint8_t c2[4]);
//=========================== public ==========================================
! void ohlone_init(void) {
ohlone_vars.httpChunk = 0;
ohlone_vars.getRequest[0] = '/';
ohlone_vars.getRequest[1] = ' ';
ohlone_webpages_init();
}
! bool ohlone_shouldIlisten(void) {
return TRUE;
}
! void ohlone_sendpkt(void) {
uint8_t buffer[TCP_DEFAULT_WINDOW_SIZE];
uint8_t buffer_len;
***************
*** 98,104 ****
openqueue_freePacketBuffer(msg);
}
! void ohlone_sendDone(OpenQueueEntry_t* msg, error_t error) {
msg->owner = COMPONENT_OHLONE;
if (msg->creator!=COMPONENT_OHLONE) {
openserial_printError(COMPONENT_OHLONE,ERR_UNEXPECTED_SENDDONE,
--- 91,97 ----
openqueue_freePacketBuffer(msg);
}
! void ohlone_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
msg->owner = COMPONENT_OHLONE;
if (msg->creator!=COMPONENT_OHLONE) {
openserial_printError(COMPONENT_OHLONE,ERR_UNEXPECTED_SENDDONE,
***************
*** 110,119 ****
openqueue_freePacketBuffer(msg);
}
! void ohlone_connectDone(error_t error) {
}
! bool ohlone_debugPrint() {
return FALSE;
}
--- 103,112 ----
openqueue_freePacketBuffer(msg);
}
! void ohlone_connectDone(owerror_t error) {
}
! bool ohlone_debugPrint(void) {
return FALSE;
}

View File

@ -0,0 +1,66 @@
*** stock_iot-lab_M3/openwsn/07-App/ohlone/ohlone.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/ohlone/ohlone.h Thu Apr 24 16:53:29 2014
***************
*** 2,27 ****
#define __OHLONE_H
/**
! \addtogroup App
\{
\addtogroup ohlone
\{
*/
//=========================== define ==========================================
//=========================== typedef =========================================
! //=========================== variables =======================================
//=========================== prototypes ======================================
! void ohlone_init();
! bool ohlone_shouldIlisten();
void ohlone_receive(OpenQueueEntry_t* msg);
! void ohlone_sendDone(OpenQueueEntry_t* msg, error_t error);
! void ohlone_connectDone(error_t error);
! bool ohlone_debugPrint();
/**
\}
--- 2,36 ----
#define __OHLONE_H
/**
! \addtogroup AppTcp
\{
\addtogroup ohlone
\{
*/
+ #include "opentcp.h"
+
//=========================== define ==========================================
//=========================== typedef =========================================
! //=========================== module variables ================================
!
! typedef struct {
! OpenQueueEntry_t* pkt;
! bool sending;
! uint16_t httpChunk;
! uint8_t getRequest[TCP_DEFAULT_WINDOW_SIZE];
! } ohlone_vars_t;
//=========================== prototypes ======================================
! void ohlone_init(void);
! bool ohlone_shouldIlisten(void);
void ohlone_receive(OpenQueueEntry_t* msg);
! void ohlone_sendDone(OpenQueueEntry_t* msg, owerror_t error);
! void ohlone_connectDone(owerror_t error);
! bool ohlone_debugPrint(void);
/**
\}

View File

@ -0,0 +1,19 @@
*** stock_iot-lab_M3/openwsn/07-App/ohlone/ohlone_webpages.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/ohlone/ohlone_webpages.c Thu Apr 24 16:55:54 2014
***************
*** 25,31 ****
//=========================== public ==========================================
! void ohlone_webpages_init() {
/*
if (*(&eui64+3)==0x09) { // this is a GINA board (not a basestation)
gyro_init();
--- 25,31 ----
//=========================== public ==========================================
! void ohlone_webpages_init(void) {
/*
if (*(&eui64+3)==0x09) { // this is a GINA board (not a basestation)
gyro_init();

View File

@ -0,0 +1,21 @@
*** stock_iot-lab_M3/openwsn/07-App/ohlone/ohlone_webpages.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/ohlone/ohlone_webpages.h Thu Apr 24 16:55:54 2014
***************
*** 27,33 ****
//=========================== prototypes ======================================
! void ohlone_webpages_init();
uint8_t ohlone_webpage(uint8_t *getRequest, uint16_t chunk, uint8_t *packet);
#endif
\ No newline at end of file
--- 27,33 ----
//=========================== prototypes ======================================
! void ohlone_webpages_init(void);
uint8_t ohlone_webpage(uint8_t *getRequest, uint16_t chunk, uint8_t *packet);
#endif
\ No newline at end of file

View File

@ -0,0 +1,151 @@
*** stock_iot-lab_M3/openwsn/07-App/rex/rex.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rex/rex.c Thu Apr 24 16:55:54 2014
***************
*** 8,13 ****
--- 8,15 ----
#include "openrandom.h"
#include "scheduler.h"
//#include "ADC_Channel.h"
+ #include "idmanager.h"
+ #include "IEEE802154E.h"
//=========================== defines =========================================
***************
*** 28,40 ****
//=========================== prototypes ======================================
! error_t rex_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rex_timer_cb();
void rex_task_cb();
void rex_sendDone(OpenQueueEntry_t* msg,
! error_t error);
//=========================== public ==========================================
--- 30,42 ----
//=========================== prototypes ======================================
! owerror_t rex_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rex_timer_cb();
void rex_task_cb();
void rex_sendDone(OpenQueueEntry_t* msg,
! owerror_t error);
//=========================== public ==========================================
***************
*** 58,64 ****
//=========================== private =========================================
! error_t rex_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
return E_FAIL;
--- 60,66 ----
//=========================== private =========================================
! owerror_t rex_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
return E_FAIL;
***************
*** 72,78 ****
void rex_task_cb() {
OpenQueueEntry_t* pkt;
! error_t outcome;
uint8_t numOptions;
uint8_t i;
--- 74,80 ----
void rex_task_cb() {
OpenQueueEntry_t* pkt;
! owerror_t outcome;
uint8_t numOptions;
uint8_t i;
***************
*** 82,92 ****
uint16_t avg = 0;
uint8_t N_avg = 10;
! for (int i = 0; i < N_avg; i++)
! {
! //ADC_getvoltage(p_x_int);
!
! sum += x_int;
}
avg = sum/N_avg;
--- 84,102 ----
uint16_t avg = 0;
uint8_t N_avg = 10;
! // don't run if not synch
! if (ieee154e_isSynch() == FALSE) return;
!
! // don't run on dagroot
! if (idmanager_getIsDAGroot()) {
! opentimers_stop(rex_vars.timerId);
! return;
! }
!
!
! for (i = 0; i < N_avg; i++) {
! //ADC_getvoltage(p_x_int);
! sum += x_int;
}
avg = sum/N_avg;
***************
*** 117,128 ****
packetfunctions_reserveHeaderSize(pkt,sizeof(rex_path0)-1);
memcpy(&pkt->payload[0],&rex_path0,sizeof(rex_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_LOCATIONPATH-COAP_OPTION_CONTENTTYPE) << 4 |
sizeof(rex_path0)-1;
numOptions++;
// content-type option
packetfunctions_reserveHeaderSize(pkt,2);
! pkt->payload[0] = COAP_OPTION_CONTENTTYPE << 4 |
1;
pkt->payload[1] = COAP_MEDTYPE_APPOCTETSTREAM;
numOptions++;
--- 127,138 ----
packetfunctions_reserveHeaderSize(pkt,sizeof(rex_path0)-1);
memcpy(&pkt->payload[0],&rex_path0,sizeof(rex_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_NUM_URIPATH) << 4 |
sizeof(rex_path0)-1;
numOptions++;
// content-type option
packetfunctions_reserveHeaderSize(pkt,2);
! pkt->payload[0] = COAP_OPTION_NUM_CONTENTFORMAT << 4 |
1;
pkt->payload[1] = COAP_MEDTYPE_APPOCTETSTREAM;
numOptions++;
***************
*** 144,149 ****
return;
}
! void rex_sendDone(OpenQueueEntry_t* msg, error_t error) {
openqueue_freePacketBuffer(msg);
}
--- 154,159 ----
return;
}
! void rex_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
openqueue_freePacketBuffer(msg);
}

View File

@ -0,0 +1,19 @@
*** stock_iot-lab_M3/openwsn/07-App/rex/rex.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rex/rex.h Thu Apr 24 16:53:29 2014
***************
*** 2,8 ****
#define __REX_H
/**
! \addtogroup App
\{
\addtogroup rT
\{
--- 2,8 ----
#define __REX_H
/**
! \addtogroup AppUdp
\{
\addtogroup rT
\{

View File

@ -0,0 +1,79 @@
*** stock_iot-lab_M3/openwsn/07-App/rheli/rheli.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rheli/rheli.c Thu Apr 24 16:55:54 2014
***************
*** 19,30 ****
//=========================== prototypes ======================================
! error_t rheli_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rheli_timer();
void rheli_sendDone(OpenQueueEntry_t* msg,
! error_t error);
//=========================== public ==========================================
--- 19,30 ----
//=========================== prototypes ======================================
! owerror_t rheli_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rheli_timer();
void rheli_sendDone(OpenQueueEntry_t* msg,
! owerror_t error);
//=========================== public ==========================================
***************
*** 49,58 ****
//=========================== private =========================================
! error_t rheli_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! error_t outcome;
if (coap_header->Code==COAP_CODE_REQ_POST) {
--- 49,58 ----
//=========================== private =========================================
! owerror_t rheli_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! owerror_t outcome;
if (coap_header->Code==COAP_CODE_REQ_POST) {
***************
*** 64,70 ****
msg->length = 0;
// set the CoAP header
- coap_header->OC = 0;
coap_header->Code = COAP_CODE_RESP_CHANGED;
outcome = E_SUCCESS;
--- 64,69 ----
***************
*** 79,84 ****
heli_off();
}
! void rheli_sendDone(OpenQueueEntry_t* msg, error_t error) {
openqueue_freePacketBuffer(msg);
}
\ No newline at end of file
--- 78,83 ----
heli_off();
}
! void rheli_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
openqueue_freePacketBuffer(msg);
}
\ No newline at end of file

View File

@ -0,0 +1,19 @@
*** stock_iot-lab_M3/openwsn/07-App/rheli/rheli.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rheli/rheli.h Thu Apr 24 16:53:29 2014
***************
*** 2,8 ****
#define __RHELI_H
/**
! \addtogroup App
\{
\addtogroup rHeli
\{
--- 2,8 ----
#define __RHELI_H
/**
! \addtogroup AppCoAP
\{
\addtogroup rHeli
\{

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/07-App/rinfo/Makefile Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rinfo/Makefile Mon May 12 13:09:44 2014
***************
*** 0 ****
--- 1,32 ----
+ SUBSUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBSUBMOD)
+
+ $(BINDIR)$(SUBSUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,106 @@
*** stock_iot-lab_M3/openwsn/07-App/rinfo/rinfo.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rinfo/rinfo.c Thu Apr 24 16:55:54 2014
***************
*** 6,11 ****
--- 6,12 ----
#include "openserial.h"
#include "openrandom.h"
#include "board.h"
+ #include "idmanager.h"
//=========================== defines =========================================
***************
*** 21,35 ****
//=========================== prototypes ======================================
! error_t rinfo_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rinfo_sendDone(OpenQueueEntry_t* msg,
! error_t error);
//=========================== public ==========================================
! void rinfo_init() {
// prepare the resource descriptor for the /temp path
rinfo_vars.desc.path0len = sizeof(rinfo_path0)-1;
rinfo_vars.desc.path0val = (uint8_t*)(&rinfo_path0);
--- 22,39 ----
//=========================== prototypes ======================================
! owerror_t rinfo_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rinfo_sendDone(OpenQueueEntry_t* msg,
! owerror_t error);
//=========================== public ==========================================
! void rinfo_init(void) {
!
!
! if(idmanager_getIsDAGroot()==TRUE) return;
// prepare the resource descriptor for the /temp path
rinfo_vars.desc.path0len = sizeof(rinfo_path0)-1;
rinfo_vars.desc.path0val = (uint8_t*)(&rinfo_path0);
***************
*** 44,53 ****
//=========================== private =========================================
! error_t rinfo_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! error_t outcome;
if (coap_header->Code==COAP_CODE_REQ_GET) {
--- 48,57 ----
//=========================== private =========================================
! owerror_t rinfo_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! owerror_t outcome;
if (coap_header->Code==COAP_CODE_REQ_GET) {
***************
*** 81,88 ****
msg->payload[sizeof(infoStackName)-1+5-1] = '0'+OPENWSN_VERSION_PATCH;
// set the CoAP header
! coap_header->OC = 0;
! coap_header->Code = COAP_CODE_RESP_CONTENT;
outcome = E_SUCCESS;
--- 85,91 ----
msg->payload[sizeof(infoStackName)-1+5-1] = '0'+OPENWSN_VERSION_PATCH;
// set the CoAP header
! coap_header->Code = COAP_CODE_RESP_CONTENT;
outcome = E_SUCCESS;
***************
*** 94,99 ****
return outcome;
}
! void rinfo_sendDone(OpenQueueEntry_t* msg, error_t error) {
openqueue_freePacketBuffer(msg);
}
\ No newline at end of file
--- 97,102 ----
return outcome;
}
! void rinfo_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
openqueue_freePacketBuffer(msg);
}
\ No newline at end of file

View File

@ -0,0 +1,36 @@
*** stock_iot-lab_M3/openwsn/07-App/rinfo/rinfo.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rinfo/rinfo.h Thu Apr 24 16:53:29 2014
***************
*** 2,8 ****
#define __RINFO_H
/**
! \addtogroup App
\{
\addtogroup rXL1
\{
--- 2,8 ----
#define __RINFO_H
/**
! \addtogroup AppCoAP
\{
\addtogroup rXL1
\{
***************
*** 16,22 ****
//=========================== prototypes ======================================
! void rinfo_init();
/**
\}
--- 16,22 ----
//=========================== prototypes ======================================
! void rinfo_init(void);
/**
\}

View File

@ -0,0 +1,114 @@
*** stock_iot-lab_M3/openwsn/07-App/rleds/rleds.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rleds/rleds.c Thu Apr 24 16:55:54 2014
***************
*** 1,8 ****
#include "openwsn.h"
! #include "rleds.h"
#include "opencoap.h"
#include "packetfunctions.h"
! #include "leds.h"
#include "openqueue.h"
//=========================== variables =======================================
--- 1,8 ----
#include "openwsn.h"
! #include "rleds_ow.h"
#include "opencoap.h"
#include "packetfunctions.h"
! #include "leds_ow.h"
#include "openqueue.h"
//=========================== variables =======================================
***************
*** 17,31 ****
//=========================== prototypes ======================================
! error_t rleds_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rleds_sendDone(OpenQueueEntry_t* msg,
! error_t error);
//=========================== public ==========================================
! void rleds_init() {
// prepare the resource descriptor for the /.well-known/core path
rleds_vars.desc.path0len = sizeof(rleds_path0)-1;
rleds_vars.desc.path0val = (uint8_t*)(&rleds_path0);
--- 17,31 ----
//=========================== prototypes ======================================
! owerror_t rleds_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rleds_sendDone(OpenQueueEntry_t* msg,
! owerror_t error);
//=========================== public ==========================================
! void rleds__init() {
// prepare the resource descriptor for the /.well-known/core path
rleds_vars.desc.path0len = sizeof(rleds_path0)-1;
rleds_vars.desc.path0val = (uint8_t*)(&rleds_path0);
***************
*** 40,49 ****
//=========================== private =========================================
! error_t rleds_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! error_t outcome;
if (coap_header->Code==COAP_CODE_REQ_GET) {
// reset packet payload
--- 40,49 ----
//=========================== private =========================================
! owerror_t rleds_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! owerror_t outcome;
if (coap_header->Code==COAP_CODE_REQ_GET) {
// reset packet payload
***************
*** 59,65 ****
}
// set the CoAP header
- coap_header->OC = 0;
coap_header->Code = COAP_CODE_RESP_CONTENT;
outcome = E_SUCCESS;
--- 59,64 ----
***************
*** 79,85 ****
msg->length = 0;
// set the CoAP header
- coap_header->OC = 0;
coap_header->Code = COAP_CODE_RESP_CHANGED;
outcome = E_SUCCESS;
--- 78,83 ----
***************
*** 89,94 ****
return outcome;
}
! void rleds_sendDone(OpenQueueEntry_t* msg, error_t error) {
openqueue_freePacketBuffer(msg);
}
\ No newline at end of file
--- 87,92 ----
return outcome;
}
! void rleds_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
openqueue_freePacketBuffer(msg);
}
\ No newline at end of file

View File

@ -0,0 +1,36 @@
*** stock_iot-lab_M3/openwsn/07-App/rleds/rleds.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rleds/rleds.h Thu Apr 24 16:53:29 2014
***************
*** 2,8 ****
#define __RLEDS_H
/**
! \addtogroup App
\{
\addtogroup netLeds
\{
--- 2,8 ----
#define __RLEDS_H
/**
! \addtogroup AppCoAP
\{
\addtogroup netLeds
\{
***************
*** 16,22 ****
//=========================== prototypes ======================================
! void rleds_init();
/**
\}
--- 16,22 ----
//=========================== prototypes ======================================
! void rleds__init();
/**
\}

View File

@ -0,0 +1,181 @@
*** stock_iot-lab_M3/openwsn/07-App/rreg/rreg.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rreg/rreg.c Thu Apr 24 16:55:54 2014
***************
*** 24,41 ****
//=========================== prototypes ======================================
! error_t rreg_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rreg_timer();
void rreg_sendDone(OpenQueueEntry_t* msg,
! error_t error);
uint8_t hexToAscii(uint8_t hex);
//=========================== public ==========================================
void rreg_init() {
! // prepare the resource descriptor for the /.well-known/core path
rreg_vars.desc.path0len = sizeof(rreg_path0)-1;
rreg_vars.desc.path0val = (uint8_t*)(&rreg_path0);
rreg_vars.desc.path1len = 0;
--- 24,44 ----
//=========================== prototypes ======================================
! owerror_t rreg_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rreg_timer();
void rreg_sendDone(OpenQueueEntry_t* msg,
! owerror_t error);
uint8_t hexToAscii(uint8_t hex);
//=========================== public ==========================================
void rreg_init() {
! //dagroot does not run upper layers.
! if(idmanager_getIsDAGroot()==TRUE) return;
!
! // prepare the resource descriptor for the /.well-known/core path
rreg_vars.desc.path0len = sizeof(rreg_path0)-1;
rreg_vars.desc.path0val = (uint8_t*)(&rreg_path0);
rreg_vars.desc.path1len = 0;
***************
*** 55,65 ****
//=========================== private =========================================
! error_t rreg_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! error_t outcome;
if (coap_header->Code==COAP_CODE_REQ_POST) {
// request to register received
--- 58,68 ----
//=========================== private =========================================
! owerror_t rreg_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! owerror_t outcome;
if (coap_header->Code==COAP_CODE_REQ_POST) {
// request to register received
***************
*** 74,81 ****
msg->length = 0;
// set the CoAP header
! coap_header->OC = 0;
! coap_header->Code = COAP_CODE_RESP_VALID;
outcome = E_SUCCESS;
} else if (coap_header->T==COAP_TYPE_ACK) {
--- 77,83 ----
msg->length = 0;
// set the CoAP header
! coap_header->Code = COAP_CODE_RESP_VALID;
outcome = E_SUCCESS;
} else if (coap_header->T==COAP_TYPE_ACK) {
***************
*** 90,96 ****
void rreg_timer() {
OpenQueueEntry_t* pkt;
uint8_t temp8b;
! error_t outcome;
uint8_t numOptions;
--- 92,98 ----
void rreg_timer() {
OpenQueueEntry_t* pkt;
uint8_t temp8b;
! owerror_t outcome;
uint8_t numOptions;
***************
*** 100,106 ****
openserial_printError(COMPONENT_RREG,ERR_NO_FREE_PACKET_BUFFER,
(errorparameter_t)0,
(errorparameter_t)0);
! openqueue_freePacketBuffer(pkt);
return;
}
// take ownership over that packet
--- 102,108 ----
openserial_printError(COMPONENT_RREG,ERR_NO_FREE_PACKET_BUFFER,
(errorparameter_t)0,
(errorparameter_t)0);
! //openqueue_freePacketBuffer(pkt);
return;
}
// take ownership over that packet
***************
*** 116,122 ****
pkt->payload[sizeof(rreg_uriquery)-1] = hexToAscii((temp8b>>4) & 0x0f);
pkt->payload[sizeof(rreg_uriquery)-0] = hexToAscii((temp8b>>0) & 0x0f);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_URIQUERY-COAP_OPTION_URIPATH) << 4 |
sizeof(rreg_uriquery)-1+2;
numOptions++;
// URI-path
--- 118,124 ----
pkt->payload[sizeof(rreg_uriquery)-1] = hexToAscii((temp8b>>4) & 0x0f);
pkt->payload[sizeof(rreg_uriquery)-0] = hexToAscii((temp8b>>0) & 0x0f);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_NUM_URIQUERY-COAP_OPTION_NUM_URIPATH) << 4 |
sizeof(rreg_uriquery)-1+2;
numOptions++;
// URI-path
***************
*** 124,135 ****
pkt->payload[0] = 'r';
pkt->payload[1] = 'd';
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_URIPATH-COAP_OPTION_CONTENTTYPE) << 4 |
2;
numOptions++;
// add content-type option
packetfunctions_reserveHeaderSize(pkt,2);
! pkt->payload[0] = COAP_OPTION_CONTENTTYPE << 4 |
1;
pkt->payload[1] = COAP_MEDTYPE_APPLINKFORMAT;
numOptions++;
--- 126,137 ----
pkt->payload[0] = 'r';
pkt->payload[1] = 'd';
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_NUM_URIPATH) << 4 |
2;
numOptions++;
// add content-type option
packetfunctions_reserveHeaderSize(pkt,2);
! pkt->payload[0] = COAP_OPTION_NUM_CONTENTFORMAT << 4 |
1;
pkt->payload[1] = COAP_MEDTYPE_APPLINKFORMAT;
numOptions++;
***************
*** 151,157 ****
return;
}
! void rreg_sendDone(OpenQueueEntry_t* msg, error_t error) {
openqueue_freePacketBuffer(msg);
}
--- 153,159 ----
return;
}
! void rreg_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
openqueue_freePacketBuffer(msg);
}

View File

@ -0,0 +1,19 @@
*** stock_iot-lab_M3/openwsn/07-App/rreg/rreg.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rreg/rreg.h Thu Apr 24 16:53:29 2014
***************
*** 2,8 ****
#define __RREG_H
/**
! \addtogroup App
\{
\addtogroup rReg
\{
--- 2,8 ----
#define __RREG_H
/**
! \addtogroup AppCoAP
\{
\addtogroup rReg
\{

View File

@ -0,0 +1,149 @@
*** stock_iot-lab_M3/openwsn/07-App/rrube/rrube.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rrube/rrube.c Thu Apr 24 16:55:54 2014
***************
*** 8,14 ****
#include "idmanager.h"
#include "board.h"
#include "heli.h"
! #include "leds.h"
//=========================== defines =========================================
--- 8,14 ----
#include "idmanager.h"
#include "board.h"
#include "heli.h"
! #include "leds_ow.h"
//=========================== defines =========================================
***************
*** 37,48 ****
//=========================== prototypes ======================================
! error_t rrube_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rrube_timer();
void rrube_sendDone(OpenQueueEntry_t* msg,
! error_t error);
uint8_t hexToAscii(uint8_t hex);
//=========================== public ==========================================
--- 37,48 ----
//=========================== prototypes ======================================
! owerror_t rrube_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rrube_timer();
void rrube_sendDone(OpenQueueEntry_t* msg,
! owerror_t error);
uint8_t hexToAscii(uint8_t hex);
//=========================== public ==========================================
***************
*** 70,80 ****
//=========================== private =========================================
! error_t rrube_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! error_t outcome;
if (rrube_vars.rrube_state==RRUBE_ST_IDLE &&
coap_header->Code==COAP_CODE_REQ_POST) {
--- 70,80 ----
//=========================== private =========================================
! owerror_t rrube_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! owerror_t outcome;
if (rrube_vars.rrube_state==RRUBE_ST_IDLE &&
coap_header->Code==COAP_CODE_REQ_POST) {
***************
*** 90,96 ****
msg->length = 0;
// set the CoAP header
- coap_header->OC = 0;
coap_header->Code = COAP_CODE_RESP_VALID;
// advance state machine
--- 90,95 ----
***************
*** 136,142 ****
void rrube_timer() {
OpenQueueEntry_t* pkt;
uint8_t numOptions;
! error_t outcome;
// turn off heli
heli_off();
--- 135,141 ----
void rrube_timer() {
OpenQueueEntry_t* pkt;
uint8_t numOptions;
! owerror_t outcome;
// turn off heli
heli_off();
***************
*** 161,167 ****
packetfunctions_reserveHeaderSize(pkt,sizeof(rrube_path0)-1);
memcpy(&pkt->payload[0],&rrube_path0,sizeof(rrube_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_URIPATH) << 4 |
sizeof(rrube_path0)-1;
numOptions++;
// metadata
--- 160,166 ----
packetfunctions_reserveHeaderSize(pkt,sizeof(rrube_path0)-1);
memcpy(&pkt->payload[0],&rrube_path0,sizeof(rrube_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_NUM_URIPATH) << 4 |
sizeof(rrube_path0)-1;
numOptions++;
// metadata
***************
*** 205,211 ****
packetfunctions_reserveHeaderSize(pkt,sizeof(rrube_path0)-1);
memcpy(&pkt->payload[0],&rrube_path0,sizeof(rrube_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_URIPATH) << 4 |
sizeof(rrube_path0)-1;
numOptions++;
// metadata
--- 204,210 ----
packetfunctions_reserveHeaderSize(pkt,sizeof(rrube_path0)-1);
memcpy(&pkt->payload[0],&rrube_path0,sizeof(rrube_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_NUM_URIPATH) << 4 |
sizeof(rrube_path0)-1;
numOptions++;
// metadata
***************
*** 238,243 ****
return;
}
! void rrube_sendDone(OpenQueueEntry_t* msg, error_t error) {
openqueue_freePacketBuffer(msg);
}
\ No newline at end of file
--- 237,242 ----
return;
}
! void rrube_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
openqueue_freePacketBuffer(msg);
}
\ No newline at end of file

View File

@ -0,0 +1,19 @@
*** stock_iot-lab_M3/openwsn/07-App/rrube/rrube.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rrube/rrube.h Thu Apr 24 16:53:29 2014
***************
*** 2,8 ****
#define __RRUBE_H
/**
! \addtogroup App
\{
\addtogroup rRube
\{
--- 2,8 ----
#define __RRUBE_H
/**
! \addtogroup AppCoAP
\{
\addtogroup rRube
\{

View File

@ -0,0 +1,141 @@
*** stock_iot-lab_M3/openwsn/07-App/rt/rt.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rt/rt.c Thu Apr 24 16:55:54 2014
***************
*** 27,38 ****
//=========================== prototypes ======================================
! error_t rt_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rt_timer();
void rt_sendDone(OpenQueueEntry_t* msg,
! error_t error);
//=========================== public ==========================================
--- 27,38 ----
//=========================== prototypes ======================================
! owerror_t rt_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rt_timer();
void rt_sendDone(OpenQueueEntry_t* msg,
! owerror_t error);
//=========================== public ==========================================
***************
*** 58,67 ****
//=========================== private =========================================
! error_t rt_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! error_t outcome;
uint8_t rawdata[SENSITIVE_ACCEL_TEMPERATURE_DATALEN];
if (coap_header->Code==COAP_CODE_REQ_POST) {
--- 58,67 ----
//=========================== private =========================================
! owerror_t rt_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! owerror_t outcome;
uint8_t rawdata[SENSITIVE_ACCEL_TEMPERATURE_DATALEN];
if (coap_header->Code==COAP_CODE_REQ_POST) {
***************
*** 78,84 ****
msg->length = 0;
// CoAP header
- coap_header->OC = 0;
coap_header->Code = COAP_CODE_RESP_VALID;
outcome = E_SUCCESS;
--- 78,83 ----
***************
*** 97,104 ****
msg->payload[1] = rawdata[9];
// set the CoAP header
! coap_header->OC = 0;
! coap_header->Code = COAP_CODE_RESP_CONTENT;
outcome = E_SUCCESS;
--- 96,102 ----
msg->payload[1] = rawdata[9];
// set the CoAP header
! coap_header->Code = COAP_CODE_RESP_CONTENT;
outcome = E_SUCCESS;
***************
*** 112,118 ****
void rt_timer() {
OpenQueueEntry_t* pkt;
! error_t outcome;
uint8_t numOptions;
uint8_t rawdata[SENSITIVE_ACCEL_TEMPERATURE_DATALEN];
--- 110,116 ----
void rt_timer() {
OpenQueueEntry_t* pkt;
! owerror_t outcome;
uint8_t numOptions;
uint8_t rawdata[SENSITIVE_ACCEL_TEMPERATURE_DATALEN];
***************
*** 139,150 ****
packetfunctions_reserveHeaderSize(pkt,sizeof(rt_path0)-1);
memcpy(&pkt->payload[0],&rt_path0,sizeof(rt_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_LOCATIONPATH-COAP_OPTION_CONTENTTYPE) << 4 |
sizeof(rt_path0)-1;
numOptions++;
// content-type option
packetfunctions_reserveHeaderSize(pkt,2);
! pkt->payload[0] = COAP_OPTION_CONTENTTYPE << 4 |
1;
pkt->payload[1] = COAP_MEDTYPE_APPOCTETSTREAM;
numOptions++;
--- 137,148 ----
packetfunctions_reserveHeaderSize(pkt,sizeof(rt_path0)-1);
memcpy(&pkt->payload[0],&rt_path0,sizeof(rt_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_NUM_URIPATH) << 4 |
sizeof(rt_path0)-1;
numOptions++;
// content-type option
packetfunctions_reserveHeaderSize(pkt,2);
! pkt->payload[0] = COAP_OPTION_NUM_CONTENTFORMAT << 4 |
1;
pkt->payload[1] = COAP_MEDTYPE_APPOCTETSTREAM;
numOptions++;
***************
*** 166,171 ****
return;
}
! void rt_sendDone(OpenQueueEntry_t* msg, error_t error) {
openqueue_freePacketBuffer(msg);
}
\ No newline at end of file
--- 164,169 ----
return;
}
! void rt_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
openqueue_freePacketBuffer(msg);
}
\ No newline at end of file

View File

@ -0,0 +1,19 @@
*** stock_iot-lab_M3/openwsn/07-App/rt/rt.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rt/rt.h Thu Apr 24 16:53:29 2014
***************
*** 2,8 ****
#define __RT_H
/**
! \addtogroup App
\{
\addtogroup rT
\{
--- 2,8 ----
#define __RT_H
/**
! \addtogroup AppCoAP
\{
\addtogroup rT
\{

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/07-App/rwellknown/Makefile Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rwellknown/Makefile Mon May 12 13:09:43 2014
***************
*** 0 ****
--- 1,32 ----
+ SUBSUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBSUBMOD)
+
+ $(BINDIR)$(SUBSUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,124 @@
*** stock_iot-lab_M3/openwsn/07-App/rwellknown/rwellknown.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rwellknown/rwellknown.c Thu Apr 24 16:55:54 2014
***************
*** 4,10 ****
#include "openqueue.h"
#include "packetfunctions.h"
#include "openserial.h"
!
//=========================== variables =======================================
typedef struct {
--- 4,10 ----
#include "openqueue.h"
#include "packetfunctions.h"
#include "openserial.h"
! #include "idmanager.h"
//=========================== variables =======================================
typedef struct {
***************
*** 19,33 ****
//=========================== prototypes ======================================
! error_t rwellknown_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rwellknown_sendDone(OpenQueueEntry_t* msg,
! error_t error);
//=========================== public ==========================================
! void rwellknown_init() {
// prepare the resource descriptor for the /.well-known/core path
rwellknown_vars.desc.path0len = sizeof(rwellknown_path0)-1;
rwellknown_vars.desc.path0val = (uint8_t*)(&rwellknown_path0);
--- 19,37 ----
//=========================== prototypes ======================================
! owerror_t rwellknown_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rwellknown_sendDone(OpenQueueEntry_t* msg,
! owerror_t error);
//=========================== public ==========================================
! void rwellknown_init(void) {
!
!
! if(idmanager_getIsDAGroot()==TRUE) return;
!
// prepare the resource descriptor for the /.well-known/core path
rwellknown_vars.desc.path0len = sizeof(rwellknown_path0)-1;
rwellknown_vars.desc.path0val = (uint8_t*)(&rwellknown_path0);
***************
*** 42,51 ****
//=========================== private =========================================
! error_t rwellknown_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! error_t outcome;
if (coap_header->Code==COAP_CODE_REQ_GET) {
// reset packet payload
--- 46,55 ----
//=========================== private =========================================
! owerror_t rwellknown_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! owerror_t outcome;
if (coap_header->Code==COAP_CODE_REQ_GET) {
// reset packet payload
***************
*** 57,69 ****
// add return option
packetfunctions_reserveHeaderSize(msg,2);
! msg->payload[0] = COAP_OPTION_CONTENTTYPE << 4 |
1;
msg->payload[1] = COAP_MEDTYPE_APPLINKFORMAT;
// set the CoAP header
! coap_header->OC = 1;
! coap_header->Code = COAP_CODE_RESP_CONTENT;
outcome = E_SUCCESS;
} else {
--- 61,72 ----
// add return option
packetfunctions_reserveHeaderSize(msg,2);
! msg->payload[0] = COAP_OPTION_NUM_CONTENTFORMAT << 4 |
1;
msg->payload[1] = COAP_MEDTYPE_APPLINKFORMAT;
// set the CoAP header
! coap_header->Code = COAP_CODE_RESP_CONTENT;
outcome = E_SUCCESS;
} else {
***************
*** 72,77 ****
return outcome;
}
! void rwellknown_sendDone(OpenQueueEntry_t* msg, error_t error) {
openqueue_freePacketBuffer(msg);
}
\ No newline at end of file
--- 75,80 ----
return outcome;
}
! void rwellknown_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
openqueue_freePacketBuffer(msg);
}
\ No newline at end of file

View File

@ -0,0 +1,36 @@
*** stock_iot-lab_M3/openwsn/07-App/rwellknown/rwellknown.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rwellknown/rwellknown.h Thu Apr 24 16:53:29 2014
***************
*** 2,8 ****
#define __RWELLKNOWN_H
/**
! \addtogroup App
\{
\addtogroup rWellKnown
\{
--- 2,8 ----
#define __RWELLKNOWN_H
/**
! \addtogroup AppCoAP
\{
\addtogroup rWellKnown
\{
***************
*** 16,22 ****
//=========================== prototypes ======================================
! void rwellknown_init();
/**
\}
--- 16,22 ----
//=========================== prototypes ======================================
! void rwellknown_init(void);
/**
\}

View File

@ -0,0 +1,131 @@
*** stock_iot-lab_M3/openwsn/07-App/rxl1/rxl1.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rxl1/rxl1.c Thu Apr 24 16:55:54 2014
***************
*** 27,38 ****
//=========================== prototypes ======================================
! error_t rxl1_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rxl1_timer();
void rxl1_sendDone(OpenQueueEntry_t* msg,
! error_t error);
//=========================== public ==========================================
--- 27,38 ----
//=========================== prototypes ======================================
! owerror_t rxl1_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
void rxl1_timer();
void rxl1_sendDone(OpenQueueEntry_t* msg,
! owerror_t error);
//=========================== public ==========================================
***************
*** 60,69 ****
//=========================== private =========================================
! error_t rxl1_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! error_t outcome;
uint8_t rawdata[SENSITIVE_ACCEL_TEMPERATURE_DATALEN];
if (coap_header->Code==COAP_CODE_REQ_POST) {
--- 60,69 ----
//=========================== private =========================================
! owerror_t rxl1_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! owerror_t outcome;
uint8_t rawdata[SENSITIVE_ACCEL_TEMPERATURE_DATALEN];
if (coap_header->Code==COAP_CODE_REQ_POST) {
***************
*** 83,89 ****
msg->length = 0;
// CoAP header
- coap_header->OC = 0;
coap_header->Code = COAP_CODE_RESP_VALID;
outcome = E_SUCCESS;
--- 83,88 ----
***************
*** 101,107 ****
memcpy(&msg->payload[0],&rawdata[8],8);
// set the CoAP header
- coap_header->OC = 0;
coap_header->Code = COAP_CODE_RESP_CONTENT;
outcome = E_SUCCESS;
--- 100,105 ----
***************
*** 116,122 ****
void rxl1_timer() {
OpenQueueEntry_t* pkt;
! error_t outcome;
uint8_t numOptions;
uint8_t rawdata[SENSITIVE_ACCEL_TEMPERATURE_DATALEN];
--- 114,120 ----
void rxl1_timer() {
OpenQueueEntry_t* pkt;
! owerror_t outcome;
uint8_t numOptions;
uint8_t rawdata[SENSITIVE_ACCEL_TEMPERATURE_DATALEN];
***************
*** 143,154 ****
packetfunctions_reserveHeaderSize(pkt,sizeof(rxl1_path0)-1);
memcpy(&pkt->payload[0],&rxl1_path0,sizeof(rxl1_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_LOCATIONPATH-COAP_OPTION_CONTENTTYPE) << 4 |
sizeof(rxl1_path0)-1;
numOptions++;
// content-type option
packetfunctions_reserveHeaderSize(pkt,2);
! pkt->payload[0] = COAP_OPTION_CONTENTTYPE << 4 |
1;
pkt->payload[1] = COAP_MEDTYPE_APPOCTETSTREAM;
numOptions++;
--- 141,152 ----
packetfunctions_reserveHeaderSize(pkt,sizeof(rxl1_path0)-1);
memcpy(&pkt->payload[0],&rxl1_path0,sizeof(rxl1_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_NUM_URIPATH) << 4 |
sizeof(rxl1_path0)-1;
numOptions++;
// content-type option
packetfunctions_reserveHeaderSize(pkt,2);
! pkt->payload[0] = COAP_OPTION_NUM_CONTENTFORMAT << 4 |
1;
pkt->payload[1] = COAP_MEDTYPE_APPOCTETSTREAM;
numOptions++;
***************
*** 171,176 ****
return;
}
! void rxl1_sendDone(OpenQueueEntry_t* msg, error_t error) {
openqueue_freePacketBuffer(msg);
}
--- 169,174 ----
return;
}
! void rxl1_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
openqueue_freePacketBuffer(msg);
}

View File

@ -0,0 +1,19 @@
*** stock_iot-lab_M3/openwsn/07-App/rxl1/rxl1.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/rxl1/rxl1.h Thu Apr 24 16:53:29 2014
***************
*** 2,8 ****
#define __RXL1_H
/**
! \addtogroup App
\{
\addtogroup rXL1
\{
--- 2,8 ----
#define __RXL1_H
/**
! \addtogroup AppCoAP
\{
\addtogroup rXL1
\{

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/07-App/tcpecho/Makefile Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/tcpecho/Makefile Mon May 12 13:09:42 2014
***************
*** 0 ****
--- 1,32 ----
+ SUBSUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBSUBMOD)
+
+ $(BINDIR)$(SUBSUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,64 @@
*** stock_iot-lab_M3/openwsn/07-App/tcpecho/tcpecho.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/tcpecho/tcpecho.c Thu Apr 24 16:55:54 2014
***************
*** 10,19 ****
//=========================== public ==========================================
! void tcpecho_init() {
}
! bool tcpecho_shouldIlisten() {
return TRUE;
}
--- 10,19 ----
//=========================== public ==========================================
! void tcpecho_init(void) {
}
! bool tcpecho_shouldIlisten(void) {
return TRUE;
}
***************
*** 31,37 ****
}
}
! void tcpecho_sendDone(OpenQueueEntry_t* msg, error_t error) {
msg->owner = COMPONENT_TCPECHO;
if (msg->creator!=COMPONENT_TCPECHO) {
openserial_printError(COMPONENT_TCPECHO,ERR_UNEXPECTED_SENDDONE,
--- 31,37 ----
}
}
! void tcpecho_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
msg->owner = COMPONENT_TCPECHO;
if (msg->creator!=COMPONENT_TCPECHO) {
openserial_printError(COMPONENT_TCPECHO,ERR_UNEXPECTED_SENDDONE,
***************
*** 43,52 ****
openqueue_freePacketBuffer(msg);
}
! void tcpecho_connectDone() {
}
! bool tcpecho_debugPrint() {
return FALSE;
}
--- 43,52 ----
openqueue_freePacketBuffer(msg);
}
! void tcpecho_connectDone(owerror_t error) {
}
! bool tcpecho_debugPrint(void) {
return FALSE;
}

View File

@ -0,0 +1,46 @@
*** stock_iot-lab_M3/openwsn/07-App/tcpecho/tcpecho.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/tcpecho/tcpecho.h Thu Apr 24 16:53:29 2014
***************
*** 2,8 ****
#define __TCPECHO_H
/**
! \addtogroup App
\{
\addtogroup tcpEcho
\{
--- 2,8 ----
#define __TCPECHO_H
/**
! \addtogroup AppTcp
\{
\addtogroup tcpEcho
\{
***************
*** 16,27 ****
//=========================== prototypes ======================================
! void tcpecho_init();
! bool tcpecho_shouldIlisten();
void tcpecho_receive(OpenQueueEntry_t* msg);
! void tcpecho_sendDone(OpenQueueEntry_t* msg, error_t error);
! void tcpecho_connectDone();
! bool tcpecho_debugPrint();
/**
\}
--- 16,27 ----
//=========================== prototypes ======================================
! void tcpecho_init(void);
! bool tcpecho_shouldIlisten(void);
void tcpecho_receive(OpenQueueEntry_t* msg);
! void tcpecho_sendDone(OpenQueueEntry_t* msg, owerror_t error);
! void tcpecho_connectDone(owerror_t error);
! bool tcpecho_debugPrint(void);
/**
\}

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/07-App/tcpinject/Makefile Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/tcpinject/Makefile Mon May 12 13:09:42 2014
***************
*** 0 ****
--- 1,32 ----
+ SUBSUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBSUBMOD)
+
+ $(BINDIR)$(SUBSUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,102 @@
*** stock_iot-lab_M3/openwsn/07-App/tcpinject/tcpinject.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/tcpinject/tcpinject.c Thu Apr 24 16:55:54 2014
***************
*** 7,33 ****
//=========================== variables =======================================
- typedef struct {
- OpenQueueEntry_t* pkt;
- bool sending;
- open_addr_t hisAddress;
- uint16_t hisPort;
- } tcpinject_vars_t;
-
tcpinject_vars_t tcpinject_vars;
//=========================== prototypes ======================================
//=========================== public ==========================================
! void tcpinject_init() {
}
! bool tcpinject_shouldIlisten() {
return FALSE;
}
! void tcpinject_trigger() {
uint8_t number_bytes_from_input_buffer;
uint8_t input_buffer[18];
//get command from OpenSerial (16B IPv6 destination address, 2B destination port)
--- 7,26 ----
//=========================== variables =======================================
tcpinject_vars_t tcpinject_vars;
//=========================== prototypes ======================================
//=========================== public ==========================================
! void tcpinject_init(void) {
}
! bool tcpinject_shouldIlisten(void) {
return FALSE;
}
! void tcpinject_trigger(void) {
uint8_t number_bytes_from_input_buffer;
uint8_t input_buffer[18];
//get command from OpenSerial (16B IPv6 destination address, 2B destination port)
***************
*** 45,51 ****
opentcp_connect(&tcpinject_vars.hisAddress,tcpinject_vars.hisPort,WKP_TCP_INJECT);
}
! void tcpinject_connectDone(error_t error) {
if (error==E_SUCCESS) {
tcpinject_vars.pkt = openqueue_getFreePacketBuffer(COMPONENT_TCPINJECT);
if (tcpinject_vars.pkt==NULL) {
--- 38,44 ----
opentcp_connect(&tcpinject_vars.hisAddress,tcpinject_vars.hisPort,WKP_TCP_INJECT);
}
! void tcpinject_connectDone(owerror_t error) {
if (error==E_SUCCESS) {
tcpinject_vars.pkt = openqueue_getFreePacketBuffer(COMPONENT_TCPINJECT);
if (tcpinject_vars.pkt==NULL) {
***************
*** 74,80 ****
}
}
! void tcpinject_sendDone(OpenQueueEntry_t* msg, error_t error) {
msg->owner = COMPONENT_TCPINJECT;
if (msg->creator!=COMPONENT_TCPINJECT) {
openserial_printError(COMPONENT_TCPINJECT,ERR_UNEXPECTED_SENDDONE,
--- 67,73 ----
}
}
! void tcpinject_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
msg->owner = COMPONENT_TCPINJECT;
if (msg->creator!=COMPONENT_TCPINJECT) {
openserial_printError(COMPONENT_TCPINJECT,ERR_UNEXPECTED_SENDDONE,
***************
*** 88,94 ****
void tcpinject_receive(OpenQueueEntry_t* msg) {
}
! bool tcpinject_debugPrint() {
return FALSE;
}
--- 81,87 ----
void tcpinject_receive(OpenQueueEntry_t* msg) {
}
! bool tcpinject_debugPrint(void) {
return FALSE;
}

View File

@ -0,0 +1,63 @@
*** stock_iot-lab_M3/openwsn/07-App/tcpinject/tcpinject.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/tcpinject/tcpinject.h Thu Apr 24 16:53:30 2014
***************
*** 2,8 ****
#define __TCPINJECT_H
/**
! \addtogroup App
\{
\addtogroup tcpInject
\{
--- 2,8 ----
#define __TCPINJECT_H
/**
! \addtogroup AppTcp
\{
\addtogroup tcpInject
\{
***************
*** 12,28 ****
//=========================== typedef =========================================
! //=========================== variables =======================================
//=========================== prototypes ======================================
! void tcpinject_init();
! bool tcpinject_shouldIlisten();
! void tcpinject_trigger();
! void tcpinject_connectDone(error_t error);
! void tcpinject_sendDone(OpenQueueEntry_t* msg, error_t error);
void tcpinject_receive(OpenQueueEntry_t* msg);
! bool tcpinject_debugPrint();
/**
\}
--- 12,35 ----
//=========================== typedef =========================================
! //=========================== module variables ================================
!
! typedef struct {
! OpenQueueEntry_t* pkt;
! bool sending;
! open_addr_t hisAddress;
! uint16_t hisPort;
! } tcpinject_vars_t;
//=========================== prototypes ======================================
! void tcpinject_init(void);
! bool tcpinject_shouldIlisten(void);
! void tcpinject_trigger(void);
! void tcpinject_connectDone(owerror_t error);
! void tcpinject_sendDone(OpenQueueEntry_t* msg, owerror_t error);
void tcpinject_receive(OpenQueueEntry_t* msg);
! bool tcpinject_debugPrint(void);
/**
\}

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/07-App/tcpprint/Makefile Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/tcpprint/Makefile Mon May 12 13:09:41 2014
***************
*** 0 ****
--- 1,32 ----
+ SUBSUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBSUBMOD)
+
+ $(BINDIR)$(SUBSUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,53 @@
*** stock_iot-lab_M3/openwsn/07-App/tcpprint/tcpprint.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/tcpprint/tcpprint.c Thu Apr 24 16:55:54 2014
***************
*** 10,19 ****
//=========================== public ==========================================
! void tcpprint_init() {
}
! bool tcpprint_shouldIlisten(){
return TRUE;
}
--- 10,19 ----
//=========================== public ==========================================
! void tcpprint_init(void) {
}
! bool tcpprint_shouldIlisten(void){
return TRUE;
}
***************
*** 24,36 ****
openqueue_freePacketBuffer(msg);
}
! void tcpprint_connectDone(error_t error) {
}
! void tcpprint_sendDone(OpenQueueEntry_t* msg, error_t error) {
}
! bool tcpprint_debugPrint() {
return FALSE;
}
--- 24,36 ----
openqueue_freePacketBuffer(msg);
}
! void tcpprint_connectDone(owerror_t error) {
}
! void tcpprint_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
}
! bool tcpprint_debugPrint(void) {
return FALSE;
}

View File

@ -0,0 +1,46 @@
*** stock_iot-lab_M3/openwsn/07-App/tcpprint/tcpprint.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/tcpprint/tcpprint.h Thu Apr 24 16:53:30 2014
***************
*** 2,8 ****
#define __TCPPRINT_H
/**
! \addtogroup App
\{
\addtogroup tcpPrint
\{
--- 2,8 ----
#define __TCPPRINT_H
/**
! \addtogroup AppTcp
\{
\addtogroup tcpPrint
\{
***************
*** 16,27 ****
//=========================== prototypes ======================================
! void tcpprint_init();
! bool tcpprint_shouldIlisten();
void tcpprint_receive(OpenQueueEntry_t* msg);
! void tcpprint_connectDone(error_t error);
! void tcpprint_sendDone(OpenQueueEntry_t* msg, error_t error);
! bool tcpprint_debugPrint();
/**
\}
--- 16,27 ----
//=========================== prototypes ======================================
! void tcpprint_init(void);
! bool tcpprint_shouldIlisten(void);
void tcpprint_receive(OpenQueueEntry_t* msg);
! void tcpprint_connectDone(owerror_t error);
! void tcpprint_sendDone(OpenQueueEntry_t* msg, owerror_t error);
! bool tcpprint_debugPrint(void);
/**
\}

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/07-App/udpecho/Makefile Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/udpecho/Makefile Mon May 12 13:09:40 2014
***************
*** 0 ****
--- 1,32 ----
+ SUBSUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBSUBMOD)
+
+ $(BINDIR)$(SUBSUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,52 @@
*** stock_iot-lab_M3/openwsn/07-App/udpecho/udpecho.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/udpecho/udpecho.c Thu Apr 24 16:55:54 2014
***************
*** 10,16 ****
//=========================== public ==========================================
! void udpecho_init() {
}
void udpecho_receive(OpenQueueEntry_t* msg) {
--- 10,16 ----
//=========================== public ==========================================
! void udpecho_init(void) {
}
void udpecho_receive(OpenQueueEntry_t* msg) {
***************
*** 44,50 ****
}
}
! void udpecho_sendDone(OpenQueueEntry_t* msg, error_t error) {
msg->owner = COMPONENT_UDPECHO;
if (msg->creator!=COMPONENT_UDPECHO) {
openserial_printError(COMPONENT_UDPECHO,ERR_UNEXPECTED_SENDDONE,
--- 44,50 ----
}
}
! void udpecho_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
msg->owner = COMPONENT_UDPECHO;
if (msg->creator!=COMPONENT_UDPECHO) {
openserial_printError(COMPONENT_UDPECHO,ERR_UNEXPECTED_SENDDONE,
***************
*** 54,60 ****
openqueue_freePacketBuffer(msg);
}
! bool udpecho_debugPrint() {
return FALSE;
}
--- 54,60 ----
openqueue_freePacketBuffer(msg);
}
! bool udpecho_debugPrint(void) {
return FALSE;
}

View File

@ -0,0 +1,42 @@
*** stock_iot-lab_M3/openwsn/07-App/udpecho/udpecho.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/udpecho/udpecho.h Thu Apr 24 16:53:30 2014
***************
*** 2,8 ****
#define __UDPECHO_H
/**
! \addtogroup App
\{
\addtogroup udpEcho
\{
--- 2,8 ----
#define __UDPECHO_H
/**
! \addtogroup AppUdp
\{
\addtogroup udpEcho
\{
***************
*** 16,25 ****
//=========================== prototypes ======================================
! void udpecho_init();
void udpecho_receive(OpenQueueEntry_t* msg);
! void udpecho_sendDone(OpenQueueEntry_t* msg, error_t error);
! bool udpecho_debugPrint();
/**
\}
--- 16,25 ----
//=========================== prototypes ======================================
! void udpecho_init(void);
void udpecho_receive(OpenQueueEntry_t* msg);
! void udpecho_sendDone(OpenQueueEntry_t* msg, owerror_t error);
! bool udpecho_debugPrint(void);
/**
\}

View File

@ -0,0 +1,59 @@
*** stock_iot-lab_M3/openwsn/07-App/udpecho/udpecho.py Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/udpecho/udpecho.py Thu Apr 24 16:53:30 2014
***************
*** 3,26 ****
request = "poipoipoipoi"
myAddress = '' #means 'all'
myPort = 21568
! hisAddress = '2001:470:48b8:cfde:1415:9200:12:e63b'
hisPort = 7
!
print "Testing udpEcho..."
! socket_handler = socket.socket(socket.AF_INET6,socket.SOCK_DGRAM)
! socket_handler.settimeout(5)
! socket_handler.bind((myAddress,myPort))
! socket_handler.sendto(request,(hisAddress,hisPort))
! print "\nrequest "+myAddress+"%"+str(myPort)+" -> "+hisAddress+"%"+str(hisPort)
! print request+" ("+str(len(request))+" bytes)"
! try:
! reply,dist_addr = socket_handler.recvfrom(1024)
! except socket.timeout:
! print "\nno reply"
! else:
! print "\nreply "+str(dist_addr[0])+"%"+str(dist_addr[1])+" -> "+myAddress+"%"+str(myPort)
! print reply+" ("+str(len(reply))+" bytes)"
! socket_handler.close()
raw_input("\nPress return to close this window...")
--- 3,32 ----
request = "poipoipoipoi"
myAddress = '' #means 'all'
myPort = 21568
! hisAddress = 'bbbb::1415:920b:0301:00e9'
hisPort = 7
! succ = 0
! fail = 0
print "Testing udpEcho..."
! for i in range(10):
! print "echo " + str(i)
! socket_handler = socket.socket(socket.AF_INET6,socket.SOCK_DGRAM)
! socket_handler.settimeout(5)
! socket_handler.bind((myAddress,myPort))
! socket_handler.sendto(request,(hisAddress,hisPort))
! print "\nrequest "+myAddress+"%"+str(myPort)+" -> "+hisAddress+"%"+str(hisPort)
! print request+" ("+str(len(request))+" bytes)"
! try:
! reply,dist_addr = socket_handler.recvfrom(1024)
! except socket.timeout:
! print "\nno reply"
! fail=fail+1
! else:
! print "\nreply "+str(dist_addr[0])+"%"+str(dist_addr[1])+" -> "+myAddress+"%"+str(myPort)
! print reply+" ("+str(len(reply))+" bytes)"
! succ=succ+1
! socket_handler.close()
+ print "success " + str(succ) + " fail " + str(fail)
raw_input("\nPress return to close this window...")

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/07-App/udpinject/Makefile Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/udpinject/Makefile Mon May 12 13:09:40 2014
***************
*** 0 ****
--- 1,32 ----
+ SUBSUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBSUBMOD)
+
+ $(BINDIR)$(SUBSUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,58 @@
*** stock_iot-lab_M3/openwsn/07-App/udpinject/udpinject.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/udpinject/udpinject.c Thu Apr 24 16:55:54 2014
***************
*** 11,20 ****
//=========================== public ==========================================
! void udpinject_init() {
}
! void udpinject_trigger() {
OpenQueueEntry_t* pkt;
uint8_t number_bytes_from_input_buffer;
uint8_t input_buffer[18];
--- 11,20 ----
//=========================== public ==========================================
! void udpinject_init(void) {
}
! void udpinject_trigger(void) {
OpenQueueEntry_t* pkt;
uint8_t number_bytes_from_input_buffer;
uint8_t input_buffer[18];
***************
*** 54,60 ****
}
}
! void udpinject_sendDone(OpenQueueEntry_t* msg, error_t error) {
msg->owner = COMPONENT_UDPINJECT;
if (msg->creator!=COMPONENT_UDPINJECT) {
openserial_printError(COMPONENT_UDPINJECT,ERR_UNEXPECTED_SENDDONE,
--- 54,60 ----
}
}
! void udpinject_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
msg->owner = COMPONENT_UDPINJECT;
if (msg->creator!=COMPONENT_UDPINJECT) {
openserial_printError(COMPONENT_UDPINJECT,ERR_UNEXPECTED_SENDDONE,
***************
*** 68,74 ****
openqueue_freePacketBuffer(msg);
}
! bool udpinject_debugPrint() {
return FALSE;
}
--- 68,74 ----
openqueue_freePacketBuffer(msg);
}
! bool udpinject_debugPrint(void) {
return FALSE;
}

View File

@ -0,0 +1,44 @@
*** stock_iot-lab_M3/openwsn/07-App/udpinject/udpinject.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/udpinject/udpinject.h Thu Apr 24 16:53:30 2014
***************
*** 2,8 ****
#define __UDPINJECT_H
/**
! \addtogroup App
\{
\addtogroup udpInject
\{
--- 2,8 ----
#define __UDPINJECT_H
/**
! \addtogroup AppUdp
\{
\addtogroup udpInject
\{
***************
*** 16,26 ****
//=========================== prototypes ======================================
! void udpinject_init();
! void udpinject_trigger();
! void udpinject_sendDone(OpenQueueEntry_t* msg, error_t error);
void udpinject_receive(OpenQueueEntry_t* msg);
! bool udpinject_debugPrint();
/**
\}
--- 16,26 ----
//=========================== prototypes ======================================
! void udpinject_init(void);
! void udpinject_trigger(void);
! void udpinject_sendDone(OpenQueueEntry_t* msg, owerror_t error);
void udpinject_receive(OpenQueueEntry_t* msg);
! bool udpinject_debugPrint(void);
/**
\}

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/07-App/udplatency/Makefile Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/udplatency/Makefile Mon May 12 13:09:39 2014
***************
*** 0 ****
--- 1,32 ----
+ SUBSUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBSUBMOD)
+
+ $(BINDIR)$(SUBSUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,223 @@
*** stock_iot-lab_M3/openwsn/07-App/udplatency/udplatency.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/udplatency/udplatency.c Thu Apr 24 16:55:54 2014
***************
*** 12,21 ****
#include "idmanager.h"
#include "neighbors.h"
! //=========================== defines =========================================
! /// inter-packet period (in mseconds)
! #define UDPLATENCYPERIOD 30000
//=========================== variables =======================================
--- 12,20 ----
#include "idmanager.h"
#include "neighbors.h"
! #include "thread.h"
! //=========================== defines =========================================
//=========================== variables =======================================
***************
*** 24,51 ****
} udplatency_vars_t;
udplatency_vars_t udplatency_vars;
//=========================== prototypes ======================================
! void udplatency_timer();
//=========================== public ==========================================
! void udplatency_init() {
! //don't run on dagroot
! if (idmanager_getIsDAGroot()) return;
!
! udplatency_vars.timerId = opentimers_start(UDPLATENCYPERIOD,
! TIMER_PERIODIC,TIME_MS,
! udplatency_timer);
}
! void udplatency_task(){
OpenQueueEntry_t* pkt;
open_addr_t * p;
open_addr_t q;
! //prepare packet
pkt = openqueue_getFreePacketBuffer(COMPONENT_UDPLATENCY);
if (pkt==NULL) {
openserial_printError(COMPONENT_UDPLATENCY,ERR_NO_FREE_PACKET_BUFFER,
--- 23,60 ----
} udplatency_vars_t;
udplatency_vars_t udplatency_vars;
+ uint16_t seqNum;
+
+ //static char openwsn_udplatency_stack[KERNEL_CONF_STACKSIZE_MAIN];
//=========================== prototypes ======================================
! void udplatency_timer(void);
//=========================== public ==========================================
! void udplatency_init(void) {
! seqNum = 0;
! udplatency_vars.timerId = opentimers_start(UDPLATENCYPERIOD,
! TIMER_PERIODIC,TIME_MS,
! udplatency_timer);
}
! void udplatency_task(void) {
OpenQueueEntry_t* pkt;
open_addr_t * p;
open_addr_t q;
! // don't run if not synch
! if (ieee154e_isSynch() == FALSE) return;
!
! // don't run on dagroot
! if (idmanager_getIsDAGroot()) {
! opentimers_stop(udplatency_vars.timerId);
! return;
! }
!
! // prepare packet
pkt = openqueue_getFreePacketBuffer(COMPONENT_UDPLATENCY);
if (pkt==NULL) {
openserial_printError(COMPONENT_UDPLATENCY,ERR_NO_FREE_PACKET_BUFFER,
***************
*** 58,106 ****
pkt->l4_protocol = IANA_UDP;
pkt->l4_sourcePortORicmpv6Type = WKP_UDP_LATENCY;
pkt->l4_destination_port = WKP_UDP_LATENCY;
! pkt->l3_destinationAdd.type = ADDR_128B;
memcpy(&pkt->l3_destinationAdd.addr_128b[0],&ipAddr_motedata,16);
! //the payload contains the 64bit address of the sender + the ASN
! packetfunctions_reserveHeaderSize(pkt,sizeof(asn_t));
! asnWriteToPkt(pkt);//gets asn from mac layer.
packetfunctions_reserveHeaderSize(pkt,8);
p=idmanager_getMyID(ADDR_64B);
! pkt->payload[0]=p->addr_64b[0];
! pkt->payload[1]=p->addr_64b[1];
! pkt->payload[2]=p->addr_64b[2];
! pkt->payload[3]=p->addr_64b[3];
! pkt->payload[4]=p->addr_64b[4];
! pkt->payload[5]=p->addr_64b[5];
! pkt->payload[6]=p->addr_64b[6];
! pkt->payload[7]=p->addr_64b[7];
neighbors_getPreferredParentEui64(&q);
! if (q.type==ADDR_64B){
packetfunctions_reserveHeaderSize(pkt,8);
! //copy my preferred parent so we can build the topology
! pkt->payload[0]=q.addr_64b[0];
! pkt->payload[1]=q.addr_64b[1];
! pkt->payload[2]=q.addr_64b[2];
! pkt->payload[3]=q.addr_64b[3];
! pkt->payload[4]=q.addr_64b[4];
! pkt->payload[5]=q.addr_64b[5];
! pkt->payload[6]=q.addr_64b[6];
! pkt->payload[7]=q.addr_64b[7];
}
! //send packet
! if ((openudp_send(pkt))==E_FAIL) {
openqueue_freePacketBuffer(pkt);
}
}
! void udplatency_timer() {
! scheduler_push_task(udplatency_task,TASKPRIO_COAP);
}
! void udplatency_sendDone(OpenQueueEntry_t* msg, error_t error) {
msg->owner = COMPONENT_UDPLATENCY;
if (msg->creator!=COMPONENT_UDPLATENCY) {
openserial_printError(COMPONENT_UDPLATENCY,ERR_UNEXPECTED_SENDDONE,
--- 67,132 ----
pkt->l4_protocol = IANA_UDP;
pkt->l4_sourcePortORicmpv6Type = WKP_UDP_LATENCY;
pkt->l4_destination_port = WKP_UDP_LATENCY;
! pkt->l3_destinationAdd.type = ADDR_128B;
memcpy(&pkt->l3_destinationAdd.addr_128b[0],&ipAddr_motedata,16);
! // the payload contains the 64bit address of the sender + the ASN
! packetfunctions_reserveHeaderSize(pkt, sizeof(asn_t));
! ieee154e_getAsn(pkt->payload);//gets asn from mac layer.
packetfunctions_reserveHeaderSize(pkt,8);
p=idmanager_getMyID(ADDR_64B);
! pkt->payload[0] = p->addr_64b[0];
! pkt->payload[1] = p->addr_64b[1];
! pkt->payload[2] = p->addr_64b[2];
! pkt->payload[3] = p->addr_64b[3];
! pkt->payload[4] = p->addr_64b[4];
! pkt->payload[5] = p->addr_64b[5];
! pkt->payload[6] = p->addr_64b[6];
! pkt->payload[7] = p->addr_64b[7];
neighbors_getPreferredParentEui64(&q);
! if (q.type==ADDR_64B) {
packetfunctions_reserveHeaderSize(pkt,8);
! // copy my preferred parent so we can build the topology
! pkt->payload[0] = q.addr_64b[0];
! pkt->payload[1] = q.addr_64b[1];
! pkt->payload[2] = q.addr_64b[2];
! pkt->payload[3] = q.addr_64b[3];
! pkt->payload[4] = q.addr_64b[4];
! pkt->payload[5] = q.addr_64b[5];
! pkt->payload[6] = q.addr_64b[6];
! pkt->payload[7] = q.addr_64b[7];
}
!
! // insert Sequence Number
! packetfunctions_reserveHeaderSize(pkt,sizeof(seqNum));
! pkt->payload[0] = (seqNum >> 8) & 0xff;
! pkt->payload[1] = seqNum & 0xff;
!
! // send packet
! if ((openudp_send(pkt)) == E_FAIL) {
openqueue_freePacketBuffer(pkt);
}
+
+ // increment seqNum
+ seqNum++;
+
+ // close timer when test finish
+ if (seqNum > NUMPKTTEST) {
+ opentimers_stop(udplatency_vars.timerId);
+ }
}
! void udplatency_timer(void) {
! scheduler_push_task(udplatency_task,TASKPRIO_COAP);
! /*thread_create(openwsn_udplatency_stack, KERNEL_CONF_STACKSIZE_MAIN,
! PRIORITY_OPENWSN_UDPLATENCY, CREATE_STACKTEST,
! udplatency_task, "udplatency task");*/
}
! void udplatency_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
msg->owner = COMPONENT_UDPLATENCY;
if (msg->creator!=COMPONENT_UDPLATENCY) {
openserial_printError(COMPONENT_UDPLATENCY,ERR_UNEXPECTED_SENDDONE,
***************
*** 114,117 ****
openqueue_freePacketBuffer(msg);
}
! //=========================== private =========================================
\ No newline at end of file
--- 140,143 ----
openqueue_freePacketBuffer(msg);
}
! //=========================== private =========================================

View File

@ -0,0 +1,61 @@
*** stock_iot-lab_M3/openwsn/07-App/udplatency/udplatency.h Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/udplatency/udplatency.h Thu Apr 24 16:53:30 2014
***************
*** 2,27 ****
#define __UDPLATENCY_H
/**
! \addtogroup App
!
! \addtogroup udpLatency
\{
*/
//=========================== define ==========================================
//=========================== typedef =========================================
//=========================== variables =======================================
//=========================== prototypes ======================================
! void udplatency_init();
! void udplatency_trigger();
! void udplatency_sendDone(OpenQueueEntry_t* msg, error_t error);
void udplatency_receive(OpenQueueEntry_t* msg);
! bool udplatency_debugPrint();
! void udplatency_task();
/**
\}
--- 2,31 ----
#define __UDPLATENCY_H
/**
! \addtogroup AppUdp
! \{
! \addtogroup UdpLatency
\{
*/
//=========================== define ==========================================
+ /// inter-packet period (in mseconds)
+ #define UDPLATENCYPERIOD 3000
+ #define NUMPKTTEST 300
+
//=========================== typedef =========================================
//=========================== variables =======================================
//=========================== prototypes ======================================
! void udplatency_init(void);
! void udplatency_trigger(void);
! void udplatency_sendDone(OpenQueueEntry_t* msg, owerror_t error);
void udplatency_receive(OpenQueueEntry_t* msg);
! bool udplatency_debugPrint(void);
! void udplatency_task(void);
/**
\}

View File

@ -0,0 +1,37 @@
*** stock_iot-lab_M3/openwsn/07-App/udpprint/Makefile Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/udpprint/Makefile Mon May 12 13:09:38 2014
***************
*** 0 ****
--- 1,32 ----
+ SUBSUBMOD:=$(shell basename $(CURDIR)).a
+ #BINDIR = $(RIOTBASE)/bin/
+ SRC = $(wildcard *.c)
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
+
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_ng/include -I$(RIOTBASE)/cpu/arm_common/include -I$(RIOTBASE)/sys/net/include/
+ INCLUDES += -I$(CURDIR)/02a-MAClow
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
+ INCLUDES += -I$(CURDIR)/03a-IPHC
+ INCLUDES += -I$(CURDIR)/03b-IPv6
+ INCLUDES += -I$(CURDIR)/04-TRAN
+ INCLUDES += -I$(CURDIR)/cross-layers
+
+ .PHONY: $(BINDIR)$(SUBSUBMOD)
+
+ $(BINDIR)$(SUBSUBMOD): $(OBJ)
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.d)
+
+ # compile and generate dependency info
+ $(BINDIR)%.o: %.c
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+
+ # remove compilation products
+
+ clean:
+ rm -f $(OBJ) $(DEP)

View File

@ -0,0 +1,41 @@
*** stock_iot-lab_M3/openwsn/07-App/udpprint/udpprint.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/udpprint/udpprint.c Thu Apr 24 16:55:54 2014
***************
*** 9,18 ****
//=========================== public ==========================================
! void udpprint_init() {
}
! void udpprint_sendDone(OpenQueueEntry_t* msg, error_t error) {
openserial_printError(COMPONENT_UDPPRINT,ERR_UNEXPECTED_SENDDONE,
(errorparameter_t)0,
(errorparameter_t)0);
--- 9,18 ----
//=========================== public ==========================================
! void udpprint_init(void) {
}
! void udpprint_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
openserial_printError(COMPONENT_UDPPRINT,ERR_UNEXPECTED_SENDDONE,
(errorparameter_t)0,
(errorparameter_t)0);
***************
*** 24,30 ****
openqueue_freePacketBuffer(msg);
}
! bool udpprint_debugPrint() {
return FALSE;
}
--- 24,30 ----
openqueue_freePacketBuffer(msg);
}
! bool udpprint_debugPrint(void) {
return FALSE;
}

Some files were not shown because too many files have changed in this diff Show More