[sim-wg] TOSSIM and the 2.1 Release
Chad Metcalf
metcalfc at gmail.com
Thu Sep 20 10:55:12 PDT 2007
Resending to the group...
On 9/20/07, Philip Levis <pal at cs.stanford.edu> wrote:
> That is, whether the SF code is *in* TOSSIM, or is just Python code
> included in the Python driver script. Don't forget, there's a TOSSIM
> command that lets you inject packets to nodes. It currently only
> works for radio packets, but adding the serial one would be trivial.
> So you could just write Python code that processes SF packets and
> calls inject() on TOSSIM. Or is that what you're doing?
I've added the serial packet injection.
34 serialpkt = t.newSerialPacket();
35 serialpkt.setData(msg.data)
36 serialpkt.setType(msg.get_amType())
37 serialpkt.setDestination(0)
38 serialpkt.deliver(0, t.time() + 3)
The SerialForwarder is a stand alone object written in C++ as a
wrapper around C functions which link into the simulation itself. I
also used SWIG to generate a Python wrapper so that it can be used in
Python. But its only integrated into TOSSIM as much as regular packet
injection is. I looked at how you did packet injection and basically
mirrored it. And yes my C/C++ processes packets which then are
injected. Its in the TOSSIM module in Python because thats the way I
had to do it to overcome build issues.
Currently the way the extension is I have my own sim-sf.extra which
builds sf support into TOSSIM. If you don't want it you run sim.extra
and you don't get the overhead. My thought was to do something
similar.
> >> The one downside of pushing this into the scripting world is it makes
> >> transitioning between C++ and Python harder.
> >
> > So is the thought going forward then that TOSSIM won't be supporting
> > C++ based simulation drivers?
>
> No -- just that moving back and forth between Python and C++ might be
> a bit trickier.
This was the basis for my decision to write it in C/C++ with a Python
wrapper. That way everyone gets access to the functionality.
Cheers
Chad
--
Chad @ Home
More information about the Sim-wg
mailing list