[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C on ns
Arioli,
> The problem I need to solve is whether it is
> possible to include a code written in C for an agenet on a node of ns
> simulator.
You will have to create a new subclass of class "Agent" that contains the code
of your protocol. You also have to derive from TclClass and register the
protocol name as well as a routine that makes if possible for the simulator to
instantiate your protocol whenever the user installs an agent of your customs
protocol on some node.
You will need C++ to do all this. You probably can use your C-code, though,
and just adapt it a little. Essentially, you must convert all your functions
to class member functions and all your global variables and typedefs to class
variables.
> Where can I find some information on this procedure
Have a look at some existing agent implementation; a simple example would be
udp.h and udp.cc.
Good luck
-Chris.
- References:
- C on ns
- From: Arioli Carlo <arioli@cefriel.it>