NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
ethernet-face.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_FACE_HPP
27
#define NFD_DAEMON_FACE_ETHERNET_FACE_HPP
28
29
#include "common.hpp"
30
#include "
face.hpp
"
31
#include "
ndnlp-partial-message-store.hpp
"
32
#include "
ndnlp-slicer.hpp
"
33
#include "
core/network-interface.hpp
"
34
35
#include <unordered_map>
36
37
#ifndef HAVE_LIBPCAP
38
#error "Cannot include this file when libpcap is not available"
39
#endif
40
41
// forward declarations
42
struct
pcap;
43
typedef
pcap
pcap_t
;
44
struct
pcap_pkthdr;
45
46
namespace
nfd
{
47
52
class
EthernetFace
:
public
Face
53
{
54
public
:
58
struct
Error
:
public
Face::Error
59
{
60
Error
(
const
std::string& what) :
Face
::
Error
(what) {}
61
};
62
63
EthernetFace
(boost::asio::posix::stream_descriptor socket,
64
const
NetworkInterfaceInfo
& interface,
65
const
ethernet::Address
& address);
66
68
void
69
sendInterest
(
const
Interest
& interest)
DECL_OVERRIDE
;
70
72
void
73
sendData
(
const
Data
& data)
DECL_OVERRIDE
;
74
80
void
81
close
()
DECL_OVERRIDE
;
82
83
private
:
87
void
88
pcapInit();
89
95
void
96
setPacketFilter(
const
char
* filterString);
97
103
bool
104
joinMulticastGroup();
105
109
void
110
sendPacket(
const
ndn::Block
& block);
111
115
void
116
handleRead(
const
boost::system::error_code& error,
size_t
nBytesRead);
117
118
PUBLIC_WITH_TESTS_ELSE_PRIVATE
:
125
void
126
processIncomingPacket(
const
pcap_pkthdr* header,
const
uint8_t* packet);
127
128
private
:
132
void
133
processErrorCode(
const
boost::system::error_code& error);
134
138
size_t
139
getInterfaceMtu();
140
141
private
:
142
struct
Reassembler
143
{
144
unique_ptr<ndnlp::PartialMessageStore> pms;
145
scheduler::EventId
expireEvent;
146
};
147
148
unique_ptr<pcap_t, void(*)(pcap_t*)> m_pcap;
149
boost::asio::posix::stream_descriptor m_socket;
150
151
#if defined(__linux__)
152
int
m_interfaceIndex;
153
#endif
154
std::string m_interfaceName;
155
ethernet::Address
m_srcAddress;
156
ethernet::Address
m_destAddress;
157
158
size_t
m_interfaceMtu;
159
unique_ptr<ndnlp::Slicer> m_slicer;
160
std::unordered_map<ethernet::Address, Reassembler> m_reassemblers;
161
static
const
time::nanoseconds REASSEMBLER_LIFETIME;
162
163
#ifdef _DEBUG
164
unsigned
int
m_nDropped;
166
#endif
167
};
168
169
}
// namespace nfd
170
171
#endif // NFD_DAEMON_FACE_ETHERNET_FACE_HPP
face.hpp
network-interface.hpp
nfd::Face::Error
Face-related error.
Definition:
face.hpp:63
ndn::util::ethernet::Address
represents an Ethernet hardware address
Definition:
ethernet.hpp:53
nfd::NetworkInterfaceInfo
contains information about a network interface
Definition:
network-interface.hpp:41
nfd::EthernetFace::EthernetFace
EthernetFace(boost::asio::posix::stream_descriptor socket, const NetworkInterfaceInfo &interface, const ethernet::Address &address)
Definition:
ethernet-face.cpp:65
nfd::EthernetFace::sendData
void sendData(const Data &data) 1
send a Data
Definition:
ethernet-face.cpp:134
ndn::Block
Class representing a wire element of NDN-TLV packet format.
Definition:
block.hpp:43
ndn::Interest
represents an Interest packet
Definition:
interest.hpp:45
ndnlp-partial-message-store.hpp
nfd::scheduler::EventId
std::shared_ptr< ns3::EventId > EventId
Definition:
scheduler.hpp:39
DECL_OVERRIDE
#define DECL_OVERRIDE
expands to 'override' if compiler supports this feature, otherwise expands to nothing ...
Definition:
common.hpp:49
ndnlp-slicer.hpp
nfd::EthernetFace::sendInterest
void sendInterest(const Interest &interest) 1
send an Interest
Definition:
ethernet-face.cpp:121
nfd::EthernetFace
Implementation of Face abstraction that uses raw Ethernet frames as underlying transport mechanism...
Definition:
ethernet-face.hpp:52
nfd::Face
represents a face
Definition:
face.hpp:57
nfd::EthernetFace::Error
EthernetFace-related error.
Definition:
ethernet-face.hpp:58
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:38
nfd::EthernetFace::close
void close() 1
Closes the face.
Definition:
ethernet-face.cpp:147
pcap_t
pcap pcap_t
Definition:
ethernet-face.hpp:42
nfd::EthernetFace::Error::Error
Error(const std::string &what)
Definition:
ethernet-face.hpp:60
PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition:
common.hpp:39
ndn::Data
represents a Data packet
Definition:
data.hpp:39
ndnSIM
NFD
daemon
face
ethernet-face.hpp
Generated on Tue Feb 23 2016 22:18:44 for ndnSIM by
1.8.11