Mana
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ManaServ::MessageIn Class Reference

Used for parsing an incoming message from manaserv. More...

#include <messagein.h>

Public Member Functions

 MessageIn (const char *data, unsigned int length)
 
uint16_t getId () const
 Returns the message ID.
 
unsigned int getLength () const
 Returns the message length.
 
unsigned int getUnreadLength () const
 Returns the length of unread data.
 
uint8_t readInt8 ()
 Reads an unsigned 8-bit integer from the message.
 
uint16_t readInt16 ()
 Reads an unsigned 16-bit integer from the message.
 
uint32_t readInt32 ()
 Reads an unsigned 32-bit integer from the message.
 
std::string readString (int length=-1)
 Reads a string.
 

Private Member Functions

bool readValueType (ManaServ::ValueType type)
 

Private Attributes

const char * mData
 The message data.
 
unsigned int mLength
 The length of the data.
 
unsigned short mId
 The message ID.
 
bool mDebugMode
 Includes debugging information.
 
unsigned int mPos
 Actual position in the packet.
 

Detailed Description

Used for parsing an incoming message from manaserv.

Definition at line 36 of file messagein.h.

Constructor & Destructor Documentation

◆ MessageIn()

ManaServ::MessageIn::MessageIn ( const char *  data,
unsigned int  length 
)

Definition at line 29 of file messagein.cpp.

Member Function Documentation

◆ getId()

uint16_t ManaServ::MessageIn::getId ( ) const
inline

Returns the message ID.

Definition at line 44 of file messagein.h.

◆ getLength()

unsigned int ManaServ::MessageIn::getLength ( ) const
inline

Returns the message length.

Definition at line 49 of file messagein.h.

◆ getUnreadLength()

unsigned int ManaServ::MessageIn::getUnreadLength ( ) const
inline

Returns the length of unread data.

Definition at line 54 of file messagein.h.

◆ readInt16()

uint16_t ManaServ::MessageIn::readInt16 ( )

Reads an unsigned 16-bit integer from the message.

Definition at line 58 of file messagein.cpp.

◆ readInt32()

uint32_t ManaServ::MessageIn::readInt32 ( )

Reads an unsigned 32-bit integer from the message.

Definition at line 75 of file messagein.cpp.

◆ readInt8()

uint8_t ManaServ::MessageIn::readInt8 ( )

Reads an unsigned 8-bit integer from the message.

Definition at line 43 of file messagein.cpp.

◆ readString()

std::string ManaServ::MessageIn::readString ( int  length = -1)

Reads a string.

If a length is not given (-1), it is assumed that the length of the string is stored in a short at the start of the string.

Definition at line 92 of file messagein.cpp.

◆ readValueType()

bool ManaServ::MessageIn::readValueType ( ManaServ::ValueType  type)
private

Definition at line 131 of file messagein.cpp.

Member Data Documentation

◆ mData

const char* ManaServ::MessageIn::mData
private

The message data.

Definition at line 84 of file messagein.h.

◆ mDebugMode

bool ManaServ::MessageIn::mDebugMode
private

Includes debugging information.

Definition at line 87 of file messagein.h.

◆ mId

unsigned short ManaServ::MessageIn::mId
private

The message ID.

Definition at line 86 of file messagein.h.

◆ mLength

unsigned int ManaServ::MessageIn::mLength
private

The length of the data.

Definition at line 85 of file messagein.h.

◆ mPos

unsigned int ManaServ::MessageIn::mPos
private

Actual position in the packet.

From 0 to packet->length. A value bigger than packet->length means EOP was reached when reading it.

Definition at line 93 of file messagein.h.


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