FileListTransfer Class Reference
[FileListTransfer]

A plugin to provide a simple way to compress and incrementally send the files in the FileList structure. Similar to the DirectoryDeltaTransfer plugin, except that it doesn't send deltas based on pre-existing files or actually write the files to disk. More...

#include <FileListTransfer.h>

Inheritance diagram for FileListTransfer:

PluginInterface List of all members.

Public Member Functions

unsigned short SetupReceive (FileListTransferCBInterface *handler, bool deleteHandler, PlayerID allowedSender)
void Send (FileList *fileList, RakPeerInterface *rakPeer, PlayerID recipient, unsigned short setID, PacketPriority priority, char orderingChannel, bool compressData)
void RemoveReceiver (PlayerID playerId)
virtual PluginReceiveResult OnReceive (RakPeerInterface *peer, Packet *packet)
virtual void OnDisconnect (RakPeerInterface *peer)
virtual void OnCloseConnection (RakPeerInterface *peer, PlayerID playerId)
virtual void OnAttach (RakPeerInterface *peer)

Protected Member Functions

bool DecodeSetHeader (Packet *packet)
bool DecodeFile (Packet *packet, bool fullFile)
void Clear (void)

Protected Attributes

DataStructures::Map< unsigned
short, FileListReceiver * > 
fileListReceivers
unsigned short setId
RakPeerInterfacerakPeer

Classes

struct  FileListReceiver

Detailed Description

A plugin to provide a simple way to compress and incrementally send the files in the FileList structure. Similar to the DirectoryDeltaTransfer plugin, except that it doesn't send deltas based on pre-existing files or actually write the files to disk.

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 send, passing the return value of FileListTransfer::SetupReceive() as the setID parameter to FileListTransfer::Send()


Member Function Documentation

void FileListTransfer::OnAttach RakPeerInterface peer  )  [virtual]
 

Called when the interface is attached

Parameters:
[in] peer the instance of RakPeer that is calling Receive

Reimplemented from PluginInterface.

void FileListTransfer::OnCloseConnection RakPeerInterface peer,
PlayerID  playerId
[virtual]
 

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters:
[in] peer the instance of RakPeer that is calling Receive
[in] playerId The system whose connection was closed

Reimplemented from PluginInterface.

void FileListTransfer::OnDisconnect RakPeerInterface peer  )  [virtual]
 

Called when RakPeer is shutdown

Parameters:
[in] peer the instance of RakPeer that is calling Receive

Reimplemented from PluginInterface.

PluginReceiveResult FileListTransfer::OnReceive RakPeerInterface peer,
Packet packet
[virtual]
 

OnReceive is called for every packet.

Parameters:
[in] peer the instance of RakPeer that is calling Receive
[in] packet the packet that is being returned to the user
Returns:
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from PluginInterface.

void FileListTransfer::Send FileList *  fileList,
RakPeerInterface rakPeer,
PlayerID  recipient,
unsigned short  setID,
PacketPriority  priority,
char  orderingChannel,
bool  compressData
 

Send the FileList structure to another system, which must have previously called SetupReceive()

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

unsigned short FileListTransfer::SetupReceive FileListTransferCBInterface handler,
bool  deleteHandler,
PlayerID  allowedSender
 

Allows one corresponding Send() call from another system to arrive.

Parameters:
[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
Returns:
A set ID value, which should be passed as the setID value to the Send() call on the other system. This value will be returned in the callback and is unique per file set. Returns 65535 on failure (not connected to sender)


The documentation for this class was generated from the following files:
Generated on Sat Oct 14 08:37:38 2006 for RakNet by  doxygen 1.4.6-NO