Shadowrun: Awakened 29 September 2011 - Build 871
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
RakNet::DirectoryDeltaTransfer Class Reference

#include <DirectoryDeltaTransfer.h>

Inheritance diagram for RakNet::DirectoryDeltaTransfer:

List of all members.

Public Member Functions

void AddUploadsFromSubdirectory (const char *subdir)
 Add all files in the specified subdirectory recursively.
void ClearUploads (void)
 Clear all allowed uploads previously set with AddUploadsFromSubdirectory.
 DirectoryDeltaTransfer ()
unsigned short DownloadFromSubdirectory (const char *subdir, const char *outputSubdir, bool prependAppDirToOutputSubdir, SystemAddress host, FileListTransferCBInterface *onFileCallback, PacketPriority _priority, char _orderingChannel, FileListProgress *cb)
 Downloads files from the matching parameter subdir in AddUploadsFromSubdirectory.
unsigned GetNumberOfFilesForUpload (void) const
 Returns how many files are available for upload.
virtual PluginReceiveResult OnReceive (Packet *packet)
void SetApplicationDirectory (const char *pathToApplication)
 Set the local root directory to base all file uploads and downloads off of.
void SetDownloadRequestIncrementalReadInterface (IncrementalReadInterface *_incrementalReadInterface, unsigned int _chunkSize)
 Normally, if a remote system requests files, those files are all loaded into memory and sent immediately.
void SetFileListTransferPlugin (FileListTransfer *flt)
 This plugin has a dependency on the FileListTransfer plugin, which it uses to actually send the files.
void SetUploadSendParameters (PacketPriority _priority, char _orderingChannel)
 What parameters to use for the RakPeerInterface::Send() call when uploading files.
virtual ~DirectoryDeltaTransfer ()

Static Public Member Functions

static void DestroyInstance (DirectoryDeltaTransfer *i)
static DirectoryDeltaTransferGetInstance (void)

Protected Member Functions

void OnDownloadRequest (Packet *packet)

Protected Attributes

char applicationDirectory [512]
FileListavailableUploads
unsigned int chunkSize
FileListTransferfileListTransfer
IncrementalReadInterfaceincrementalReadInterface
char orderingChannel
PacketPriority priority

Detailed Description

Definition at line 56 of file DirectoryDeltaTransfer.h.


Constructor & Destructor Documentation

RakNet::DirectoryDeltaTransfer::DirectoryDeltaTransfer ( )
virtual RakNet::DirectoryDeltaTransfer::~DirectoryDeltaTransfer ( ) [virtual]

Member Function Documentation

void RakNet::DirectoryDeltaTransfer::AddUploadsFromSubdirectory ( const char *  subdir)

subdir is appended to pathToApplication in SetApplicationDirectory(). All files in the resultant directory and subdirectories are then hashed so that users can download them.

Precondition:
You must call SetFileListTransferPlugin with a valid FileListTransfer plugin
Parameters:
[in]subdirConcatenated with pathToApplication to form the final path from which to allow uploads.
void RakNet::DirectoryDeltaTransfer::ClearUploads ( void  )
static void RakNet::DirectoryDeltaTransfer::DestroyInstance ( DirectoryDeltaTransfer i) [static]
unsigned short RakNet::DirectoryDeltaTransfer::DownloadFromSubdirectory ( const char *  subdir,
const char *  outputSubdir,
bool  prependAppDirToOutputSubdir,
SystemAddress  host,
FileListTransferCBInterface onFileCallback,
PacketPriority  _priority,
char  _orderingChannel,
FileListProgress cb 
)

subdir must contain all starting characters in subdir in AddUploadsFromSubdirectory Therefore, AddUploadsFromSubdirectory("Levels/Level1/"); would allow you to download using DownloadFromSubdirectory("Levels/Level1/Textures/"... but it would NOT allow you to download from DownloadFromSubdirectory("Levels/"... or DownloadFromSubdirectory("Levels/Level2/"...

Precondition:
You must call SetFileListTransferPlugin with a valid FileListTransfer plugin
Parameters:
[in]subdirA directory passed to AddUploadsFromSubdirectory on the remote system. The passed dir can be more specific than the remote dir.
[in]outputSubdirThe directory to write the output to. Usually this will match subdir but it can be different if you want.
[in]prependAppDirToOutputSubdirTrue to prepend outputSubdir with pathToApplication when determining the final output path. Usually you want this to be true.
[in]hostThe address of the remote system to send the message to.
[in]onFileCallbackCallback to call per-file (optional). When fileIndex+1==setCount in the callback then the download is done
[in]_prioritySee RakPeerInterface::Send()
[in]_orderingChannelSee RakPeerInterface::Send()
[in]cbCallback to get progress updates. Pass 0 to not use.
Returns:
A set ID, identifying this download set. Returns 65535 on host unreachable.
static DirectoryDeltaTransfer* RakNet::DirectoryDeltaTransfer::GetInstance ( void  ) [static]
unsigned RakNet::DirectoryDeltaTransfer::GetNumberOfFilesForUpload ( void  ) const
Returns:
How many files are available for upload
void RakNet::DirectoryDeltaTransfer::OnDownloadRequest ( Packet packet) [protected]
virtual PluginReceiveResult RakNet::DirectoryDeltaTransfer::OnReceive ( Packet packet) [virtual]

OnReceive is called for every packet.

Parameters:
[in]packetthe 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 RakNet::PluginInterface2.

void RakNet::DirectoryDeltaTransfer::SetApplicationDirectory ( const char *  pathToApplication)
Parameters:
[in]pathToApplicationThis path will be prepended to applicationSubdirectory in AddUploadsFromSubdirectory to find the actual path on disk.
void RakNet::DirectoryDeltaTransfer::SetDownloadRequestIncrementalReadInterface ( IncrementalReadInterface _incrementalReadInterface,
unsigned int  _chunkSize 
)

This function allows the files to be read in incremental chunks, saving memory

Parameters:
[in]_incrementalReadInterfaceIf a file in fileList has no data, filePullInterface will be used to read the file in chunks of size chunkSize
[in]_chunkSizeHow large of a block of a file to send at once
void RakNet::DirectoryDeltaTransfer::SetFileListTransferPlugin ( FileListTransfer flt)

So you need an instance of that plugin registered with RakPeerInterface, and a pointer to that interface should be passed here.

Parameters:
[in]fltA pointer to a registered instance of FileListTransfer
void RakNet::DirectoryDeltaTransfer::SetUploadSendParameters ( PacketPriority  _priority,
char  _orderingChannel 
)
Parameters:
[in]_prioritySee RakPeerInterface::Send()
[in]_orderingChannelSee RakPeerInterface::Send()

Member Data Documentation

Definition at line 124 of file DirectoryDeltaTransfer.h.

Definition at line 126 of file DirectoryDeltaTransfer.h.

Definition at line 130 of file DirectoryDeltaTransfer.h.

Definition at line 125 of file DirectoryDeltaTransfer.h.

Definition at line 129 of file DirectoryDeltaTransfer.h.

Definition at line 128 of file DirectoryDeltaTransfer.h.

Definition at line 127 of file DirectoryDeltaTransfer.h.


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

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net