generalization of a network interface More...
#include <face.hpp>
Classes | |
class | Options |
Options that control the behavior of GenericLinkService. More... | |
Public Types | |
using | Counters = GenericLinkServiceCounters |
counters provided by GenericLinkService More... | |
Public Types inherited from nfd::face::StreamTransport< boost::asio::ip::tcp > | |
using | protocol = boost::asio::ip::tcp |
Public Types inherited from nfd::face::Transport | |
using | Counters = TransportCounters |
Counters provided by a transport. More... | |
Public Types inherited from nfd::face::LinkService | |
typedef LinkServiceCounters | Counters |
counters provided by LinkService More... | |
Public Member Functions | |
Face (unique_ptr< LinkService > service, unique_ptr< Transport > transport) | |
LinkService * | getLinkService () const |
Transport * | getTransport () const |
void | close () |
Request that the face be closed. More... | |
void | sendInterest (const Interest &interest) |
send Interest More... | |
void | sendData (const Data &data) |
send Data More... | |
void | sendNack (const lp::Nack &nack) |
send Nack More... | |
FaceId | getId () const |
void | setId (FaceId id) |
sets face ID More... | |
void | setMetric (uint64_t metric) |
uint64_t | getMetric () const |
FaceUri | getLocalUri () const |
FaceUri | getRemoteUri () const |
ndn::nfd::FaceScope | getScope () const |
ndn::nfd::FacePersistency | getPersistency () const |
void | setPersistency (ndn::nfd::FacePersistency persistency) |
changes face persistency setting More... | |
ndn::nfd::LinkType | getLinkType () const |
ssize_t | getMtu () const |
Returns face effective MTU. More... | |
FaceState | getState () const |
time::steady_clock::TimePoint | getExpirationTime () const |
const FaceCounters & | getCounters () const |
FaceCounters & | getCounters () |
weak_ptr< Channel > | getChannel () const |
Get channel on which face was created (unicast) or the associated channel (multicast) More... | |
void | setChannel (weak_ptr< Channel > channel) |
Set channel on which face was created (unicast) or the associated channel (multicast) More... | |
GenericLinkService (const Options &options={}) | |
const Options & | getOptions () const |
get Options used by GenericLinkService More... | |
void | setOptions (const Options &options) |
sets Options used by GenericLinkService More... | |
const Counters & | getCounters () const NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL |
ssize_t | getEffectiveMtu () const NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL |
bool | canOverrideMtuTo (ssize_t mtu) const |
Whether MTU can be overridden to the specified value. More... | |
void | sendLpPacket (lp::Packet &&pkt) |
send an LpPacket More... | |
void | doSendInterest (const Interest &interest) NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL |
performs LinkService specific operations to send an Interest More... | |
void | doSendData (const Data &data) NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL |
performs LinkService specific operations to send a Data More... | |
void | doSendNack (const ndn::lp::Nack &nack) NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL |
performs LinkService specific operations to send a Nack More... | |
void | assignSequences (std::vector< lp::Packet > &pkts) |
assign consecutive sequence numbers to LpPackets More... | |
NullTransport (const FaceUri &localUri=FaceUri("null://"), const FaceUri &remoteUri=FaceUri("null://"), ndn::nfd::FaceScope scope=ndn::nfd::FACE_SCOPE_NON_LOCAL, ndn::nfd::FacePersistency persistency=ndn::nfd::FACE_PERSISTENCY_PERMANENT) | |
TcpTransport (protocol::socket &&socket, ndn::nfd::FacePersistency persistency, ndn::nfd::FaceScope faceScope) | |
ssize_t | getSendQueueLength () final |
Public Member Functions inherited from nfd::face::StreamTransport< boost::asio::ip::tcp > | |
StreamTransport (typename protocol::socket &&socket) | |
Construct stream transport. More... | |
ssize_t | getSendQueueLength () override |
Public Member Functions inherited from nfd::face::Transport | |
Transport () | |
Default constructor. More... | |
virtual | ~Transport () |
void | setFaceAndLinkService (Face &face, LinkService &service) |
set Face and LinkService for Transport More... | |
const Face * | getFace () const |
const LinkService * | getLinkService () const |
LinkService * | getLinkService () |
void | close () |
Request the transport to be closed. More... | |
void | send (const Block &packet) |
Send a link-layer packet. More... | |
FaceUri | getLocalUri () const |
FaceUri | getRemoteUri () const |
ndn::nfd::FaceScope | getScope () const |
ndn::nfd::FacePersistency | getPersistency () const |
bool | canChangePersistencyTo (ndn::nfd::FacePersistency newPersistency) const |
check whether the face persistency can be changed to newPersistency More... | |
void | setPersistency (ndn::nfd::FacePersistency newPersistency) |
changes face persistency setting More... | |
ndn::nfd::LinkType | getLinkType () const |
ssize_t | getMtu () const |
ssize_t | getSendQueueCapacity () const |
TransportState | getState () const |
time::steady_clock::TimePoint | getExpirationTime () const |
Public Member Functions inherited from nfd::face::LinkService | |
LinkService () | |
virtual | ~LinkService () |
void | setFaceAndTransport (Face &face, Transport &transport) |
set Face and Transport for LinkService More... | |
const Face * | getFace () const |
const Transport * | getTransport () const |
Transport * | getTransport () |
void | sendInterest (const Interest &interest) |
Send Interest. More... | |
void | sendData (const Data &data) |
Send Data. More... | |
void | sendNack (const ndn::lp::Nack &nack) |
Send Nack. More... | |
void | receivePacket (const Block &packet, const EndpointId &endpoint) |
performs LinkService specific operations to receive a lower-layer packet More... | |
Protected Member Functions | |
void | doClose () NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL |
performs Transport specific operations to close the transport More... | |
bool | canChangePersistencyToImpl (ndn::nfd::FacePersistency newPersistency) const final |
invoked by canChangePersistencyTo to perform the check More... | |
void | afterChangePersistency (ndn::nfd::FacePersistency oldPersistency) final |
invoked after the persistency has been changed More... | |
void | doClose () final |
performs Transport specific operations to close the transport More... | |
void | handleError (const boost::system::error_code &error) final |
NFD_VIRTUAL_WITH_TESTS void | handleReconnect (const boost::system::error_code &error) |
NFD_VIRTUAL_WITH_TESTS void | handleReconnectTimeout () |
Protected Member Functions inherited from nfd::face::StreamTransport< boost::asio::ip::tcp > | |
void | doClose () override |
performs Transport specific operations to close the transport More... | |
void | deferredClose () |
void | doSend (const Block &packet) override |
performs Transport specific operations to send a packet More... | |
void | sendFromQueue () |
void | handleSend (const boost::system::error_code &error, size_t nBytesSent) |
void | startReceive () |
void | handleReceive (const boost::system::error_code &error, size_t nBytesReceived) |
void | processErrorCode (const boost::system::error_code &error) |
void | resetReceiveBuffer () |
void | resetSendQueue () |
size_t | getSendQueueBytes () const |
NFD_LOG_MEMBER_DECL () | |
Protected Member Functions inherited from nfd::face::Transport | |
void | receive (const Block &packet, const EndpointId &endpoint=0) |
Pass a received link-layer packet to the upper layer for further processing. More... | |
void | setLocalUri (const FaceUri &uri) |
void | setRemoteUri (const FaceUri &uri) |
void | setScope (ndn::nfd::FaceScope scope) |
void | setLinkType (ndn::nfd::LinkType linkType) |
void | setMtu (ssize_t mtu) |
void | setSendQueueCapacity (ssize_t sendQueueCapacity) |
void | setState (TransportState newState) |
set transport state More... | |
void | setExpirationTime (const time::steady_clock::TimePoint &expirationTime) |
Protected Member Functions inherited from nfd::face::LinkService | |
void | receiveInterest (const Interest &interest, const EndpointId &endpoint) |
delivers received Interest to forwarding More... | |
void | receiveData (const Data &data, const EndpointId &endpoint) |
delivers received Data to forwarding More... | |
void | receiveNack (const lp::Nack &nack, const EndpointId &endpoint) |
delivers received Nack to forwarding More... | |
void | sendPacket (const Block &packet) |
send a lower-layer packet via Transport More... | |
void | notifyDroppedInterest (const Interest &packet) |
Protected Attributes | |
NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE | __pad1__: static time::milliseconds s_initialReconnectWait |
Protected Attributes inherited from nfd::face::StreamTransport< boost::asio::ip::tcp > | |
protocol::socket | m_socket |
Protected Attributes inherited from nfd::face::TransportCounters | |
PacketCounter | nInPackets |
count of incoming packets More... | |
PacketCounter | nOutPackets |
count of outgoing packets More... | |
ByteCounter | nInBytes |
total incoming bytes More... | |
ByteCounter | nOutBytes |
total outgoing bytes More... | |
Protected Attributes inherited from nfd::face::LinkServiceCounters | |
PacketCounter | nInInterests |
count of incoming Interests More... | |
PacketCounter | nOutInterests |
count of outgoing Interests More... | |
PacketCounter | nInterestsExceededRetx |
count of Interests dropped by reliability system for exceeding allowed number of retx More... | |
PacketCounter | nInData |
count of incoming Data packets More... | |
PacketCounter | nOutData |
count of outgoing Data packets More... | |
PacketCounter | nInNacks |
count of incoming Nacks More... | |
PacketCounter | nOutNacks |
count of outgoing Nacks More... | |
Protected Attributes inherited from nfd::face::GenericLinkServiceCounters | |
PacketCounter | nFragmentationErrors |
count of failed fragmentations More... | |
PacketCounter | nOutOverMtu |
count of outgoing LpPackets dropped due to exceeding MTU limit More... | |
PacketCounter | nInLpInvalid |
count of invalid LpPackets dropped before reassembly More... | |
SizeCounter< LpReassembler > | nReassembling |
count of network-layer packets currently being reassembled More... | |
PacketCounter | nReassemblyTimeouts |
count of dropped partial network-layer packets due to reassembly timeout More... | |
PacketCounter | nInNetInvalid |
count of invalid reassembled network-layer packets dropped More... | |
PacketCounter | nAcknowledged |
count of network-layer packets that did not require retransmission of a fragment More... | |
PacketCounter | nRetransmitted |
count of network-layer packets that had at least one fragment retransmitted, but were eventually received in full More... | |
PacketCounter | nRetxExhausted |
count of network-layer packets dropped because a fragment reached the maximum number of retransmissions More... | |
PacketCounter | nDuplicateSequence |
count of LpPackets dropped due to duplicate Sequence numbers More... | |
PacketCounter | nCongestionMarked |
count of outgoing LpPackets that were marked with congestion marks More... | |
Static Protected Attributes | |
static time::milliseconds | s_maxReconnectWait |
maximum amount of time to wait before a reconnection attempt More... | |
static float | s_reconnectWaitMultiplier |
multiplier for the exponential backoff of the reconnection timer More... | |
Friends | |
class | LpReliability |
generalization of a network interface
A Transport that communicates on a connected TCP socket.
A Transport that drops every packet.
GenericLinkService is a LinkService that implements the NDNLPv2 protocol.
A face generalizes a network interface. It provides best-effort network-layer packet delivery services on a physical interface, an overlay tunnel, or a link to a local application.
A face combines two parts: LinkService and Transport. Transport is the lower part, which provides best-effort TLV block deliveries. LinkService is the upper part, which translates between network-layer packets and TLV blocks, and may provide additional services such as fragmentation and reassembly.
When persistency is set to permanent, whenever the TCP connection is severed, the transport state is set to DOWN, and the connection is retried periodically with exponential backoff until it is reestablished
counters provided by GenericLinkService
Definition at line 179 of file generic-link-service.hpp.
nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::Face | ( | unique_ptr< LinkService > | service, |
unique_ptr< Transport > | transport | ||
) |
LinkService* nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::getLinkService | ( | ) | const |
Transport* nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::getTransport | ( | ) | const |
void nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::close | ( | ) |
Request that the face be closed.
This operation is effective only if face is in the UP or DOWN state; otherwise, it has no effect. The face will change state to CLOSING, and then perform a cleanup procedure. When the cleanup is complete, the state will be changed to CLOSED, which may happen synchronously or asynchronously.
void nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::sendInterest | ( | const Interest & | interest | ) |
send Interest
void nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::sendData | ( | const Data & | data | ) |
send Data
void nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::sendNack | ( | const lp::Nack & | nack | ) |
send Nack
FaceId nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::getId | ( | ) | const |
void nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::setId | ( | FaceId | id | ) |
sets face ID
void nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::setMetric | ( | uint64_t | metric | ) |
uint64_t nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::getMetric | ( | ) | const |
FaceUri nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::getLocalUri | ( | ) | const |
FaceUri nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::getRemoteUri | ( | ) | const |
ndn::nfd::FaceScope nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::getScope | ( | ) | const |
ndn::nfd::FacePersistency nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::getPersistency | ( | ) | const |
void nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::setPersistency | ( | ndn::nfd::FacePersistency | persistency | ) |
changes face persistency setting
ndn::nfd::LinkType nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::getLinkType | ( | ) | const |
ssize_t nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::getMtu | ( | ) | const |
Returns face effective MTU.
This function is a wrapper. The effective MTU of a face is determined by the link service.
FaceState nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::getState | ( | ) | const |
time::steady_clock::TimePoint nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::getExpirationTime | ( | ) | const |
time::steady_clock::TimePoint::max() | the face has an indefinite lifetime |
|
inlinevirtual |
Reimplemented from nfd::face::LinkService.
|
inline |
|
inline |
|
inline |
Set channel on which face was created (unicast) or the associated channel (multicast)
Definition at line 204 of file face.hpp.
References close(), Face, ndn::net::detail::getLinkType(), and nonstd::optional_lite::std11::move().
|
explicit |
const Options& nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::getOptions | ( | ) | const |
get Options used by GenericLinkService
void nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::setOptions | ( | const Options & | options | ) |
sets Options used by GenericLinkService
|
virtual |
Reimplemented from nfd::face::LinkService.
|
virtual |
Reimplemented from nfd::face::LinkService.
bool nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::canOverrideMtuTo | ( | ssize_t | mtu | ) | const |
Whether MTU can be overridden to the specified value.
If the transport MTU is unlimited, then this will always return false.
void nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::sendLpPacket | ( | lp::Packet && | pkt | ) |
send an LpPacket
|
virtual |
performs LinkService specific operations to send an Interest
Implements nfd::face::LinkService.
|
virtual |
performs LinkService specific operations to send a Data
Implements nfd::face::LinkService.
|
virtual |
performs LinkService specific operations to send a Nack
Implements nfd::face::LinkService.
void nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::assignSequences | ( | std::vector< lp::Packet > & | pkts | ) |
assign consecutive sequence numbers to LpPackets
|
explicit |
|
inlineprotectedvirtual |
performs Transport specific operations to close the transport
This is invoked once by close()
after changing state to CLOSING. It will not be invoked by Transport class if the transport is already CLOSING or CLOSED.
When the cleanup procedure is complete, this method should change state to CLOSED. This transition can happen synchronously or asynchronously.
Implements nfd::face::Transport.
Definition at line 47 of file null-transport.hpp.
References nfd::face::CLOSED, and NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL.
nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::TcpTransport | ( | protocol::socket && | socket, |
ndn::nfd::FacePersistency | persistency, | ||
ndn::nfd::FaceScope | faceScope | ||
) |
|
finalvirtual |
QUEUE_UNSUPPORTED | transport does not support queue length retrieval |
QUEUE_ERROR | transport was unable to retrieve the queue length |
Reimplemented from nfd::face::Transport.
|
finalprotectedvirtual |
invoked by canChangePersistencyTo to perform the check
Base class implementation returns false.
newPersistency | the new persistency, guaranteed to be different from current persistency |
Reimplemented from nfd::face::Transport.
|
finalprotectedvirtual |
invoked after the persistency has been changed
The base class implementation does nothing. When overridden in a subclass, the function should update internal states after persistency setting has been changed.
Reimplemented from nfd::face::Transport.
|
finalprotectedvirtual |
performs Transport specific operations to close the transport
This is invoked once by close()
after changing state to CLOSING. It will not be invoked by Transport class if the transport is already CLOSING or CLOSED.
When the cleanup procedure is complete, this method should change state to CLOSED. This transition can happen synchronously or asynchronously.
Implements nfd::face::Transport.
|
finalprotectedvirtual |
Reimplemented from nfd::face::StreamTransport< boost::asio::ip::tcp >.
|
protected |
|
protected |
|
friend |
Definition at line 321 of file generic-link-service.hpp.
signal::Signal<LinkService, Interest, EndpointId>& nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::afterReceiveInterest |
signal::Signal<LinkService, Data, EndpointId>& nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::afterReceiveData |
signal::Signal<LinkService, lp::Nack, EndpointId>& nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::afterReceiveNack |
signal::Signal<LinkService, Interest>& nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::onDroppedInterest |
signal::Signal<Transport, FaceState, FaceState>& nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::afterStateChange |
NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::__pad0__ |
Definition at line 211 of file generic-link-service.hpp.
|
protected |
Definition at line 77 of file tcp-transport.hpp.
|
staticprotected |
maximum amount of time to wait before a reconnection attempt
Definition at line 81 of file tcp-transport.hpp.
|
staticprotected |
multiplier for the exponential backoff of the reconnection timer
Definition at line 85 of file tcp-transport.hpp.