Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
message_buff Class Reference

message buffer More...

#include <dnsmessage.h>

+ Collaboration diagram for message_buff:

Public Member Functions

 message_buff (unsigned char *_msg, int _len, bool is_dynamic=false)
 static constructor
 message_buff (const message_buff &buff)
 copy constructor
 message_buff ()
 dynamic constructor
 ~message_buff ()
 destructor
message_buffoperator= (const message_buff &buff)
 assignment operator

Public Attributes

bool is_static
 whether the message is static
int len
 buffer length
unsigned char * msg
 buffer

Detailed Description

message buffer

This is a structure that can hold a piece of binary data and its length. Depending on the way it is constructed, or whether is_static is set, it will choose whether or not to free the resources associated with it upon destruction.

Constructor & Destructor Documentation

message_buff::message_buff ( unsigned char *  _msg,
int  _len,
bool  is_dynamic = false 
)

static constructor

This constructor will just set the msg pointer to the address pointed to by _msg, and copy the length. It will not copy the data, and, when the structure is destroyed, the data will not be freed (e.g., it sets is_static to true), unless you set is_dynamic to true.

Parameters
_msgSource data
_lenSource length
is_dynamicWhether the data is dynamic.
message_buff::message_buff ( const message_buff buff)

copy constructor

This constructor will copy the specified message buffer. If the source message buffer is dynamic (e.g. buff.is_static is false), the data will be dynamically copied.

Parameters
buffThe buffer to copy
message_buff::message_buff ( )

dynamic constructor

This constructor will set msg to NULL, len to 0 and is_static to false. Thus, it will creatr a dynamic message buffer whose msg will be destroyed by the destructor.

message_buff::~message_buff ( )

destructor

If is_static is set to false, this destructor will free the memory associated with msg.

Member Function Documentation

message_buff & message_buff::operator= ( const message_buff buff)

assignment operator

This operator will copy the given message buffer. It works the same as message_buff(const messagebuf &buff).

Parameters
buffMessage buffer to copy

Member Data Documentation

bool message_buff::is_static

whether the message is static

This determines whether the msg field is static - that is, whether it should be freed by the message_buffer ( false ) or not. The default value of this depends on the used constructor.

int message_buff::len

buffer length

The length, in bytes, of the data pointed to by msg.

unsigned char* message_buff::msg

buffer

The data the message_buff holds.


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