NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
nfd::face Namespace Reference

Classes

class  Channel
 represent a channel that communicates on a local endpoint More...
 
class  DatagramTransport
 Implements Transport for datagram-based protocols. More...
 
class  EthernetChannel
 Class implementing Ethernet-based channel to create faces. More...
 
class  EthernetFactory
 Protocol factory for Ethernet. More...
 
class  EthernetTransport
 Base class for Ethernet-based Transports. More...
 
class  Face
 generalization of a network interface More...
 
class  FaceCounters
 gives access to counters provided by Face More...
 
class  FaceLogHelper
 for internal use by FaceLogging macros More...
 
struct  FaceParams
 Parameters used to set Transport properties or LinkService options on a newly created face. More...
 
class  FaceSystem
 entry point of the face system More...
 
class  GenericLinkService
 GenericLinkService is a LinkService that implements the NDNLPv2 protocol. More...
 
class  GenericLinkServiceCounters
 counters provided by GenericLinkService More...
 
class  InternalClientTransport
 implements a client-side transport that can be paired with another More...
 
class  InternalForwarderTransport
 implements a forwarder-side transport that can be paired with another More...
 
class  InternalTransportBase
 abstracts a transport that can be paired with another More...
 
class  LinkService
 the upper part of a Face More...
 
class  LinkServiceCounters
 counters provided by LinkService More...
 
class  LpFragmenter
 fragments network-layer packets into NDNLPv2 link-layer packets More...
 
class  LpReassembler
 reassembles fragmented network-layer packets More...
 
class  LpReliability
 provides for reliable sending and receiving of link-layer packets More...
 
struct  Multicast
 
class  MulticastEthernetTransport
 A multicast Transport that uses raw Ethernet II frames. More...
 
class  MulticastUdpTransport
 A Transport that communicates on a UDP multicast group. More...
 
class  NetdevBound
 manages netdev-bound faces More...
 
class  PcapHelper
 Helper class for dealing with libpcap handles. More...
 
class  ProtocolFactory
 Provides support for an underlying protocol. More...
 
struct  ProtocolFactoryCtorParams
 Parameters to ProtocolFactory constructor. More...
 
class  StreamTransport
 Implements Transport for stream-based protocols. More...
 
class  TcpChannel
 Class implementing TCP-based channel to create faces. More...
 
class  TcpFactory
 Protocol factory for TCP over IPv4 and IPv6. More...
 
class  TcpTransport
 A Transport that communicates on a connected TCP socket. More...
 
class  Transport
 the lower part of a Face More...
 
class  TransportCounters
 counters provided by Transport More...
 
class  UdpChannel
 Class implementing UDP-based channel to create faces. More...
 
class  UdpFactory
 Protocol factory for UDP over IPv4 and IPv6. More...
 
struct  Unicast
 
class  UnicastEthernetTransport
 A unicast Transport that uses raw Ethernet II frames. More...
 
class  UnicastUdpTransport
 A Transport that communicates on a unicast UDP socket. More...
 
class  UnixStreamChannel
 Class implementing a local channel to create faces. More...
 
class  UnixStreamFactory
 Protocol factory for stream-oriented Unix sockets. More...
 
class  UnixStreamTransport
 A Transport that communicates on a stream-oriented Unix domain socket. More...
 
class  WebSocketChannel
 Class implementing WebSocket-based channel to create faces. More...
 
class  WebSocketFactory
 Protocol factory for WebSocket. More...
 
class  WebSocketTransport
 A Transport that communicates on a WebSocket connection. More...
 
class  WebSocketTransportCounters
 counters provided by WebSocketTransport More...
 

Typedefs

using FaceCreatedCallback = std::function< void(const shared_ptr< Face > &face)>
 Prototype for the callback that is invoked when a face is created (in response to an incoming connection or after a connection is established) More...
 
using FaceCreationFailedCallback = std::function< void(uint32_t status, const std::string &reason)>
 Prototype for the callback that is invoked when a face fails to be created. More...
 
typedef uint64_t FaceId
 identifies a face More...
 
typedef TransportState FaceState
 indicates the state of a face More...
 
