NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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 "transport.hpp"
26 #include "../util/config-file.hpp"
27 
28 namespace boost {
29 namespace asio {
30 namespace ip {
31 class tcp;
32 } // namespace ip
33 } // namespace asio
34 } // namespace boost
35 
36 namespace ndn {
37 
38 template<typename BaseTransport, typename Protocol>
39 class StreamTransportImpl;
40 
41 template<typename BaseTransport, typename Protocol>
42 class StreamTransportWithResolverImpl;
43 
46 class TcpTransport : public Transport
47 {
48 public:
49  explicit
50  TcpTransport(const std::string& host, const std::string& port = "6363");
51 
52  ~TcpTransport();
53 
54  virtual void
55  connect(boost::asio::io_service& ioService,
56  const ReceiveCallback& receiveCallback) override;
57 
58  virtual void
59  close() override;
60 
61  virtual void
62  pause() override;
63 
64  virtual void
65  resume() override;
66 
67  virtual void
68  send(const Block& wire) override;
69 
70  virtual void
71  send(const Block& header, const Block& payload) override;
72 
76  static shared_ptr<TcpTransport>
77  create(const std::string& uri);
78 
80  static std::pair<std::string, std::string>
81  getSocketHostAndPortFromUri(const std::string& uri);
82 
83 private:
84  std::string m_host;
85  std::string m_port;
86 
88  friend class StreamTransportImpl<TcpTransport, boost::asio::ip::tcp>;
89  friend class StreamTransportWithResolverImpl<TcpTransport, boost::asio::ip::tcp>;
90  shared_ptr<Impl> m_impl;
91 };
92 
93 } // namespace ndn
94 
95 #endif // NDN_TRANSPORT_TCP_TRANSPORT_HPP
Copyright (c) 2011-2015 Regents of the University of California.
Copyright (c) 2013-2016 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
a transport using TCP socket
implementation detail of a Boost.Asio-based stream-oriented transport
implementation detail of a Boost.Asio-based stream-oriented transport with resolver support ...
provides TLV-block delivery service
Definition: transport.hpp:40
function< void(const Block &wire)> ReceiveCallback
Definition: transport.hpp:52