management: Making LocalControlHeader encoding independent of Interest/Data wire
Boost.Asio support multi-buffer send operation, which is enabled in this
commit for prepending (potentially different) LocalControlHeader's to
Interest/Data wire.
Change-Id: I39b979f89f196d3e47d6466fb71f6d440bce74d4
refs: #1265
diff --git a/src/transport/tcp-transport.hpp b/src/transport/tcp-transport.hpp
index c2ba56e..b97e2a1 100644
--- a/src/transport/tcp-transport.hpp
+++ b/src/transport/tcp-transport.hpp
@@ -1,18 +1,24 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * Copyright (C) 2013-2014 Regents of the University of California.
* See COPYING for copyright and distribution information.
*/
-#ifndef NDN_TCP_TRANSPORT_HPP
-#define NDN_TCP_TRANSPORT_HPP
+#ifndef NDN_TRANSPORT_TCP_TRANSPORT_HPP
+#define NDN_TRANSPORT_TCP_TRANSPORT_HPP
#include "../common.hpp"
#include "transport.hpp"
+// forward declaration
+namespace boost { namespace asio { namespace ip { class tcp; } } }
+
namespace ndn {
-
+
+// forward declaration
+template<class T, class U> class StreamTransportImpl;
+template<class T, class U> class StreamTransportWithResolverImpl;
+
class TcpTransport : public Transport
{
public:
@@ -21,23 +27,28 @@
// from Transport
virtual void
- connect(boost::asio::io_service &ioService,
- const ReceiveCallback &receiveCallback);
+ connect(boost::asio::io_service& ioService,
+ const ReceiveCallback& receiveCallback);
virtual void
close();
virtual void
- send(const Block &wire);
-
-private:
- std::string host_;
- std::string port_;
+ send(const Block& wire);
- class Impl;
- ptr_lib::shared_ptr<Impl> impl_;
+ virtual void
+ send(const Block& header, const Block& payload);
+
+private:
+ std::string m_host;
+ std::string m_port;
+
+ typedef StreamTransportWithResolverImpl<TcpTransport, boost::asio::ip::tcp> Impl;
+ friend class StreamTransportImpl<TcpTransport, boost::asio::ip::tcp>;
+ friend class StreamTransportWithResolverImpl<TcpTransport, boost::asio::ip::tcp>;
+ shared_ptr< Impl > m_impl;
};
-}
+} // namespace ndn
-#endif // NDN_TCP_TRANSPORT_HPP
+#endif // NDN_TRANSPORT_TCP_TRANSPORT_HPP