Public Member Functions | Protected Member Functions | Protected Attributes

Router Class Reference
[Router]

Used to route messages between peers. More...

#include <Router.h>

Inherits PluginInterface2, and RouterInterface.

Collaboration diagram for Router:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

Used to route messages between peers.

Deprecated:

Definition at line 36 of file Router.h.


Constructor & Destructor Documentation

Router::Router (  ) 

Definition at line 20 of file Router.cpp.

Router::~Router (  )  [virtual]

Definition at line 26 of file Router.cpp.


Member Function Documentation

void Router::AddAllowedType ( unsigned char  messageId  ) 

If types are restricted, this adds an allowed message type to be routed

Parameters:
[in] messageId The type to not allow routing of.

Definition at line 33 of file Router.cpp.

Here is the call graph for this function:

void Router::OnAttach ( void   )  [virtual]

Definition at line 295 of file Router.cpp.

Here is the call graph for this function:

void Router::OnDetach ( void   )  [virtual]

Definition at line 299 of file Router.cpp.

Here is the call graph for this function:

PluginReceiveResult Router::OnReceive ( Packet packet  )  [virtual]

Definition at line 145 of file Router.cpp.

Here is the call graph for this function:

void Router::RemoveAllowedType ( unsigned char  messageId  ) 

Removes a restricted type previously added with AddRestrictedType

Parameters:
[in] messageId The type to no longer restrict routing of.

Definition at line 38 of file Router.cpp.

Here is the call graph for this function:

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

Precondition:
You just have called SetConnectionGraph with a valid graph representing the network topology
Note:
Single target sends from RakPeer with this plugin installed will also be routed. Sends from other plugins will also be routed as long as this plugin is attached first.
Parameters:
[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
Returns:
True on success, false mostly if the connection graph cannot find the destination.

Definition at line 63 of file Router.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the call graph for this function:

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.

Here is the call graph for this function:

Here is the caller graph for this function:

void Router::SerializePreorder ( DataStructures::Tree< ConnectionGraph::SystemAddressAndGroupId > *  tree,
RakNet::BitStream out,
SystemAddressList recipients 
) const [protected]

Definition at line 303 of file Router.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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).

Parameters:
[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

Parameters:
[in] restrict True to restrict what messages will be routed. False to not do so (default).

Definition at line 29 of file Router.cpp.


Member Data Documentation

DataStructures::OrderedList<unsigned char,unsigned char> Router::allowedTypes [protected]

Definition at line 89 of file Router.h.

Definition at line 87 of file Router.h.

bool Router::restrictByType [protected]

Definition at line 88 of file Router.h.


The documentation for this class was generated from the following files: