# HG changeset patch # User Natale Patriciello # Date 1436363320 25200 # Node ID e5def623f9e8c04dc01333044e4efd22af2f7686 # Parent 97a672449c14790f308bda9730fbd6351c2d22ec Instead of directly manage the m_socketList member from TcpSocketBase, interact with it through public methods of TcpL4Protocol. diff -r 97a672449c14 -r e5def623f9e8 src/internet/model/tcp-l4-protocol.cc --- a/src/internet/model/tcp-l4-protocol.cc Wed Jul 08 06:46:54 2015 -0700 +++ b/src/internet/model/tcp-l4-protocol.cc Wed Jul 08 06:48:40 2015 -0700 @@ -611,6 +611,43 @@ } void +TcpL4Protocol::AddSocket(Ptr socket) +{ + std::vector >::iterator it = m_sockets.begin (); + + while (it != m_sockets.end()) + { + if (*it == socket) + { + return; + } + + ++it; + } + + m_sockets.push_back (socket); +} + +bool +TcpL4Protocol::RemoveSocket(Ptr socket) +{ + std::vector >::iterator it = m_sockets.begin (); + + while (it != m_sockets.end()) + { + if (*it == socket) + { + m_sockets.erase(it); + return true; + } + + ++it; + } + + return false; +} + +void TcpL4Protocol::SetDownTarget (IpL4Protocol::DownTargetCallback callback) { m_downTarget = callback; diff -r 97a672449c14 -r e5def623f9e8 src/internet/model/tcp-l4-protocol.h --- a/src/internet/model/tcp-l4-protocol.h Wed Jul 08 06:46:54 2015 -0700 +++ b/src/internet/model/tcp-l4-protocol.h Wed Jul 08 06:48:40 2015 -0700 @@ -182,6 +182,23 @@ Ipv6Address saddr, Ipv6Address daddr, Ptr oif = 0); /** + * \brief Make a socket capable to being demultiplexed + * + * Called after a socket has been bound, it is inserted in an internal vector. + * + * \param socket Socket to be added + */ + void AddSocket (Ptr socket); + + /** + * \brief Remove a socket from the internal list + * + * \param socket socket to Remove + * \return true if the socket has been removed + */ + bool RemoveSocket(Ptr socket); + + /** * \brief Remove an IPv4 Endpoint. * \param endPoint the end point to remove */