[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/tossim TOSSIM.py, 1.4,
1.5 packet.c, 1.2, 1.3 packet.h, 1.2, 1.3 packet.i, 1.2,
1.3 sim_packet.c, 1.4, 1.5 sim_packet.h, 1.4,
1.5 tossim_wrap.cxx, 1.4, 1.5
Phil Levis
scipio at users.sourceforge.net
Wed Jul 4 09:15:15 PDT 2007
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/tossim
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv7325
Modified Files:
TOSSIM.py packet.c packet.h packet.i sim_packet.c sim_packet.h
tossim_wrap.cxx
Log Message:
Patch that includes source address fields for packet.
Index: TOSSIM.py
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/tossim/TOSSIM.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TOSSIM.py 1 Apr 2007 00:29:34 -0000 1.4
--- TOSSIM.py 4 Jul 2007 16:15:11 -0000 1.5
***************
*** 114,117 ****
--- 114,119 ----
if self.thisown: destroy(self)
except: pass
+ def setSource(*args): return apply(_TOSSIM.Packet_setSource,args)
+ def source(*args): return apply(_TOSSIM.Packet_source,args)
def setDestination(*args): return apply(_TOSSIM.Packet_setDestination,args)
def destination(*args): return apply(_TOSSIM.Packet_destination,args)
Index: packet.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/tossim/packet.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** packet.c 12 Jul 2006 17:02:35 -0000 1.2
--- packet.c 4 Jul 2007 16:15:11 -0000 1.3
***************
*** 55,58 ****
--- 55,65 ----
}
+ void Packet::setSource(int src) {
+ sim_packet_set_source(msgPtr, (uint16_t)src);
+ }
+ int Packet::source() {
+ return sim_packet_source(msgPtr);
+ }
+
void Packet::setDestination(int dest) {
sim_packet_set_destination(msgPtr, (uint16_t)dest);
Index: packet.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/tossim/packet.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** packet.h 12 Jul 2006 17:02:35 -0000 1.2
--- packet.h 4 Jul 2007 16:15:11 -0000 1.3
***************
*** 41,44 ****
--- 41,47 ----
~Packet();
+ void setSource(int src);
+ int source();
+
void setDestination(int dest);
int destination();
Index: packet.i
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/tossim/packet.i,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** packet.i 12 Jul 2006 17:02:35 -0000 1.2
--- packet.i 4 Jul 2007 16:15:11 -0000 1.3
***************
*** 46,49 ****
--- 46,52 ----
Packet();
~Packet();
+
+ void setSource(int src);
+ int source();
void setDestination(int dest);
Index: sim_packet.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/tossim/sim_packet.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** sim_packet.c 12 Dec 2006 18:23:35 -0000 1.4
--- sim_packet.c 4 Jul 2007 16:15:11 -0000 1.5
***************
*** 44,51 ****
}
void sim_packet_set_destination(sim_packet_t* msg, uint16_t dest)__attribute__ ((C, spontaneous)) {
tossim_header_t* hdr = getHeader((message_t*)msg);
hdr->dest = dest;
! }__attribute__ ((C, spontaneous))
uint16_t sim_packet_destination(sim_packet_t* msg)__attribute__ ((C, spontaneous)) {
--- 44,61 ----
}
+ void sim_packet_set_source(sim_packet_t* msg, uint16_t src)__attribute__ ((C, spontaneous)) {
+ tossim_header_t* hdr = getHeader((message_t*)msg);
+ hdr->src = src;
+ }
+
+ uint16_t sim_packet_source(sim_packet_t* msg)__attribute__ ((C, spontaneous)) {
+ tossim_header_t* hdr = getHeader((message_t*)msg);
+ return hdr->src;
+ }
+
void sim_packet_set_destination(sim_packet_t* msg, uint16_t dest)__attribute__ ((C, spontaneous)) {
tossim_header_t* hdr = getHeader((message_t*)msg);
hdr->dest = dest;
! }
uint16_t sim_packet_destination(sim_packet_t* msg)__attribute__ ((C, spontaneous)) {
Index: sim_packet.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/tossim/sim_packet.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** sim_packet.h 12 Dec 2006 18:23:35 -0000 1.4
--- sim_packet.h 4 Jul 2007 16:15:11 -0000 1.5
***************
*** 51,54 ****
--- 51,57 ----
typedef struct sim_packet {} sim_packet_t;
+ void sim_packet_set_source(sim_packet_t* msg, uint16_t src);
+ uint16_t sim_packet_source(sim_packet_t* msg);
+
void sim_packet_set_destination(sim_packet_t* msg, uint16_t dest);
uint16_t sim_packet_destination(sim_packet_t* msg);
Index: tossim_wrap.cxx
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/tossim/tossim_wrap.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** tossim_wrap.cxx 1 Apr 2007 00:29:34 -0000 1.4
--- tossim_wrap.cxx 4 Jul 2007 16:15:11 -0000 1.5
***************
*** 1505,1508 ****
--- 1505,1542 ----
+ static PyObject *_wrap_Packet_setSource(PyObject *self, PyObject *args) {
+ PyObject *resultobj;
+ Packet *arg1 = (Packet *) 0 ;
+ int arg2 ;
+ PyObject * obj0 = 0 ;
+
+ if(!PyArg_ParseTuple(args,(char *)"Oi:Packet_setSource",&obj0,&arg2)) goto fail;
+ if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_Packet,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ (arg1)->setSource(arg2);
+
+ Py_INCREF(Py_None); resultobj = Py_None;
+ return resultobj;
+ fail:
+ return NULL;
+ }
+
+
+ static PyObject *_wrap_Packet_source(PyObject *self, PyObject *args) {
+ PyObject *resultobj;
+ Packet *arg1 = (Packet *) 0 ;
+ int result;
+ PyObject * obj0 = 0 ;
+
+ if(!PyArg_ParseTuple(args,(char *)"O:Packet_source",&obj0)) goto fail;
+ if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_Packet,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ result = (int)(arg1)->source();
+
+ resultobj = PyInt_FromLong((long)result);
+ return resultobj;
+ fail:
+ return NULL;
+ }
+
+
static PyObject *_wrap_Packet_setDestination(PyObject *self, PyObject *args) {
PyObject *resultobj;
***************
*** 3323,3326 ****
--- 3357,3362 ----
{ (char *)"new_Packet", _wrap_new_Packet, METH_VARARGS },
{ (char *)"delete_Packet", _wrap_delete_Packet, METH_VARARGS },
+ { (char *)"Packet_setSource", _wrap_Packet_setSource, METH_VARARGS },
+ { (char *)"Packet_source", _wrap_Packet_source, METH_VARARGS },
{ (char *)"Packet_setDestination", _wrap_Packet_setDestination, METH_VARARGS },
{ (char *)"Packet_destination", _wrap_Packet_destination, METH_VARARGS },
More information about the Tinyos-2-commits
mailing list