using DetermineFaceScopeFromAddress = std::function< ndn::nfd::FaceScope(const boost::asio::ip::address &local, const boost::asio::ip::address &remote)>
 

Enumerations

enum  TransportState {
  TransportState::NONE, TransportState::UP, TransportState::DOWN, TransportState::CLOSING,
  TransportState::FAILED, TransportState::CLOSED
}
 indicates the state of a transport More...
 

Functions

std::ostream & operator<< (std::ostream &os, const Face &face)
 
void connectFaceClosedSignal (Face &face, const std::function< void()> &f)
 invokes a callback when the face is closed More...
 
 NFD_REGISTER_PROTOCOL_FACTORY (EthernetFactory)
 
std::ostream & operator<< (std::ostream &os, const FaceLogHelper< Face > &flh)
 
std::tuple< shared_ptr< Face >, shared_ptr< ndn::Face > > makeInternalFace (ndn::KeyChain &clientKeyChain)
 make a pair of forwarder-side face and client-side face that are connected with each other More...
 
 NFD_LOG_MEMBER_INIT (InternalForwarderTransport, InternalForwarderTransport)
 
 NFD_LOG_MEMBER_INIT (InternalClientTransport, InternalClientTransport)
 
static void asyncReceive (InternalTransportBase *recipient, const Block &packet)
 
std::ostream & operator<< (std::ostream &os, const FaceLogHelper< LinkService > &flh)
 
template<typename T >
std::enable_if< std::is_base_of< LinkService, T >::value &&!std::is_same< LinkService, T >::value, std::ostream & >::type operator<< (std::ostream &os, const FaceLogHelper< T > &flh)
 
std::ostream & operator<< (std::ostream &os, const FaceLogHelper< LpFragmenter > &flh)
 
std::ostream & operator<< (std::ostream &os, const FaceLogHelper< LpReassembler > &flh)
 
 NFD_LOG_MEMBER_INIT_SPECIALIZED ((DatagramTransport< boost::asio::ip::udp, Multicast >), MulticastUdpTransport)
 
static void bindToDevice (int fd, const std::string &ifname)
 
 NFD_LOG_MEMBER_DECL_SPECIALIZED ((DatagramTransport< boost::asio::ip::udp, Multicast >))
 
shared_ptr< FacemakeNullFace (const FaceUri &uri)
 
ssize_t getTxQueueLength (int fd)
 obtain send queue length from a specified system socket More...
 
 NFD_REGISTER_PROTOCOL_FACTORY (TcpFactory)
 
 NFD_LOG_MEMBER_INIT_SPECIALIZED (StreamTransport< boost::asio::ip::tcp >, TcpTransport)
 
 NFD_LOG_MEMBER_DECL_SPECIALIZED (StreamTransport< boost::asio::ip::tcp >)
 
std::ostream & operator<< (std::ostream &os, TransportState state)
 
std::ostream & operator<< (std::ostream &os, const FaceLogHelper< Transport > &flh)
 
template<typename T >
std::enable_if< std::is_base_of< Transport, T >::value &&!std::is_same< Transport, T >::value, std::ostream & >::type operator<< (std::ostream &os, const FaceLogHelper< T > &flh)
 
 NFD_REGISTER_PROTOCOL_FACTORY (UdpFactory)
 
static optional< ip::address > pickAddress (const net::NetworkInterface &netif, net::AddressFamily af)
 
 NFD_LOG_MEMBER_INIT_SPECIALIZED ((DatagramTransport< boost::asio::ip::udp, Unicast >), UnicastUdpTransport)
 
 NFD_LOG_MEMBER_DECL_SPECIALIZED ((DatagramTransport< boost::asio::ip::udp, Unicast >))
 
 NFD_REGISTER_PROTOCOL_FACTORY (UnixStreamFactory)
 
 NFD_LOG_MEMBER_INIT_SPECIALIZED (StreamTransport< boost::asio::local::stream_protocol >, UnixStreamTransport)
 
 NFD_LOG_MEMBER_DECL_SPECIALIZED (StreamTransport< boost::asio::local::stream_protocol >)
 
 NFD_REGISTER_PROTOCOL_FACTORY (WebSocketFactory)
 
