Classes | Public Member Functions | Protected Member Functions | Protected Attributes

FileListTransfer Class Reference
[FileListTransfer]

A plugin to provide a simple way to compress and incrementally send the files in the FileList structure. More...

#include <FileListTransfer.h>

Inherits PluginInterface2.

Collaboration diagram for FileListTransfer:
Collaboration graph
[legend]

List of all members.

Classes

struct  FileToPush
struct  FileToPushRecipient

Public Member Functions

 FileListTransfer ()
virtual ~FileListTransfer ()
unsigned short SetupReceive (FileListTransferCBInterface *handler, bool deleteHandler, SystemAddress allowedSender)
 Allows one corresponding Send() call from another system to arrive.
void Send (FileList *fileList, RakPeerInterface *rakPeer, SystemAddress recipient, unsigned short setID, PacketPriority priority, char orderingChannel, bool compressData, IncrementalReadInterface *_incrementalReadInterface=0, unsigned int _chunkSize=262144 *4 *16)
 Send the FileList structure to another system, which must have previously called SetupReceive().
unsigned int GetPendingFilesToAddress (SystemAddress recipient)
 Return number of files waiting to go out to a particular address.
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?
void SetCallback (FileListProgress *cb)
 Set a callback to get progress reports about what the file list instances do.
FileListProgressGetCallback (void) const
virtual PluginReceiveResult OnReceive (Packet *packet)
virtual void OnRakPeerShutdown (void)
 Called when RakPeer is shutdown.
virtual void OnClosedConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void Update (void)
 Update is called every time a packet is checked for .

Protected Member Functions

bool DecodeSetHeader (Packet *packet)
bool DecodeFile (Packet *packet, bool fullFile)
void Clear (void)
void OnReferencePush (Packet *packet, bool fullFile)
void OnReferencePushAck (Packet *packet)
void SendIRIToAddress (SystemAddress systemAddress)

Protected Attributes

DataStructures::Map< unsigned
short, FileListReceiver * > 
fileListReceivers
unsigned short setId
FileListProgresscallback
DataStructures::List
< FileToPushRecipient * > 
filesToPushAllSameAddress
SimpleMutex filesToPushAllSameAddressMutex

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

Definition at line 45 of file FileListTransfer.h.


Constructor & Destructor Documentation

FileListTransfer::FileListTransfer (  ) 

Definition at line 56 of file FileListTransfer.cpp.

FileListTransfer::~FileListTransfer (  )  [virtual]

Definition at line 62 of file FileListTransfer.cpp.

Here is the call graph for this function:


Member Function Documentation

void FileListTransfer::CancelReceive ( unsigned short  setId  ) 

Stop a download.

Definition at line 477 of file FileListTransfer.cpp.

Here is the call graph for this function:

void FileListTransfer::Clear ( void   )  [protected]

Definition at line 445 of file FileListTransfer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool FileListTransfer::DecodeFile ( Packet packet,
bool  fullFile 
) [protected]

Definition at line 270 of file FileListTransfer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool FileListTransfer::DecodeSetHeader ( Packet packet  )  [protected]

Definition at line 212 of file FileListTransfer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

FileListProgress * FileListTransfer::GetCallback ( void   )  const
Returns:
what was sent to SetCallback
What was sent to SetCallback

Definition at line 549 of file FileListTransfer.cpp.

Here is the caller graph for this function:

unsigned int FileListTransfer::GetPendingFilesToAddress ( SystemAddress  recipient  ) 

Return number of files waiting to go out to a particular address.

Definition at line 898 of file FileListTransfer.cpp.

Here is the call graph for this function:

bool FileListTransfer::IsHandlerActive ( unsigned short  setId  ) 

Is a handler passed to SetupReceive still running?

Definition at line 541 of file FileListTransfer.cpp.

Here is the call graph for this function:

void FileListTransfer::OnClosedConnection ( SystemAddress  systemAddress,
RakNetGUID  rakNetGUID,
PI2_LostConnectionReason  lostConnectionReason 
) [virtual]

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

Parameters:
[in] systemAddress The system whose connection was closed
[in] rakNetGuid The guid of the specified system
[in] lostConnectionReason How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from PluginInterface2.

Definition at line 470 of file FileListTransfer.cpp.

Here is the call graph for this function:

void FileListTransfer::OnRakPeerShutdown ( void   )  [virtual]

Called when RakPeer is shutdown.

Reimplemented from PluginInterface2.

Definition at line 441 of file FileListTransfer.cpp.

Here is the call graph for this function:

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

OnReceive is called for every packet.

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

Definition at line 406 of file FileListTransfer.cpp.

Here is the call graph for this function:

void FileListTransfer::OnReferencePush ( Packet packet,
bool  fullFile 
) [protected]

Definition at line 571 of file FileListTransfer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FileListTransfer::OnReferencePushAck ( Packet packet  )  [protected]

Definition at line 894 of file FileListTransfer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FileListTransfer::RemoveReceiver ( SystemAddress  systemAddress  ) 

Remove all handlers associated with a particular system address.

Definition at line 493 of file FileListTransfer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FileListTransfer::Send ( FileList fileList,
RakPeerInterface rakPeer,
SystemAddress  recipient,
unsigned short  setID,
PacketPriority  priority,
char  orderingChannel,
bool  compressData,
IncrementalReadInterface _incrementalReadInterface = 0,
unsigned int  _chunkSize = 262144*4*16 
)

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. Pass 0 to use the instance the plugin is attached to
[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 deprecated, unsupported
[in] _incrementalReadInterface If a file in fileList has no data, filePullInterface will be used to read the file in chunks of size chunkSize
[in] _chunkSize How large of a block of a file to send at once

Definition at line 96 of file FileListTransfer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FileListTransfer::SendIRIToAddress ( SystemAddress  systemAddress  )  [protected]

Definition at line 791 of file FileListTransfer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FileListTransfer::SetCallback ( FileListProgress cb  ) 

Set a callback to get progress reports about what the file list instances do.

Parameters:
[in] cb A pointer to an externally defined instance of FileListProgress. This pointer is held internally, so should remain valid as long as this class is valid.

Definition at line 545 of file FileListTransfer.cpp.

unsigned short FileListTransfer::SetupReceive ( FileListTransferCBInterface handler,
bool  deleteHandler,
SystemAddress  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)

Definition at line 66 of file FileListTransfer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FileListTransfer::Update ( void   )  [virtual]

Update is called every time a packet is checked for .

Reimplemented from PluginInterface2.

Definition at line 553 of file FileListTransfer.cpp.

Here is the call graph for this function:


Member Data Documentation

Definition at line 111 of file FileListTransfer.h.

Definition at line 109 of file FileListTransfer.h.

Definition at line 129 of file FileListTransfer.h.

Definition at line 131 of file FileListTransfer.h.

unsigned short FileListTransfer::setId [protected]

Definition at line 110 of file FileListTransfer.h.


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