NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
udp-channel.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_DAEMON_FACE_UDP_CHANNEL_HPP
27
#define NFD_DAEMON_FACE_UDP_CHANNEL_HPP
28
29
#include "
channel.hpp
"
30
31
namespace
nfd
{
32
33
namespace
udp {
34
typedef
boost::asio::ip::udp::endpoint
Endpoint
;
35
}
// namespace udp
36
40
class
UdpChannel
:
public
Channel
41
{
42
public
:
53
UdpChannel
(
const
udp::Endpoint
& localEndpoint,
54
const
time::seconds& timeout);
55
59
size_t
60
size()
const
;
61
67
void
68
connect(
const
udp::Endpoint
& remoteEndpoint,
69
ndn::nfd::FacePersistency
persistency,
70
const
FaceCreatedCallback
& onFaceCreated,
71
const
FaceCreationFailedCallback
& onConnectFailed);
72
85
void
86
listen(
const
FaceCreatedCallback
& onFaceCreated,
87
const
FaceCreationFailedCallback
& onReceiveFailed);
88
89
bool
90
isListening()
const
;
91
92
private
:
93
void
94
waitForNewPeer(
const
FaceCreatedCallback
& onFaceCreated,
95
const
FaceCreationFailedCallback
& onReceiveFailed);
96
101
void
102
handleNewPeer(
const
boost::system::error_code& error,
103
size_t
nBytesReceived,
104
const
FaceCreatedCallback
& onFaceCreated,
105
const
FaceCreationFailedCallback
& onReceiveFailed);
106
107
std::pair<bool, shared_ptr<Face>>
108
createFace(
const
udp::Endpoint
& remoteEndpoint,
ndn::nfd::FacePersistency
persistency);
109
110
private
:
111
std::map<udp::Endpoint, shared_ptr<Face>> m_channelFaces;
112
113
udp::Endpoint
m_localEndpoint;
114
118
udp::Endpoint
m_remoteEndpoint;
119
123
boost::asio::ip::udp::socket m_socket;
124
128
time::seconds m_idleFaceTimeout;
129
130
uint8_t m_inputBuffer[
ndn::MAX_NDN_PACKET_SIZE
];
131
};
132
133
inline
bool
134
UdpChannel::isListening
()
const
135
{
136
return
m_socket.is_open();
137
}
138
139
}
// namespace nfd
140
141
#endif // NFD_DAEMON_FACE_UDP_CHANNEL_HPP
nfd::FaceCreationFailedCallback
function< void(const std::string &reason)> FaceCreationFailedCallback
Prototype for the callback that is invoked when the face fails to be created.
Definition:
channel.hpp:44
nfd::UdpChannel
Class implementing UDP-based channel to create faces.
Definition:
udp-channel.hpp:40
nfd::Channel
Definition:
channel.hpp:47
channel.hpp
nfd::UdpChannel
UdpChannel
Definition:
udp-channel.cpp:33
ndn::nfd::FacePersistency
FacePersistency
Definition:
nfd-constants.hpp:49
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::UdpChannel::isListening
bool isListening() const
Definition:
udp-channel.hpp:134
nfd::udp::Endpoint
boost::asio::ip::udp::endpoint Endpoint
Definition:
udp-channel.hpp:34
nfd::FaceCreatedCallback
function< void(const shared_ptr< Face > &newFace)> FaceCreatedCallback
Prototype for the callback that is invoked when the face is created (as a response to incoming connec...
Definition:
channel.hpp:38
ndn::MAX_NDN_PACKET_SIZE
const size_t MAX_NDN_PACKET_SIZE
practical limit of network layer packet size
Definition:
tlv.hpp:39
ndnSIM
NFD
daemon
face
udp-channel.hpp
Generated on Sat Nov 12 2016 16:02:54 for ndnSIM by
1.8.12