#include <RakPeerInterface.h>
Inheritance diagram for RakPeerInterface:
Public Member Functions | |
virtual | ~RakPeerInterface () |
Destructor. | |
virtual bool | Initialize (unsigned short MaximumNumberOfPeers, unsigned short localPort, int _threadSleepTimer, const char *forceHostAddress=0)=0 |
virtual void | InitializeSecurity (const char *pubKeyE, const char *pubKeyN, const char *privKeyP, const char *privKeyQ)=0 |
virtual void | DisableSecurity (void)=0 |
virtual void | SetMaximumIncomingConnections (unsigned short numberAllowed)=0 |
virtual unsigned short | GetMaximumIncomingConnections (void) const =0 |
virtual void | SetIncomingPassword (const char *passwordData, int passwordDataLength)=0 |
virtual RakNet::BitStream * | GetIncomingPassword (void)=0 |
virtual bool | Connect (const char *host, unsigned short remotePort, char *passwordData, int passwordDataLength)=0 |
virtual void | Disconnect (unsigned int blockDuration, unsigned char orderingChannel=0)=0 |
virtual bool | IsActive (void) const =0 |
virtual bool | GetConnectionList (PlayerID *remoteSystems, unsigned short *numberOfSystems) const =0 |
virtual bool | Send (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast)=0 |
virtual bool | Send (RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast)=0 |
virtual Packet * | Receive (void)=0 |
virtual void | DeallocatePacket (Packet *packet)=0 |
virtual unsigned short | GetMaximumNumberOfPeers (void) const =0 |
Return the total number of connections we are allowed. | |
virtual void | RegisterAsRemoteProcedureCall (char *uniqueID, void(*functionPointer)(RPCParameters *rpcParms))=0 |
virtual void | RegisterClassMemberRPC (char *uniqueID, void *functionPointer)=0 |
virtual void | UnregisterAsRemoteProcedureCall (char *uniqueID)=0 |
virtual bool | RPC (char *uniqueID, const char *data, unsigned int bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp, ObjectID objectID, RakNet::BitStream *replyFromTarget)=0 |
virtual bool | RPC (char *uniqueID, RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp, ObjectID objectID, RakNet::BitStream *replyFromTarget)=0 |
virtual void | CloseConnection (const PlayerID target, bool sendDisconnectionNotification, unsigned char orderingChannel=0)=0 |
virtual int | GetIndexFromPlayerID (const PlayerID playerId)=0 |
virtual PlayerID | GetPlayerIDFromIndex (int index)=0 |
virtual void | AddToBanList (const char *IP, unsigned int milliseconds=0)=0 |
virtual void | RemoveFromBanList (const char *IP)=0 |
virtual void | ClearBanList (void)=0 |
Allows all previously banned IPs to connect. | |
virtual bool | IsBanned (const char *IP)=0 |
virtual void | Ping (const PlayerID target)=0 |
virtual void | Ping (const char *host, unsigned short remotePort, bool onlyReplyOnAcceptingConnections)=0 |
virtual int | GetAveragePing (const PlayerID playerId)=0 |
virtual int | GetLastPing (const PlayerID playerId) const =0 |
virtual int | GetLowestPing (const PlayerID playerId) const =0 |
virtual void | SetOccasionalPing (bool doPing)=0 |
virtual RakNet::BitStream * | GetRemoteStaticData (const PlayerID playerId)=0 |
virtual void | SetRemoteStaticData (const PlayerID playerId, const char *data, const int length)=0 |
virtual void | SendStaticData (const PlayerID target)=0 |
virtual void | SetOfflinePingResponse (const char *data, const unsigned int length)=0 |
virtual PlayerID | GetInternalID (void) const =0 |
virtual PlayerID | GetExternalID (const PlayerID target) const =0 |
virtual void | SetTimeoutTime (unsigned int timeMS, const PlayerID target)=0 |
virtual bool | SetMTUSize (int size)=0 |
virtual int | GetMTUSize (void) const =0 |
virtual unsigned | GetNumberOfAddresses (void)=0 |
Returns the number of IP addresses we have. | |
virtual const char * | PlayerIDToDottedIP (const PlayerID playerId) const =0 |
virtual void | IPToPlayerID (const char *host, unsigned short remotePort, PlayerID *playerId)=0 |
virtual const char * | GetLocalIP (unsigned int index)=0 |
Returns an IP address at index 0 to GetNumberOfAddresses-1. | |
virtual void | AllowConnectionResponseIPMigration (bool allow)=0 |
virtual void | AdvertiseSystem (char *host, unsigned short remotePort, const char *data, int dataLength)=0 |
virtual void | SetCompileFrequencyTable (bool doCompile)=0 |
virtual bool | GetOutgoingFrequencyTable (unsigned int outputFrequencyTable[256])=0 |
virtual bool | GenerateCompressionLayer (unsigned int inputFrequencyTable[256], bool inputLayer)=0 |
virtual bool | DeleteCompressionLayer (bool inputLayer)=0 |
virtual float | GetCompressionRatio (void) const =0 |
virtual float | GetDecompressionRatio (void) const =0 |
virtual void | AttachPlugin (PluginInterface *messageHandler)=0 |
virtual void | DetachPlugin (PluginInterface *messageHandler)=0 |
virtual void | GetPasswordData (char *passwordData, int *passwordDataLength)=0 |
virtual void | PushBackPacket (Packet *packet, bool pushAtHead)=0 |
virtual RPCMap * | GetRPCMap (const PlayerID playerId)=0 |
virtual void | ApplyNetworkSimulator (unsigned short maxPacketsOnWire, unsigned short minExtraPing, unsigned short extraPingVariance)=0 |
virtual bool | IsNetworkSimulatorActive (void)=0 |
virtual RakNetStatisticsStruct *const | GetStatistics (const PlayerID playerId)=0 |
The primary interface for RakNet, RakPeer contains all major functions for the library. RakServer and RakClient are simply specialized Implementations of RakPeer. See the individual functions for what the class can do.
|
Bans an IP from connecting. Banned IPs persist between connections. param[in] IP Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will banAll IP addresses starting with 128.0.0
Implemented in RakPeer. |
|
Sends a one byte message ID_ADVERTISE_SYSTEM to the remote unconnected system. This will tell the remote system our external IP outside the LAN, and can be used for NAT punch through
|
|
Allow or disallow connection responses from any IP. Normally this should be false, but may be necessary when connection to servers with multiple IP addresses.
|
|
Adds simulated ping and packet loss to the outgoing data flow. To simulate bi-directional ping and packet loss, you should call this on both the sender and the recipient, with half the total ping and maxPacketsOnWire value on each. You can exclude network simulator code with the _FINAL define to decrease code size
|
|
Attatches a Plugin interface to run code automatically on message receipt in the Receive call
|
|
Close the connection to another host (if we initiated the connection it will disconnect, if they did it will kick them out).
Implemented in RakPeer. |
|
Call this to connect to the specified host (ip or domain name) and server port. Calling Connect and not calling SetMaximumIncomingConnections acts as a dedicated client. Calling both acts as a true peer. This is a non-blocking connection. You know the connection is successful when IsConnected() returns trueor receive gets a packet with the type identifier ID_CONNECTION_ACCEPTED. If the connection is notsuccessful, such as rejected connection or no response then neither of these things will happen.
Implemented in RakPeer. |
|
Call this to deallocate a packet returned by Receive when you are done handling it.
|
|
Delete the output or input layer as specified. This is not necessary to call and is only valuable for freeing memory.
|
|
Detaches a Plugin interface to run code automatically on message receipt
|
|
Disables all security.
|
|
Stops the network threads and close all connections. Multiple calls are ok.
|
|
This is an optional function to generate the compression layer based on the input frequency table. If you want to use it you should call this twice - once with inputLayer as true and once as false. The frequency table passed here with inputLayer=true should match the frequency table on the recipient with inputLayer=false. Likewise, the frequency table passed here with inputLayer=false should match the frequency table on the recipient with inputLayer=true. Calling this function when there is an existing layer will overwrite the old layer.
|
|
Returns the average of all ping times read for the specific player or -1 if none read yet
|
|
Returns the compression ratio. A low compression ratio is good. Compression is for outgoing data
|
|
Fills the array remoteSystems with the playerID of all the systems we are connected to
Implemented in RakPeer. |
|
Returns the decompression ratio. A high decompression ratio is good. Decompression is for incoming data
|
|
Return the unique address identifier that represents you on the the network and is based on your externalIP / port (the IP / port the specified player uses to communicate with you)
Implemented in RakPeer. |
|
Get the password set by SetIncomingPassword in a BitStream
Implemented in RakPeer. |
|
Given a playerID, returns an index from 0 to the maximum number of players allowed - 1.
|
|
Return the unique address identifier that represents you on the the network and is based on your local IP / port. Note that unlike in previous versions, this is a struct and is not sequential |
|
Returns the last ping time read for the specific player or -1 if none read yet
Implemented in RakPeer. |
|
Returns the lowest ping time read or -1 if none read yet
Implemented in RakPeer. |
|
Returns the number of maximum incoming connection.
Implemented in RakPeer. |
|
Returns the current MTU size
|
|
Returns the frequency of outgoing bytes into output frequency table The purpose is to save to file as either a master frequency table from a sample game session for passing to GenerateCompressionLayer()
Implemented in RakPeer. |
|
Retrieves the data you passed to the passwordData parameter in Connect
Implemented in RakPeer. |
|
This function is only useful for looping through all players. Given an index, will return a PlayerID.
|
|
All systems have a block of data associated with them, for user use. This block of data can be used to easily specify typical system data that you want to know on connection, such as the player's name.
Implemented in RakPeer. |
|
Returns a structure containing a large set of network statistics for the specified system. You can map this data to a string using the C style StatisticsToString() function
|
|
Starts the network threads, opens the listen port. You must call this before calling SetMaximumIncomingConnections or ConnectMultiple calls while already active are ignored. To call this function again with different settings, you must first call Disconnect()To accept incoming connections, use SetMaximumIncomingConnectionsParameters:
Implemented in RakPeer. |
|
Secures connections though a combination of SHA1, AES128, SYN Cookies, and RSA to preventconnection spoofing, replay attacks, data eavesdropping, packet tampering, and MitM attacks. There is a significant amount of processing and a slight amount of bandwidthoverhead for this feature. If you accept connections, you must call this or else secure connections will not be enabledfor incoming connections. If you are connecting to another system, you can call this with values for the(e and p,q) public keys before connecting to prevent MitM
Implemented in RakPeer. |
|
Converts a dotted IP to a playerId
Implemented in RakPeer. |
|
Returns if the network thread is running
|
|
Returns true or false indicating if a particular IP is banned.
|
|
Returns if you previously called ApplyNetworkSimulator
|
|
Send a ping to the specified unconnected system.The remote system, if it is Initialized, will respond with ID_PONG.The final ping time will be encoded in the following 4 bytes (2-5) as an unsigned intRequires:The sender and recipient must already be started via a successful call to Initialize
Implemented in RakPeer. |
|
Send a ping to the specified connected system.
Implemented in RakPeer. |
|
Returns the dotted IP address for the specified playerId
|
|
Put a packet back at the end of the receive queue in case you don't want to deal with it immediately
|
|
Gets a packet from the incoming packet queue. Use DeallocatePacket() to deallocate the packet after you are done with it. If the server is not active this will also return 0, as all waiting packets are flushed when the server is Disconnected User-thread functions, such as RPC calls and the plugin function PluginInterface::OnUpdate occur here.
|
|
Allows a previously banned IP to connect. param[in] Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will banAll IP addresses starting with 128.0.0 |
|
Sends a block of data to the specified system that you are connected to.This function only works while the client is connected (Use the Connect function).
|
|
Sends a block of data to the specified system that you are connected to. This function only works while the connected (Use the Connect function).
|
|
Sends your static data to the specified system. This is automatically done on connection. You should call this when you change your static data.To send the static data of another system (such as relaying their data) you should do this normally with Send)
Implemented in RakPeer. |
|
Enables or disables frequency table tracking. This is required to get a frequency table, which is used in GenerateCompressionLayer() This value persists between connect calls and defaults to false (no frequency tracking)
Implemented in RakPeer. |
|
Sets the password incoming connections must match in the call to Connect (defaults to none). Pass 0 to passwordData to specify no password
Implemented in RakPeer. |
|
Sets how many incoming connections are allowed. If this is less than the number of players currently connected, no more players will be allowed to connect. If this is greater than the maximum number of peers allowed, it will be reducedto the maximum number of peers allowed. Defaults to 0.
Implemented in RakPeer. |
|
Set the MTU per datagram. It's important to set this correctly - otherwise packets will be needlessly split, decreasing performance and throughput. Maximum allowed size is MAXIMUM_MTU_SIZE. Too high of a value will cause packets not to arrive at worst and be fragmented at best. Too low of a value will split packets unnecessarily. sa MTUSize.h
|
|
Ping the remote systems every so often, or not. This is off by default. Can be called anytime.
Implemented in RakPeer. |
|
Sets the data to send along with a LAN server discovery or offline ping reply. length should be under 400 bytes, as a security measure against flood attacks
|
|
All systems have a block of data associated with them, for user use. This block of data can be used to easily specify typical system data that you want to know on connection, such as the player's name.
Implemented in RakPeer. |
|
Set the time, in MS, to use before considering ourselves disconnected after not being able to deliver a reliable packet Default time is 10,000 or 10 seconds in release and 30,000 or 30 seconds in debug.
|