face+transport: Eliminating concept of ConnectionInfo
The current "transport" is not really a transport, rather than a
connection, which completely handles all connection-specific tasks.
I don't see any reason for not to keep connection information as
inherent property of the "transport".
Change-Id: Ib06697522d1b8f5b22d82fa86994056a9b0b7dec
diff --git a/src/transport/tcp-transport.cpp b/src/transport/tcp-transport.cpp
index 6c5dc85..cb1c6e3 100644
--- a/src/transport/tcp-transport.cpp
+++ b/src/transport/tcp-transport.cpp
@@ -17,24 +17,19 @@
namespace ndn {
-TcpTransport::ConnectionInfo::~ConnectionInfo()
-{
-}
-
-TcpTransport::TcpTransport()
- : isConnected_(false), transport_(new struct ndn_TcpTransport), elementReader_(new struct ndn_BinaryXmlElementReader)
+TcpTransport::TcpTransport(const char *host, unsigned short port/* = 6363*/)
+ : host_(host), port_(port)
+ , isConnected_(false), transport_(new struct ndn_TcpTransport), elementReader_(new struct ndn_BinaryXmlElementReader)
{
ndn_TcpTransport_initialize(transport_.get());
elementReader_->partialData.array = 0;
}
void
-TcpTransport::connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener)
+TcpTransport::connect(ElementListener& elementListener)
{
- const TcpTransport::ConnectionInfo& tcpConnectionInfo = dynamic_cast<const TcpTransport::ConnectionInfo&>(connectionInfo);
-
ndn_Error error;
- if ((error = ndn_TcpTransport_connect(transport_.get(), (char *)tcpConnectionInfo.getHost().c_str(), tcpConnectionInfo.getPort())))
+ if ((error = ndn_TcpTransport_connect(transport_.get(), (char *)host_.c_str(), port_)))
throw runtime_error(ndn_getErrorString(error));
// TODO: This belongs in the socket listener.