Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

MemBuf Class Reference

List of all members.

Public Member Functions

void addBuffer (MemBuf *nmb)
void addBuffer (const void *pAdr, u_int size)
u_int find (const void *pAdr, u_int size, u_int start=0)
u_int find (MemBuf *smb, u_int start=0)
u_int find (char c, u_int start=0)
int free ()
char & getAt (u_int nIndex)
char * getBuffer ()
char * getBuffersetLength (u_int newSize)
u_int getLength ()
int getPart (u_int nStart, u_int nEnd, MemBuf &result)
int getPartAsString (u_int nStart, u_int nEnd, MemBuf &result)
u_int getRealLength ()
void hashCRC (MemBuf &membuf)
void hashCRC (const void *pAdr, u_int nSize)
void hashMD5 (MemBuf &membuf)
void hashMD5 (const void *pAdr, u_int nSize)
void hex (MemBuf &membuf)
void hex (const void *pAdr, u_int nSize)
unsigned char hexCharToNumber (unsigned char c)
MemBuf hexToData (const void *pAdr, u_int nSize)
void intToStr (int i, char *pBufToUse, u_int nBufSize)
void intToStr (int i)
int isValid ()
 MemBuf (MemBuf &srcBuf, int bCopy)
 MemBuf (const MemBuf &srcBuf)
 MemBuf (const void *pAdr, u_int size)
 MemBuf ()
 operator const void * ()
MemBuf operator+ (const char *src)
MemBuf operator+ (MemBuf &src)
const MemBufoperator+= (char c)
const MemBufoperator+= (const char *pStr)
const MemBufoperator+= (MemBuf &add)
MemBufoperator<< (const string &src)
MemBufoperator<< (const MemBuf &src)
MemBufoperator<< (unsigned char c)
MemBufoperator<< (char c)
MemBufoperator<< (unsigned long i)
MemBufoperator<< (long i)
MemBufoperator<< (unsigned int i)
MemBufoperator<< (int i)
MemBufoperator<< (const char *pSrc)
MemBufoperator= (const char *src)
MemBufoperator= (const MemBuf &src)
char & operator[] (u_int nIndex)
void replace (char what, char by)
int setBuffer (const void *pAdr, u_int size)
void setExternalBuffer (const void *pAdr, u_int size)
void setLength (u_int newSize)
int strToInt (const char *pAdr)
u_int strToUint (const char *pAdr)
void uintToStr (u_int i, char *pBufToUse, u_int nBufSize)
void uintToStr (u_int i)
void xIntToStr (u_int i, int bNegative, char *pBufToUse, u_int nBufSize)
 ~MemBuf ()

Public Attributes

u_int m_nBlockLength
u_int m_nSizeLimit

Protected Member Functions

void allocBuffer (u_int size)
void xIntToStr (u_int i, int bNegative)

Protected Attributes

int m_bCanDelete
char * m_buffer
u_int m_nRealSize
u_int m_nSize

Static Protected Attributes

u_int crc32Table [256]

Constructor & Destructor Documentation

MemBuf::MemBuf  ) 
 

Default constructor

MemBuf::MemBuf const void *  pAdr,
u_int  size
 

Copy constructor pAdr : pointer to the buffer to copy size : size of pAdr

MemBuf::MemBuf const MemBuf srcBuf  ) 
 

Direct copy constructor (should only be used by the operators to avoid reallocations)

MemBuf::MemBuf MemBuf srcBuf,
int  bCopy
 

Copy constructor

MemBuf::~MemBuf  ) 
 

Destructor


Member Function Documentation

void MemBuf::addBuffer MemBuf nmb  ) 
 

void MemBuf::addBuffer const void *  pAdr,
u_int  size
 

Add a buffer at the end of the internal buffer. If the internal buffer isn't large enough, a reallocation is done until m_nSizeLimit is reached If m_nSizeLimit is equal to 0, reallocation are always done.

void MemBuf::allocBuffer u_int  size  )  [protected]
 

u_int MemBuf::find const void *  pAdr,
u_int  size,
u_int  start = 0
 

find a specific buffer in the internal buffer from a specific location

u_int MemBuf::find MemBuf smb,
u_int  start = 0
 

u_int MemBuf::find char  c,
u_int  start = 0
 

find a specific character in the internal buffer from a specific location

int MemBuf::free  ) 
 

free used memory

char & MemBuf::getAt u_int  nIndex  ) 
 

char * MemBuf::getBuffer  ) 
 

char * MemBuf::getBuffersetLength u_int  newSize  ) 
 

Return the internal buffer by setting previously a specific length

u_int MemBuf::getLength  ) 
 

int MemBuf::getPart u_int  nStart,
u_int  nEnd,
MemBuf result
 

Copy a part of the internal buffer in "result". Here, "result" is completly removed and replaced by this part.

int MemBuf::getPartAsString u_int  nStart,
u_int  nEnd,
MemBuf result
 

Copy a part of the internal buffer in "result". Here, "result" is completly removed and replaced by this part.

u_int MemBuf::getRealLength  ) 
 

Get the real allocated size.

void MemBuf::hashCRC MemBuf membuf  ) 
 

void MemBuf::hashCRC const void *  pAdr,
u_int  nSize
 

CRC hashing function

void MemBuf::hashMD5 MemBuf membuf  ) 
 

void MemBuf::hashMD5 const void *  pAdr,
u_int  nSize
 

MD5 hashing function

void MemBuf::hex MemBuf membuf  ) 
 

void MemBuf::hex const void *  pAdr,
u_int  nSize
 

Write to the MemBuf the hex representation of pAdr

unsigned char MemBuf::hexCharToNumber unsigned char  c  ) 
 

Return the decimal number of an hexadecimal character

MemBuf MemBuf::hexToData const void *  pAdr,
u_int  nSize
 

Return a MemBuf with the decoded hexadicmal string pointed at pAdr

void MemBuf::intToStr int  i,
char *  pBufToUse,
u_int  nBufSize
 

void MemBuf::intToStr int  i  ) 
 

int MemBuf::isValid  ) 
 

MemBuf::operator const void *  ) 
 

MemBuf MemBuf::operator+ const char *  src  ) 
 

MemBuf MemBuf::operator+ MemBuf src  ) 
 

const MemBuf & MemBuf::operator+= char  c  ) 
 

const MemBuf & MemBuf::operator+= const char *  pStr  ) 
 

const MemBuf & MemBuf::operator+= MemBuf add  ) 
 

MemBuf & MemBuf::operator<< const string &  src  ) 
 

MemBuf & MemBuf::operator<< const MemBuf src  ) 
 

MemBuf & MemBuf::operator<< unsigned char  c  ) 
 

MemBuf & MemBuf::operator<< char  c  ) 
 

MemBuf & MemBuf::operator<< unsigned long  i  ) 
 

MemBuf & MemBuf::operator<< long  i  ) 
 

MemBuf & MemBuf::operator<< unsigned int  i  ) 
 

MemBuf & MemBuf::operator<< int  i  ) 
 

MemBuf & MemBuf::operator<< const char *  pSrc  ) 
 

MemBuf & MemBuf::operator= const char *  src  ) 
 

MemBuf & MemBuf::operator= const MemBuf src  ) 
 

char & MemBuf::operator[] u_int  nIndex  ) 
 

void MemBuf::replace char  what,
char  by
 

replace a character by another

int MemBuf::setBuffer const void *  pAdr,
u_int  size
 

void MemBuf::setExternalBuffer const void *  pAdr,
u_int  size
 

Set an external buffer as the internal buffer. No memory copy are done. This can be useful to use variables from the stack. Ex.: unsigned char stackBuffer[10]; MemBuf buffer; buffer.setExternalBuffer(stackBuffer, 10); // here, you'll use the memory from stackBuffer

void MemBuf::setLength u_int  newSize  ) 
 

Set the length of the internal buffer. If the length is smallest than the existing one, no reallocation is done. if it's biggest, a reallocation is done until m_nSizeLimit is reached.

int MemBuf::strToInt const char *  pAdr  ) 
 

u_int MemBuf::strToUint const char *  pAdr  ) 
 

void MemBuf::uintToStr u_int  i,
char *  pBufToUse,
u_int  nBufSize
 

void MemBuf::uintToStr u_int  i  ) 
 

void MemBuf::xIntToStr u_int  i,
int  bNegative
[protected]
 

Return a MemBuf with the string representation of "i"

void MemBuf::xIntToStr u_int  i,
int  bNegative,
char *  pBufToUse,
u_int  nBufSize
 

Return a MemBuf with the string representation of "i" using an external buffer.


Member Data Documentation

u_int MemBuf::crc32Table [static, protected]
 

int MemBuf::m_bCanDelete [protected]
 

char* MemBuf::m_buffer [protected]
 

u_int MemBuf::m_nBlockLength
 

u_int MemBuf::m_nRealSize [protected]
 

u_int MemBuf::m_nSize [protected]
 

u_int MemBuf::m_nSizeLimit
 


Generated on Thu May 1 12:41:03 2008 for MyServer by  doxygen 1.3.9.1