Main Page Modules Namespaces C++ Classes Compound List File List Index
TNL::EventConnection class Reference

TNL::EventConnection Class Reference

#include <tnlEventConnection.h>

Inheritance diagram for TNL::EventConnection:

TNL::NetConnection TNL::Object MasterServerInterface TNL::GhostConnection TNLTest::TestConnection

Detailed Description

EventConnection is a NetConnection subclass used for sending guaranteed and unguaranteed event packages across a connection.

The EventConnection is responsible for transmitting NetEvents over the wire. It deals with ensuring that the various types of NetEvents are delivered appropriately, and with notifying the event of its delivery status.

The EventConnection is mainly accessed via postNetEvent(), which accepts NetEvents.

See also:
NetEvent for a more thorough explanation of how to use events.


Public Member Functions

 EventConnection ()
 ~EventConnection ()
U32 getEventClassVersion ()
 returns the highest event version number supported on this connection.

bool postNetEvent (NetEvent *event)
 Posts a NetEvent for processing on the remote host.


Protected Types

enum  DebugConstants {
  DebugChecksum = 0xF00DBAAD,
  BitStreamPosBitSize = 16
}

Protected Member Functions

PacketNotify * allocNotify ()
 Allocates a PacketNotify for this connection.

void packetDropped (PacketNotify *notify)
 Override processing to requeue any guaranteed events in the packet that was dropped.

void packetReceived (PacketNotify *notify)
 Override processing to notify for delivery and dereference any events sent in the packet.

void writePacket (BitStream *bstream, PacketNotify *notify)
 Writes pending events into the packet, and attaches them to the PacketNotify.

void readPacket (BitStream *bstream)
 Reads events from the stream, and queues them for processing.

virtual bool isDataToTransmit ()
 Returns true if there are events pending that should be sent across the wire.

void processEvent (NetEvent *theEvent)
 Dispatches an event.

void writeConnectRequest (BitStream *stream)
 Writes the NetEvent class count into the stream, so that the remote host can negotiate a class count for the connection.

bool readConnectRequest (BitStream *stream, const char **errorString)
 Reads the NetEvent class count max that the remote host is requesting.

void writeConnectAccept (BitStream *stream)
 Writes the negotiated NetEvent class count into the stream.

bool readConnectAccept (BitStream *stream, const char **errorString)
 Reads the negotiated NetEvent class count from the stream and validates that it is on a boundary between versions.


Protected Attributes

U32 mEventClassCount
 Number of NetEvent classes supported by this connection.

U32 mEventClassBitSize
 Bit field width of NetEvent class count.

U32 mEventClassVersion
 The highest version number of events on this connection.


Private Types

typedef NetConnection Parent
enum  {
  InvalidSendEventSeq = -1,
  FirstValidSendEventSeq = 0
}

Private Attributes

EventNotemSendEventQueueHead
 Head of the list of events to be sent to the remote host.

EventNotemSendEventQueueTail
 Tail of the list of events to be sent to the remote host. New events are tagged on to the end of this list.

EventNotemUnorderedSendEventQueueHead
 Head of the list of events sent without ordering information.

EventNotemUnorderedSendEventQueueTail
 Tail of the list of events sent without ordering information.

EventNotemWaitSeqEvents
 List of ordered events on the receiving host that are waiting on previous sequenced events to arrive.

EventNotemNotifyEventList
 Ordered list of events on the sending host that are waiting for receipt of processing on the client.

S32 mNextSendEventSeq
 The next sequence number for an ordered event sent through this connection.

S32 mNextRecvEventSeq
 The next receive event sequence to process.

S32 mLastAckedEventSeq
 The last event the remote host is known to have processed.


Static Private Attributes

ClassChunker< EventNotemEventNoteChunker
 Quick memory allocator for net event notes.


Member Typedef Documentation

typedef NetConnection TNL::EventConnection::Parent [private]
 

Reimplemented from TNL::NetConnection.

Reimplemented in TNL::GhostConnection, and TNLTest::TestConnection.


Member Enumeration Documentation

enum TNL::EventConnection::DebugConstants [protected]
 

Enumeration values:
DebugChecksum 
BitStreamPosBitSize 

anonymous enum [private]
 

Enumeration values:
InvalidSendEventSeq 
FirstValidSendEventSeq 


Constructor & Destructor Documentation

TNL::EventConnection::EventConnection  ) 
 

TNL::EventConnection::~EventConnection  ) 
 


Member Function Documentation

PacketNotify* TNL::EventConnection::allocNotify  )  [inline, protected, virtual]
 

