#include <Router.h>
Public Member Functions | |
void | SetRestrictRoutingByType (bool restrict__) |
void | AddAllowedType (unsigned char messageId) |
void | RemoveAllowedType (unsigned char messageId) |
void | SetConnectionGraph (DataStructures::WeightedGraph< ConnectionGraph::SystemAddressAndGroupId, unsigned short, false > *connectionGraph) |
bool | Send (char *data, unsigned bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, SystemAddressList *recipients) |
virtual void | OnAttach (RakPeerInterface *peer) |
virtual void | OnDetach (RakPeerInterface *peer) |
virtual void | OnShutdown (RakPeerInterface *peer) |
virtual void | Update (RakPeerInterface *peer) |
virtual PluginReceiveResult | OnReceive (RakPeerInterface *peer, Packet *packet) |
virtual void | OnCloseConnection (RakPeerInterface *peer, SystemAddress systemAddress) |
void Router::SetRestrictRoutingByType | ( | bool | restrict__ | ) |
We can restrict what kind of messages are routed by this plugin. This is useful for security, since you usually want to restrict what kind of messages you have to worry about from (as an example) other clients in a client / server system
[in] | restrict | True to restrict what messages will be routed. False to not do so (default). |
void Router::AddAllowedType | ( | unsigned char | messageId | ) |
If types are restricted, this adds an allowed message type to be routed
[in] | messageId | The type to not allow routing of. |
void Router::RemoveAllowedType | ( | unsigned char | messageId | ) |
Removes a restricted type previously added with AddRestrictedType
[in] | messageId | The type to no longer restrict routing of. |
void Router::SetConnectionGraph | ( | DataStructures::WeightedGraph< ConnectionGraph::SystemAddressAndGroupId, unsigned short, false > * | connectionGraph | ) |
Set the connection graph, which is a weighted graph of the topology of the network. You can easily get this from the ConnectionGraph plugin. See the 'router' sample for usage. This is necessary if you want to send (not necessary just to route).
[in] | connectionGraph | A weighted graph representing the topology of the network. |
bool Router::Send | ( | char * | data, | |
unsigned | bitLength, | |||
PacketPriority | priority, | |||
PacketReliability | reliability, | |||
char | orderingChannel, | |||
SystemAddressList * | recipients | |||
) |
Sends a bitstream to one or more systems. If multiple systems are specified, the message will be multicasted using a minimum spanning tree
[in] | data | The data to send |
[in] | bitLength | How many bits long data is |
[in] | priority | What priority level to send on. |
[in] | reliability | How reliability to send this data |
[in] | orderingChannel | When using ordered or sequenced packets, what channel to order these on.- Packets are only ordered relative to other packets on the same stream |
[in] | recipients | A list of recipients to send to. To send to one recipient, just pass a SystemAddress |
void Router::OnAttach | ( | RakPeerInterface * | peer | ) | [virtual] |
Called when the interface is attached
[in] | peer | the instance of RakPeer that is calling Receive |
Reimplemented from PluginInterface.
void Router::OnDetach | ( | RakPeerInterface * | peer | ) | [virtual] |
Called when the interface is detached
[in] | peer | the instance of RakPeer that is calling Receive |
Reimplemented from PluginInterface.
void Router::OnShutdown | ( | RakPeerInterface * | peer | ) | [virtual] |
Called when RakPeer is shutdown
[in] | peer | the instance of RakPeer that is calling Receive |
Reimplemented from PluginInterface.
void Router::Update | ( | RakPeerInterface * | peer | ) | [virtual] |
Update is called every time a packet is checked for .
[in] | peer | - the instance of RakPeer that is calling Receive |
Reimplemented from PluginInterface.
PluginReceiveResult Router::OnReceive | ( | RakPeerInterface * | peer, | |
Packet * | packet | |||
) | [virtual] |
OnReceive is called for every packet.
[in] | peer | the instance of RakPeer that is calling Receive |
[in] | packet | the packet that is being returned to the user |
Reimplemented from PluginInterface.
void Router::OnCloseConnection | ( | RakPeerInterface * | peer, | |
SystemAddress | systemAddress | |||
) | [virtual] |
Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system
[in] | peer | the instance of RakPeer that is calling Receive |
[in] | systemAddress | The system whose connection was closed |
Reimplemented from PluginInterface.