Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
ipcMessageReader Class Reference

#include <ipcMessageReader.h>

List of all members.

Public Member Functions

 ipcMessageReader (const PRUint8 *inBuffer, PRUint32 bufferSize)
 ~ipcMessageReader ()
PRBool HasError ()
PRUint8 GetInt8 ()
PRUint16 GetInt16 ()
PRUint32 GetInt32 ()
PRInt32 GetBytes (void *destBuffer, PRInt32 n)
const PRUint8GetPtr ()
PRBool AdvancePtr (PRInt32 n)

Private Attributes

const PRUint8mBuf
const PRUint8mBufEnd
const PRUint8mBufPtr
PRBool mError

Detailed Description

Definition at line 52 of file ipcMessageReader.h.


Constructor & Destructor Documentation

ipcMessageReader::ipcMessageReader ( const PRUint8 inBuffer,
PRUint32  bufferSize 
) [inline]

Definition at line 55 of file ipcMessageReader.h.

                                                                                 :
                    mBuf(inBuffer), mBufEnd(inBuffer + bufferSize),
                    mBufPtr(mBuf),
                    mError(PR_FALSE)
                  { }

Definition at line 61 of file ipcMessageReader.h.

                  { }

Member Function Documentation

Definition at line 91 of file ipcMessageReader.cpp.

{
  const PRUint8 *newPtr = mBufPtr + n;
  if (newPtr >= mBuf && newPtr <= mBufEnd) {
    mBufPtr = newPtr;
    return PR_TRUE;
  }
  mError = PR_TRUE;
  return PR_FALSE;
}
PRInt32 ipcMessageReader::GetBytes ( void destBuffer,
PRInt32  n 
)

Definition at line 80 of file ipcMessageReader.cpp.

{
  if (mBufPtr + n <= mBufEnd) {
    memcpy(destBuffer, mBufPtr, n);
    mBufPtr += n;
    return n;
  }
  mError = PR_TRUE;
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 58 of file ipcMessageReader.cpp.

{
  if (mBufPtr + sizeof(PRUint16) <= mBufEnd) {
    PRUint8 temp[2] = { mBufPtr[0], mBufPtr[1] };
    mBufPtr += sizeof(PRUint16);
    return *(PRUint16*)temp;
  }
  mError = PR_TRUE;
  return 0;
}

Here is the caller graph for this function:

Definition at line 69 of file ipcMessageReader.cpp.

{
  if (mBufPtr + sizeof(PRUint32) <= mBufEnd) {
    PRUint8 temp[4] = { mBufPtr[0], mBufPtr[1], mBufPtr[2], mBufPtr[3] };
    mBufPtr += sizeof(PRUint32);
    return *(PRUint32*)temp;
  }
  mError = PR_TRUE;
  return 0;
}

Here is the caller graph for this function:

Definition at line 46 of file ipcMessageReader.cpp.

{
  if (mBufPtr < mBufEnd)
    return *mBufPtr++;
  mError = PR_TRUE;
  return 0;
}

Here is the caller graph for this function:

Definition at line 76 of file ipcMessageReader.h.

                  { return mBufPtr; }

Definition at line 67 of file ipcMessageReader.h.

                  { return mError; }

Member Data Documentation

Definition at line 84 of file ipcMessageReader.h.

Definition at line 84 of file ipcMessageReader.h.

Definition at line 85 of file ipcMessageReader.h.

Definition at line 86 of file ipcMessageReader.h.


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