# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLNET::CBufNetBase Class Reference

Layer 1. More...

#include <buf_net_base.h>

Inheritance diagram for NLNET::CBufNetBase:

NLNET::CBufClient NLNET::CBufServer NLNET::CCallbackClient NLNET::CCallbackServer List of all members.

Public Types

enum  TEventType { User = 'U', Connection = 'C', Disconnection = 'D' }
 Type of incoming events (max 256). More...


Public Methods

virtual ~CBufNetBase ()
 Destructor. More...

void setDisconnectionCallback (TNetCallback cb, void *arg)
 Sets callback for detecting a disconnection (or NULL to disable callback). More...

uint32 getReceiveQueueSize ()
 Returns the size of the receive queue (mutexed). More...

void setMaxExpectedBlockSize (sint32 limit)
 Sets the max size of the received messages. More...

void setMaxSentBlockSize (sint32 limit)
 Sets the max size of the sent messages. More...

uint32 maxExpectedBlockSize () const
 Returns the max size of the received messages (default: 2^31-1). More...

uint32 maxSentBlockSize () const
 Returns the max size of the sent messages (default: 2^31-1). More...


Protected Methods

 CBufNetBase ()
 Constructor. More...

CSynchronizedFIFOreceiveQueue ()
 Access to the receive queue. More...

TNetCallback disconnectionCallback () const
 Returns the disconnection callback. More...

void * argOfDisconnectionCallback () const
 Returns the argument of the disconnection callback. More...

void pushMessageIntoReceiveQueue (const std::vector< uint8 > &buffer)
 Push message into receive queue (mutexed). More...

void pushMessageIntoReceiveQueue (const uint8 *buffer, uint32 size)
void setDataAvailableFlag (bool da)
 Sets _DataAvailable. More...

volatile bool dataAvailableFlag () const
 Return _DataAvailable. More...


Private Attributes

CSynchronizedFIFO _RecvFifo
 The receive queue, protected by a mutex-like device. More...

volatile bool _DataAvailable
 True if there is data available (avoids locking a mutex). More...

TNetCallback _DisconnectionCallback
 Callback for disconnection. More...

void * _DisconnectionCbArg
 Argument of the disconnection callback. More...

uint32 _MaxExpectedBlockSize
 Max size of received messages (limited by the user). More...

uint32 _MaxSentBlockSize
 Max size of sent messages (limited by the user). More...


Friends

class NLNET::CBufSock

Detailed Description

Layer 1.

Base class for CBufClient and CBufServer. The max block sizes for sending and receiving are controlled by setMaxSentBlockSize() and setMaxExpectedBlockSize(). Their default value is the maximum number contained in a sint32, that is 2^31-1 (i.e. 0x7FFFFFFF). The limit for sending is checked only in debug mode.

Author:
Nevrax France
Date:
2001

Definition at line 73 of file buf_net_base.h.


Member Enumeration Documentation

enum NLNET::CBufNetBase::TEventType
 

Type of incoming events (max 256).

Enumeration values:
User 
Connection 
Disconnection 

Definition at line 78 of file buf_net_base.h.


Constructor & Destructor Documentation

virtual NLNET::CBufNetBase::~CBufNetBase   [inline, virtual]
 

Destructor.

Definition at line 81 of file buf_net_base.h.

NLNET::CBufNetBase::CBufNetBase   [protected]
 

Constructor.

Definition at line 45 of file buf_net_base.cpp.


Member Function Documentation

void* NLNET::CBufNetBase::argOfDisconnectionCallback   const [inline, protected]
 

Returns the argument of the disconnection callback.

Definition at line 149 of file buf_net_base.h.

References _DisconnectionCbArg.

Referenced by NLNET::CBufServer::dataAvailable, and NLNET::CBufClient::dataAvailable.

volatile bool NLNET::CBufNetBase::dataAvailableFlag   const [inline, protected]
 

Return _DataAvailable.

Definition at line 195 of file buf_net_base.h.

References _DataAvailable.

Referenced by NLNET::CBufServer::dataAvailable, and NLNET::CBufClient::dataAvailable.

TNetCallback NLNET::CBufNetBase::disconnectionCallback   const [inline, protected]
 

Returns the disconnection callback.

Definition at line 146 of file buf_net_base.h.

References _DisconnectionCallback, and NLNET::TNetCallback.

Referenced by NLNET::CBufServer::dataAvailable, and NLNET::CBufClient::dataAvailable.

uint32 NLNET::CBufNetBase::getReceiveQueueSize   [inline]
 

Returns the size of the receive queue (mutexed).

Reimplemented in NLNET::CCallbackClient.

Definition at line 87 of file buf_net_base.h.

References _RecvFifo, and NLNET::CFifoAccessor.

uint32 NLNET::CBufNetBase::maxExpectedBlockSize   const [inline]
 

Returns the max size of the received messages (default: 2^31-1).

