[Ns-developers] How to get a list of all tcp-sockets from TcpL4Protocol class?
Mathieu Lacage
mathieu.lacage at sophia.inria.fr
Tue May 13 08:37:37 PDT 2008
On Tue, 2008-05-13 at 00:55 +0200, Florian Westphal wrote:
> 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
You can receive the TCP SYNACK as a response to the initial SYN but you
cannot receive the data packets ?
> 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.
Scheduling a function at the next opportunity is done with
Simulator::ScheduleNow.
>
> 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?
That sounds about right.
regards,
Mathieu
More information about the Ns-developers
mailing list