Class PacketBuffer

Inheritance Relationships

Derived Types

Class Documentation

class PacketBuffer

Generatic Interface to raw packet data stored in memory. Provides a base class implemented for Ethernet Frames, IPV4 and UDP packets.

Subclassed by ska::pst::recv::EthernetFrame, ska::pst::recv::IPv4Packet, ska::pst::recv::UDPPacket

Public Functions

PacketBuffer()

Construct a new Packet Buffer object.

PacketBuffer(char *ptr, size_t length)

Construct a new Packet Buffer object with a memory address and size.

Parameters
  • ptr – memory address of the packet

  • length – length of the packet

char *data() const

Return a pointer to packet memory address.

Returns

char* pointer to the packet memory address

size_t size() const

Return the size of the packet.

Returns

size_t size of the packet

Protected Functions

template<typename T>
inline T get(size_t offset) const

Return a little endian representation of data in the packet.

Template Parameters

T – type of data to be returned

Parameters

offset – offset from the base memory address in the packet

Returns

T data returned

template<typename T>
inline T get_be(size_t offset) const

Return a big endian representation of data in the packet.

Template Parameters

T – type of data to be returned

Parameters

offset – offset from the base memory address in the packet

Returns

T data returned