EMANE  1.2.1
EMANE::UpstreamPacket Class Reference

A Packet class that allows upstream processing to strip layer headers as the packet travels up the stack towards the emulation/application boundary (transport). More...

#include <upstreampacket.h>

Public Member Functions

 UpstreamPacket (const PacketInfo &info, const void *buf, size_t len)
 
 UpstreamPacket (const PacketInfo &info, const Utils::VectorIO &vectorIO)
 
 UpstreamPacket (const UpstreamPacket &)
 
UpstreamPacketoperator= (const UpstreamPacket &pkt)
 
 UpstreamPacket (UpstreamPacket &&pkt)
 
UpstreamPacketoperator= (UpstreamPacket &&pkt)
 
 ~UpstreamPacket ()
 
size_t strip (size_t size)
 
std::uint16_t stripLengthPrefixFraming ()
 
std::uint32_t stripLengthPrefixFramingLong ()
 
const void * get () const
 
size_t length () const
 
const PacketInfogetPacketInfo () const
 

Detailed Description

A Packet class that allows upstream processing to strip layer headers as the packet travels up the stack towards the emulation/application boundary (transport).

Definition at line 52 of file upstreampacket.h.

Constructor & Destructor Documentation

◆ UpstreamPacket() [1/4]

EMANE::UpstreamPacket::UpstreamPacket ( const PacketInfo info,
const void *  buf,
size_t  len 
)

Creates an UpstreamPacket instance from a buffer

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

Definition at line 150 of file upstreampacket.cc.

◆ UpstreamPacket() [2/4]

EMANE::UpstreamPacket::UpstreamPacket ( const PacketInfo info,
const Utils::VectorIO vectorIO 
)

Creates an UpstreamPacket instance from a Utils::VectorIO

Parameters
infoThe PacketInfo to use
vectorIOVectored IO object
Note
A deep copy is performed and the internal packet data is stored contiguously

Definition at line 155 of file upstreampacket.cc.

◆ UpstreamPacket() [3/4]

EMANE::UpstreamPacket::UpstreamPacket ( const UpstreamPacket pkt)

Creates an UpstreamPacket instance by copying another instance

Definition at line 159 of file upstreampacket.cc.

◆ UpstreamPacket() [4/4]

EMANE::UpstreamPacket::UpstreamPacket ( UpstreamPacket &&  pkt)

Creates an UpstreamPacket instance by moving another instance

Definition at line 162 of file upstreampacket.cc.

◆ ~UpstreamPacket()

EMANE::UpstreamPacket::~UpstreamPacket ( )

Destroys an UpstreamPacket instance

Definition at line 165 of file upstreampacket.cc.

Member Function Documentation

◆ get()

const void * EMANE::UpstreamPacket::get ( ) const

Gets a pointer to the internal buffer holding the message

Returns
Pointer to message or 0 if the packet was not combined or if there is no data

Definition at line 196 of file upstreampacket.cc.

◆ getPacketInfo()

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

Gets a reference to the packet information

Returns
packet information

Definition at line 208 of file upstreampacket.cc.

◆ length()

size_t EMANE::UpstreamPacket::length ( ) const

Gets the packet length in bytes

Returns
length in bytes

Definition at line 202 of file upstreampacket.cc.

◆ operator=() [1/2]

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

Sets an UpstreamPacket instance to a copy of another instance

Definition at line 167 of file upstreampacket.cc.

◆ operator=() [2/2]

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

Sets and UpstreamPacket instance by moving another instance

Definition at line 173 of file upstreampacket.cc.

◆ strip()

size_t EMANE::UpstreamPacket::strip ( size_t  size)

Removes size bytes from the beginning of a packet. This method is used to remove layer specific headers from a packet after they are processed.

Parameters
sizeNumber of bytes to strip from the head of the packet.
Returns
bytes stripped

Definition at line 180 of file upstreampacket.cc.

◆ stripLengthPrefixFraming()

std::uint16_t EMANE::UpstreamPacket::stripLengthPrefixFraming ( )

Removes 2 bytes for the beginning of the packet and returns them as an unsigned 16-bit integer in host byte order.

Returns
The prefixed length value

Definition at line 186 of file upstreampacket.cc.

◆ stripLengthPrefixFramingLong()

std::uint32_t EMANE::UpstreamPacket::stripLengthPrefixFramingLong ( )

Removes 4 bytes for the beginning of the packet and returns them as an unsigned 32-bit integer in host byte order.

Returns
The prefixed length value

Definition at line 191 of file upstreampacket.cc.


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