nfd::face Namespace Reference

Classes

class  Channel
 Represents a channel that listens on a local endpoint. More...
 
class  DatagramTransport
 Implements a Transport for datagram-based protocols. More...
 
class  EthernetChannel
 Class implementing an 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 the 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 NFD's face system. More...
 
class  GenericLinkService
 GenericLinkService is a LinkService that implements the NDNLPv2 protocol. More...
 
class  GenericLinkServiceCounters
 Counters provided by GenericLinkService. More...
 
struct  GenericLinkServiceOptions
 Options that control the behavior of GenericLinkService. More...
 
class  InternalClientTransport
 Implements a client-side transport that can be paired with an InternalForwarderTransport. More...
 
class  InternalForwarderTransport
 Implements a forwarder-side transport that can be paired with another transport. More...
 
class  InternalTransportBase
 Abstracts a transport that can be paired with another. More...
 
class  IpAddressPredicate
 Represents a predicate to accept or reject an IP address. More...
 
class  LinkService
 The upper half 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  NetworkInterfacePredicate
 Represents a predicate to accept or reject a ndn::net::NetworkInterface. More...
 
class  NetworkPredicateBase
 
class  NullLinkService
 A LinkService that drops every packet. More...
 
class  NullTransport
 A Transport that drops every packet. 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 a Transport for stream-based protocols. More...
 
class  TcpChannel
 Class implementing a 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 half of a Face. More...
 
class  TransportCounters
 Counters provided by a transport. More...
 
class  UdpChannel
 Class implementing a 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 a 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 DetermineFaceScopeFromAddress = std::function< ndn::nfd::FaceScope(const boost::asio::ip::address &local, const boost::asio::ip::address &remote)>
 
using EndpointId = std::variant< std::monostate, ethernet::Address, udp::Endpoint >
 Identifies a remote endpoint on the link. More...
 
