EMANE  1.2.1
EMANE::DownstreamPacket Class Reference

Specialized packet the allows downstream processing to add layer specific headers as the packet travels down the stack. Optionally, events can be attached to the packet to guarantee delivery before the packet. More...

#include <downstreampacket.h>

Public Types

using EventSerializations = std::list< std::tuple< EMANE::NEMId, EMANE::EventId, Serialization > >
 

Public Member Functions

 DownstreamPacket (const PacketInfo &info, const void *buf, size_t size)
 
 DownstreamPacket (const DownstreamPacket &)
 
DownstreamPacketoperator= (const DownstreamPacket &pkt)
 
 DownstreamPacket (DownstreamPacket &&pkt)
 
DownstreamPacketoperator= (DownstreamPacket &&pkt)
 
 ~DownstreamPacket ()
 
void prepend (const void *buf, size_t size)
 
void prependLengthPrefixFraming (std::uint16_t u16Length)
 
void prependLengthPrefixFramingLong (std::uint32_t u32Length)
 
Utils::VectorIO getVectorIO () const
 
size_t length () const
 
const PacketInfogetPacketInfo () const
 
void attachEvent (NEMId nemId, const Event &event)
 
const EventSerializationsgetEventSerializations () const
 

Detailed Description

Specialized packet the allows downstream processing to add layer specific headers as the packet travels down the stack. Optionally, events can be attached to the packet to guarantee delivery before the packet.

Definition at line 55 of file downstreampacket.h.

Member Typedef Documentation

◆ EventSerializations

Constructor & Destructor Documentation

◆ DownstreamPacket() [1/3]

EMANE::DownstreamPacket::DownstreamPacket ( const PacketInfo info,
const void *  buf,
size_t  size 
)

Creates a DownstreamPacket instance from a buffer

Parameters
infoThe PacketInfo to use
bufPointer to the buffer
sizeLength of the buffer

Definition at line 148 of file downstreampacket.cc.

◆ DownstreamPacket() [2/3]

EMANE::DownstreamPacket::DownstreamPacket ( const DownstreamPacket pkt)

Creates a DownstreamPacket instance by copying another instance

Definition at line 154 of file downstreampacket.cc.

◆ DownstreamPacket() [3/3]

EMANE::DownstreamPacket::DownstreamPacket ( DownstreamPacket &&  pkt)

Creates a DownstreamPacket instance by moving another instance

Definition at line 157 of file downstreampacket.cc.

◆ ~DownstreamPacket()

EMANE::DownstreamPacket::~DownstreamPacket ( )

Destroys an instance

Definition at line 160 of file downstreampacket.cc.

Member Function Documentation

◆ attachEvent()

void EMANE::DownstreamPacket::attachEvent ( NEMId  nemId,
const Event event 
)

Attach an event to the packet.

Parameters
nemIdNEM id of the event target. Use 0 for all NEMs
eventEvent to be attached

Definition at line 204 of file downstreampacket.cc.

◆ getEventSerializations()

const EMANE::DownstreamPacket::EventSerializations & EMANE::DownstreamPacket::getEventSerializations ( ) const

Gets any attached events in serialized form

Returns
reference to the event serializations

Definition at line 210 of file downstreampacket.cc.

◆ getPacketInfo()

const EMANE::PacketInfo & EMANE::DownstreamPacket::getPacketInfo ( ) const

Get a reference to the packet information

Returns
packet information

Definition at line 199 of file downstreampacket.cc.

◆ getVectorIO()

EMANE::Utils::VectorIO EMANE::DownstreamPacket::getVectorIO ( ) const

Gets a vectored IO representation of the packet.

Returns
vectored IO instance
Note
Packet data is not copied.

Definition at line 189 of file downstreampacket.cc.

◆ length()

size_t EMANE::DownstreamPacket::length ( ) const

Gets the overall packet length which is a summation of all the vectored IO segments.

Returns
size in bytes

Definition at line 194 of file downstreampacket.cc.

◆ operator=() [1/2]

EMANE::DownstreamPacket & EMANE::DownstreamPacket::operator= ( const DownstreamPacket pkt)

Creates a DownstreamPacket instance by copying another instance

Definition at line 162 of file downstreampacket.cc.

◆ operator=() [2/2]

EMANE::DownstreamPacket & EMANE::DownstreamPacket::operator= ( DownstreamPacket &&  pkt)

Creates a DownstreamPacket instance by moving another instance

Definition at line 168 of file downstreampacket.cc.

◆ prepend()

void EMANE::DownstreamPacket::prepend ( const void *  buf,
size_t  size 
)

Prepends bytes of buf to the beginning of packet. This method is used to add layer specific headers to a packet

Parameters
bufPointer to the start of the layer specific data
sizeNumber of bytes to prepend

Definition at line 174 of file downstreampacket.cc.

◆ prependLengthPrefixFraming()

void EMANE::DownstreamPacket::prependLengthPrefixFraming ( std::uint16_t  u16Length)

Prepends an unsigned 16 bit length value to the beginning of the packet. This method is used in conjunction with prefix length framing.

Parameters
u16Lengthvalue to be prepended
Note
Value prepended in network byte order

Definition at line 179 of file downstreampacket.cc.

◆ prependLengthPrefixFramingLong()

void EMANE::DownstreamPacket::prependLengthPrefixFramingLong ( std::uint32_t  u32Length)

Prepends an unsigned 32 bit length value to the beginning of the packet. This method is used in conjunction with prefix length framing.

Parameters
u32Lengthvalue to be prepended
Note
Value prepended in network byte order

Definition at line 184 of file downstreampacket.cc.


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