NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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 "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
DECL_CLASS_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)
DECL_FINAL
;
70
71
virtual
void
72
doClose()
DECL_FINAL
;
73
74
private
:
75
virtual
void
76
doSend(
Transport::Packet
&& packet)
DECL_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
network-interface.hpp
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
std
STL namespace.
ndn::Block
Class representing a wire element of NDN-TLV packet format.
Definition:
block.hpp:43
DECL_FINAL
#define DECL_FINAL
expands to 'final' if compiler supports 'final' specifier on method, otherwise expands to nothing ...
Definition:
common.hpp:60
nfd::face::DECL_CLASS_FINAL::Error
Definition:
ethernet-transport.hpp:51
ndn::nfd::FacePersistency
FacePersistency
Definition:
nfd-constants.hpp:49
nfd::face::EthernetTransport
EthernetTransport
Definition:
ethernet-transport.cpp:62
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::DECL_CLASS_FINAL
A multicast Transport that uses raw Ethernet II frames.
Definition:
ethernet-transport.hpp:48
transport.hpp
nfd::face::DECL_CLASS_FINAL::Error::Error
Error(const std::string &what)
Definition:
ethernet-transport.hpp:55
PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition:
common.hpp:39
nfd::face::Transport
the lower part of a Face
Definition:
transport.hpp:104
ndnSIM
NFD
daemon
face
ethernet-transport.hpp
Generated on Sat Nov 12 2016 16:02:53 for ndnSIM by
1.8.12