plugins/ip-faces: Implementing UdpFace and fixing bugs with TcpFace
Now UdpFace is fully working. Due to nature of UDP transmission, all
demultiplexing is happening inside IpFaceStack (with TCP, NS-3 is taking
care of that).
Bugfix: Map between IP addresses and Tcp/Udp faces was incorrectly
embedded as a static variable inside Udp/TcpFace implementation, causing
unexpected behavior.
Refs #1006 (http://redmine.named-data.net/)
diff --git a/plugins/ip-faces/ndn-tcp-face.h b/plugins/ip-faces/ndn-tcp-face.h
index 8b4a90c..56cb0e9 100644
--- a/plugins/ip-faces/ndn-tcp-face.h
+++ b/plugins/ip-faces/ndn-tcp-face.h
@@ -42,15 +42,6 @@
public:
static TypeId
GetTypeId ();
-
- /**
- * @brief A singleton method allowing creation and lookup of faces
- *
- * All created TCP faces are stored internally in the map, and if the same face is created, it will simply be looked up
- */
- static Ptr<TcpFace>
- CreateOrGetFace (Ptr<Node> node, Ipv4Address address,
- Callback< void, Ptr<Face> > onCreate = NULL_CREATE_CALLBACK);
/**
* \brief Constructor
@@ -60,14 +51,6 @@
TcpFace (Ptr<Node> node, Ptr<Socket> socket, Ipv4Address address);
virtual ~TcpFace();
- ////////////////////////////////////////////////////////////////////
- // methods overloaded from ndn::Face
- virtual void
- RegisterProtocolHandlers (const InterestHandler &interestHandler, const DataHandler &dataHandler);
-
- virtual void
- UnRegisterProtocolHandlers ();
-
void
OnTcpConnectionClosed (Ptr<Socket> socket);
@@ -80,25 +63,25 @@
void
SetCreateCallback (Callback< void, Ptr<Face> > callback);
-public:
- const static Callback< void, Ptr<Face> > NULL_CREATE_CALLBACK;
-private:
void
OnConnect (Ptr<Socket> socket);
+
+ ////////////////////////////////////////////////////////////////////
+ // methods overloaded from ndn::Face
+ virtual void
+ RegisterProtocolHandlers (const InterestHandler &interestHandler, const DataHandler &dataHandler);
+
+ virtual void
+ UnRegisterProtocolHandlers ();
+
+ virtual std::ostream&
+ Print (std::ostream &os) const;
protected:
// also from ndn::Face
virtual bool
Send (Ptr<Packet> p);
-public:
- /**
- * @brief Print out name of the NdnFace to the stream
- */
- virtual std::ostream&
- Print (std::ostream &os) const;
- ////////////////////////////////////////////////////////////////////
-
private:
TcpFace (const TcpFace &); ///< \brief Disabled copy constructor
TcpFace& operator= (const TcpFace &); ///< \brief Disabled copy operator
@@ -111,9 +94,6 @@
Ipv4Address m_address;
uint32_t m_pendingPacketLength;
Callback< void, Ptr<Face> > m_onCreateCallback;
-
- typedef std::map<Ipv4Address, Ptr<TcpFace> > FaceMap;
- static FaceMap s_map;
};
} // namespace ndn