UT_NetPacket Class Reference

#include <UT_NetPacket.h>

List of all members.

Public Types

enum  { PacketCompress = 0x01, PacketCrypt = 0x02 }

Public Member Functions

 UT_NetPacket (unsigned bufsize=4096)
virtual ~UT_NetPacket ()
int writeData (UT_NetSocket &sock, const void *data, unsigned len)
int writeData (UT_NetSocket &sock, const char *data)
int flush (UT_NetSocket &sock)
int readPacketLength (UT_NetSocket &sock, int *timeout_ms=NULL)
int readPacketData (UT_NetSocket &sock, void *buf, unsigned len, int *timeout_ms=NULL)
int readPacketData (UT_NetSocket &sock, UT_WorkBuffer &buf, unsigned int len, int *timeout_ms=NULL)
void * readPacket (UT_NetSocket &sock, unsigned &len, int timeout_ms=-1)
unsigned readPacket (UT_NetSocket &sock, void *data, unsigned size, int timeout_ms=-1)
unsigned readPacket (UT_NetSocket &sock, UT_WorkBuffer &wbuf, int timeout_ms=-1)
void setFlag (unsigned flag)
void clearFlag (unsigned flag)
int getFlag (unsigned flag) const
unsigned getDataSize () const
void limitDataSize (unsigned maxsize=4096)
void * steal ()

Static Public Member Functions

static UT_NetSocketacceptClient (UT_NetSocket &server, int blocking=1, int timeout=10)
static const char * getUserHost ()
static int matchIPMask (const char *mask, const char *address, UT_NetSocket *socket)
static bool matchServerClientIPs (const unsigned short server[4], const unsigned short client[4], const char *mask_pattern)
static UT_NetSocketconnectToServer (const char *host=0, int port=-1, int blocking=1, int timeout=5, int forcesocket=0)
static int getDefaultServerPort ()
static void disconnectFromServer (UT_NetSocket *socket)

Protected Member Functions

void growBuffer (unsigned len, unsigned doshrink=0)


Detailed Description

Definition at line 36 of file UT_NetPacket.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
PacketCompress 
PacketCrypt 

Definition at line 91 of file UT_NetPacket.h.


Constructor & Destructor Documentation

UT_NetPacket::UT_NetPacket ( unsigned  bufsize = 4096  )  [explicit]

virtual UT_NetPacket::~UT_NetPacket (  )  [virtual]


Member Function Documentation

static UT_NetSocket* UT_NetPacket::acceptClient ( UT_NetSocket server,
int  blocking = 1,
int  timeout = 10 
) [static]

void UT_NetPacket::clearFlag ( unsigned  flag  )  [inline]

Definition at line 167 of file UT_NetPacket.h.

static UT_NetSocket* UT_NetPacket::connectToServer ( const char *  host = 0,
int  port = -1,
int  blocking = 1,
int  timeout = 5,
int  forcesocket = 0 
) [static]

static void UT_NetPacket::disconnectFromServer ( UT_NetSocket socket  )  [static]

int UT_NetPacket::flush ( UT_NetSocket sock  ) 

unsigned UT_NetPacket::getDataSize (  )  const [inline]

Definition at line 170 of file UT_NetPacket.h.

static int UT_NetPacket::getDefaultServerPort (  )  [static]

int UT_NetPacket::getFlag ( unsigned  flag  )  const [inline]

Definition at line 168 of file UT_NetPacket.h.

static const char* UT_NetPacket::getUserHost (  )  [static]

void UT_NetPacket::growBuffer ( unsigned  len,
unsigned  doshrink = 0 
) [protected]

void UT_NetPacket::limitDataSize ( unsigned  maxsize = 4096  )  [inline]

Definition at line 171 of file UT_NetPacket.h.

static int UT_NetPacket::matchIPMask ( const char *  mask,
const char *  address,
UT_NetSocket socket 
) [static]

static bool UT_NetPacket::matchServerClientIPs ( const unsigned short  server[4],
const unsigned short  client[4],
const char *  mask_pattern 
) [static]

unsigned UT_NetPacket::readPacket ( UT_NetSocket sock,
UT_WorkBuffer wbuf,
int  timeout_ms = -1 
)

unsigned UT_NetPacket::readPacket ( UT_NetSocket sock,
void *  data,
unsigned  size,
int  timeout_ms = -1 
) [inline]

Definition at line 146 of file UT_NetPacket.h.

void* UT_NetPacket::readPacket ( UT_NetSocket sock,
unsigned &  len,
int  timeout_ms = -1 
) [inline]

Definition at line 128 of file UT_NetPacket.h.

int UT_NetPacket::readPacketData ( UT_NetSocket sock,
UT_WorkBuffer buf,
unsigned int  len,
int *  timeout_ms = NULL 
)

int UT_NetPacket::readPacketData ( UT_NetSocket sock,
void *  buf,
unsigned  len,
int *  timeout_ms = NULL 
)

int UT_NetPacket::readPacketLength ( UT_NetSocket sock,
int *  timeout_ms = NULL 
)

void UT_NetPacket::setFlag ( unsigned  flag  )  [inline]

Definition at line 166 of file UT_NetPacket.h.

void* UT_NetPacket::steal (  )  [inline]

Definition at line 176 of file UT_NetPacket.h.

int UT_NetPacket::writeData ( UT_NetSocket sock,
const char *  data 
) [inline]

Definition at line 101 of file UT_NetPacket.h.

int UT_NetPacket::writeData ( UT_NetSocket sock,
const void *  data,
unsigned  len 
)


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

Generated on Mon Jan 28 00:49:08 2013 for HDK by  doxygen 1.5.9