Allocates a PacketNotify for this connection.

Reimplemented from TNL::NetConnection.

Reimplemented in TNL::GhostConnection.

void TNL::EventConnection::packetDropped PacketNotify *  notify  )  [protected, virtual]
 

Override processing to requeue any guaranteed events in the packet that was dropped.

Reimplemented from TNL::NetConnection.

Reimplemented in TNL::GhostConnection.

void TNL::EventConnection::packetReceived PacketNotify *  notify  )  [protected, virtual]
 

Override processing to notify for delivery and dereference any events sent in the packet.

Reimplemented from TNL::NetConnection.

Reimplemented in TNL::GhostConnection.

void TNL::EventConnection::writePacket BitStream bstream,
PacketNotify *  notify
[protected, virtual]
 

Writes pending events into the packet, and attaches them to the PacketNotify.

Reimplemented from TNL::NetConnection.

Reimplemented in TNL::GhostConnection.

void TNL::EventConnection::readPacket BitStream bstream  )  [protected, virtual]
 

Reads events from the stream, and queues them for processing.

Reimplemented from TNL::NetConnection.

Reimplemented in TNL::GhostConnection.

virtual bool TNL::EventConnection::isDataToTransmit  )  [protected, virtual]
 

Returns true if there are events pending that should be sent across the wire.

Reimplemented from TNL::NetConnection.

Reimplemented in TNL::GhostConnection, and TNLTest::TestConnection.

void TNL::EventConnection::processEvent NetEvent theEvent  )  [protected]
 

Dispatches an event.

void TNL::EventConnection::writeConnectRequest BitStream stream  )  [protected, virtual]
 

Writes the NetEvent class count into the stream, so that the remote host can negotiate a class count for the connection.

Reimplemented from TNL::NetConnection.

bool TNL::EventConnection::readConnectRequest BitStream stream,
const char **  errorString
[protected, virtual]
 

Reads the NetEvent class count max that the remote host is requesting.

If this host has MORE NetEvent classes declared, the mEventClassCount is set to the requested count, and is verified to lie on a boundary between versions.

Reimplemented from TNL::NetConnection.

void TNL::EventConnection::writeConnectAccept BitStream stream  )  [protected, virtual]
 

Writes the negotiated NetEvent class count into the stream.

Reimplemented from TNL::NetConnection.

bool TNL::EventConnection::readConnectAccept BitStream stream,
const char **  errorString
[protected, virtual]
 

Reads the negotiated NetEvent class count from the stream and validates that it is on a boundary between versions.

Reimplemented from TNL::NetConnection.

U32 TNL::EventConnection::getEventClassVersion  )  [inline]
 

returns the highest event version number supported on this connection.

bool TNL::EventConnection::postNetEvent NetEvent event  ) 
 

Posts a NetEvent for processing on the remote host.


Field Documentation

ClassChunker<EventNote> TNL::EventConnection::mEventNoteChunker [static, private]
 

Quick memory allocator for net event notes.

EventNote* TNL::EventConnection::mSendEventQueueHead [private]
 

Head of the list of events to be sent to the remote host.

EventNote* TNL::EventConnection::mSendEventQueueTail [private]
 

Tail of the list of events to be sent to the remote host. New events are tagged on to the end of this list.

EventNote* TNL::EventConnection::mUnorderedSendEventQueueHead [private]
 

Head of the list of events sent without ordering information.

EventNote* TNL::EventConnection::mUnorderedSendEventQueueTail [private]
 

Tail of the list of events sent without ordering information.

EventNote* TNL::EventConnection::mWaitSeqEvents [private]
 

List of ordered events on the receiving host that are waiting on previous sequenced events to arrive.

EventNote* TNL::EventConnection::mNotifyEventList [private]
 

Ordered list of events on the sending host that are waiting for receipt of processing on the client.

S32 TNL::EventConnection::mNextSendEventSeq [private]
 

The next sequence number for an ordered event sent through this connection.

S32 TNL::EventConnection::mNextRecvEventSeq [private]
 

The next receive event sequence to process.

S32 TNL::EventConnection::mLastAckedEventSeq [private]
 

The last event the remote host is known to have processed.

U32 TNL::EventConnection::mEventClassCount [protected]
 

Number of NetEvent classes supported by this connection.

U32 TNL::EventConnection::mEventClassBitSize [protected]
 

Bit field width of NetEvent class count.

U32 TNL::EventConnection::mEventClassVersion [protected]
 

The highest version number of events on this connection.