NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
tcp-transport.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_TRANSPORT_TCP_TRANSPORT_HPP
23 #define NDN_TRANSPORT_TCP_TRANSPORT_HPP
24 
25 #include "../common.hpp"
26 #include "transport.hpp"
27 #include "../util/config-file.hpp"
28 
29 
30 // forward declaration
31 namespace boost { namespace asio { namespace ip { class tcp; } } }
32 
33 namespace ndn {
34 
35 // forward declaration
36 template<class T, class U> class StreamTransportImpl;
37 template<class T, class U> class StreamTransportWithResolverImpl;
38 
39 class TcpTransport : public Transport
40 {
41 public:
42  TcpTransport(const std::string& host, const std::string& port = "6363");
43  ~TcpTransport();
44 
45  // from Transport
46  virtual void
47  connect(boost::asio::io_service& ioService,
48  const ReceiveCallback& receiveCallback);
49 
50  virtual void
51  close();
52 
53  virtual void
54  pause();
55 
56  virtual void
57  resume();
58 
59  virtual void
60  send(const Block& wire);
61 
62  virtual void
63  send(const Block& header, const Block& payload);
64 
65  static shared_ptr<TcpTransport>
66  create(const ConfigFile& config);
67 
69 
70  static std::pair<std::string, std::string>
71  getDefaultSocketHostAndPort(const ConfigFile& config);
72 
73 private:
74  std::string m_host;
75  std::string m_port;
76 
78  friend class StreamTransportImpl<TcpTransport, boost::asio::ip::tcp>;
79  friend class StreamTransportWithResolverImpl<TcpTransport, boost::asio::ip::tcp>;
80  shared_ptr< Impl > m_impl;
81 };
82 
83 } // namespace ndn
84 
85 #endif // NDN_TRANSPORT_TCP_TRANSPORT_HPP
Copyright (c) 2011-2015 Regents of the University of California.
Copyright (c) 2013-2015 Regents of the University of California.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:43
Class representing a wire element of NDN-TLV packet format.
Definition: block.hpp:43
function< void(const Block &wire)> ReceiveCallback
Definition: transport.hpp:42