|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NLNET::CCallbackNetBase Class ReferenceLayer 3.
More...
#include <callback_net_base.h>
Inheritance diagram for NLNET::CCallbackNetBase:
List of all members.
Public Types |
enum | TRecordingState { Off,
Record,
Replay
} |
Public Methods |
virtual | ~CCallbackNetBase () |
virtual void | send (const CMessage &buffer, TSockId hostid=InvalidSockId, bool log=true)=0 |
| Sends a message to special connection. More...
|
uint64 | getBytesSent () |
uint64 | getBytesReceived () |
virtual uint64 | getReceiveQueueSize ()=0 |
virtual uint64 | getSendQueueSize ()=0 |
virtual bool | flush (TSockId hostid=InvalidSockId)=0 |
| Force to send all data pending in the send queue. More...
|
void | addCallbackArray (const TCallbackItem *callbackarray, NLMISC::CStringIdArray::TStringId arraysize) |
| Appends callback array with the specified array. More...
|
void | setDefaultCallback (TMsgCallback defaultCallback) |
| Sets default callback for unknown message types. More...
|
void | setDisconnectionCallback (TNetCallback cb, void *arg) |
| Sets callback for disconnections (or NULL to disable callback). More...
|
virtual TSockId | getSockId (TSockId hostid=InvalidSockId)=0 |
| returns the sockid of a connection. On a server, this function returns the parameter. On a client, it returns the connection. More...
|
void | authorizeOnly (const char *callbackName, TSockId hostid=InvalidSockId) |
| Sets the callback that you want the other side calls. More...
|
bool | isAServer () const |
| Returns true if this is a CCallbackServer. More...
|
NLMISC::CStringIdArray & | getSIDA () |
| Use this function to get the String ID Array needed when you want to create a message. More...
|
virtual bool | dataAvailable () |
| This function is implemented in the client and server class. More...
|
virtual void | update (sint32 timeout=0) |
| This function is implemented in the client and server class. More...
|
virtual bool | connected () const |
| This function is implemented in the client and server class. More...
|
virtual void | disconnect (TSockId hostid=InvalidSockId) |
| This function is implemented in the client and server class. More...
|
virtual const CInetAddress & | hostAddress (TSockId hostid) |
| Returns the address of the specified host. More...
|
void | sendAllMyAssociations (TSockId to) |
| Used by client and server class. More...
|
void | setOtherSideAssociations (const char **associationarray, NLMISC::CStringIdArray::TStringId arraysize) |
| Gives some association of the other side. More...
|
void | displayAllMyAssociations () |
void | ignoreAllUnknownId (bool b) |
| If you ignore all unknown id, the net will not ask for other side to know new association. It's used in the naming service for example because the naming client will never answer. In this case, it will always send the message with the full string name (slower). More...
|
Protected Methods |
| CCallbackNetBase (TRecordingState rec=Off, const std::string &recfilename="", bool recordall=true) |
| Constructor. More...
|
void | baseUpdate (sint32 timeout=0) |
| Used by client and server class. More...
|
void | processOneMessage () |
| Read a message from the network and process it. More...
|
virtual void | receive (CMessage &buffer, TSockId *hostid)=0 |
| On this layer, you can't call directly receive, It s the update() function that receive and call your callaback. More...
|
void | checkThreadId () const |
Protected Attributes |
uint64 | _BytesSent |
uint64 | _BytesReceived |
TNetCallback | _NewDisconnectionCallback |
| Used by client and server class. More...
|
NLMISC::CStringIdArray | _InputSIDA |
NLMISC::CStringIdArray | _OutputSIDA |
std::vector< TCallbackItem > | _CallbackArray |
TMsgCallback | _DefaultCallback |
bool | _IsAServer |
bool | _FirstUpdate |
uint | _ThreadId |
Private Attributes |
NLMISC::TTime | _LastUpdateTime |
NLMISC::TTime | _LastMovedStringArray |
TNetCallback | _DisconnectionCallback |
void * | _DisconnectionCbArg |
Friends |
void | cbnbMessageAskAssociations (CMessage &msgin, TSockId from, CCallbackNetBase &netbase) |
void | cbnbMessageRecvAssociations (CMessage &msgin, TSockId from, CCallbackNetBase &netbase) |
void | cbnbNewDisconnection (TSockId from, void *data) |
Detailed Description
Layer 3.
-
Author:
-
Vianney Lecroart , Nevrax France
-
Date:
-
2001
Definition at line 75 of file callback_net_base.h.
Member Enumeration Documentation
enum NLNET::CCallbackNetBase::TRecordingState
|
|
Constructor & Destructor Documentation
virtual NLNET::CCallbackNetBase::~CCallbackNetBase |
( |
|
) |
[inline, virtual] |
|
NLNET::CCallbackNetBase::CCallbackNetBase |
( |
TRecordingState |
rec = Off, |
|
|
const std::string & |
recfilename = "", |
|
|
bool |
recordall = true |
|
) |
[protected] |
|
Member Function Documentation
void NLNET::CCallbackNetBase::authorizeOnly |
( |
const char * |
callbackName, |
|
|
TSockId |
hostid = InvalidSockId |
|
) |
|
|
|
Sets the callback that you want the other side calls.
If it didn't call this callback, it will be disconnected If cb is NULL, we authorize *all* callback. On a client, the hostid must be InvalidSockId (or ommited). On a server, you must provide a hostid.
Definition at line 469 of file callback_net_base.cpp.
References checkThreadId, getSockId, nlassert, nldebug, and NLNET::TSockId. |
void NLNET::CCallbackNetBase::baseUpdate |
( |
sint32 |
timeout = 0 |
) |
[protected] |
|
|
Used by client and server class.
Definition at line 328 of file callback_net_base.cpp.
References _FirstUpdate, _InputSIDA, _LastMovedStringArray, _LastUpdateTime, checkThreadId, dataAvailable, NLMISC::CStringIdArray::getAskedStringArray, NLMISC::CStringIdArray::getNeedToAskedStringArray, NLMISC::CStringIdArray::moveNeedToAskToAskedStringArray, nlassert, nldebug, NLMISC::nlSleep, processOneMessage, send, and NLMISC::TTime.
Referenced by NLNET::CCallbackServer::update, and NLNET::CCallbackClient::update. |
void NLNET::CCallbackNetBase::checkThreadId |
( |
|
) |
const [protected] |
|
|
Definition at line 531 of file callback_net_base.cpp.
Referenced by addCallbackArray, authorizeOnly, baseUpdate, NLNET::CCallbackClient::connect, NLNET::CCallbackServer::connected, NLNET::CCallbackClient::connected, NLNET::CCallbackServer::dataAvailable, NLNET::CCallbackClient::dataAvailable, NLNET::CCallbackServer::disconnect, NLNET::CCallbackClient::disconnect, displayAllMyAssociations, NLNET::CCallbackServer::flush, NLNET::CCallbackClient::flush, NLNET::CCallbackServer::getSockId, NLNET::CCallbackClient::getSockId, NLNET::CCallbackServer::hostAddress, isAServer, processOneMessage, NLNET::CCallbackServer::receive, NLNET::CCallbackClient::receive, NLNET::CCallbackServer::send, NLNET::CCallbackClient::send, NLNET::CCallbackServer::sendAllMyAssociations, NLNET::CCallbackServer::setConnectionCallback, NLNET::CCallbackServer::setDisconnectionCallback, setDisconnectionCallback, NLNET::CCallbackClient::setDisconnectionCallback, setOtherSideAssociations, NLNET::CCallbackServer::update, and NLNET::CCallbackClient::update. |
virtual bool NLNET::CCallbackNetBase::connected |
( |
|
) |
const [inline, virtual] |
|
virtual bool NLNET::CCallbackNetBase::dataAvailable |
( |
|
) |
[inline, virtual] |
|
virtual void NLNET::CCallbackNetBase::disconnect |
( |
TSockId |
hostid = InvalidSockId |
) |
[inline, virtual] |
|
void NLNET::CCallbackNetBase::displayAllMyAssociations |
( |
|
) |
|
|
|
Force to send all data pending in the send queue.
On a client, the hostid isn't used and must be InvalidSockId On a server, you must provide a hostid.
Implemented in NLNET::CCallbackClient. |
uint64 NLNET::CCallbackNetBase::getBytesReceived |
( |
|
) |
[inline] |
|
uint64 NLNET::CCallbackNetBase::getBytesSent |
( |
|
) |
[inline] |
|
virtual uint64 NLNET::CCallbackNetBase::getReceiveQueueSize |
( |
|
) |
[pure virtual] |
|
virtual uint64 NLNET::CCallbackNetBase::getSendQueueSize |
( |
|
) |
[pure virtual] |
|
void NLNET::CCallbackNetBase::ignoreAllUnknownId |
( |
bool |
b |
) |
[inline] |
|
|
If you ignore all unknown id, the net will not ask for other side to know new association. It's used in the naming service for example because the naming client will never answer. In this case, it will always send the message with the full string name (slower).
Definition at line 152 of file callback_net_base.h.
References _InputSIDA, and NLMISC::CStringIdArray::ignoreAllUnknownId. |
bool NLNET::CCallbackNetBase::isAServer |
( |
|
) |
const [inline] |
|
void NLNET::CCallbackNetBase::processOneMessage |
( |
|
) |
[protected] |
|
|
Read a message from the network and process it.
Definition at line 223 of file callback_net_base.cpp.
References _BytesReceived, _CallbackArray, _DefaultCallback, _OutputSIDA, checkThreadId, disconnect, getSockId, nldebug, nlwarning, receive, NLNET::TMsgCallback, NLNET::TSockId, and NLMISC::CStringIdArray::TStringId.
Referenced by baseUpdate. |
virtual void NLNET::CCallbackNetBase::receive |
( |
CMessage & |
buffer, |
|
|
TSockId * |
hostid |
|
) |
[protected, pure virtual] |
|
|
Sends a message to special connection.
On a client, the hostid isn't used. On a server, you must provide a hostid. If you hostid = InvalidSockId, the message will be sent to all connected client.
Implemented in NLNET::CCallbackClient.
Referenced by baseUpdate. |
void NLNET::CCallbackNetBase::sendAllMyAssociations |
( |
TSockId |
to |
) |
|
|
void NLNET::CCallbackNetBase::setDefaultCallback |
( |
TMsgCallback |
defaultCallback |
) |
[inline] |
|
void NLNET::CCallbackNetBase::setDisconnectionCallback |
( |
TNetCallback |
cb, |
|
|
void * |
arg |
|
) |
[inline] |
|
virtual void NLNET::CCallbackNetBase::update |
( |
sint32 |
timeout = 0 |
) |
[inline, virtual] |
|
Friends And Related Function Documentation
void cbnbMessageAskAssociations |
( |
CMessage & |
msgin, |
|
|
TSockId |
from, |
|
|
CCallbackNetBase & |
netbase |
|
) |
[friend] |
|
void cbnbMessageRecvAssociations |
( |
CMessage & |
msgin, |
|
|
TSockId |
from, |
|
|
CCallbackNetBase & |
netbase |
|
) |
[friend] |
|
void cbnbNewDisconnection |
( |
TSockId |
from, |
|
|
void * |
data |
|
) |
[friend] |
|
Member Data Documentation
uint64 NLNET::CCallbackNetBase::_BytesReceived [protected]
|
|
uint64 NLNET::CCallbackNetBase::_BytesSent [protected]
|
|
std::vector<TCallbackItem> NLNET::CCallbackNetBase::_CallbackArray [protected]
|
|
TMsgCallback NLNET::CCallbackNetBase::_DefaultCallback [protected]
|
|
TNetCallback NLNET::CCallbackNetBase::_DisconnectionCallback [private]
|
|
void* NLNET::CCallbackNetBase::_DisconnectionCbArg [private]
|
|
bool NLNET::CCallbackNetBase::_FirstUpdate [protected]
|
|
bool NLNET::CCallbackNetBase::_IsAServer [protected]
|
|
NLMISC::TTime NLNET::CCallbackNetBase::_LastMovedStringArray [private]
|
|
TNetCallback NLNET::CCallbackNetBase::_NewDisconnectionCallback [protected]
|
|
uint NLNET::CCallbackNetBase::_ThreadId [protected]
|
|
The documentation for this class was generated from the following files:
|
|