#include <Transport.h>
Public Types | |
enum | Error { kTransport_EOK = 0, kTransport_EERROR = -1, kTransport_ECANTLISTENONCHANNEL = -2, kTransport_EWAITING = -3 } |
enum | Bandwidth { kBandwidth_Off = 0, kBandwidth_Connection = 1 } |
Public Member Functions | |
Transport () | |
virtual | ~Transport () |
virtual int | GetPacketsSent (const bool reset=false) |
virtual int | GetPacketsSentMerged (const bool reset=false) |
virtual int | GetPacketsSentSize (const bool reset=false) |
virtual int | GetPacketsReceived (const bool reset=false) |
virtual int | GetPacketsReceivedMerged (const bool reset=false) |
virtual int | GetPacketsReceivedSize (const bool reset=false) |
virtual int | GetPacketsLost (const bool reset=false) |
virtual void | SetBandwidthLimit (const Bandwidth enable=kBandwidth_Off) |
virtual Bandwidth | GetBandwidthLimit () |
virtual void | SetMaximumOutputBandwidth (const int bytesPerSecond=0) |
virtual int | GetMaximumOutputBandwidth (void) |
virtual void | SetMaximumInputBandwidth (const int bytesPerSecond=0) |
virtual int | GetMaximumInputBandwidth (void) |
virtual std::string | GetPeerURL (void) |
virtual bool | GetTransportClosed (void) |
virtual void | SetEnableLANDiscovery (const bool enable=true) |
virtual bool | GetEnableLANDiscovery (void) |
virtual std::string | CanAccept (void)=0 |
virtual std::string | CanRoute (void)=0 |
virtual std::string | ExportURL (void)=0 |
virtual Transport * | Allocate (void)=0 |
virtual Error | Listen (const int channel=TransportAnyGameChannel)=0 |
virtual Error | Connect (const std::string address)=0 |
virtual Transport * | Accept (void)=0 |
virtual Error | Send (const char *data, const int len)=0 |
virtual Error | SendReliable (const char *data, const int len)=0 |
virtual Error | SendCertain (const char *data, const int len)=0 |
virtual int | Recv (char *const data, const int maxlen)=0 |
virtual int | GetMaxPacketSize (void)=0 |
virtual std::string | HandleDiscovery (void)=0 |
virtual void | HandleDiscoveryReply (const std::string reply)=0 |
virtual void | BeginDiscovery (void)=0 |
virtual std::string | GetNextDiscovery (void)=0 |
virtual Error | GetStatus (void)=0 |
|
Standard Transport errors
|
|
The ctor performs some basic initialisation |
|
The dtor makes sure everything is tidy |
|
Accepts the first pending connection from another Transport |
|
Used to allocate a transport of the relevant class type
|
|
This starts the discovery cycle to try to find other transports |
|
Enables a Transport to state which type of protocol it can receive. Each protocol type is separated by a comma.
|
|
Enables a Transport to state which type of protocol it can route. Each protocol type is separated by a comma.
|
|
Tries to connect to a specified address
|
|
Exports a URL that is used by this transport and can be used by other Transports to locate this transport.
|
|
Reads the configuration value set by SetBandwidthLimit()
|
|
Reads the configuration value set by SetEnableLANDiscovery().
|
|
Reads the configuration value set by GetMaximumInputBandwidth().
|
|
Reads the configuration value set by SetMaximumOutputBandwidth()
|
|
Gets the maximum packet size that can be transmitted over this Transport. The base spec requires a Transport to cope with packets of at least the number of bytes defined by TransportMinimumPacketSize
|
|
This is the function that can be used to discover other similar transports that can be connected to.
|
|
Gets the total number of packets that were lost and had to be resent.
|
|
Gets the total number of packets that were received.
|
|
Gets the total number of merged packets that were received.
|
|
Gets the total size of packets that were received.
|
|
Gets the total number of packets that were sent.
|
|
Gets the total number of merged packets that were sent.
|
|
Gets the total size of packets that were sent.
|
|
If connected this gets the URL of the other transport. It is possible this function will return a null string when connected if the transport provider does not support this functionality.
|
|
Gets the status of this transport
|
|
If this returns false the transport was closed due to an error such as a timeout. If this returns true then the transport was gracefully closed without an error. The default is to return false. |
|
If a discovery is pending this will return the URL of the source machine that made a discovery request
|
|
This function handles the reply URL that is passed back to the previous calling machine of HandleDiscovery()
|
|
Sets this Transport to listen on a certain channel. The default channel is defined as AnyGameChannel
|
|
Tries to receive data pending at this Transport. Data packets received by this method cannot be merged together.
|
|
Tries to send data to the currently connected Transport via the "unreliable" method without using any form of packet loss correction.
|
|
Tries to send data to the currently connected Transport via the "certain" method that guarantees delivery of packets but does not gaurantee the packet receive order is maintained.
|
|
Tries to send data to the currently connected Transport via the "reliable" method that guarantees packets are received in the same order they are sent.
|
|
Sets the bandwidth limit algorithm to be used for this Transport type.
|
|
Enables or disables LAN discovery of this transport type.
|
|
Sets the maximum input bandwidth for emulation.
|
|
Sets the maximum output bandwidth for emulation.
|