NLNET::CCallbackClient Class Reference

Client class for layer 3. More...

#include <callback_client.h>

Inherits NLNET::CCallbackNetBase, and NLNET::CBufClient.

List of all members.

Public Member Functions

 CCallbackClient (TRecordingState rec=Off, const std::string &recfilename="", bool recordall=true, bool initPipeForDataAvailable=true)
 Constructor.
 ~CCallbackClient ()
void send (const CMessage &buffer, TSockId hostid=InvalidSockId, bool log=true)
 Sends a message to the remote host (the second parameter isn't used).
bool flush (TSockId hostid=InvalidSockId, uint *nbBytesRemaining=NULL)
 Force to send all data pending in the send queue. hostid must be InvalidSockId here. See comment in CCallbackNetBase.
void update2 (sint32 timeout=-1, sint32 mintime=0)
 Updates the network (call this method evenly).
void update (sint32 timeout=0)
 Updates the network (call this method evenly) (legacy).
void connect (const CInetAddress &addr)
 Connects to the specified host.
virtual bool connected () const
 Returns true if the connection is still connected (changed when a disconnection event has reached the front of the receive queue, just before calling the disconnection callback if there is one).
virtual const CInetAddresshostAddress (TSockId)
 Returns the address of the specified host.
void disconnect (TSockId hostid=InvalidSockId)
 Disconnect a connection Unlike in CCallbackClient, you can call disconnect() on a socket that is already disconnected (it will do nothing).
void setDisconnectionCallback (TNetCallback cb, void *arg)
 Sets callback for disconnections (or NULL to disable callback).
virtual TSockId getSockId (TSockId hostid=InvalidSockId)
 Returns the sockid.
uint64 getReceiveQueueSize ()
uint64 getSendQueueSize ()
void displayReceiveQueueStat (NLMISC::CLog *log=NLMISC::InfoLog)
void displaySendQueueStat (NLMISC::CLog *log=NLMISC::InfoLog, TSockId=InvalidSockId)
void displayThreadStat (NLMISC::CLog *log=NLMISC::InfoLog)

Private Member Functions

void send (const NLMISC::CMemStream &)
 These function is public in the base class and put it private here because user cannot use it in layer 2.
bool dataAvailable ()
 Returns true if there are messages to read.
virtual bool getDataAvailableFlagV () const
 This function is implemented in the client and server class.
void receive (CMessage &buffer, TSockId *hostid=NULL)
 On this layer, you can't call directly receive, It s the update() function that receive and call your callaback.

Private Attributes

bool LockDeletion

Detailed Description

Client class for layer 3.

Author:
Vianney Lecroart, Olivier Cado
Nevrax France
Date:
2001

Definition at line 44 of file callback_client.h.


Constructor & Destructor Documentation

NLNET::CCallbackClient::CCallbackClient ( TRecordingState  rec = Off,
const std::string &  recfilename = "",
bool  recordall = true,
bool  initPipeForDataAvailable = true 
)
NLNET::CCallbackClient::~CCallbackClient (  ) 

Definition at line 53 of file callback_client.cpp.

References LockDeletion, and nlassert.


Member Function Documentation

void NLNET::CCallbackClient::connect ( const CInetAddress addr  ) 
virtual bool NLNET::CCallbackClient::connected (  )  const [inline, virtual]
bool NLNET::CCallbackClient::dataAvailable (  )  [private]

Returns true if there are messages to read.

Reimplemented from NLNET::CBufClient.

Definition at line 188 of file callback_client.cpp.

References NLNET::CCallbackNetBase::Replay.

void NLNET::CCallbackClient::disconnect ( TSockId  hostid = InvalidSockId  )  [virtual]
void NLNET::CCallbackClient::displayReceiveQueueStat ( NLMISC::CLog log = NLMISC::InfoLog  )  [inline, virtual]

Implements NLNET::CCallbackNetBase.

Definition at line 92 of file callback_client.h.

Referenced by NLNET::CGatewayL3ClientTransport::dump().

void NLNET::CCallbackClient::displaySendQueueStat ( NLMISC::CLog log = NLMISC::InfoLog,
TSockId  = InvalidSockId 
) [inline, virtual]

Implements NLNET::CCallbackNetBase.

Definition at line 93 of file callback_client.h.

Referenced by NLNET::CGatewayL3ClientTransport::dump().

void NLNET::CCallbackClient::displayThreadStat ( NLMISC::CLog log = NLMISC::InfoLog  )  [inline]

Reimplemented from NLNET::CBufClient.

Definition at line 95 of file callback_client.h.

bool NLNET::CCallbackClient::flush ( TSockId  hostid = InvalidSockId,
uint nbBytesRemaining = NULL 
) [virtual]

Force to send all data pending in the send queue. hostid must be InvalidSockId here. See comment in CCallbackNetBase.

Implements NLNET::CCallbackNetBase.

Definition at line 101 of file callback_client.cpp.

References NLNET::InvalidSockId, nlassert, and NLNET::CCallbackNetBase::Replay.

Referenced by NLNET::CGatewayL3ClientTransport::update().

virtual bool NLNET::CCallbackClient::getDataAvailableFlagV (  )  const [inline, private, virtual]

This function is implemented in the client and server class.

Implements NLNET::CCallbackNetBase.

Definition at line 104 of file callback_client.h.

References NLNET::CBufNetBase::dataAvailableFlag().

uint64 NLNET::CCallbackClient::getReceiveQueueSize (  )  [inline, virtual]

Implements NLNET::CCallbackNetBase.

Definition at line 89 of file callback_client.h.

uint64 NLNET::CCallbackClient::getSendQueueSize (  )  [inline, virtual]

Implements NLNET::CCallbackNetBase.

Definition at line 90 of file callback_client.h.

TSockId NLNET::CCallbackClient::getSockId ( TSockId  hostid = InvalidSockId  )  [virtual]
virtual const CInetAddress& NLNET::CCallbackClient::hostAddress ( TSockId  hostid  )  [inline, virtual]

Returns the address of the specified host.

Reimplemented from NLNET::CCallbackNetBase.

Definition at line 75 of file callback_client.h.

References NLNET::CBufClient::remoteAddress().

void NLNET::CCallbackClient::receive ( CMessage buffer,
TSockId hostid = NULL 
) [private, virtual]

On this layer, you can't call directly receive, It s the update() function that receive and call your callaback.

Implements NLNET::CCallbackNetBase.

Definition at line 214 of file callback_client.cpp.

References NLNET::CMessage::buffer(), NLNET::InvalidSockId, NLMISC_BSWAP32, NLNET::CMessage::readType(), NLNET::Receiving, NLNET::CCallbackNetBase::Record, and NLNET::CCallbackNetBase::Replay.

void NLNET::CCallbackClient::send ( const NLMISC::CMemStream  )  [inline, private]

These function is public in the base class and put it private here because user cannot use it in layer 2.

Reimplemented from NLNET::CBufClient.

Definition at line 100 of file callback_client.h.

References nlstop.

void NLNET::CCallbackClient::send ( const CMessage buffer,
TSockId  hostid = InvalidSockId,
bool  log = true 
) [virtual]
void NLNET::CCallbackClient::setDisconnectionCallback ( TNetCallback  cb,
void *  arg 
) [inline]

Sets callback for disconnections (or NULL to disable callback).

Reimplemented from NLNET::CCallbackNetBase.

Definition at line 84 of file callback_client.h.

Referenced by NLNET::CUnifiedNetwork::addService(), and CCallbackClient().

void NLNET::CCallbackClient::update ( sint32  timeout = 0  )  [virtual]
void NLNET::CCallbackClient::update2 ( sint32  timeout = -1,
sint32  mintime = 0 
) [virtual]

Updates the network (call this method evenly).

More info about timeout and mintime in the code of CCallbackNetBase::baseUpdate().

Implements NLNET::CCallbackNetBase.

Definition at line 128 of file callback_client.cpp.

References NLNET::CCallbackNetBase::baseUpdate2(), H_AUTO, LockDeletion, NLNET::CCallbackNetBase::Replay, and NLNET::CBufClient::update().

Referenced by NLNET::CGatewayL3ClientTransport::update().


Member Data Documentation

Definition at line 113 of file callback_client.h.

Referenced by CCallbackClient(), update(), update2(), and ~CCallbackClient().


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

Generated on Thu Jan 7 08:30:20 2010 for NeL by  doxygen 1.6.1