esp8266ndn
NDN Arduino library for ESP8266 and more
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
ndnph::lp::Reassembler Class Reference

NDNLPv2 fragmenter. More...

#include <lp.hpp>

Inherits ndnph::WithRegion.

Public Member Functions

 Reassembler (Region &region)
 Constructor. More...
 
void discard ()
 Discard the reassembly buffer. More...
 
bool add (const Fragment &frag)
 Add a fragment. More...
 
PacketClassify reassemble () const
 Reassemble the packet if it's complete. More...
 
- Public Member Functions inherited from ndnph::WithRegion
 WithRegion (WithRegion &&)=default
 

Additional Inherited Members

- Protected Member Functions inherited from ndnph::WithRegion
 WithRegion (Region &region)
 
 WithRegion (const WithRegion &)=delete
 
WithRegionoperator= (const WithRegion &)=delete
 
- Protected Attributes inherited from ndnph::WithRegion
Regionregion
 

Detailed Description

NDNLPv2 fragmenter.

Constructor & Destructor Documentation

◆ Reassembler()

ndnph::lp::Reassembler::Reassembler ( Region region)
inlineexplicit

Constructor.

Parameters
regionwhere to allocate memory for fragment payloads. This region may be shared with others fragmenters and reassemblers.

Member Function Documentation

◆ add()

bool ndnph::lp::Reassembler::add ( const Fragment frag)
inline

Add a fragment.

If FragIndex is 0:

  • Discard the existing reassembly buffer.
  • Start a new reassembly buffer in the region passed to the constructor.
  • Return true.

If frag comes after the previous fragment:

  • Append to the existing reassembly buffer.
  • Return true.

Otherwise:

  • Return false.

◆ discard()

void ndnph::lp::Reassembler::discard ( )
inline

Discard the reassembly buffer.

When the region is reset elsewhere (e.g. in another fragmenter or reassembler sharing the region), this function should be invoked to discard the reassembly buffer. Otherwise, undefined behavior may occur.

◆ reassemble()

PacketClassify ndnph::lp::Reassembler::reassemble ( ) const
inline

Reassemble the packet if it's complete.

If the reassembly buffer contains a complete packet, return the reassembled packet. Otherwise, return a PacketClassify with Type::None .


The documentation for this class was generated from the following file: