openikev2::ByteBuffer Class Reference

This class represents a byte buffer. More...

#include <bytebuffer.h>

Inheritance diagram for openikev2::ByteBuffer:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 ByteBuffer (uint32_t capacity)
 Creates a new ByteBuffer.
 ByteBuffer (const ByteBuffer &other)
 Creates a new ByteBuffer cloning another one.
 ByteBuffer (const ByteArray &byte_array)
 Creates a new ByteBuffer copying the data from a ByteArray.
virtual void writeBuffer (const void *buffer, uint32_t buffer_size)
 Appends a standard byte array at the end of this ByteBuffer.
virtual void writeByteArray (const ByteArray &byte_array)
 Appends a ByteArray at the end of this ByteBuffer.
virtual void writeInt8 (uint8_t value)
 Appends a 8 bit integer at the end of the ByteBuffer.
virtual void writeInt16 (uint16_t value)
 Appends a 16 bit integer at the end of the ByteBuffer, in network byte order.
virtual void writeInt32 (uint32_t value)
 Appends a 32 bit integer at the end of the ByteBuffer, in network byte order.
virtual void fillBytes (uint32_t num_bytes, uint8_t byte)
 Appends a 8 bit integer repeated num_bytes times.
virtual void readBuffer (uint32_t size_to_read, void *destination_buffer)
 Reads size bytes and stores them in destination_buffer.
virtual auto_ptr< ByteArrayreadByteArray (uint32_t size)
 Reads size bytes and stores them in a new ByteArray.
virtual uint8_t readInt8 ()
 Reads a 8 bit integer from the begin of the ByteBuffer.
virtual uint16_t readInt16 ()
 Reads a 16 bit integer from the begin of the ByteBuffer, in network byte order.
virtual uint32_t readInt32 ()
 Reads a 32 bit integer from the begin of the ByteBuffer, in network byte order.
virtual uint8_t * getWritePosition () const
 Gets the current write position.
virtual void setWritePosition (uint8_t *position)
 Sets the write position.
virtual uint8_t * getReadPosition () const
 Gets the current read position.
virtual void setReadPosition (uint8_t *position)
 Sets the read position.
virtual void reset ()
 Resets the pointers.
virtual void skip (uint32_t bytes)
 Skips the read of the indicated bytes.

Protected Member Functions

virtual uint32_t capacity () const
 Returns the internal array capacity.

Protected Attributes

uint8_t * real_begin_array
 Internal array.

Detailed Description

This class represents a byte buffer.

Author:
Alejandro Perez Mendez, Pedro J. Fernandez Ruiz <alejandro_perez@dif.um.es, pedroj.fernandez@dif.um.es>


Constructor & Destructor Documentation

openikev2::ByteBuffer::ByteBuffer ( uint32_t  capacity  ) 

Creates a new ByteBuffer.

Parameters:
capacity Capacity

openikev2::ByteBuffer::ByteBuffer ( const ByteBuffer other  ) 

Creates a new ByteBuffer cloning another one.

Parameters:
other Another ByteBuffer

openikev2::ByteBuffer::ByteBuffer ( const ByteArray byte_array  ) 

Creates a new ByteBuffer copying the data from a ByteArray.

Parameters:
byte_array ByteArray to copy the data


Member Function Documentation

uint32_t openikev2::ByteBuffer::capacity (  )  const [protected, virtual]

Returns the internal array capacity.

Returns:
The internal array capacity

Reimplemented from openikev2::ByteArray.

void openikev2::ByteBuffer::writeBuffer ( const void *  buffer,
uint32_t  buffer_size 
) [virtual]

Appends a standard byte array at the end of this ByteBuffer.

Parameters:
buffer Standard byte arrray
buffer_size Size of the byte array

void openikev2::ByteBuffer::writeByteArray ( const ByteArray byte_array  )  [virtual]

Appends a ByteArray at the end of this ByteBuffer.

Parameters:
byte_array Other ByteBuffer

void openikev2::ByteBuffer::writeInt8 ( uint8_t  value  )  [virtual]

Appends a 8 bit integer at the end of the ByteBuffer.

Parameters:
value 8 bit integer

void openikev2::ByteBuffer::writeInt16 ( uint16_t  value  )  [virtual]

Appends a 16 bit integer at the end of the ByteBuffer, in network byte order.

Parameters:
value 16 bit integer in host byte order

void openikev2::ByteBuffer::writeInt32 ( uint32_t  value  )  [virtual]

Appends a 32 bit integer at the end of the ByteBuffer, in network byte order.

Parameters:
value 32 bit integer in host byte order

void openikev2::ByteBuffer::fillBytes ( uint32_t  num_bytes,
uint8_t  byte 
) [virtual]

Appends a 8 bit integer repeated num_bytes times.

Parameters:
num_bytes Number of bytes
byte 8 bit value

void openikev2::ByteBuffer::readBuffer ( uint32_t  size_to_read,
void *  destination_buffer 
) [virtual]

Reads size bytes and stores them in destination_buffer.

Parameters:
size_to_read Size to read
destination_buffer Destination buffer

auto_ptr< ByteArray > openikev2::ByteBuffer::readByteArray ( uint32_t  size  )  [virtual]

Reads size bytes and stores them in a new ByteArray.

Parameters:
size Size to read
Returns:
New ByteArray with the read bytes

uint8_t openikev2::ByteBuffer::readInt8 (  )  [virtual]

Reads a 8 bit integer from the begin of the ByteBuffer.

Returns:
8 bit integer

uint16_t openikev2::ByteBuffer::readInt16 (  )  [virtual]

Reads a 16 bit integer from the begin of the ByteBuffer, in network byte order.

Returns:
16 bit integer in host byte order

uint32_t openikev2::ByteBuffer::readInt32 (  )  [virtual]

Reads a 32 bit integer from the begin of the ByteBuffer, in network byte order.

Returns:
32 bit integer in host byte order

uint8_t * openikev2::ByteBuffer::getWritePosition (  )  const [virtual]

Gets the current write position.

Returns:
Write position

void openikev2::ByteBuffer::setWritePosition ( uint8_t *  position  )  [virtual]

Sets the write position.

Parameters:
position New write position

uint8_t * openikev2::ByteBuffer::getReadPosition (  )  const [virtual]

Gets the current read position.

Returns:
Read position

void openikev2::ByteBuffer::setReadPosition ( uint8_t *  position  )  [virtual]

Sets the read position.

Parameters:
position New read position

void openikev2::ByteBuffer::skip ( uint32_t  bytes  )  [virtual]

Skips the read of the indicated bytes.

Parameters:
bytes Number of bytes to be skipped


Generated on Fri Jul 27 11:04:50 2007 for libopenikev2 by  doxygen 1.5.1