From: scipio Date: Sat, 14 Apr 2007 00:40:57 +0000 (+0000) Subject: Copyrights and fixes X-Git-Tag: tinyos/2.0.1~48 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=5ddc35b4c40e4692bb5b153836dadd3b3fe2ae1e Copyrights and fixes --- diff --git a/tos/lib/net/ctp/CollectionSenderC.nc b/tos/lib/net/ctp/CollectionSenderC.nc index 721f44e5..bdb118aa 100644 --- a/tos/lib/net/ctp/CollectionSenderC.nc +++ b/tos/lib/net/ctp/CollectionSenderC.nc @@ -1,3 +1,34 @@ +/* + * Copyright (c) 2007 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + /** * The virtualized collection sender abstraction. * diff --git a/tos/lib/net/ctp/CollectionSenderP.nc b/tos/lib/net/ctp/CollectionSenderP.nc index 9ca2279a..9c854c7f 100644 --- a/tos/lib/net/ctp/CollectionSenderP.nc +++ b/tos/lib/net/ctp/CollectionSenderP.nc @@ -1,3 +1,34 @@ +/* + * Copyright (c) 2007 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #include "Collection.h" generic configuration diff --git a/tos/lib/net/lqi/LqiForwardingEngineP.nc b/tos/lib/net/lqi/LqiForwardingEngineP.nc index c1481d9e..9c448bc0 100644 --- a/tos/lib/net/lqi/LqiForwardingEngineP.nc +++ b/tos/lib/net/lqi/LqiForwardingEngineP.nc @@ -248,6 +248,10 @@ implementation { if (call SubSend.send(call AMPacket.destination(msg), msg, call SubPacket.payloadLength(msg)) == SUCCESS) { + call CollectionDebug.logEventMsg(NET_C_DBG_1, + call CollectionPacket.getSequenceNumber(msg), + call CollectionPacket.getOrigin(msg), + call AMPacket.destination(msg)); dbg("LQI", "%s: Send to %hu success.\n", __FUNCTION__, call AMPacket.destination(msg)); } fwdbusy = TRUE; @@ -260,7 +264,7 @@ implementation { len -= sizeof(lqi_header_t); call CollectionDebug.logEventMsg(NET_C_FE_RCV_MSG, - call CollectionPacket.getTestNetworkSeq(msg), + call CollectionPacket.getSequenceNumber(msg), call CollectionPacket.getOrigin(msg), call AMPacket.destination(msg)); @@ -279,7 +283,7 @@ implementation { message_t* nextMsg() { int i; - int inc = call Random.rand16(); + uint16_t inc = call Random.rand16() & 0xfff; for (i = 0; i < FWD_QUEUE_SIZE; i++) { int pindex = (i + inc) % FWD_QUEUE_SIZE; if (FwdBufBusy[pindex]) { @@ -302,14 +306,14 @@ implementation { call SubPacket.payloadLength(msg)) == SUCCESS) { dbg("LQI", "Packet not acked, retransmit @%s:\n\t%s\n", sim_time_string(), fields(msg)); call CollectionDebug.logEventMsg(NET_C_FE_SENDDONE_WAITACK, - call CollectionPacket.getTestNetworkSeq(msg), + call CollectionPacket.getSequenceNumber(msg), call CollectionPacket.getOrigin(msg), call AMPacket.destination(msg)); fail_count ++; return; } else { call CollectionDebug.logEventMsg(NET_C_FE_SENDDONE_FAIL, - call CollectionPacket.getTestNetworkSeq(msg), + call CollectionPacket.getSequenceNumber(msg), call CollectionPacket.getOrigin(msg), call AMPacket.destination(msg)); dbg("LQI", "Packet not acked, retransmit fail @%s:\n\t%s\n", sim_time_string(), fields(msg)); @@ -319,7 +323,7 @@ implementation { } else if (fail_count >= 5) { call CollectionDebug.logEventMsg(NET_C_FE_SENDDONE_FAIL_ACK_FWD, - call CollectionPacket.getTestNetworkSeq(msg), + call CollectionPacket.getSequenceNumber(msg), call CollectionPacket.getOrigin(msg), call AMPacket.destination(msg)); dbg("LQI", "Packet failed:\t%s\n", fields(msg)); @@ -327,7 +331,7 @@ implementation { else if (call PacketAcknowledgements.wasAcked(msg)) { dbg("LQI", "Packet acked:\t%s\n", fields(msg)); call CollectionDebug.logEventMsg(NET_C_FE_FWD_MSG, - call CollectionPacket.getTestNetworkSeq(msg), + call CollectionPacket.getSequenceNumber(msg), call CollectionPacket.getOrigin(msg), call AMPacket.destination(msg)); } @@ -359,14 +363,14 @@ implementation { call SubPacket.payloadLength(msg)) == SUCCESS) { dbg("LQI", "Packet not acked, retransmit (%hhu) @%s:\n\t%s\n", fail_count, sim_time_string(), fields(msg)); call CollectionDebug.logEventMsg(NET_C_FE_SENDDONE_WAITACK, - call CollectionPacket.getTestNetworkSeq(msg), + call CollectionPacket.getSequenceNumber(msg), call CollectionPacket.getOrigin(msg), call AMPacket.destination(msg)); fail_count ++; return; } else { call CollectionDebug.logEventMsg(NET_C_FE_SENDDONE_FAIL, - call CollectionPacket.getTestNetworkSeq(msg), + call CollectionPacket.getSequenceNumber(msg), call CollectionPacket.getOrigin(msg), call AMPacket.destination(msg)); dbg("LQI", "Packet not acked, retransmit fail @%s:\n\t%s\n", sim_time_string(), fields(msg)); @@ -376,7 +380,7 @@ implementation { } else if (fail_count >= 5) { call CollectionDebug.logEventMsg(NET_C_FE_SENDDONE_FAIL_ACK_SEND, - call CollectionPacket.getTestNetworkSeq(msg), + call CollectionPacket.getSequenceNumber(msg), call CollectionPacket.getOrigin(msg), call AMPacket.destination(msg)); dbg("LQI", "Packet failed:\t%s\n", fields(msg)); @@ -384,7 +388,7 @@ implementation { else if (call PacketAcknowledgements.wasAcked(msg)) { dbg("LQI", "Packet acked:\t%s\n", fields(msg)); call CollectionDebug.logEventMsg(NET_C_FE_SENT_MSG, - call CollectionPacket.getTestNetworkSeq(msg), + call CollectionPacket.getSequenceNumber(msg), call CollectionPacket.getOrigin(msg), call AMPacket.destination(msg)); } @@ -504,11 +508,6 @@ implementation { hdr->originseqno = seqno; } - command uint16_t CollectionPacket.getTestNetworkSeq(message_t* msg) { - TestNetworkMsg *tn; - tn = (TestNetworkMsg *)call Packet.getPayload(msg, NULL); - return tn->seqno; - } default event void Send.sendDone(message_t* pMsg, error_t success) {} diff --git a/tos/lib/net/lqi/LqiRoutingEngineP.nc b/tos/lib/net/lqi/LqiRoutingEngineP.nc index 4d990957..fdea7b4a 100644 --- a/tos/lib/net/lqi/LqiRoutingEngineP.nc +++ b/tos/lib/net/lqi/LqiRoutingEngineP.nc @@ -89,7 +89,8 @@ implementation { uint8_t gLastHeard; int16_t gCurrentSeqNo; - + int16_t gOriginSeqNo; + uint16_t gUpdateInterval; uint8_t gRecentIndex; @@ -137,7 +138,6 @@ implementation { bMsg->cost = 0; bMsg->originaddr = TOS_NODE_ID; bMsg->hopcount = 0; - bMsg->originseqno = gCurrentSeqNo; bMsg->seqno = gCurrentSeqNo++; } else { @@ -145,7 +145,6 @@ implementation { bMsg->cost = gbCurrentParentCost + gbCurrentLinkEst; bMsg->originaddr = TOS_NODE_ID; bMsg->hopcount = gbCurrentHopCount; - bMsg->originseqno = gCurrentSeqNo; bMsg->seqno = gCurrentSeqNo++; } @@ -189,6 +188,7 @@ implementation { gbCurrentHopCount = ROUTE_INVALID; gbCurrentCost = 0xfffe; + gOriginSeqNo = 0; gCurrentSeqNo = 0; gUpdateInterval = BEACON_PERIOD; msgBufBusy = FALSE; @@ -280,7 +280,7 @@ implementation { lqi_header_t* header = (lqi_header_t*)call Packet.getPayload(msg, NULL); header->originaddr = TOS_NODE_ID; - header->originseqno = gCurrentSeqNo; + header->originseqno = gOriginSeqNo++; header->seqno = gCurrentSeqNo; if (isRoot) {