NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
ethernet-transport.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_DAEMON_FACE_ETHERNET_TRANSPORT_HPP
27
#define NFD_DAEMON_FACE_ETHERNET_TRANSPORT_HPP
28
29
#include "
core/common.hpp
"
30
#include "
transport.hpp
"
31
#include "
core/network-interface.hpp
"
32
33
#ifndef HAVE_LIBPCAP
34
#error "Cannot include this file when libpcap is not available"
35
#endif
36
37
// forward declarations
38
struct
pcap;
39
typedef
pcap
pcap_t
;
40
struct
pcap_pkthdr;
41
42
namespace
nfd
{
43
namespace
face
{
44
48
class
EthernetTransport
final :
public
Transport
49
{
50
public
:
51
class
Error
:
public
std::runtime_error
52
{
53
public
:
54
explicit
55
Error
(
const
std::string& what)
56
:
std
::runtime_error(what)
57
{
58
}
59
};
60
64
EthernetTransport
(
const
NetworkInterfaceInfo
& interface,
65
const
ethernet::Address
& mcastAddress);
66
67
protected
:
68
virtual
void
69
beforeChangePersistency
(
ndn::nfd::FacePersistency
newPersistency)
final
;
70
71
virtual
void
72
doClose
()
final
;
73
74
private
:
75
virtual
void
76
doSend(
Transport::Packet
&& packet)
final
;
77
81
void
82
pcapInit();
83
89
void
90
setPacketFilter(
const
char
* filterString);
91
97
bool
98
joinMulticastGroup();
99
103
void
104
sendPacket(
const
ndn::Block
& block);
105
109
void
110
handleRead(
const
boost::system::error_code& error,
size_t
nBytesRead);
111
112
PUBLIC_WITH_TESTS_ELSE_PRIVATE
:
119
void
120
processIncomingPacket(
const
pcap_pkthdr* header,
const
uint8_t* packet);
121
122
private
:
126
void
127
processErrorCode(
const
boost::system::error_code& error);
128
132
size_t
133
getInterfaceMtu();
134
135
private
:
136
unique_ptr<pcap_t, void(*)(pcap_t*)> m_pcap;
137
boost::asio::posix::stream_descriptor m_socket;
138
139
ethernet::Address
m_srcAddress;
140
ethernet::Address
m_destAddress;
141
std::string m_interfaceName;
142
#if defined(__linux__)
143
int
m_interfaceIndex;
144
#endif
145
146
#ifdef _DEBUG
147
unsigned
int
m_nDropped;
149
#endif
150
};
151
152
}
// namespace face
153
}
// namespace nfd
154
155
#endif // NFD_DAEMON_FACE_ETHERNET_TRANSPORT_HPP
PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition:
common.hpp:40
network-interface.hpp
nfd::face::EthernetTransport::Error
Definition:
ethernet-transport.hpp:51
ndn::util::ethernet::Address
represents an Ethernet hardware address
Definition:
ethernet.hpp:53
nfd::face::Transport::Packet
stores a packet along with the remote endpoint
Definition:
transport.hpp:113
nfd::NetworkInterfaceInfo
contains information about a network interface
Definition:
network-interface.hpp:41
nfd::face::EthernetTransport::EthernetTransport
EthernetTransport(const NetworkInterfaceInfo &interface, const ethernet::Address &mcastAddress)
Creates an Ethernet-based transport for multicast communication.
Definition:
ethernet-transport.cpp:64
std
STL namespace.
ndn::Block
Class representing a wire element of NDN-TLV packet format.
Definition:
block.hpp:43
common.hpp
nfd::face::EthernetTransport::doClose
virtual void doClose() final
performs Transport specific operations to close the transport
Definition:
ethernet-transport.cpp:138
ndn::nfd::FacePersistency
FacePersistency
Definition:
nfd-constants.hpp:49
pcap_t
pcap pcap_t
Definition:
ethernet-transport.hpp:38
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
face
nfd::face::EthernetTransport::Error::Error
Error(const std::string &what)
Definition:
ethernet-transport.hpp:55
transport.hpp
nfd::face::EthernetTransport
A multicast Transport that uses raw Ethernet II frames.
Definition:
ethernet-transport.hpp:48
nfd::face::Transport
the lower part of a Face
Definition:
transport.hpp:104
nfd::face::EthernetTransport::beforeChangePersistency
virtual void beforeChangePersistency(ndn::nfd::FacePersistency newPersistency) final
invoked before persistency is changed
Definition:
ethernet-transport.cpp:123
ndnSIM
NFD
daemon
face
ethernet-transport.hpp
Generated on Wed Jan 11 2017 18:17:15 for ndnSIM by
1.8.13