Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "NativeFeatureIncludes.h"
00010 #if _RAKNET_SUPPORT_Router==1
00011
00012
00013 #ifndef __ROUTER_PLUGIN_H
00014 #define __ROUTER_PLUGIN_H
00015
00016 class RakPeerInterface;
00017 #include "RakNetTypes.h"
00018 #include "PluginInterface2.h"
00019 #include "DS_OrderedList.h"
00020 #include "DS_WeightedGraph.h"
00021 #include "PacketPriority.h"
00022 #include "SystemAddressList.h"
00023 #include "RouterInterface.h"
00024 #include "Export.h"
00025 #include "ConnectionGraph.h"
00026
00031
00036 class RAK_DLL_EXPORT Router : public PluginInterface2 , public RouterInterface
00037 {
00038 public:
00039 Router();
00040 virtual ~Router();
00041
00042
00043
00044
00049 void SetRestrictRoutingByType(bool restrict__);
00050
00053 void AddAllowedType(unsigned char messageId);
00054
00057 void RemoveAllowedType(unsigned char messageId);
00058
00063 void SetConnectionGraph(DataStructures::WeightedGraph<ConnectionGraph::SystemAddressAndGroupId, unsigned short, false> *connectionGraph);
00064
00075 bool Send( char *data, BitSize_t bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, SystemAddressList *recipients );
00076 bool Send( const char *data, BitSize_t bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, SystemAddress systemAddress );
00077
00078
00079
00080
00081 virtual void OnAttach(void);
00082 virtual void OnDetach(void);
00083 virtual PluginReceiveResult OnReceive(Packet *packet);
00084 protected:
00085 void SendTree(PacketPriority priority, PacketReliability reliability, char orderingChannel, DataStructures::Tree<ConnectionGraph::SystemAddressAndGroupId> *tree, const char *data, BitSize_t bitLength, RakNet::BitStream *out, SystemAddressList *recipients);
00086 void SerializePreorder(DataStructures::Tree<ConnectionGraph::SystemAddressAndGroupId> *tree, RakNet::BitStream *out, SystemAddressList *recipients) const;
00087 DataStructures::WeightedGraph<ConnectionGraph::SystemAddressAndGroupId, unsigned short, false> *graph;
00088 bool restrictByType;
00089 DataStructures::OrderedList<unsigned char,unsigned char> allowedTypes;
00090 };
00091
00092 #endif
00093
00094 #endif // _RAKNET_SUPPORT_*