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/node.cpp b/src/node.cpp
index 99db103..a5f3d95 100644
--- a/src/node.cpp
+++ b/src/node.cpp
@@ -110,8 +110,8 @@
   signature->setSignature(Blob(signatureBits, (size_t)signatureBitsLength));
 }
 
-Node::Node(const ptr_lib::shared_ptr<Transport>& transport, const ptr_lib::shared_ptr<const Transport::ConnectionInfo>& connectionInfo)
-: transport_(transport), connectionInfo_(connectionInfo),
+Node::Node(const ptr_lib::shared_ptr<Transport>& transport)
+: transport_(transport),
   ndndIdFetcherInterest_(Name("/%C1.M.S.localhost/%C1.M.SRV/ndnd/KEY"), 4000.0)
 {
 }
@@ -121,7 +121,7 @@
 {
   // TODO: Properly check if we are already connected to the expected host.
   if (!transport_->getIsConnected())
-    transport_->connect(*connectionInfo_, *this);
+    transport_->connect(*this);
   
   uint64_t pendingInterestId = PendingInterest::getNextPendingInterestId();
   pendingInterestTable_.push_back(ptr_lib::shared_ptr<PendingInterest>(new PendingInterest
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.
diff --git a/src/transport/transport.cpp b/src/transport/transport.cpp
index 0dcf518..4d5db21 100644
--- a/src/transport/transport.cpp
+++ b/src/transport/transport.cpp
@@ -12,34 +12,6 @@
 
 namespace ndn {
 
-Transport::ConnectionInfo::~ConnectionInfo()
-{  
-}
-
-void 
-Transport::connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener) 
-{
-  throw logic_error("unimplemented");
-}
-  
-void 
-Transport::send(const uint8_t *data, size_t dataLength)
-{
-  throw logic_error("unimplemented");
-}
-
-void 
-Transport::processEvents()
-{
-  throw logic_error("unimplemented");
-}
-
-bool 
-Transport::getIsConnected()
-{
-  throw logic_error("unimplemented");
-}
-
 void 
 Transport::close()
 {
diff --git a/src/transport/udp-transport.cpp b/src/transport/udp-transport.cpp
index c8def39..aaf3d06 100644
--- a/src/transport/udp-transport.cpp
+++ b/src/transport/udp-transport.cpp
@@ -17,24 +17,19 @@
 
 namespace ndn {
 
-UdpTransport::ConnectionInfo::~ConnectionInfo()
-{  
-}
-
-UdpTransport::UdpTransport() 
-  : isConnected_(false), transport_(new struct ndn_UdpTransport), elementReader_(new struct ndn_BinaryXmlElementReader)
+UdpTransport::UdpTransport(const char *host, unsigned short port/* = 6363*/)
+  : host_(host), port_(port)
+  , isConnected_(false), transport_(new struct ndn_UdpTransport), elementReader_(new struct ndn_BinaryXmlElementReader)
 {
   ndn_UdpTransport_initialize(transport_.get());
   elementReader_->partialData.array = 0;
 }
 
 void 
-UdpTransport::connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener)
+UdpTransport::connect(ElementListener& elementListener)
 {
-  const UdpTransport::ConnectionInfo& udpConnectionInfo = dynamic_cast<const UdpTransport::ConnectionInfo&>(connectionInfo);
-  
   ndn_Error error;
-  if ((error = ndn_UdpTransport_connect(transport_.get(), (char *)udpConnectionInfo.getHost().c_str(), udpConnectionInfo.getPort())))
+  if ((error = ndn_UdpTransport_connect(transport_.get(), (char *)host_.c_str(), port_)))
     throw runtime_error(ndn_getErrorString(error)); 
 
   // TODO: This belongs in the socket listener.