Definition at line 124 of file buf_net_base.h.

References _MaxExpectedBlockSize.

uint32 NLNET::CBufNetBase::maxSentBlockSize   const [inline]
 

Returns the max size of the sent messages (default: 2^31-1).

Definition at line 130 of file buf_net_base.h.

References _MaxSentBlockSize.

Referenced by NLNET::CBufClient::send.

void NLNET::CBufNetBase::pushMessageIntoReceiveQueue const uint8   buffer,
uint32    size
[inline, protected]
 

Definition at line 172 of file buf_net_base.h.

References _RecvFifo, NLNET::CFifoAccessor, and setDataAvailableFlag.

void NLNET::CBufNetBase::pushMessageIntoReceiveQueue const std::vector< uint8 > &    buffer [inline, protected]
 

Push message into receive queue (mutexed).

Definition at line 153 of file buf_net_base.h.

References _RecvFifo, NLNET::CFifoAccessor, and setDataAvailableFlag.

CSynchronizedFIFO& NLNET::CBufNetBase::receiveQueue   [inline, protected]
 

Access to the receive queue.

Definition at line 143 of file buf_net_base.h.

References NLNET::CSynchronizedFIFO, and receiveQueue.

Referenced by NLNET::CBufServer::dataAvailable, NLNET::CBufClient::dataAvailable, NLNET::CBufClient::disconnect, NLNET::CBufServer::receive, NLNET::CBufClient::receive, and receiveQueue.

void NLNET::CBufNetBase::setDataAvailableFlag bool    da [inline, protected]
 

Sets _DataAvailable.

Definition at line 192 of file buf_net_base.h.

References _DataAvailable.

Referenced by NLNET::CBufServer::dataAvailable, NLNET::CBufClient::dataAvailable, NLNET::CBufClient::disconnect, pushMessageIntoReceiveQueue, NLNET::CBufServer::receive, and NLNET::CBufClient::receive.

void NLNET::CBufNetBase::setDisconnectionCallback TNetCallback    cb,
void *    arg
[inline]
 

Sets callback for detecting a disconnection (or NULL to disable callback).

Reimplemented in NLNET::CCallbackClient.

Definition at line 84 of file buf_net_base.h.

References _DisconnectionCallback, _DisconnectionCbArg, and NLNET::TNetCallback.

void NLNET::CBufNetBase::setMaxExpectedBlockSize sint32    limit [inline]
 

Sets the max size of the received messages.

Default value: 2^31-1 (0x7FFFFFF) (which is the very maximum !). If you put a negative number as limit, the max size is reset to the default value. Warning: you can call this method only at initialization time, before connecting (for a client) or calling init() (for a server) !

Definition at line 100 of file buf_net_base.h.

References _MaxExpectedBlockSize.

void NLNET::CBufNetBase::setMaxSentBlockSize sint32    limit [inline]
 

Sets the max size of the sent messages.

Default value: 2^31-1 (0x7FFFFFF) (which is the very maximum !). If you put a negative number as limit, the max size is reset to the default value. Warning: you can call this method only at initialization time, before connecting (for a client) or calling init() (for a server) !

Definition at line 115 of file buf_net_base.h.

References _MaxSentBlockSize.


Friends And Related Function Documentation

friend class NLNET::CBufSock [friend]
 

Definition at line 137 of file buf_net_base.h.


Member Data Documentation

volatile bool NLNET::CBufNetBase::_DataAvailable [private]
 

True if there is data available (avoids locking a mutex).

Definition at line 203 of file buf_net_base.h.

Referenced by dataAvailableFlag, and setDataAvailableFlag.

TNetCallback NLNET::CBufNetBase::_DisconnectionCallback [private]
 

Callback for disconnection.

Definition at line 206 of file buf_net_base.h.

Referenced by disconnectionCallback, and setDisconnectionCallback.

void* NLNET::CBufNetBase::_DisconnectionCbArg [private]
 

Argument of the disconnection callback.

Definition at line 209 of file buf_net_base.h.

Referenced by argOfDisconnectionCallback, and setDisconnectionCallback.

uint32 NLNET::CBufNetBase::_MaxExpectedBlockSize [private]
 

Max size of received messages (limited by the user).

Definition at line 212 of file buf_net_base.h.

Referenced by maxExpectedBlockSize, and setMaxExpectedBlockSize.

uint32 NLNET::CBufNetBase::_MaxSentBlockSize [private]
 

Max size of sent messages (limited by the user).

Definition at line 215 of file buf_net_base.h.

Referenced by maxSentBlockSize, and setMaxSentBlockSize.

CSynchronizedFIFO NLNET::CBufNetBase::_RecvFifo [private]
 

The receive queue, protected by a mutex-like device.

Definition at line 200 of file buf_net_base.h.

Referenced by getReceiveQueueSize, and pushMessageIntoReceiveQueue.


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