[Tinyos-2-commits]
CVS: tinyos-2.x/tos/lib/net/le LinkEstimatorP.nc, 1.6, 1.7
Phil Levis
scipio at users.sourceforge.net
Thu Sep 13 16:10:51 PDT 2007
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/le
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27056/tos/lib/net/le
Modified Files:
LinkEstimatorP.nc
Log Message:
The big interface switchover for Packet, Send, Receive, and AMSend.
Index: LinkEstimatorP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** LinkEstimatorP.nc 9 Apr 2007 15:34:34 -0000 1.6
--- LinkEstimatorP.nc 13 Sep 2007 23:10:18 -0000 1.7
***************
*** 92,101 ****
// get the link estimation header in the packet
linkest_header_t* getHeader(message_t* m) {
! return (linkest_header_t*)call SubPacket.getPayload(m, NULL);
}
// get the link estimation footer (neighbor entries) in the packet
linkest_footer_t* getFooter(message_t* m, uint8_t len) {
! return (linkest_footer_t*)(len + (uint8_t *)call Packet.getPayload(m,NULL));
}
--- 92,102 ----
// get the link estimation header in the packet
linkest_header_t* getHeader(message_t* m) {
! return (linkest_header_t*)call SubPacket.getPayload(m, sizeof(linkest_header_t));
}
// get the link estimation footer (neighbor entries) in the packet
linkest_footer_t* getFooter(message_t* m, uint8_t len) {
! // To get a footer at offset "len", the payload must be len + sizeof large.
! return (linkest_footer_t*)(len + (uint8_t *)call Packet.getPayload(m,len + sizeof(linkest_footer_t)));
}
***************
*** 586,591 ****
}
! command void* Send.getPayload(message_t* msg) {
! return call Packet.getPayload(msg, NULL);
}
--- 587,592 ----
}
! command void* Send.getPayload(message_t* msg, uint8_t len) {
! return call Packet.getPayload(msg, len);
}
***************
*** 650,657 ****
if ((nidx != INVALID_RVAL) && (num_entries > 0)) {
dbg("LI", "Number of footer entries: %d\n", num_entries);
! footer = (linkest_footer_t*) ((uint8_t *)call SubPacket.getPayload(msg, NULL)
! + call SubPacket.payloadLength(msg)
! - num_entries*sizeof(linkest_footer_t));
{
uint8_t i, my_ll_addr;
--- 651,660 ----
if ((nidx != INVALID_RVAL) && (num_entries > 0)) {
+ uint8_t payloadLen = call SubPacket.payloadLength(msg);
+ void* subPayload = call SubPacket.getPayload(msg, payloadLen);
+ void* payloadEnd = subPayload + payloadLen;
dbg("LI", "Number of footer entries: %d\n", num_entries);
!
! footer = (linkest_footer_t*) (payloadEnd - (num_entries*sizeof(linkest_footer_t)));
{
uint8_t i, my_ll_addr;
***************
*** 682,697 ****
processReceivedMessage(msg, payload, len);
return signal Receive.receive(msg,
! call Packet.getPayload(msg, NULL),
call Packet.payloadLength(msg));
}
- command void* Receive.getPayload(message_t* msg, uint8_t* len) {
- return call Packet.getPayload(msg, len);
- }
-
- command uint8_t Receive.payloadLength(message_t* msg) {
- return call Packet.payloadLength(msg);
- }
-
command void Packet.clear(message_t* msg) {
call SubPacket.clear(msg);
--- 685,692 ----
processReceivedMessage(msg, payload, len);
return signal Receive.receive(msg,
! call Packet.getPayload(msg, call Packet.payloadLength(msg)),
call Packet.payloadLength(msg));
}
command void Packet.clear(message_t* msg) {
call SubPacket.clear(msg);
***************
*** 724,735 ****
// application payload pointer is just past the link estimation header
! command void* Packet.getPayload(message_t* msg, uint8_t* len) {
! uint8_t* payload = call SubPacket.getPayload(msg, len);
! linkest_header_t *hdr;
! hdr = getHeader(msg);
! if (len != NULL) {
! *len = *len - sizeof(linkest_header_t) - sizeof(linkest_footer_t)*(NUM_ENTRIES_FLAG & hdr->flags);
}
! return payload + sizeof(linkest_header_t);
}
}
--- 719,730 ----
// application payload pointer is just past the link estimation header
! command void* Packet.getPayload(message_t* msg, uint8_t len) {
! linkest_header_t *hdr = getHeader(msg);
! uint8_t footerLen = (hdr->flags & NUM_ENTRIES_FLAG) * sizeof(linkest_header_t);
! void* payload = call SubPacket.getPayload(msg, len + footerLen);
! if (payload != NULL) {
! payload += sizeof(linkest_header_t);
}
! return payload;
}
}
More information about the Tinyos-2-commits
mailing list