static bool isLoopback (const boost::asio::ip::address &addr)
 

Variables

 EthernetChannel
 
 EthernetFactory
 
 EthernetTransport
 
 FaceSystem
 
static const std::string SECTION_GENERAL = "general"
 
static const std::string SECTION_NETDEVBOUND = "netdev_bound"
 
const FaceId INVALID_FACEID = 0
 indicates an invalid FaceId More...
 
const FaceId FACEID_INTERNAL_FACE = 1
 identifies the InternalFace used in management More...
 
const FaceId FACEID_CONTENT_STORE = 254
 identifies a packet comes from the ContentStore More...
 
const FaceId FACEID_NULL = 255
 identifies the NullFace that drops every packet More...
 
const FaceId FACEID_RESERVED_MAX = 255
 upper bound of reserved FaceIds More...
 
 GenericLinkService
 
constexpr uint32_t DEFAULT_CONGESTION_THRESHOLD_DIVISOR = 2
 
 LinkService
 
 LpFragmenter
 
static const size_t MAX_SINGLE_FRAG_OVERHEAD
 maximum overhead on a single fragment, not counting other NDNLPv2 headers More...
 
static const size_t MAX_FRAG_OVERHEAD
 maximum overhead of adding fragmentation to payload, not counting other NDNLPv2 headers More...
 
 LpReassembler
 
 MulticastEthernetTransport
 
 NetdevBound
 
 TcpChannel
 
 TcpFactory
 
 Transport
 
const ssize_t MTU_UNLIMITED = -1
 indicates the transport has no limit on payload size More...
 
const ssize_t MTU_INVALID = -2
 (for internal use) indicates MTU field is unset More...
 
const ssize_t QUEUE_UNSUPPORTED = -1
 indicates that the transport does not support reading the queue capacity/length More...
 
const ssize_t QUEUE_ERROR = -2
 indicates that the transport was unable to retrieve the queue capacity/length More...
 
 UdpChannel
 
 UdpFactory
 
 UnicastEthernetTransport
 
 UnixStreamChannel
 
 UnixStreamFactory
 
 WebSocketChannel
 
 WebSocketFactory
 
 WebSocketTransport
 

Typedef Documentation

◆ FaceCreatedCallback

using nfd::face::FaceCreatedCallback = typedef std::function<void(const shared_ptr<Face>& face)>

Prototype for the callback that is invoked when a face is created (in response to an incoming connection or after a connection is established)

Definition at line 40 of file channel.hpp.

◆ FaceCreationFailedCallback

using nfd::face::FaceCreationFailedCallback = typedef std::function<void(uint32_t status, const std::string& reason)>

Prototype for the callback that is invoked when a face fails to be created.

Definition at line 44 of file channel.hpp.

◆ FaceId

typedef uint64_t nfd::face::FaceId

identifies a face

Definition at line 39 of file face.hpp.

◆ FaceState

indicates the state of a face

Definition at line 54 of file face.hpp.

◆ DetermineFaceScopeFromAddress

using nfd::face::DetermineFaceScopeFromAddress = typedef std::function<ndn::nfd::FaceScope(const boost::asio::ip::address& local, const boost::asio::ip::address& remote)>

Definition at line 41 of file tcp-channel.hpp.

Enumeration Type Documentation

◆ TransportState

indicates the state of a transport

Enumerator
NONE 
UP 

the transport is up and can transmit packets

DOWN 

the transport is temporarily down, and is being recovered

CLOSING 

the transport is being closed gracefully, either by the peer or by a call to close()

FAILED 

the transport is being closed due to a failure

CLOSED 

the transport is closed, and can be safely deallocated

Definition at line 42 of file transport.hpp.

Function Documentation

◆ operator<<() [1/9]

std::ostream& nfd::face::operator<< ( std::ostream &  os,
const Face face 
)
inline

Definition at line 89 of file ndn-common.hpp.

References nfd::face::Face::getLocalUri().

◆ connectFaceClosedSignal()

void nfd::face::connectFaceClosedSignal ( Face face,
const std::function< void()> &  f 
)

invokes a callback when the face is closed

