NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
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-2022 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_CXX_TRANSPORT_TRANSPORT_HPP
23
#define NDN_CXX_TRANSPORT_TRANSPORT_HPP
24
25
#include "
ndn-cxx/detail/asio-fwd.hpp
"
26
#include "
ndn-cxx/detail/common.hpp
"
27
#include "
ndn-cxx/encoding/block.hpp
"
28
29
#include <boost/system/error_code.hpp>
30
31
namespace
ndn
{
32
35
class
Transport
: noncopyable
36
{
37
public
:
38
class
Error
:
public
std::runtime_error
39
{
40
public
:
41
using
std::runtime_error::runtime_error;
42
43
Error
(
const
boost::system::error_code& code,
const
std::string& msg);
44
};
45
46
using
ReceiveCallback
= std::function<void(const Block& wire)>;
47
using
ErrorCallback
= std::function<void()>;
48
49
virtual
50
~Transport
() =
default
;
51
56
virtual
void
57
connect
(
ReceiveCallback
receiveCallback);
58
62
virtual
void
63
close
() = 0;
64
68
virtual
void
69
send
(
const
Block
& block) = 0;
70
77
virtual
void
78
pause
() = 0;
79
86
virtual
void
87
resume
() = 0;
88
92
bool
93
isConnected
() const noexcept
94
{
95
return
m_isConnected
;
96
}
97
102
bool
103
isReceiving
() const noexcept
104
{
105
return
m_isReceiving
;
106
}
107
108
protected
:
109
ReceiveCallback
m_receiveCallback
;
110
bool
m_isConnected
=
false
;
111
bool
m_isReceiving
=
false
;
112
};
113
114
}
// namespace ndn
115
116
#endif // NDN_CXX_TRANSPORT_TRANSPORT_HPP
ndn::Transport::Error
Definition:
transport.hpp:38
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::Transport::isReceiving
bool isReceiving() const noexcept
Definition:
transport.hpp:103
ndn::Transport::Error::Error
Error(const boost::system::error_code &code, const std::string &msg)
Definition:
transport.cpp:26
ndn::Transport::close
virtual void close()=0
Close the connection.
ndn::Block
Represents a TLV element of the NDN packet format.
Definition:
block.hpp:44
ndn::Transport::m_receiveCallback
ReceiveCallback m_receiveCallback
Definition:
transport.hpp:109
ndn::Transport::ErrorCallback
std::function< void()> ErrorCallback
Definition:
transport.hpp:47
asio-fwd.hpp
common.hpp
Common includes and macros used throughout the library.
ndn::Transport::resume
virtual void resume()=0
Resume the transport.
ndn::Transport::isConnected
bool isConnected() const noexcept
Return whether the transport is connected.
Definition:
transport.hpp:93
ndn::Transport
Provides TLV-block delivery service.
Definition:
transport.hpp:35
block.hpp
ndn::Transport::pause
virtual void pause()=0
Pause the transport, canceling all pending operations.
ndn::Transport::m_isReceiving
bool m_isReceiving
Definition:
transport.hpp:111
ndn::Transport::m_isConnected
bool m_isConnected
Definition:
transport.hpp:110
ndn::Transport::connect
virtual void connect(ReceiveCallback receiveCallback)
Asynchronously open the connection.
Definition:
transport.cpp:32
ndn::Transport::ReceiveCallback
std::function< void(const Block &wire)> ReceiveCallback
Definition:
transport.hpp:46
ndn::Transport::~Transport
virtual ~Transport()=default
ndn::Transport::send
virtual void send(const Block &block)=0
Send a TLV block through the transport.
ndnSIM
ndn-cxx
ndn-cxx
transport
transport.hpp
Generated on Fri May 6 2022 12:34:13 for ndnSIM by
1.8.13