NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
p
q
r
s
t
u
v
w
+
Typedefs
a
b
c
d
e
f
h
i
k
l
n
o
p
q
r
s
t
u
v
+
Enumerations
a
b
c
d
f
i
k
l
n
p
q
r
s
t
u
+
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
~
+
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
~
+
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Typedefs
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
+
Enumerations
_
a
c
e
i
r
s
t
v
+
Enumerator
a
c
d
e
f
i
k
l
m
n
p
r
s
u
v
w
+
Related Functions
b
c
d
e
f
g
i
k
l
m
n
o
p
s
v
+
Files
File List
+
File Members
+
All
a
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
+
Functions
c
f
h
m
r
s
u
w
+
Variables
a
c
d
f
g
i
k
l
m
n
p
r
s
t
Typedefs
+
Macros
a
d
e
f
i
l
m
n
o
p
r
s
u
v
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
pcap-helper.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_DAEMON_FACE_PCAP_HELPER_HPP
27
#define NFD_DAEMON_FACE_PCAP_HELPER_HPP
28
29
#include "
core/common.hpp
"
30
31
#ifndef HAVE_LIBPCAP
32
#error "Cannot include this file when libpcap is not available"
33
#endif
34
35
// forward declarations
36
struct
pcap;
37
typedef
pcap
pcap_t
;
38
39
namespace
nfd
{
40
namespace
face {
41
45
class
PcapHelper
: noncopyable
46
{
47
public
:
48
class
Error
:
public
std::runtime_error
49
{
50
public
:
51
explicit
52
Error
(
const
std::string& what)
53
: std::runtime_error(what)
54
{
55
}
56
};
57
63
explicit
64
PcapHelper
(
const
std::string& interfaceName);
65
66
~PcapHelper
();
67
74
void
75
activate
(
int
dlt);
76
81
void
82
close
();
83
91
int
92
getFd
()
const
;
93
100
std::string
101
getLastError
()
const
;
102
108
size_t
109
getNDropped
()
const
;
110
118
void
119
setPacketFilter
(
const
char
* filter)
const
;
120
131
std::tuple<const uint8_t*, size_t, std::string>
132
readNextPacket
()
const
;
133
134
operator
pcap_t
*()
const
135
{
136
return
m_pcap;
137
}
138
139
private
:
140
pcap_t
* m_pcap;
141
};
142
143
}
// namespace face
144
}
// namespace nfd
145
146
#endif // NFD_DAEMON_FACE_PCAP_HELPER_HPP
nfd::face::PcapHelper::activate
void activate(int dlt)
Start capturing packets.
Definition:
pcap-helper.cpp:60
nfd::face::PcapHelper::~PcapHelper
~PcapHelper()
Definition:
pcap-helper.cpp:54
nfd::face::PcapHelper
Helper class for dealing with libpcap handles.
Definition:
pcap-helper.hpp:45
nfd::face::PcapHelper::setPacketFilter
void setPacketFilter(const char *filter) const
Install a BPF filter on the receiving socket.
Definition:
pcap-helper.cpp:111
common.hpp
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
pcap_t
pcap pcap_t
Definition:
pcap-helper.hpp:36
nfd::face::PcapHelper::getLastError
std::string getLastError() const
Get last error message.
Definition:
pcap-helper.cpp:95
nfd::face::PcapHelper::close
void close()
Stop capturing and close the handle.
Definition:
pcap-helper.cpp:74
nfd::face::PcapHelper::Error::Error
Error(const std::string &what)
Definition:
pcap-helper.hpp:52
nfd::face::PcapHelper::PcapHelper
PcapHelper(const std::string &interfaceName)
Create a libpcap context for live packet capture on a network interface.
Definition:
pcap-helper.cpp:38
nfd::face::PcapHelper::getFd
int getFd() const
Obtain a file descriptor that can be used in calls such as select(2) and poll(2).
Definition:
pcap-helper.cpp:83
nfd::face::PcapHelper::getNDropped
size_t getNDropped() const
Get the number of packets dropped by the kernel, as reported by libpcap.
Definition:
pcap-helper.cpp:101
nfd::face::PcapHelper::Error
Definition:
pcap-helper.hpp:48
nfd::face::PcapHelper::readNextPacket
std::tuple< const uint8_t *, size_t, std::string > readNextPacket() const
Read the next packet captured on the interface.
Definition:
pcap-helper.cpp:124
ndnSIM
NFD
daemon
face
pcap-helper.hpp
Generated on Sun Feb 24 2019 22:16:07 for ndnSIM by
1.8.15