Parameters
facethe face
fthe callback to be invoked when the face enters CLOSED state

This function connects a callback to the afterStateChange signal on the face, and invokes f when the state becomes CLOSED.

Definition at line 40 of file channel.cpp.

References nfd::face::Face::afterStateChange, and CLOSED.

Referenced by nfd::face::EthernetFactory::createMulticastFace(), and nfd::face::UdpFactory::createMulticastFace().

◆ NFD_REGISTER_PROTOCOL_FACTORY() [1/5]

nfd::face::NFD_REGISTER_PROTOCOL_FACTORY ( EthernetFactory  )

◆ operator<<() [2/9]

std::ostream & nfd::face::operator<< ( std::ostream &  os,
const FaceLogHelper< Face > &  flh 
)

◆ makeInternalFace()

std::tuple< shared_ptr< Face >, shared_ptr< ndn::Face > > nfd::face::makeInternalFace ( ndn::KeyChain clientKeyChain)

make a pair of forwarder-side face and client-side face that are connected with each other

Network-layer packets sent by one face will be received by the other face after io.poll().

Parameters
clientKeyChainA KeyChain used by client-side face to sign prefix registration commands.
Returns
a forwarder-side face and a client-side face connected with each other

Definition at line 35 of file internal-face.cpp.

References nfd::face::GenericLinkService::Options::allowLocalFields.

◆ NFD_LOG_MEMBER_INIT() [1/2]

nfd::face::NFD_LOG_MEMBER_INIT ( InternalForwarderTransport  ,
InternalForwarderTransport   
)

◆ NFD_LOG_MEMBER_INIT() [2/2]

nfd::face::NFD_LOG_MEMBER_INIT ( InternalClientTransport  ,
InternalClientTransport   
)

◆ asyncReceive()

static void nfd::face::asyncReceive ( InternalTransportBase recipient,
const Block packet 
)
static

◆ operator<<() [3/9]

std::ostream & nfd::face::operator<< ( std::ostream &  os,
const FaceLogHelper< LinkService > &  flh 
)

◆ operator<<() [4/9]

template<typename T >
std::enable_if<std::is_base_of<LinkService, T>::value && !std::is_same<LinkService, T>::value, std::ostream&>::type nfd::face::operator<< ( std::ostream &  os,
const FaceLogHelper< T > &  flh 
)

Definition at line 260 of file link-service.hpp.

References nfd::face::FaceLogHelper< T >::obj.

◆ operator<<() [5/9]

std::ostream & nfd::face::operator<< ( std::ostream &  os,
const FaceLogHelper< LpFragmenter > &  flh 
)

◆ operator<<() [6/9]

std::ostream & nfd::face::operator<< ( std::ostream &  os,
const FaceLogHelper< LpReassembler > &  flh 
)

◆ NFD_LOG_MEMBER_INIT_SPECIALIZED() [1/4]

nfd::face::NFD_LOG_MEMBER_INIT_SPECIALIZED ( (DatagramTransport< boost::asio::ip::udp, Multicast >)  ,
MulticastUdpTransport   
)

◆ bindToDevice()

static void nfd::face::bindToDevice ( int  fd,
const std::string &  ifname 
)
static

◆ NFD_LOG_MEMBER_DECL_SPECIALIZED() [1/4]

nfd::face::NFD_LOG_MEMBER_DECL_SPECIALIZED ( (DatagramTransport< boost::asio::ip::udp, Multicast >)  )

◆ makeNullFace()

shared_ptr< Face > nfd::face::makeNullFace ( const FaceUri uri = FaceUri("null://"))
Returns
a Face that has no underlying transport and drops every packet

Definition at line 37 of file null-face.cpp.

References ndn::nfd::FACE_SCOPE_LOCAL.

Referenced by nfd::Nfd::initialize().

◆ getTxQueueLength()

ssize_t nfd::face::getTxQueueLength ( int  fd)

obtain send queue length from a specified system socket

Parameters
fdfile descriptor of the socket
Return values
QUEUE_UNSUPPORTEDthis operation is unsupported on the current platform
QUEUE_ERRORthere was an error retrieving the send queue length

