Plugin Interface

Plugin Interface Overview PluginInterface.h is a class interface that works with RakNet to provide automatic functionality. It can intercept, modify, and create messages before they get to the user. It can also update automatically every time RakPeerInterface::Receive() is called. To use it, derive from the base class and implement the virtual functions you want to handle. Then register your class by calling RakPeerInterface::AttachPlugin() These are the virtual functions you'll probably need to handle in most cases: Called when you attach the plugin to the RakPeer virtual void OnAttach(RakPeerInterface *peer); Called when the plugin is detached virtual void OnDetach(RakPeerInterface *peer); Update is called everytime Receive is called through RakNet virtual void Update(RakPeerInterface *peer); OnReceive is called everytime a packet goes through RakNet. You can handle it or not as you want. Return RR_STOP_PROCESSING_AND_DEALLOCATE to absorb the packet, or RR_CONTINUE_PROCESSING to allow the packet to propagate to another handler, or to the game. Generally you will return RR_CONTINUE_PROCESSING unless the packet type is specific to your handler. virtual PluginReceiveResult OnReceive(RakPeerInterface *peer, Packet *packet); Called when Shutdown is called for the RakPeer. virtual void OnShutdown(RakPeerInterface *peer); Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system. virtual void OnCloseConnection(RakPeerInterface *peer, SystemAddress systemAddress);

See Also

Index Fully Connected Mesh Replica Manager