nfd::face::LpReassembler Class Reference

Reassembles fragmented network-layer packets. More...

#include <daemon/face/lp-reassembler.hpp>

+ Inheritance diagram for nfd::face::LpReassembler:
+ Collaboration diagram for nfd::face::LpReassembler:

Classes

struct  Options
 Options that control the behavior of LpReassembler. More...
 

Public Member Functions

 LpReassembler (const Options &options, const LinkService *linkService=nullptr)
 
const LinkServicegetLinkService () const noexcept
 Returns the LinkService that owns this instance. More...
 
std::tuple< bool, Block, lp::Packet > receiveFragment (const EndpointId &remoteEndpoint, const lp::Packet &packet)
 Adds received fragment to the buffer. More...
 
void setOptions (const Options &options)
 Set options for reassembler. More...
 
size_t size () const noexcept
 Count of partial packets. More...
 

Public Attributes

signal::Signal< LpReassembler, EndpointId, size_t > beforeTimeout
 Notifies before a partial packet is dropped due to timeout. More...
 

Detailed Description

Reassembles fragmented network-layer packets.

See also
https://redmine.named-data.net/projects/nfd/wiki/NDNLPv2

Definition at line 43 of file lp-reassembler.hpp.

Constructor & Destructor Documentation

◆ LpReassembler()

nfd::face::LpReassembler::LpReassembler ( const Options options,
const LinkService linkService = nullptr 
)
explicit

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

Member Function Documentation

◆ getLinkService()

const LinkService* nfd::face::LpReassembler::getLinkService ( ) const
inlinenoexcept

Returns the LinkService that owns this instance.

This is only used for logging, and may be nullptr.

Definition at line 82 of file lp-reassembler.hpp.

◆ receiveFragment()

std::tuple< bool, Block, lp::Packet > nfd::face::LpReassembler::receiveFragment ( const EndpointId remoteEndpoint,
const lp::Packet &  packet 
)

Adds received fragment to the buffer.

Parameters
remoteEndpointendpoint that sent the packet
packetreceived fragment; must have Fragment field
Returns
a tuple containing: whether a network-layer packet has been completely received, the reassembled network-layer packet, the first fragment for inspecting other NDNLPv2 headers
Exceptions
tlv::Errorpacket is malformed

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

◆ setOptions()

void nfd::face::LpReassembler::setOptions ( const Options options)
inline

Set options for reassembler.

Definition at line 71 of file lp-reassembler.hpp.

◆ size()

size_t nfd::face::LpReassembler::size ( ) const
inlinenoexcept

Count of partial packets.

Definition at line 104 of file lp-reassembler.hpp.

Member Data Documentation

◆ beforeTimeout

signal::Signal<LpReassembler, EndpointId, size_t> nfd::face::LpReassembler::beforeTimeout

Notifies before a partial packet is dropped due to timeout.

If a partial packet is incomplete and no new fragments are received within Options::reassemblyTimeout, the partial packet is dropped due to timeout. Before dropping the packet, this signal is emitted with the remote endpoint and the number of fragments being dropped.

Definition at line 117 of file lp-reassembler.hpp.