On Linux, ioctl() is used to obtain the value of SIOCOUTQ from the socket. On macOS, getsockopt() is used to obtain the value of SO_NWRITE from the socket.

Definition at line 40 of file socket-utils.cpp.

References QUEUE_ERROR, and QUEUE_UNSUPPORTED.

Referenced by nfd::face::StreamTransport< boost::asio::local::stream_protocol >::getSendQueueLength(), nfd::face::DatagramTransport< boost::asio::ip::udp, Multicast >::getSendQueueLength(), and nfd::face::MulticastUdpTransport::getSendQueueLength().

◆ NFD_REGISTER_PROTOCOL_FACTORY() [2/5]

nfd::face::NFD_REGISTER_PROTOCOL_FACTORY ( TcpFactory  )

◆ NFD_LOG_MEMBER_INIT_SPECIALIZED() [2/4]

nfd::face::NFD_LOG_MEMBER_INIT_SPECIALIZED ( StreamTransport< boost::asio::ip::tcp >  ,
TcpTransport   
)

◆ NFD_LOG_MEMBER_DECL_SPECIALIZED() [2/4]

nfd::face::NFD_LOG_MEMBER_DECL_SPECIALIZED ( StreamTransport< boost::asio::ip::tcp >  )

◆ operator<<() [7/9]

std::ostream & nfd::face::operator<< ( std::ostream &  os,
TransportState  state 
)

Definition at line 37 of file transport.cpp.

References CLOSED, CLOSING, DOWN, FAILED, and UP.

◆ operator<<() [8/9]

◆ operator<<() [9/9]

template<typename T >
std::enable_if<std::is_base_of<Transport, T>::value && !std::is_same<Transport, T>::value, std::ostream&>::type nfd::face::operator<< ( std::ostream &  os,
const FaceLogHelper< T > &  flh 
)

Definition at line 517 of file transport.hpp.

References nfd::face::FaceLogHelper< T >::obj.

◆ NFD_REGISTER_PROTOCOL_FACTORY() [3/5]

nfd::face::NFD_REGISTER_PROTOCOL_FACTORY ( UdpFactory  )

◆ pickAddress()

static optional<ip::address> nfd::face::pickAddress ( const net::NetworkInterface netif,
net::AddressFamily  af 
)
static

◆ NFD_LOG_MEMBER_INIT_SPECIALIZED() [3/4]

nfd::face::NFD_LOG_MEMBER_INIT_SPECIALIZED ( (DatagramTransport< boost::asio::ip::udp, Unicast >)  ,
UnicastUdpTransport   
)

◆ NFD_LOG_MEMBER_DECL_SPECIALIZED() [3/4]

nfd::face::NFD_LOG_MEMBER_DECL_SPECIALIZED ( (DatagramTransport< boost::asio::ip::udp, Unicast >)  )

◆ NFD_REGISTER_PROTOCOL_FACTORY() [4/5]

nfd::face::NFD_REGISTER_PROTOCOL_FACTORY ( UnixStreamFactory  )

◆ NFD_LOG_MEMBER_INIT_SPECIALIZED() [4/4]

nfd::face::NFD_LOG_MEMBER_INIT_SPECIALIZED ( StreamTransport< boost::asio::local::stream_protocol >  ,
UnixStreamTransport   
)

◆ NFD_LOG_MEMBER_DECL_SPECIALIZED() [4/4]

nfd::face::NFD_LOG_MEMBER_DECL_SPECIALIZED ( StreamTransport< boost::asio::local::stream_protocol >  )

◆ NFD_REGISTER_PROTOCOL_FACTORY() [5/5]

nfd::face::NFD_REGISTER_PROTOCOL_FACTORY ( WebSocketFactory  )

◆ isLoopback()

static bool nfd::face::isLoopback ( const boost::asio::ip::address &  addr)
static

Variable Documentation

◆ EthernetChannel

Definition at line 38 of file ethernet-channel.cpp.

◆ EthernetFactory

Definition at line 36 of file ethernet-factory.cpp.

◆ EthernetTransport

◆ FaceSystem

Definition at line 35 of file face-system.cpp.

