]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/tossim/sim_packet.c
Patch that includes source address fields for packet.
[tinyos-2.x.git] / tos / lib / tossim / sim_packet.c
index e2d97979218ef7348ab9ebf86ca1cdb4cc9c7bfd..d6105e538c5bb7befe361fb4a4d166b0dce9c798 100644 (file)
@@ -43,10 +43,20 @@ static tossim_header_t* getHeader(message_t* msg) {
   return (tossim_header_t*)(msg->data - sizeof(tossim_header_t));
 }
 
+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;
-}__attribute__ ((C, spontaneous))
+}
 
 uint16_t sim_packet_destination(sim_packet_t* msg)__attribute__ ((C, spontaneous)) {
   tossim_header_t* hdr = getHeader((message_t*)msg);