int fwdbusy = 0;
lqi_header_t* getHeader(message_t* msg) {
- return (lqi_header_t*) call SubPacket.getPayload(msg, NULL);
+ return (lqi_header_t*) call SubPacket.getPayload(msg, sizeof(lqi_header_t));
}
/***********************************************************************
call CollectionPacket.getSequenceNumber(msg),
call CollectionPacket.getOrigin(msg),
call AMPacket.destination(msg));
-
if (call RootControl.isRoot()) {
dbg("LQI,LQIDeliver", "LQI Root is receiving packet from node %hu @%s\n", getHeader(msg)->originaddr, sim_time_string());
return signal Receive.receive[id](msg, payload, len);
}
+ else if (call AMPacket.destination(msg) != call AMPacket.address()) {
+ return msg;
+ }
else if (signal Intercept.forward[id](msg, payload, len)) {
dbg("LQI,LQIDeliver", "LQI fwd is forwarding packet from node %hu @%s\n", getHeader(msg)->originaddr, sim_time_string());
return mForward(msg);
}
- command void* Send.getPayload(message_t* m) {
- return call Packet.getPayload(m, NULL);
+ command void* Send.getPayload(message_t* m, uint8_t len) {
+ return call Packet.getPayload(m, len);
}
command uint8_t Send.maxPayloadLength() {
}
- command void* Receive.getPayload[collection_id_t id](message_t* msg, uint8_t* len) {
- return call Packet.getPayload(msg, len);
- }
-
- command uint8_t Receive.payloadLength[collection_id_t id](message_t* m) {
- return call Packet.payloadLength(m);
- }
-
- command void* Snoop.getPayload[collection_id_t id](message_t* msg, uint8_t* len) {
- return call Packet.getPayload(msg, len);
- }
-
- command uint8_t Snoop.payloadLength[collection_id_t id](message_t* m) {
- return call Packet.payloadLength(m);
- }
-
command uint8_t Packet.payloadLength(message_t* msg) {
return call SubPacket.payloadLength(msg) - sizeof(lqi_header_t);
}
command uint8_t Packet.maxPayloadLength() {
return (call SubPacket.maxPayloadLength() - sizeof(lqi_header_t));
}
- command void* Packet.getPayload(message_t* msg, uint8_t* len) {
- void* rval = call SubPacket.getPayload(msg, len);
- if (len != NULL) {
- *len -= sizeof(lqi_header_t);
+ command void* Packet.getPayload(message_t* msg, uint8_t len) {
+ void* rval = call SubPacket.getPayload(msg, len + sizeof(lqi_header_t));
+ if (rval != NULL) {
+ rval += sizeof(lqi_header_t);
}
- rval += sizeof(lqi_header_t);
return rval;
}
default event bool Intercept.forward[collection_id_t id](message_t* pMsg, void* payload, uint16_t len) {
return 1;
}
+
+ /* Default implementations for CollectionDebug calls.
+ * These allow CollectionDebug not to be wired to anything if debugging
+ * is not desired. */
+
+ default command error_t CollectionDebug.logEvent(uint8_t type) {
+ return SUCCESS;
+ }
+ default command error_t CollectionDebug.logEventSimple(uint8_t type, uint16_t arg) {
+ return SUCCESS;
+ }
+ default command error_t CollectionDebug.logEventDbg(uint8_t type, uint16_t arg1, uint16_t arg2, uint16_t arg3) {
+ return SUCCESS;
+ }
+ default command error_t CollectionDebug.logEventMsg(uint8_t type, uint16_t msg, am_addr_t origin, am_addr_t node) {
+ return SUCCESS;
+ }
+ default command error_t CollectionDebug.logEventRoute(uint8_t type, am_addr_t parent, uint8_t hopcount, uint16_t metric) {
+ return SUCCESS;
+ }
}