◆ SECTION_GENERAL

const std::string nfd::face::SECTION_GENERAL = "general"
static

Definition at line 37 of file face-system.cpp.

◆ SECTION_NETDEVBOUND

const std::string nfd::face::SECTION_NETDEVBOUND = "netdev_bound"
static

Definition at line 38 of file face-system.cpp.

◆ INVALID_FACEID

◆ FACEID_INTERNAL_FACE

const FaceId nfd::face::FACEID_INTERNAL_FACE = 1

identifies the InternalFace used in management

Definition at line 44 of file face.hpp.

◆ FACEID_CONTENT_STORE

const FaceId nfd::face::FACEID_CONTENT_STORE = 254

identifies a packet comes from the ContentStore

Definition at line 46 of file face.hpp.

Referenced by nfd::Forwarder::Forwarder(), and nfd::Nfd::initialize().

◆ FACEID_NULL

const FaceId nfd::face::FACEID_NULL = 255

identifies the NullFace that drops every packet

Definition at line 48 of file face.hpp.

Referenced by nfd::Nfd::initialize().

◆ FACEID_RESERVED_MAX

const FaceId nfd::face::FACEID_RESERVED_MAX = 255

upper bound of reserved FaceIds

Definition at line 50 of file face.hpp.

Referenced by nfd::FaceTable::add(), and nfd::FaceTable::addReserved().

◆ GenericLinkService

◆ DEFAULT_CONGESTION_THRESHOLD_DIVISOR

constexpr uint32_t nfd::face::DEFAULT_CONGESTION_THRESHOLD_DIVISOR = 2

Definition at line 37 of file generic-link-service.cpp.

◆ LinkService

Definition at line 32 of file link-service.cpp.

◆ LpFragmenter

Definition at line 34 of file lp-fragmenter.cpp.

◆ MAX_SINGLE_FRAG_OVERHEAD

const size_t nfd::face::MAX_SINGLE_FRAG_OVERHEAD
static
Initial value:
=
1 + 9 +
1 + 1 + 8 +
1 + 9

maximum overhead on a single fragment, not counting other NDNLPv2 headers

Definition at line 45 of file lp-fragmenter.cpp.

Referenced by nfd::face::LpFragmenter::fragmentPacket().

◆ MAX_FRAG_OVERHEAD

const size_t nfd::face::MAX_FRAG_OVERHEAD
static
Initial value:
=
1 + 9 +
1 + 1 + 8 +
1 + 1 + 8 +
1 + 1 + 8 +
1 + 9

maximum overhead of adding fragmentation to payload, not counting other NDNLPv2 headers

Definition at line 53 of file lp-fragmenter.cpp.

Referenced by nfd::face::LpFragmenter::fragmentPacket().

◆ LpReassembler

Definition at line 34 of file lp-reassembler.cpp.

◆ MulticastEthernetTransport

◆ NetdevBound

Definition at line 33 of file netdev-bound.cpp.

◆ TcpChannel

Definition at line 34 of file tcp-channel.cpp.

◆ TcpFactory

Definition at line 33 of file tcp-factory.cpp.

◆ Transport

Definition at line 32 of file transport.cpp.

◆ MTU_UNLIMITED

◆ MTU_INVALID

const ssize_t nfd::face::MTU_INVALID = -2

(for internal use) indicates MTU field is unset

Definition at line 100 of file transport.hpp.

◆ QUEUE_UNSUPPORTED

const ssize_t nfd::face::QUEUE_UNSUPPORTED = -1

indicates that the transport does not support reading the queue capacity/length

Definition at line 104 of file transport.hpp.

Referenced by ns3::ndn::NetDeviceTransport::getSendQueueLength(), nfd::face::Transport::getSendQueueLength(), and getTxQueueLength().

◆ QUEUE_ERROR

◆ UdpChannel

Definition at line 34 of file udp-channel.cpp.

◆ UdpFactory

Definition at line 40 of file udp-factory.cpp.

◆ UnicastEthernetTransport

◆ UnixStreamChannel

◆ UnixStreamFactory

◆ WebSocketChannel

◆ WebSocketFactory

◆ WebSocketTransport