20 #ifndef SGCTP_CPAYLOAD_HPP
21 #define SGCTP_CPAYLOAD_HPP
63 return (
unsigned char*)malloc(
BUFFER_SIZE *
sizeof(
unsigned char ) );
72 memset( _pucBuffer, 0,
BUFFER_SIZE *
sizeof(
unsigned char ) );
118 void putBits( uint8_t _ui8tBitsSize,
125 void putBytes( uint16_t _ui16tBytesSize,
126 const unsigned char *_pucBytes );
132 uint8_t
getBits( uint8_t _ui8tBitsSize );
138 void getBytes( uint16_t _ui16tBytesSize,
139 unsigned char *_pucBytes );
156 virtual int serialize(
unsigned char *_pucBuffer,
157 const CData &_roData );
165 const unsigned char *_pucBuffer,
166 uint16_t _ui16tBufferSize );
174 #endif // SGCTP_CPAYLOAD_HPP
virtual int unserialize(CData *_poData, const unsigned char *_pucBuffer, uint16_t _ui16tBufferSize)
Unserialize the SGCTP data from the given payload buffer.
static const uint16_t BUFFER_SIZE
Buffer size required for payload (un-)serialization.
static void freeBuffer(unsigned char *_pucBuffer)
Free a buffer allocated for payload (un-)serialization.
uint8_t getBits(uint8_t _ui8tBitsSize)
Retrieve the given bits from the payload.
uint32_t ui32tBufferBitOffset
SGCTP payload bit position.
virtual void free()
Free resources for payload (un-)serialization.
virtual int serialize(unsigned char *_pucBuffer, const CData &_roData)
Serialize the given SGCTP data into the given payload buffer.
void putBytes(uint16_t _ui16tBytesSize, const unsigned char *_pucBytes)
Add the given bytes to the payload.
unsigned char * pucBufferPut
SGCTP payload export buffer pointer.
void putBits(uint8_t _ui8tBitsSize, uint8_t _ui8tBits)
Add the given bits to the payload.
virtual int alloc()
Allocate resources for payload (un-)serialization.
static void zeroBuffer(unsigned char *_pucBuffer)
Zero-out a buffer required for payload (un-)serialization.
const unsigned char * pucBufferGet
SGCTP payload import buffer pointer.
static const uint8_t BITMASK[9]
Bit masks used to (un-)serialize data bit-per-bit.
void getBytes(uint16_t _ui16tBytesSize, unsigned char *_pucBytes)
Retrieve the given bytes from the payload.
static unsigned char * allocBuffer()
Allocate a buffer for payload (un-)serialization.