#include <XPSession.h>
Public Types | |
enum | Error { kXPSession_EOK = 0, kXPSession_EERROR = -1, kXPSession_ETRANSPORT_CLOSED = -2, kXPSession_ETRANSPORT_ERROR = -3 } |
Public Member Functions | |
XPSession () | |
virtual | ~XPSession () |
virtual void | Create (const std::string name)=0 |
virtual void | Create (const std::string name, const std::string protocols)=0 |
virtual std::string | ExportURL (const bool shortAddress=true)=0 |
virtual void | Join (const std::string url)=0 |
virtual void | Find (void)=0 |
virtual void | Find (const std::string protocols)=0 |
virtual std::string | EnumerateFound (void)=0 |
virtual int | GetGameChannel (void)=0 |
virtual void | SetGameChannel (const int channel=TransportAnyGameChannel)=0 |
virtual int | GetSessionID (void)=0 |
virtual bool | IsStable (void)=0 |
virtual Error | GetStatus (void)=0 |
virtual Error | GetSessionErrorReason (void)=0 |
virtual void | DataSendToSession (const int sessionid, const char *data, const int length, const bool reliable=true, const bool certain=false)=0 |
virtual void | DataSendToSessionUnreliable (const int sessionid, const char *data, const int length)=0 |
virtual void | DataSendToSessionReliable (const int sessionid, const char *data, const int length)=0 |
virtual void | DataSendToSessionCertain (const int sessionid, const char *data, const int length)=0 |
virtual bool | DataReceive (int *const fromsessionid, char *const data, int *const length, unsigned char *const type=0)=0 |
virtual bool | IsMaster (void)=0 |
virtual int | GetJoiner (void)=0 |
virtual int | GetLeaver (void)=0 |
virtual float | GetTime (void)=0 |
virtual float | GetLocalTime (void)=0 |
virtual float | GetNetworkSendRate (void)=0 |
virtual float | GetNetworkReceiveRate (void)=0 |
virtual int | GetNetworkPacketsLost (void)=0 |
virtual void | Poll (void)=0 |
virtual void | SetPollLayerBelow (bool enable=true)=0 |
virtual bool | GetPollLayerBelow (void)=0 |
virtual void | SetManualPoll (void)=0 |
virtual void | SetAutomaticPoll (void)=0 |
virtual void | SetManualPollXPURL (void)=0 |
virtual void | SetAutomaticPollXPURL (void)=0 |
virtual void | SetCanSpider (const bool canSpider=true)=0 |
virtual bool | GetCanSpider (void)=0 |
virtual void | SetCanBecomeMaster (const bool canBeMaster=true)=0 |
virtual bool | GetCanBecomeMaster (void)=0 |
virtual float | GetLatencyToMasterSession (void)=0 |
virtual void | SetLatencyRecalculationDelay (const float seconds=1.0f)=0 |
virtual void | SetEncryption (const bool enable=false)=0 |
virtual bool | GetEncryption (void)=0 |
virtual void | Disconnect (const int sessionID=kXPSessionUnknownID)=0 |
virtual bool | GetPreConnectStatus (void)=0 |
virtual void | SetPreConnect (const bool enable=false)=0 |
virtual bool | GetPreConnect (void)=0 |
virtual void | PreConnectHasFinished (void)=0 |
virtual void | SetAutomaticPacketCompression (const bool enable=false)=0 |
virtual bool | GetAutomaticPacketCompression (void)=0 |
virtual void | GetCompressionStatistics (int *const before=0, int *const after=0, const bool reset=false)=0 |
virtual void | GetMergedStatistics (int *const sent=0, int *const received=0, const bool reset=false)=0 |
virtual int | GetMasterSessionID (void)=0 |
virtual std::string | GetURLFromSessionID (const int sessionID)=0 |
virtual void | SetClientOnly (const bool isClient=false)=0 |
virtual bool | GetClientOnly (void)=0 |
virtual bool | GetBandwidthFromSessionID (const int sessionID, Transport::Bandwidth *const bandwidth, int *const output, int *const input)=0 |
virtual void | SetAllowConnections (const bool allow=true)=0 |
virtual bool | GetAllowConnections (void)=0 |
virtual void | SetNodeBuffers (const bool enable=false)=0 |
virtual bool | GetNodeBuffers (void)=0 |
Static Public Member Functions | |
static XPSession * | Allocate (void) |
|
Standard XPSession errors |
|
The ctor for an XPSession |
|
The dtor for an XPSession This cleans up everything for this class |
|
Allocates a new session to be used
|
|
Creates a new session using the supplied protocols
|
|
Creates a new session using the default protocols
|
|
Receives data and responds with what session sent this data
|
|
Sends data from this session to any other session via its ID or to all sessions by using XPSessionBroadcastID. If the node is in a pre-connect state and wants to send data to the master session then use kXPSessionUnknownID as the session ID to send to.
|
|
Sends data using the 'Certain' packet type from this session to any other session via it's ID or to all sessions by using XPSessionBroadcastID
|
|
Sends data using the 'Reliable' packet type from this session to any other session via it's ID or to all sessions by using XPSessionBroadcastID
|
|
Sends data using the 'Unreliable' packet type from this session to any other session via it's ID or to all sessions by using XPSessionBroadcastID
|
|
This forces a disconnect from the supplied sessionID or if the sessionID is not supplied then all session nodes are disconnected. The disconnect is immediate and initiates the fault tolerant mechanism for XPSession and ReplicaNet on other connected session nodes. This means if the session was a master session node then the other session nodes will try to find a new master if this mechanism is enabled. In the case of a ReplicaNet session node having objects, these objects will attempt to use the fault recovery and migration to other nodes if it is enabled.
|
|
Enumerates any found sessions
|
|
Exports a URL that can be used to connect to this session in future
|
|
Tries to find sessions using the listed protocols
|
|
Tries to find sessions using the default protocols |
|
Returns the value configured by SetAllowConnections() the value. |
|
Gets the value configured by SetAutomaticPacketCompression()
|
|
Attempts to read the configured bandwidth for a route to a specific session ID. If the session ID is not directly connected to this node then this function will return false and the contents of the output and input pointers will be left unchanged. If this node can supply bandwidth information about a session ID then this function will return true and the bandwidth, output, input pointers will contain the values as used by SetBandwidthLimit(), SetMaximumOutputBandwidth() and SetMaximumInputBandwidth(). Note that output and input bandwidth will appear to be exchanged because the output of one end of transport connection is really the input of the other end of the connection.
|
|
Allows the state to be read
|
|
This allows the spidering state to be read /return the status of the spidering state |
|
Gets the client only configuration set by SetClientOnly().
|
|
Gets the compression statistics totals for packets sent from this session node.
|
|
Gets the status of the encryption flag for this session |
|
Gets the current channel number for this session
|
|
Gets the session id that recently joined the network session
|
|
This allows the latency to the master session to be read. This is the time taken for a packet to reach the master session.
|
|
Gets the session id that left the network session
|
|
Gets the current local time. This time is local to the session and is not synchronised to the session master clock.
|
|
Gets the master session unique ID. If the session is not connected then the return value is kXPSessionUnknownID.
|
|
Gets the merged packet statistics totals for connections managed by this session node.
|
|
Gets the number of packets that are lost and lost and resent
|
|
Gets the current network receive transfer rate in bytes per second
|
|
Gets the current network send transfer rate in bytes per second
|
|
Returns the value configured by SetNodeBuffers()
|
|
Allows the state of SetPollLayerBelow() to be read. If the library is always single threading then this function will always return true.
|
|
Gets the status of the pre-connect mechanism for this session node.
|
|
Allows the status of the pre-connect mechanism to be tested.
|
|
This can be used to read extended information when XPSession encounters a session error.
|
|
Gets the session unique ID
|
|
Gets the session status. A session error happens when the master session disconnects and a new master cannot be found.
|
|
Gets the current system time of this ReplicaNet session synchronised with the time on the session master.
|
|
Attempts to resolve the URL of the session unique ID from the point of view of this session node. If the session unique ID is not known to the session then the result is a null string. If the session unique ID is not directly connected to this node, for example the spider connection was broken, then this function is not guaranteed to produce a URL and can return a null string.
|
|
Tests to see if this session is a master session
|
|
This allows the user o check if the session is really stable.
|
|
Tries to connect this session to the supplied URL
|
|
This polls XPSession. Normally an application will yield enough time during threads for XPSession to function. Sometimes an application that uses a lot of 3D graphics can lock out other threads for quite some time. In these cases you may call XPSession::Poll() to yield some time to XPSession to perform housekeeping. |
|
If the pre-connect mechanism is enabled then this function must be called by the joining session node when packets have been exchanged to the satisfaction of the joining session node. |
|
Enables or disables any further connection attempts to this session.
|
|
Enables or disables the automatic packet compression test. If enabled XPSession will test each packet sent to see if it can be compressed and if there is a space saving then the packet is compressed before sending.
|
|
Sets the automatic Poll() method In multi-threading libraries this restarts the automatic polling thread so that an application does not need the call Poll() |
|
This allows the poll method to be set for the XPURL layer that is used by this session. |
|
This allows the session to set if it can become a master due to a fault being found from another session
|
|
This allows the user to enable or disable spidering of network connections
|
|
Sets the client only flag for this session node. The default value is false which means this node will get joiner and leaver messages. If this is set to be true then this node will only get joiner/leaver messages for spider nodes or nodes that can become master nodes. This must not be changed after the session is used for joining a session. Setting this to option to be true also automatically sets SetCanBecomeMaster() and SetCanSpider() to be false.
|
|
Enables or disables encryption for this session
|
|
Sets the current channel number for this session. If no channel number is passed then TransportAnyGameChannel is used.
|
|
This allows the latency recalculation delay to be set. The default value is 1 second meaning there is a ping packet sent every second.
|
|
Sets the manual Poll() method for this class only. |
|
This allows the poll method to be set for the XPURL layer that is used by this session. |
|
Enables or disables buffering for this session node. With buffering enabled extra memory is used to improve multi-threaded performance when this node is used by another thread.
|
|
This allows the user to determine if during a Poll() the layer below also gets called. For single threaded applications this function has no effect as the layer below always has the Poll() called. The default is true.
|
|
Enables or disables the pre-connect mechanism for session nodes that are joining a session. When this mechanism is enabled the joining session node will be able to exchange packets with the master session node before the node properly joins the session. The function PreConnectHasFinished() can be called to signal that the node wishes to complete a connect to the session. This function should only be used before a session node is used to join the session. The function IsStable() will not return true until the pre-connect is finished.
|