[Ns-developers] How to get a list of all tcp-sockets from TcpL4Protocol class?
Florian Westphal
fw at strlen.de
Mon May 12 15:55:30 PDT 2008
Hi all,
I am currently working on integrating network simulation
cradle and ns-3.
At the moment, the ns3 network simulation cradle port doesn't
really work beyond the inital TCP handshake.
In order to send and receive data over a NSC Tcp connection,
i first need to detect
a) when a call to nsc->connect() has finished
b) when a connection is pending on a listening nsc socket
In the current ns-3-nsc code,
src/internet-node/tcp-l4-protocol.cc contains a method
( void TcpL4Protocol::wakeup() )
that is called by NSC when something of interest has happened,
but at this point its only a stub function that doesn't really
do anything.
So, what i'd like to do inside wakeup() is to walk though a list
of all the tcp-sockets owned by the TcpL4Protocol instance
and check if they have changed state, or, if this isn't
possible due to nsc requirements, schedule another function
to do so at the next opportunity.
I looked at TcpL4Protocol::Receive() which will
use Ipv4EndPointDemux::Lookup() to find the tcp-socket that matches
the packets' source/destination.
Unfortunately, i cannot use Lookup(), because i don't have any address
or interface information.
I don't see a public interface that would allow me to
iterate through the socket list either.
Now, i could just go ahead and add a
a 'get all sockets' method to the Ipv4EndPointDemux class.
But i wonder if there is a better alternative?
Thanks, Florian
More information about the Ns-developers
mailing list