Click or drag to resize

CrosserProtocol Class

The CROSSER communication protocol. This class parse data from IBaseTransport and make sure that the messages follow the rules of the protocol. RPC/RMI, PUB/SUB and so on. It also makes sure that other operations such as security, PING/PONG etc works as expected
Inheritance Hierarchy
SystemObject
  Crosser.Server.Modules.ProtocolProtocol
    Crosser.Server.Modules.Protocol.CrosserCrosserProtocol

Namespace:  Crosser.Server.Modules.Protocol.Crosser
Assembly:  Crosser.Server (in Crosser.Server.dll) Version: 0.0.5
Syntax
C#
public class CrosserProtocol : Protocol, 
	ICrosserProtocol, IProtocol, IDisposable

The CrosserProtocol type exposes the following members.

Constructors
  NameDescription
Public methodCrosserProtocol
Ctor
Top
Properties
  NameDescription
Protected propertyAuthRequired
True if the IBaseEndpoint requires authentication
(Inherited from Protocol.)
Public propertyClientStats
Clients statistics
(Inherited from Protocol.)
Public propertyConnectionContext
Connection information IConnectionContext
(Inherited from Protocol.)
Public propertyControllers
The controller instances used by this connection
(Inherited from Protocol.)
Public propertyProtocolIdentifier
Identifier for the protocol, passed into the ctor from implementing protocols
(Inherited from Protocol.)
Protected propertyPubSubHandler (Inherited from Protocol.)
Public propertyServer
Reference to the IServer
(Inherited from Protocol.)
Public propertySubscriptions
Current subscriptions for this connection
(Inherited from Protocol.)
Public propertyTransport
IBaseTransport for the protocol
(Inherited from Protocol.)
Top
Methods
  NameDescription
Public methodDispose
Clean up the resources used by the protocol
(Overrides ProtocolDispose.)
Protected methodEnsureController
Makes sure that there is an instance of a specific controller. Also makes sure that security is in place. Knowing what methods the connection can call.
(Inherited from Protocol.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodExecuteCall
Invoke the correct RPC controller/method with the payload. Also handles return values when needed
(Inherited from Protocol.)
Protected methodExecuteCallSynchronously
Invoke the correct RPC controller/method with the payload. Also handles return values when needed Will execute 1 operation at the time. Other operations will wait. This will be executed when the IController or the method being invoked is decorated with the RunSynchronouslyAttribute
(Inherited from Protocol.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFlushTransport
Flushes the IBaseTransport write stream
(Inherited from Protocol.)
Protected methodGetControllerDelegate
Creates a ControllerDelegate to use when calling the controller/method
(Inherited from Protocol.)
Protected methodGetDeadConnectionFrame
Returns a dead connection frame for the crosser protocol
(Overrides ProtocolGetDeadConnectionFrame.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Protected methodGetPingFrame
Returns a PING frame for the crosser protocol
(Overrides ProtocolGetPingFrame.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodHasControllerInstanceOf
True if the controllers repository has a instance of the specific BinaryKey
(Inherited from Protocol.)
Protected methodInitClientStats
Setup the properties on the ClientStats object
(Inherited from Protocol.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodReadLoop
Continuously reads the transport and parse messages -> track read-state -> take actions
(Overrides ProtocolReadLoop.)
Public methodRemoveController
Removes a controller instance from the Controllers repository.
(Inherited from Protocol.)
Public methodSend(Byte)
Enqueue the data to send and update the IServerStatistics
(Overrides ProtocolSend(Byte).)
Public methodSend(BinaryKey, String, Byte)
Builds the operation frame and add it to the outgoing queue
(Overrides ProtocolSend(BinaryKey, String, Byte).)
Protected methodSend(Byte, Byte, Byte, Byte)
Builds the operation frame and add it to the outgoing queue
(Overrides ProtocolSend(Byte, Byte, Byte, Byte).)
Public methodSendLoop
Send loop that reads the OutQueue
(Inherited from Protocol.)
Protected methodStartPing
If heartbeat is enabled on this endpoint the method will initiate a ping/pong sequence
(Inherited from Protocol.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Fields
  NameDescription
Protected fieldcallbackId
Buffer for callback-id.
(Inherited from Protocol.)
Protected fieldcallbackIdPos
Length to read from callbackId
(Inherited from Protocol.)
Protected fieldCancellation
CancellationToken used in communication
(Inherited from Protocol.)
Protected fieldCloseReason
Reason CloseReason for closing the connection
(Inherited from Protocol.)
Protected fieldcontroller
Controller buffer, controller to call is within
(Inherited from Protocol.)
Protected fieldcontrollerPos
The length to read from the controller
(Inherited from Protocol.)
Protected fieldcontrollerToCall
Cache controller since it will save time when same controller is called for each message
(Inherited from Protocol.)
Protected fielddata
Last byte operation read from the IBaseTransport
(Inherited from Protocol.)
Protected fielddisposed
Flag for knowing if the object has been disposed
(Inherited from Protocol.)
Protected fieldiam
Buffer for the IAM message operation
(Inherited from Protocol.)
Protected fieldiampos
Size of the IAM message
(Inherited from Protocol.)
Protected fieldInQueue
Queue for incoming data
(Inherited from Protocol.)
Protected fieldInteractive
If true the protocol will respond with +OK messages for every valid operation. Only possible for full-duplex connections.
(Inherited from Protocol.)
Protected fieldIsAuthenticated
True if the Authenticate(IProtocol) method returned true
(Inherited from Protocol.)
Protected fieldlastControllerAsByte
Cache for last controller called
(Inherited from Protocol.)
Protected fieldlastControllerKey
Cache for the last controller called as BinaryKey
(Inherited from Protocol.)
Protected fieldlastMethodAsByte
Cache for last method called
(Inherited from Protocol.)
Protected fieldlastMethodKey
Cache for the last method called as BinaryKey
(Inherited from Protocol.)
Protected fieldlen
Length to read from the IBaseTransport
(Inherited from Protocol.)
Protected fieldlocker
For blocking simultaneous access to certain areas
(Inherited from Protocol.)
Protected fieldmethod
Method buffer, method to call is within
(Inherited from Protocol.)
Protected fieldmethodPos
The length to read from the method
(Inherited from Protocol.)
Protected fieldmethodToCall
Information about the method to be called ControllerDelegate
(Inherited from Protocol.)
Protected fieldOutQueue
Queue for outgoing data
(Inherited from Protocol.)
Protected fieldPubQueue
Queue for messages published over a pub/sub pattern
(Inherited from Protocol.)
Protected fieldread
Read buffer
(Inherited from Protocol.)
Protected fieldReadState
The ReadState for the ReadLoop
(Inherited from Protocol.)
Protected fieldrun
The readloop will continue as long as this flag is true. When false the connection will be disposed
(Inherited from Protocol.)
Protected fieldsize
Size buffer
(Inherited from Protocol.)
Protected fieldsizepos
Size position (for knowing size to read from size buffer)
(Inherited from Protocol.)
Protected fieldtopic
Topic parsed from the stream
(Inherited from Protocol.)
Protected fieldtopicpos
Length of the topic
(Inherited from Protocol.)
Protected fieldunsubcount
Max messages to publish before doing automatic unsubscribe
(Inherited from Protocol.)
Protected fieldunsubcountpos
Length of unsub-count
(Inherited from Protocol.)
Protected fieldvalidTopic
Flag for knowing if the topic parsed is valid
(Inherited from Protocol.)
Protected fieldwrite
Write buffer
(Inherited from Protocol.)
Top
See Also