[Ns-developers] NS-3: state of ns-3-pybindgen

Gustavo Carneiro gjcarneiro at gmail.com
Tue Jan 1 13:23:21 PST 2008


As some may have noticed, I have spent some of my time lately working on the
ns-3-pybindgen branch.  The goal of this branch is to prototype python
bindings for NS-3 using a custom python bindings generation tool, PyBindGen,
which I have been slowly developing from scratch since about half a year
ago.

The results so far have been very promising.  After the feedback received
last time, basically reflecting some concerns about the complexity and
verbosity of the approach that used a Python API to declare the NS-3
interface, I have been experimenting with (py)gccxml[1], making it parse the
NS-3 public header files directly, and extract the needed information from
there.  The result is that ns-3-pybindgen now uses a small generator script
with  less than 200 lines of code, and generates a ~ 55000 lines C++ file
wrapping most of NS-3.  And most importantly, the generated C++ source file
is fully debug-able, unlike some other popular python wrapping solutions
out there... ;-)

Still some important things are missing, namely:

   1- Parameters default values (but should not be very difficult to
implement this);
   2- Templated classes in general;  -> needed for protocol implementation (
e.g. Header classes)
   3- Callback<...> in particular;  -> needed for working with sockets and
tracing (simple scripting needs this)
   4- Simulator::Schedule* methods; -> needed for scripting

I'd be glad to hear some feedback on the general direction I'm heading.

As a side note, is there any reason why Simulator::Schedule is not using
Callback's as parameters?  Because it would be easier to wrap only
Callback<> and not Simulator::Schedule  as well...

[1]  It should be noted that gccxml from CVS is now based on  GCC 4.2, and
so parses all C++ code as well as GCC 4.2 itself, including the templated
QueryInterface<T>() method.

-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list