Used to route messages between peers. More...
#include <Router.h>
Inherits PluginInterface2, and RouterInterface.
Public Member Functions | |
Router () | |
virtual | ~Router () |
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, BitSize_t bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, SystemAddressList *recipients) |
bool | Send (const char *data, BitSize_t bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, SystemAddress systemAddress) |
virtual void | OnAttach (void) |
virtual void | OnDetach (void) |
virtual PluginReceiveResult | OnReceive (Packet *packet) |
Protected Member Functions | |
void | SendTree (PacketPriority priority, PacketReliability reliability, char orderingChannel, DataStructures::Tree< ConnectionGraph::SystemAddressAndGroupId > *tree, const char *data, BitSize_t bitLength, RakNet::BitStream *out, SystemAddressList *recipients) |
void | SerializePreorder (DataStructures::Tree< ConnectionGraph::SystemAddressAndGroupId > *tree, RakNet::BitStream *out, SystemAddressList *recipients) const |
Protected Attributes | |
DataStructures::WeightedGraph < ConnectionGraph::SystemAddressAndGroupId, unsigned short, false > * | graph |
bool | restrictByType |
DataStructures::OrderedList < unsigned char, unsigned char > | allowedTypes |
Used to route messages between peers.
Definition at line 36 of file Router.h.
Router::Router | ( | ) |
Definition at line 20 of file Router.cpp.
Router::~Router | ( | ) | [virtual] |
Definition at line 26 of file Router.cpp.
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. |
Definition at line 33 of file Router.cpp.
void Router::OnAttach | ( | void | ) | [virtual] |
void Router::OnDetach | ( | void | ) | [virtual] |
PluginReceiveResult Router::OnReceive | ( | Packet * | packet | ) | [virtual] |
void Router::RemoveAllowedType | ( | unsigned char | messageId | ) |
Removes a restricted type previously added with AddRestrictedType
[in] | messageId | The type to no longer restrict routing of. |
Definition at line 38 of file Router.cpp.
bool Router::Send | ( | char * | data, | |
BitSize_t | 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 |
Definition at line 63 of file Router.cpp.
bool Router::Send | ( | const char * | data, | |
BitSize_t | bitLength, | |||
PacketPriority | priority, | |||
PacketReliability | reliability, | |||
char | orderingChannel, | |||
SystemAddress | systemAddress | |||
) | [virtual] |
Implements RouterInterface.
Definition at line 47 of file Router.cpp.
void Router::SendTree | ( | PacketPriority | priority, | |
PacketReliability | reliability, | |||
char | orderingChannel, | |||
DataStructures::Tree< ConnectionGraph::SystemAddressAndGroupId > * | tree, | |||
const char * | data, | |||
BitSize_t | bitLength, | |||
RakNet::BitStream * | out, | |||
SystemAddressList * | recipients | |||
) | [protected] |
Definition at line 96 of file Router.cpp.
void Router::SerializePreorder | ( | DataStructures::Tree< ConnectionGraph::SystemAddressAndGroupId > * | tree, | |
RakNet::BitStream * | out, | |||
SystemAddressList * | recipients | |||
) | const [protected] |
Definition at line 303 of file Router.cpp.
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. |
Definition at line 43 of file Router.cpp.
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). |
Definition at line 29 of file Router.cpp.
DataStructures::OrderedList<unsigned char,unsigned char> Router::allowedTypes [protected] |
DataStructures::WeightedGraph<ConnectionGraph::SystemAddressAndGroupId, unsigned short, false>* Router::graph [protected] |
bool Router::restrictByType [protected] |