Class for storing data to be sent / received across the network.
#include <nrg_packet.h>
Public Member Functions | |
| Packet () | |
| Default Constructor. | |
| Packet (size_t initial_size) | |
| Constructor with explicit initial size. | |
| Packet (const Packet ©) | |
| Copy Constructor. | |
| Packet & | operator= (const Packet &other) |
| Assignment operator. | |
| virtual | ~Packet () |
| Standard Destructor. | |
| PacketWritable & | write8 (const uint8_t &v) |
| Write a uint8_t, automatically converting endianness. | |
| PacketWritable & | write16 (const uint16_t &v) |
| Write a uint16_t, automatically converting endianness. | |
| PacketWritable & | write32 (const uint32_t &v) |
| Write a uint32_t, automatically converting endianness. | |
| PacketWritable & | write64 (const uint64_t &v) |
| Write a uint64_t, automatically converting endianness. | |
| PacketWritable & | writeArray (const void *v, size_t size) |
Write an array of size size, no endian conversion is performed. | |
| template<typename T > | |
| void | writeBE (const T &be_v) |
| Generic write function without endian conversion, be careful with types like size_t that differ across platforms! | |
| template<typename T > | |
| void | write (const T &v) |
| Generic write function with endian conversion, be careful with types like size_t that differ across platforms! | |
| PacketReadable & | read8 (uint8_t &v) |
| Read a uint8_t, automatically converting endianness. | |
| PacketReadable & | read16 (uint16_t &v) |
| Read a uint16_t, automatically converting endianness. | |
| PacketReadable & | read32 (uint32_t &v) |
| Read a uint32_t, automatically converting endianness. | |
| PacketReadable & | read64 (uint64_t &v) |
| Read a uint64_t, automatically converting endianness. | |
| PacketReadable & | readArray (uint8_t *v, size_t size) |
Read an array of size size into v, make sure it's big enough! | |
| template<typename T > | |
| void | readBE (T &be_v) |
| Generic read function without endian conversion, be careful with types like size_t that differ across platforms! | |
| template<typename T > | |
| void | read (T &v) |
| Generic read function with endian conversion, be careful with types like size_t that differ across platforms! | |
| virtual Packet & | reset () |
| Clears all data in the Packet. | |
| Packet & | seek (off_t offset, int whence) |
| Seeks the packet to some offset using SEEK_SET, SEEK_CUR or SEEK_END. | |
| off_t | tell () const |
| Get the current offset of this Packet's internal pointer. | |
| size_t | size () const |
| Get the total used-size of this packet. | |
| size_t | remaining () const |
| Get the amount of data that can be read from the internal pointer's current position. | |
| const uint8_t * | getPointer () const |
| Returns the internal pointer. | |
| const uint8_t * | getBasePointer () const |
| Returns the base address of the packet's data without affecting the internal pointer. | |
Public Member Functions inherited from nrg::PacketReadable | |
| virtual | ~PacketReadable () |
| Standard Destructor. | |
Public Member Functions inherited from nrg::PacketWritable | |
| virtual | ~PacketWritable () |
| Standard Destructor. | |