using FaceCreatedCallback = std::function< void(const shared_ptr< 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...
 
using FaceId = uint64_t
 Identifies a face. More...
 
using FaceState = TransportState
 Indicates the state of a face. More...
 

Enumerations

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

Functions

static void bindToDevice (int fd, const std::string &ifname)
 
void connectFaceClosedSignal (Face &face, std::function< void()> f)
 Invokes a callback when a face is closed. More...
 
static bool doesAddressMatchRule (const boost::asio::ip::address &address, const std::string &rule)
 
static bool doesMatchPattern (const std::string &ifname, const std::string &pattern)
 
static bool doesNetifMatchRule (const ndn::net::NetworkInterface &netif, const std::string &rule)
 
ssize_t getTxQueueLength (int fd)
 Obtain send queue length from a specified system socket. More...
 
static bool isLoopback (const boost::asio::ip::address &addr)
 
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 to each other. More...
 
shared_ptr< FacemakeNullFace (const FaceUri &uri=FaceUri("null://"))
 Returns a Face that has no underlying transport and drops every packet. More...
 
std::ostream & operator<< (std::ostream &os, const FaceLogHelper< Face > &flh)
 
std::ostream & operator<< (std::ostream &os, const FaceLogHelper< LinkService > &flh)
 
std::ostream & operator<< (std::ostream &os, const FaceLogHelper< LpFragmenter > &flh)
 
std::ostream & operator<< (std::ostream &os, const FaceLogHelper< LpReassembler > &flh)
 
std::ostream & operator<< (std::ostream &os, const FaceLogHelper< LpReliability > &flh)
 
template<typename T >
std::enable_if_t< std::is_base_of_v< LinkService, T > &&!std::is_same_v< LinkService, T >, std::ostream & > operator<< (std::ostream &os, const FaceLogHelper< T > &flh)
 
template<typename T >
std::enable_if_t< std::is_base_of_v< Transport, T > &&!std::is_same_v< Transport, T >, std::ostream & > operator<< (std::ostream &os, const FaceLogHelper< T > &flh)
 
std::ostream & operator<< (std::ostream &os, const FaceLogHelper< Transport > &flh)
 
std::ostream & operator<< (std::ostream &os, TransportState state)
 
static std::optional< ip::address > pickAddress (const net::NetworkInterface &netif, net::AddressFamily af)
 

Variables

const std::string CFGSEC_FACESYSTEM = "face_system"
 
const std::string CFGSEC_GENERAL = "general"
 
const std::string CFGSEC_GENERAL_FQ = CFGSEC_FACESYSTEM + ".general"
 
const std::string CFGSEC_NETDEVBOUND = "netdev_bound"
 
constexpr size_t CONGESTION_MARK_SIZE
 
constexpr FaceId FACEID_CONTENT_STORE = 254
 Identifies a packet comes from the ContentStore. More...
 
constexpr FaceId FACEID_INTERNAL_FACE = 1
 Identifies the InternalFace used in management. More...
 
constexpr FaceId FACEID_NULL = 255
 Identifies the NullFace that drops every packet. More...
 
constexpr FaceId FACEID_RESERVED_MAX = 255
 Upper bound of reserved FaceIds. More...
 
static class nfd::face::NfdAutoEthernetFactoryProtocolFactoryRegistrationClass g_nfdAutoEthernetFactoryProtocolFactoryRegistrationVariable
 
static class nfd::face::NfdAutoTcpFactoryProtocolFactoryRegistrationClass g_nfdAutoTcpFactoryProtocolFactoryRegistrationVariable
 
static class nfd::face::NfdAutoUdpFactoryProtocolFactoryRegistrationClass g_nfdAutoUdpFactoryProtocolFactoryRegistrationVariable
 
static class nfd::face::NfdAutoUnixStreamFactoryProtocolFactoryRegistrationClass g_nfdAutoUnixStreamFactoryProtocolFactoryRegistrationVariable
 
static class nfd::face::NfdAutoWebSocketFactoryProtocolFactoryRegistrationClass g_nfdAutoWebSocketFactoryProtocolFactoryRegistrationVariable
 
constexpr FaceId INVALID_FACEID = ndn::nfd::INVALID_FACE_ID
 Indicates an invalid FaceId. More...
 
constexpr size_t MAX_FRAG_OVERHEAD
 Maximum overhead of adding fragmentation to payload, not counting other NDNLPv2 headers. More...
 
constexpr size_t MAX_SINGLE_FRAG_OVERHEAD
 Maximum overhead on a single fragment, not counting other NDNLPv2 headers. More...
 
constexpr ssize_t MIN_MTU = 64
 Minimum MTU that may be set. More...
 
constexpr ssize_t MTU_INVALID = -2
 (for internal use) Indicates that the MTU field is unset. More...
 
constexpr ssize_t MTU_UNLIMITED = -1
 Indicates that the transport has no limit on payload size. More...
 
constexpr ssize_t QUEUE_ERROR = -2
 Indicates that the transport was unable to retrieve the queue capacity/length. More...
 
constexpr ssize_t QUEUE_UNSUPPORTED = -1
 Indicates that the transport does not support reading the queue capacity/length. More...
 

Typedef Documentation

◆ 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 43 of file tcp-channel.hpp.

◆ EndpointId

using nfd::face::EndpointId = typedef std::variant<std::monostate, ethernet::Address, udp::Endpoint>

Identifies a remote endpoint on the link.

This ID is only meaningful in the context of the same Transport. Incoming packets from the same remote endpoint have the same EndpointId, and incoming packets from different remote endpoints have different EndpointIds.

Typically, a point-to-point Transport has only one meaningful EndpointId, represented by std::monostate.

Definition at line 78 of file face-common.hpp.

◆ FaceCreatedCallback

using nfd::face::FaceCreatedCallback = typedef std::function<void(const shared_ptr<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 90 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 94 of file channel.hpp.

◆ FaceId

using nfd::face::FaceId = typedef uint64_t

Identifies a face.

Definition at line 48 of file face-common.hpp.

◆ FaceState

Indicates the state of a face.

Definition at line 41 of file face.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 37 of file transport.hpp.

Function Documentation

◆ bindToDevice()

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

Definition at line 115 of file multicast-udp-transport.cpp.

◆ connectFaceClosedSignal()

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

Invokes a callback when a 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 of face, and invokes f when the state becomes CLOSED.

Definition at line 46 of file channel.cpp.

◆ doesAddressMatchRule()

static bool nfd::face::doesAddressMatchRule ( const boost::asio::ip::address &  address,
const std::string &  rule 
)
static

Definition at line 200 of file network-predicate.cpp.

◆ doesMatchPattern()

static bool nfd::face::doesMatchPattern ( const std::string &  ifname,
const std::string &  pattern 
)
static

Definition at line 165 of file network-predicate.cpp.

◆ doesNetifMatchRule()

static bool nfd::face::doesNetifMatchRule ( const ndn::net::NetworkInterface &  netif,
const std::string &  rule 
)
static

Definition at line 173 of file network-predicate.cpp.

◆ 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 39 of file socket-utils.cpp.

◆ isLoopback()

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

Definition at line 34 of file websocket-transport.cpp.

◆ 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 to 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 34 of file internal-face.cpp.

◆ makeNullFace()

shared_ptr< Face > nfd::face::makeNullFace ( const FaceUri &  uri)

Returns a Face that has no underlying transport and drops every packet.

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

◆ operator<<() [1/9]

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

Definition at line 62 of file face.cpp.

◆ operator<<() [2/9]

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

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

◆ operator<<() [3/9]

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

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

◆ operator<<() [4/9]

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

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

◆ operator<<() [5/9]

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

Definition at line 399 of file lp-reliability.cpp.

◆ operator<<() [6/9]

template<typename T >
std::enable_if_t<std::is_base_of_v<LinkService, T> && !std::is_same_v<LinkService, T>, std::ostream&> nfd::face::operator<< ( std::ostream &  os,
const FaceLogHelper< T > &  flh 
)

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

◆ operator<<() [7/9]

template<typename T >
std::enable_if_t<std::is_base_of_v<Transport, T> && !std::is_same_v<Transport, T>, std::ostream&> nfd::face::operator<< ( std::ostream &  os,
const FaceLogHelper< T > &  flh 
)

Definition at line 443 of file transport.hpp.

◆ operator<<() [8/9]

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

Definition at line 214 of file transport.cpp.

◆ operator<<() [9/9]

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

Definition at line 33 of file transport.cpp.

◆ pickAddress()

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

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

Variable Documentation

◆ CFGSEC_FACESYSTEM

const std::string nfd::face::CFGSEC_FACESYSTEM = "face_system"

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

◆ CFGSEC_GENERAL

const std::string nfd::face::CFGSEC_GENERAL = "general"

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

◆ CFGSEC_GENERAL_FQ

const std::string nfd::face::CFGSEC_GENERAL_FQ = CFGSEC_FACESYSTEM + ".general"

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

◆ CFGSEC_NETDEVBOUND

const std::string nfd::face::CFGSEC_NETDEVBOUND = "netdev_bound"

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

◆ CONGESTION_MARK_SIZE

constexpr size_t nfd::face::CONGESTION_MARK_SIZE
constexpr
Initial value:
= tlv::sizeOfVarNumber(lp::tlv::CongestionMark) +
tlv::sizeOfVarNumber(sizeof(uint64_t)) +
tlv::sizeOfNonNegativeInteger(UINT64_MAX)

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

◆ FACEID_CONTENT_STORE

constexpr FaceId nfd::face::FACEID_CONTENT_STORE = 254
inlineconstexpr

Identifies a packet comes from the ContentStore.

Definition at line 55 of file face-common.hpp.

◆ FACEID_INTERNAL_FACE

constexpr FaceId nfd::face::FACEID_INTERNAL_FACE = 1
inlineconstexpr

Identifies the InternalFace used in management.

Definition at line 53 of file face-common.hpp.

◆ FACEID_NULL

constexpr FaceId nfd::face::FACEID_NULL = 255
inlineconstexpr

Identifies the NullFace that drops every packet.

Definition at line 57 of file face-common.hpp.

◆ FACEID_RESERVED_MAX

constexpr FaceId nfd::face::FACEID_RESERVED_MAX = 255
inlineconstexpr

Upper bound of reserved FaceIds.

Definition at line 59 of file face-common.hpp.

◆ g_nfdAutoEthernetFactoryProtocolFactoryRegistrationVariable

class nfd::face::NfdAutoEthernetFactoryProtocolFactoryRegistrationClass nfd::face::g_nfdAutoEthernetFactoryProtocolFactoryRegistrationVariable
static

◆ g_nfdAutoTcpFactoryProtocolFactoryRegistrationVariable

class nfd::face::NfdAutoTcpFactoryProtocolFactoryRegistrationClass nfd::face::g_nfdAutoTcpFactoryProtocolFactoryRegistrationVariable
static

◆ g_nfdAutoUdpFactoryProtocolFactoryRegistrationVariable

class nfd::face::NfdAutoUdpFactoryProtocolFactoryRegistrationClass nfd::face::g_nfdAutoUdpFactoryProtocolFactoryRegistrationVariable
static

◆ g_nfdAutoUnixStreamFactoryProtocolFactoryRegistrationVariable

class nfd::face::NfdAutoUnixStreamFactoryProtocolFactoryRegistrationClass nfd::face::g_nfdAutoUnixStreamFactoryProtocolFactoryRegistrationVariable
static

◆ g_nfdAutoWebSocketFactoryProtocolFactoryRegistrationVariable

class nfd::face::NfdAutoWebSocketFactoryProtocolFactoryRegistrationClass nfd::face::g_nfdAutoWebSocketFactoryProtocolFactoryRegistrationVariable
static

◆ INVALID_FACEID

constexpr FaceId nfd::face::INVALID_FACEID = ndn::nfd::INVALID_FACE_ID
inlineconstexpr

Indicates an invalid FaceId.

Definition at line 51 of file face-common.hpp.

◆ MAX_FRAG_OVERHEAD

constexpr size_t nfd::face::MAX_FRAG_OVERHEAD
constexpr
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 52 of file lp-fragmenter.cpp.

◆ MAX_SINGLE_FRAG_OVERHEAD

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

Maximum overhead on a single fragment, not counting other NDNLPv2 headers.

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

◆ MIN_MTU

constexpr ssize_t nfd::face::MIN_MTU = 64
inlineconstexpr

Minimum MTU that may be set.

This is done to ensure the NDNLPv2 fragmentation feature functions properly.

Definition at line 66 of file face-common.hpp.

◆ MTU_INVALID

constexpr ssize_t nfd::face::MTU_INVALID = -2
inlineconstexpr

(for internal use) Indicates that the MTU field is unset.

Definition at line 106 of file transport.hpp.

◆ MTU_UNLIMITED

constexpr ssize_t nfd::face::MTU_UNLIMITED = -1
inlineconstexpr

Indicates that the transport has no limit on payload size.

Definition at line 101 of file transport.hpp.

◆ QUEUE_ERROR

constexpr ssize_t nfd::face::QUEUE_ERROR = -2
inlineconstexpr

Indicates that the transport was unable to retrieve the queue capacity/length.

Definition at line 116 of file transport.hpp.

◆ QUEUE_UNSUPPORTED

constexpr ssize_t nfd::face::QUEUE_UNSUPPORTED = -1
inlineconstexpr

Indicates that the transport does not support reading the queue capacity/length.

Definition at line 111 of file transport.hpp.