unix-transport.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013-2018 Regents of the University of California.
4  *
5  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6  *
7  * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License as published by the Free Software
9  * Foundation, either version 3 of the License, or (at your option) any later version.
10  *
11  * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13  * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14  *
15  * You should have received copies of the GNU General Public License and GNU Lesser
16  * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17  * <http://www.gnu.org/licenses/>.
18  *
19  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20  */
21 
22 #ifndef NDN_TRANSPORT_UNIX_TRANSPORT_HPP
23 #define NDN_TRANSPORT_UNIX_TRANSPORT_HPP
24 
27 
28 #include <boost/asio/local/stream_protocol.hpp>
29 
30 namespace ndn {
31 
32 namespace detail {
33 
34 template<typename BaseTransport, typename Protocol>
35 class StreamTransportImpl;
36 
37 } // namespace detail
38 
41 class UnixTransport : public Transport
42 {
43 public:
44  explicit
45  UnixTransport(const std::string& unixSocket);
46 
47  ~UnixTransport() override;
48 
49  void
50  connect(boost::asio::io_service& ioService,
51  const ReceiveCallback& receiveCallback) override;
52 
53  void
54  close() override;
55 
56  void
57  pause() override;
58 
59  void
60  resume() override;
61 
62  void
63  send(const Block& wire) override;
64 
65  void
66  send(const Block& header, const Block& payload) override;
67 
71  static shared_ptr<UnixTransport>
72  create(const std::string& uri);
73 
75  static std::string
76  getSocketNameFromUri(const std::string& uri);
77 
78 private:
79  std::string m_unixSocket;
80 
82  friend Impl;
83  shared_ptr<Impl> m_impl;
84 };
85 
86 } // namespace ndn
87 
88 #endif // NDN_TRANSPORT_UNIX_TRANSPORT_HPP
a transport using Unix stream socket
Definition: data.cpp:26
Represents a TLV element of NDN packet format.
Definition: block.hpp:42
Implementation detail of a Boost.Asio-based stream-oriented transport.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:43
provides TLV-block delivery service
Definition: transport.hpp:35
function< void(const Block &wire)> ReceiveCallback
Definition: transport.hpp:47