#include <FileListTransfer.h>
Public Member Functions | |
unsigned short | SetupReceive (FileListTransferCBInterface *handler, bool deleteHandler, SystemAddress allowedSender) |
void | Send (FileList *fileList, RakPeerInterface *rakPeer, SystemAddress recipient, unsigned short setID, PacketPriority priority, char orderingChannel, bool compressData) |
void | CancelReceive (unsigned short setId) |
Stop a download. | |
void | RemoveReceiver (SystemAddress systemAddress) |
Remove all handlers associated with a particular system address. | |
bool | IsHandlerActive (unsigned short setId) |
Is a handler passed to SetupReceive still running? | |
virtual PluginReceiveResult | OnReceive (RakPeerInterface *peer, Packet *packet) |
virtual void | OnShutdown (RakPeerInterface *peer) |
virtual void | OnCloseConnection (RakPeerInterface *peer, SystemAddress systemAddress) |
virtual void | OnAttach (RakPeerInterface *peer) |
virtual void | Update (RakPeerInterface *peer) |
Usage: Call SetupReceive to allow one file set to arrive. The value returned by FileListTransfer::SetupReceive() is the setID that is allowed. It's up to you to transmit this value to the other system, along with information indicating what kind of files you want to get. The other system should then prepare a FileList and call FileListTransfer::Send(), passing the return value of FileListTransfer::SetupReceive() as the setID parameter to FileListTransfer::Send()
unsigned short FileListTransfer::SetupReceive | ( | FileListTransferCBInterface * | handler, | |
bool | deleteHandler, | |||
SystemAddress | allowedSender | |||
) |
Allows one corresponding Send() call from another system to arrive.
[in] | handler | The class to call on each file |
[in] | deleteHandler | True to delete the handler when it is no longer needed. False to not do so. |
[in] | allowedSender | Which system to allow files from |
void FileListTransfer::Send | ( | FileList * | fileList, | |
RakPeerInterface * | rakPeer, | |||
SystemAddress | recipient, | |||
unsigned short | setID, | |||
PacketPriority | priority, | |||
char | orderingChannel, | |||
bool | compressData | |||
) |
Send the FileList structure to another system, which must have previously called SetupReceive()
[in] | fileList | A list of files. The data contained in FileList::data will be sent incrementally and compressed among all files in the set |
[in] | rakPeer | The instance of RakNet to use to send the message |
[in] | recipient | The address of the system to send to |
[in] | setID | The return value of SetupReceive() which was previously called on recipient |
[in] | priority | Passed to RakPeerInterface::Send() |
[in] | orderingChannel | Passed to RakPeerInterface::Send() |
[in] | compressData | Use a poor but fast compression algorithm. This makes your data larger if it is already compressed or if the amount of data to send is small so don't use it blindly. |
PluginReceiveResult FileListTransfer::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 FileListTransfer::OnShutdown | ( | RakPeerInterface * | peer | ) | [virtual] |
Called when RakPeer is shutdown
[in] | peer | the instance of RakPeer that is calling Receive |
Reimplemented from PluginInterface.
void FileListTransfer::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.
void FileListTransfer::OnAttach | ( | RakPeerInterface * | peer | ) | [virtual] |
Called when the interface is attached
[in] | peer | the instance of RakPeer that is calling Receive |
Reimplemented from PluginInterface.
void FileListTransfer::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.