[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/SP/tos/lib/SP SP.h, 1.2, 1.3 SPM.nc,
1.2, 1.3 SPNeighbor.nc, 1.2, 1.3 SPReceive.nc, 1.1,
1.2 SPSend.nc, 1.2, 1.3 SPSendQueue.nc, 1.2, 1.3
Arsalan Tavakoli
arsalant at users.sourceforge.net
Mon Jul 24 13:22:16 PDT 2006
Update of /cvsroot/tinyos/tinyos-1.x/contrib/SP/tos/lib/SP
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13784/tos/lib/SP
Modified Files:
SP.h SPM.nc SPNeighbor.nc SPReceive.nc SPSend.nc
SPSendQueue.nc
Log Message:
Index: SP.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/SP/tos/lib/SP/SP.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SP.h 10 Mar 2006 01:12:10 -0000 1.2
--- SP.h 24 Jul 2006 20:22:13 -0000 1.3
***************
*** 63,66 ****
--- 63,67 ----
#ifndef SP_MESSAGE
+ #define SP_MESSAGE 1
/* SP_MESSAGE_T
* SP Wrapper class for TOS_Msg
***************
*** 95,98 ****
--- 96,100 ----
#ifndef SP_NEIGHBOR
+ #define SP_NEIGHBOR 1
/* Structure of Neighbor Table Entries */
Index: SPM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/SP/tos/lib/SP/SPM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SPM.nc 13 Apr 2006 22:34:33 -0000 1.2
--- SPM.nc 24 Jul 2006 20:22:13 -0000 1.3
***************
*** 267,270 ****
--- 267,273 ----
event TOS_MsgPtr RadioReceive.receive(TOS_MsgPtr msg, void* payload, uint16_t payloadLen, uint8_t _sourceHandle, uint8_t _destHandle, uint8_t msgID, uint8_t groupID) {
if(groupID == TOS_AM_GROUP) {
+ if ((_sourceHandle != TOS_NO_HANDLE) && (_sourceHandle != TOS_OTHER_HANDLE)) {
+ call SPNeighbor.adjust(nghTableP[_sourceHandle], msg);
+ }
return signal SPReceive.receive[msgID](msg, payload, payloadLen, _sourceHandle, _destHandle);
}
***************
*** 274,277 ****
--- 277,283 ----
event TOS_MsgPtr UARTReceive.receive(TOS_MsgPtr msg, void* payload, uint16_t payloadLen, uint8_t _sourceHandle, uint8_t _destHandle, uint8_t msgID, uint8_t groupID) {
//if(groupID == TOS_AM_GROUP)
+ if ((_sourceHandle != TOS_NO_HANDLE) && (_sourceHandle != TOS_OTHER_HANDLE)) {
+ call SPNeighbor.adjust(nghTableP[_sourceHandle], msg);
+ }
return signal SPReceive.receive[msgID](msg, payload, payloadLen, _sourceHandle, _destHandle);
//return msg;
***************
*** 287,294 ****
* the link address of the new neighbor
*
! * @result - Returns true if neighbor inserted into table
! * or already existed
*/
! command result_t SPNeighbor.insert(sp_neighbor_t* neighbor, TOS_MsgPtr msg) {
// Call appropriate function for inserting neighbor
int counter;
--- 293,300 ----
* the link address of the new neighbor
*
! * @result - SP Handle of inserted neighbor. Returns
! * TOS_NO_HANDLE if operation failed.
*/
! command uint8_t SPNeighbor.insert(sp_neighbor_t* neighbor, TOS_MsgPtr msg) {
// Call appropriate function for inserting neighbor
int counter;
***************
*** 304,308 ****
if (neighbor == NULL) {
if (msg == NULL)
! return FAIL;
else
existing = call SPLinkAdaptor.findNode(NULL, msg);
--- 310,314 ----
if (neighbor == NULL) {
if (msg == NULL)
! return TOS_NO_HANDLE;
else
existing = call SPLinkAdaptor.findNode(NULL, msg);
***************
*** 328,340 ****
}
}
! return SUCCESS;
}
else {
addr_struct* _tmp = call SPLinkAdaptor.getAddress(msg);
if (_tmp == NULL)
! return FAIL;
neighbor->addrLL.addr_type = _tmp->addr_type;
if (neighbor->addrLL.addr_type == TOS_UART_HANDLE)
! return FAIL;
neighbor->addrLL.addr = _tmp->addr;
call SPNeighbor.adjust(neighbor, msg);
--- 334,346 ----
}
}
! return existing->sp_handle;
}
else {
addr_struct* _tmp = call SPLinkAdaptor.getAddress(msg);
if (_tmp == NULL)
! return TOS_NO_HANDLE;
neighbor->addrLL.addr_type = _tmp->addr_type;
if (neighbor->addrLL.addr_type == TOS_UART_HANDLE)
! return TOS_NO_HANDLE;
neighbor->addrLL.addr = _tmp->addr;
call SPNeighbor.adjust(neighbor, msg);
***************
*** 347,360 ****
nghTable[counter] = *neighbor;
}
! return SUCCESS;
}
! return FAIL;
}
}
! return FAIL;
}
}
/* SPNeighbor.remove
* Removes a neighbor from the table
--- 353,391 ----
nghTable[counter] = *neighbor;
}
! return counter;
}
! return TOS_NO_HANDLE;
}
}
! return TOS_NO_HANDLE;
}
}
+ /* SPNeighbor.getPointer
+ * Gets a pointer to a SP Neighbor table entry
+ *
+ * @param msg - A message from the node for which the requested entry will be used.
+ *
+ * @result - Returns NULL if no space is available AND if the node is already in the table. (Should this change)
+ *
+ * NOTE: Sets up potential race condition. One node requests pointer, and if before it inserts the neighbor,
+ * another node calls the function, it will get the same pointer.
+ *
+ */
+ command sp_neighbor_t* SPNeighbor.getPointer(TOS_MsgPtr msg) {
+ int counter;
+ sp_neighbor_t* existing = NULL;
+ existing = call SPLinkAdaptor.findNode(NULL, msg);
+ if (existing != NULL)
+ return NULL;
+ for (counter = 0; counter < SP_NEIGHBOR_BUF_SIZE; counter++) {
+ if (nghTableP[counter] == NULL)
+ return nghTableP[counter];
+ }
+ return NULL;
+ }
+
+
/* SPNeighbor.remove
* Removes a neighbor from the table
Index: SPNeighbor.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/SP/tos/lib/SP/SPNeighbor.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SPNeighbor.nc 10 Mar 2006 01:12:10 -0000 1.2
--- SPNeighbor.nc 24 Jul 2006 20:22:13 -0000 1.3
***************
*** 28,32 ****
* @author Joe Polastre <joe at polastre.com>
*/
! includes SP;
interface SPNeighbor {
/*
--- 28,32 ----
* @author Joe Polastre <joe at polastre.com>
*/
! #include "SP.h"
interface SPNeighbor {
/*
***************
*** 38,48 ****
* the link layer address portion of the entry
*
! * @result - SUCCESS if room in table or entry already
! * exists.
*
* NOTE: If neighbor already exists, its information is
* updated using the new entry
*/
! command result_t insert(sp_neighbor_t* neighbor, TOS_MsgPtr msg);
/*
--- 38,59 ----
* the link layer address portion of the entry
*
! * @result - Returns SP Handle of inserted node. It is
! * set as TOS_NO_HANDLE if insert fails.
*
* NOTE: If neighbor already exists, its information is
* updated using the new entry
*/
! command uint8_t insert(sp_neighbor_t* neighbor, TOS_MsgPtr msg);
!
! /*
! * Gets a pointer to a SP Neighbor table entry
! *
! * @param msg - A message from the node for which the requested
! * entry will be used.
! *
! * @result - Returns NULL if no space is available AND if the node
! * is already in the table. (Should this change)
! */
! command sp_neighbor_t* getPointer(TOS_MsgPtr msg);
/*
Index: SPReceive.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/SP/tos/lib/SP/SPReceive.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SPReceive.nc 9 Mar 2006 23:33:09 -0000 1.1
--- SPReceive.nc 24 Jul 2006 20:22:13 -0000 1.2
***************
*** 27,31 ****
* @author Sukun Kim <binetude at cs.berkeley.edu>
*/
! includes SP;
interface SPReceive {
/*
--- 27,31 ----
* @author Sukun Kim <binetude at cs.berkeley.edu>
*/
! #include "SP.h"
interface SPReceive {
/*
Index: SPSend.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/SP/tos/lib/SP/SPSend.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SPSend.nc 10 Mar 2006 01:12:10 -0000 1.2
--- SPSend.nc 24 Jul 2006 20:22:13 -0000 1.3
***************
*** 28,32 ****
* @author Joe Polastre <joe at polastre.com>
*/
! includes SP;
interface SPSend {
/*
--- 28,32 ----
* @author Joe Polastre <joe at polastre.com>
*/
! #include "SP.h"
interface SPSend {
/*
Index: SPSendQueue.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/SP/tos/lib/SP/SPSendQueue.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SPSendQueue.nc 10 Mar 2006 01:12:10 -0000 1.2
--- SPSendQueue.nc 24 Jul 2006 20:22:13 -0000 1.3
***************
*** 28,32 ****
* @author Joe Polastre <joe at polastre.com>
*/
! includes SP;
interface SPSendQueue {
/* Asks for the next packet for a certain message
--- 28,32 ----
* @author Joe Polastre <joe at polastre.com>
*/
! #include "SP.h"
interface SPSendQueue {
/* Asks for the next packet for a certain message
More information about the Tinyos-contrib-commits
mailing list