|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NLNET::CBufSock Class ReferenceCBufSock A socket and its sending buffer.
More...
#include <buf_sock.h>
Inheritance diagram for NLNET::CBufSock:
List of all members.
Public Methods |
virtual | ~CBufSock () |
| Destructor. More...
|
void | setAppId (uint64 id) |
| Sets the application identifier. More...
|
uint64 | appId () const |
| Returns the application identifier. More...
|
std::string | asString () const |
| Returns a string with the characteristics of the object. More...
|
Public Attributes |
std::string | AuthorizedCallback |
| Little tricky but this string is used by Layer4 to know which callback is authorized. This is empty when all callback are authorized. More...
|
uint32 | SendNextValue |
uint32 | ReceiveNextValue |
Protected Methods |
| CBufSock (CTcpSock *sock=NULL) |
| Constructor. More...
|
virtual std::string | typeStr () const |
| Returns "CLT " (client). More...
|
bool | advertiseDisconnection (CBufNetBase *bnb, TSockId sockid) |
| Pushes a disconnection message into bnb's receive queue, if it has not already been done (returns true in this case). More...
|
bool | advertiseSystemEvent (CBufNetBase *bnb, TSockId sockid, bool &flag, bool condition, CBufNetBase::TEventType event) |
| Pushes a system message into bnb's receive queue, if the flags meets the condition, then resets the flag and returns true. More...
|
bool | pushBuffer (const NLMISC::CMemStream &buffer) |
| Pushes a buffer to the send queue and update, or returns false if the socket is not physically connected the or an error occured during sending. More...
|
void | connect (const CInetAddress &addr, bool nodelay, bool connectedstate) |
| Connects to the specified addr; set connectedstate to true if no connection advertising is needed. More...
|
void | disconnect (bool connectedstate) |
| Disconnects; set connectedstate to false if no disconnection advertising is needed. More...
|
void | setConnectedState (bool connectedstate) |
| Sets the "logically connected" state (changed when processing a connection/disconnection callback). More...
|
bool | connectedState () const |
| Returns the "logically connected" state (changed when processing a connection/disconnection callback). More...
|
|
bool | update () |
| Update the network sending (call this method evenly). Returns false if an error occured. More...
|
void | setTimeFlushTrigger (sint32 ms) |
| Sets the time flush trigger (in millisecond). More...
|
void | setSizeFlushTrigger (sint32 size) |
| Sets the size flush trigger. More...
|
bool | flush () |
| Forces to send all data pending in the send queue. More...
|
Protected Attributes |
NLMISC::CBufFIFO | SendFifo |
CTcpSock * | Sock |
bool | _KnowConnected |
Private Attributes |
NLMISC::TTime | _LastFlushTime |
NLMISC::TTime | _TriggerTime |
sint32 | _TriggerSize |
NLMISC::CObjectVector< uint8 > | _ReadyToSendBuffer |
TBlockSize | _RTSBIndex |
uint64 | _AppId |
bool | _ConnectedState |
Friends |
class | CBufClient |
class | CBufServer |
class | CClientReceiveTask |
class | CServerReceiveTask |
class | CCallbackClient |
class | CCallbackServer |
class | CCallbackNetBase |
Detailed Description
CBufSock A socket and its sending buffer.
Definition at line 52 of file buf_sock.h.
Constructor & Destructor Documentation
NLNET::CBufSock::~CBufSock |
( |
|
) |
[virtual] |
|
|
Destructor.
Definition at line 81 of file buf_sock.cpp.
References _AppId, _ConnectedState, _KnowConnected, _LastFlushTime, _ReadyToSendBuffer, _RTSBIndex, _TriggerSize, _TriggerTime, AuthorizedCallback, NLMISC::CObjectVector< uint8 >::clear, nlassert, nlnettrace, and Sock. |
NLNET::CBufSock::CBufSock |
( |
CTcpSock * |
sock = NULL |
) |
[protected] |
|
Member Function Documentation
bool NLNET::CBufSock::advertiseDisconnection |
( |
CBufNetBase * |
bnb, |
|
|
TSockId |
sockid |
|
) |
[inline, protected] |
|
uint64 NLNET::CBufSock::appId |
( |
|
) |
const [inline] |
|
|
Returns the application identifier.
Definition at line 63 of file buf_sock.h.
References _AppId. |
string NLNET::CBufSock::asString |
( |
|
) |
const |
|
void NLNET::CBufSock::connect |
( |
const CInetAddress & |
addr, |
|
|
bool |
nodelay, |
|
|
bool |
connectedstate |
|
) |
[protected] |
|
bool NLNET::CBufSock::connectedState |
( |
|
) |
const [inline, protected] |
|
|
Returns the "logically connected" state (changed when processing a connection/disconnection callback).
Definition at line 237 of file buf_sock.h.
References _ConnectedState. |
void NLNET::CBufSock::disconnect |
( |
bool |
connectedstate |
) |
[protected] |
|
bool NLNET::CBufSock::flush |
( |
|
) |
[protected] |
|
|
Forces to send all data pending in the send queue.
-
Returns:
-
False if an error has occured (e.g. the remote host is disconnected). To retrieve the reason of the error, call CSock::getLastError() and/or CSock::errorString()
Definition at line 138 of file buf_sock.cpp.
References _ReadyToSendBuffer, _RTSBIndex, asString, NLMISC::CObjectVector< uint8 >::clear, NLMISC::CBufFIFO::empty, NLMISC::CBufFIFO::front, NLMISC::CObjectVector< uint8 >::getPtr, nlassert, nlassertex, nldebug, NLMISC::CBufFIFO::pop, res, NLMISC::CObjectVector< uint8 >::resize, SendFifo, NLMISC::CObjectVector< uint8 >::size, Sock, and NLNET::TBlockSize.
Referenced by update. |
bool NLNET::CBufSock::pushBuffer |
( |
const NLMISC::CMemStream & |
buffer |
) |
[inline, protected] |
|
void NLNET::CBufSock::setAppId |
( |
uint64 |
id |
) |
[inline] |
|
|
Sets the application identifier.
Definition at line 60 of file buf_sock.h.
References _AppId, and id. |
void NLNET::CBufSock::setConnectedState |
( |
bool |
connectedstate |
) |
[inline, protected] |
|
|
Sets the "logically connected" state (changed when processing a connection/disconnection callback).
Definition at line 234 of file buf_sock.h.
References _ConnectedState. |
void NLNET::CBufSock::setSizeFlushTrigger |
( |
sint32 |
size |
) |
[inline, protected] |
|
|
Sets the size flush trigger.
When the size of the send queue reaches or exceeds this calue, all data in the send queue is automatically sent (-1 to disable this trigger )
Definition at line 104 of file buf_sock.h.
References _TriggerSize. |
void NLNET::CBufSock::setTimeFlushTrigger |
( |
sint32 |
ms |
) |
[protected] |
|
|
Sets the time flush trigger (in millisecond).
When this time is elapsed, all data in the send queue is automatically sent (-1 to disable this trigger)
Definition at line 232 of file buf_sock.cpp.
References _LastFlushTime, _TriggerTime, and nlassert. |
virtual std::string NLNET::CBufSock::typeStr |
( |
|
) |
const [inline, protected, virtual] |
|
bool NLNET::CBufSock::update |
( |
|
) |
[protected] |
|
Friends And Related Function Documentation
friend class CBufClient [friend]
|
|
friend class CBufServer [friend]
|
|
friend class CCallbackClient [friend]
|
|
friend class CCallbackNetBase [friend]
|
|
friend class CCallbackServer [friend]
|
|
friend class CClientReceiveTask [friend]
|
|
friend class CServerReceiveTask [friend]
|
|
Member Data Documentation
uint64 NLNET::CBufSock::_AppId [private]
|
|
bool NLNET::CBufSock::_ConnectedState [private]
|
|
bool NLNET::CBufSock::_KnowConnected [protected]
|
|
sint32 NLNET::CBufSock::_TriggerSize [private]
|
|
std::string NLNET::CBufSock::AuthorizedCallback
|
|
|
Little tricky but this string is used by Layer4 to know which callback is authorized. This is empty when all callback are authorized.
Definition at line 70 of file buf_sock.h.
Referenced by ~CBufSock. |
uint32 NLNET::CBufSock::ReceiveNextValue
|
|
uint32 NLNET::CBufSock::SendNextValue
|
|
CTcpSock* NLNET::CBufSock::Sock [protected]
|
|
The documentation for this class was generated from the following files:
|
|