NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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; -*- */
22
#ifndef NDN_TRANSPORT_TRANSPORT_HPP
23
#define NDN_TRANSPORT_TRANSPORT_HPP
24
25
#include "../common.hpp"
26
#include "../encoding/block.hpp"
27
28
#include <boost/system/error_code.hpp>
29
30
namespace
boost
{
31
namespace
asio {
32
class
io_service;
33
}
// namespace asio
34
}
// namespace boost
35
36
namespace
ndn
{
37
40
class
Transport
: noncopyable
41
{
42
public
:
43
class
Error
:
public
std::runtime_error
44
{
45
public
:
46
Error
(
const
boost::system::error_code& code,
const
std::string& msg);
47
48
explicit
49
Error
(
const
std::string& msg);
50
};
51
52
typedef
function<void(const Block& wire)>
ReceiveCallback
;
53
typedef
function<void()>
ErrorCallback
;
54
55
Transport
();
56
57
virtual
58
~
Transport
() =
default
;
59
65
virtual
void
66
connect(boost::asio::io_service& ioService,
const
ReceiveCallback& receiveCallback);
67
70
virtual
void
71
close() = 0;
72
75
virtual
void
76
send(
const
Block
& wire) = 0;
77
83
virtual
void
84
send(
const
Block
& header,
const
Block
& payload) = 0;
85
91
virtual
void
92
pause() = 0;
93
99
virtual
void
100
resume() = 0;
101
105
bool
106
isConnected()
const
;
107
111
bool
112
isReceiving()
const
;
113
114
protected
:
117
void
118
receive(
const
Block
& wire);
119
120
protected
:
121
boost::asio::io_service*
m_ioService
;
122
bool
m_isConnected
;
123
bool
m_isReceiving
;
124
ReceiveCallback
m_receiveCallback
;
125
};
126
127
inline
bool
128
Transport::isConnected()
const
129
{
130
return
m_isConnected;
131
}
132
133
inline
bool
134
Transport::isReceiving()
const
135
{
136
return
m_isReceiving;
137
}
138
139
inline
void
140
Transport::receive(
const
Block
& wire)
141
{
142
m_receiveCallback(wire);
143
}
144
145
}
// namespace ndn
146
147
#endif // NDN_TRANSPORT_TRANSPORT_HPP
ndn::Transport::Error
Definition:
transport.hpp:43
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
boost
Copyright (c) 2013-2016 Regents of the University of California.
Definition:
ndn-content-store.hpp:209
nfd::face::Transport
Transport
Definition:
transport.cpp:32
ndn::Block
Class representing a wire element of NDN-TLV packet format.
Definition:
block.hpp:43
ndn::Transport::m_receiveCallback
ReceiveCallback m_receiveCallback
Definition:
transport.hpp:124
ndn::Transport::ErrorCallback
function< void()> ErrorCallback
Definition:
transport.hpp:53
ndn::Transport::m_ioService
boost::asio::io_service * m_ioService
Definition:
transport.hpp:121
ndn::Transport
provides TLV-block delivery service
Definition:
transport.hpp:40
ndn::Transport::m_isReceiving
bool m_isReceiving
Definition:
transport.hpp:123
ndn::Transport::m_isConnected
bool m_isConnected
Definition:
transport.hpp:122
ndn::Transport::ReceiveCallback
function< void(const Block &wire)> ReceiveCallback
Definition:
transport.hpp:52
ndnSIM
ndn-cxx
src
transport
transport.hpp
Generated on Wed Jan 11 2017 18:17:15 for ndnSIM by
1.8.13