SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | List of all members
SLNet::FileListTransferCBInterface Class Referenceabstract

Used by FileListTransfer plugin as a callback for when we get a file. More...

`#include <slikenet/FileListTransferCBInterface.h>`

## Classes

struct | DownloadCompleteStruct
struct | FileProgressStruct
struct | OnFileStruct

## Public Member Functions

| FileListTransferCBInterface ()
virtual | ~FileListTransferCBInterface ()
virtual bool | OnFile (OnFileStruct *onFileStruct)=0
| Got a file.
virtual void | OnFileProgress (FileProgressStruct *fps)=0
| Got part of a big file internally in RakNet.
virtual bool | Update (void)
| Called while the handler is active by FileListTransfer.
virtual bool | OnDownloadComplete (DownloadCompleteStruct *dcs)
| Called when the download is completed.
virtual void | OnDereference (void)
| This function is called when this instance is about to be dereferenced by the FileListTransfer plugin.

## Detailed Description

Used by FileListTransfer plugin as a callback for when we get a file.

You get the last file when fileIndex==numberOfFilesInThisSet

See Also
  FileListTransfer

Definition at line 32 of file FileListTransferCBInterface.h.

## Class Documentation

struct SLNet::FileListTransferCBInterface::DownloadCompleteStruct

Definition at line 102 of file FileListTransferCBInterface.h.

Class Members
unsigned | byteLengthOfThisSet | The total length of the transmitted files for this set, after being uncompressed.
unsigned | numberOfFilesInThisSet | The number of files that are in this set.
RakNetGUID | senderGuid | Who sent this file. Not valid when using TCP, only RakPeer (UDP)
SystemAddress | senderSystemAddress | Who sent this file.
unsigned short | setID | Files are transmitted in sets, where more than one set of files can be transmitted at the same time. This is the identifier for the set, which is returned by FileListTransfer::SetupReceive

struct SLNet::FileListTransferCBInterface::FileProgressStruct

Definition at line 78 of file FileListTransferCBInterface.h.

Class Members

bool

allocateIrIDataChunkAutomatically

Parameters

  [in] | allocateIrIDataChunkAutomatically | If true, then RakNet will hold iriDataChunk for you and return it in OnFile. Defaults to true

unsigned int

dataChunkLength

Parameters

  [out] | dataChunkLength | How many bytes long firstDataChunk and iriDataChunk are

char *

firstDataChunk

Parameters

  [out] | firstDataChunk | The first partLength of the final file. If you store identifying information about the file in the first partLength bytes, you can read them while the download is taking place. If this hasn't arrived yet, firstDataChunk will be 0

char *

iriDataChunk

Parameters

  [out] | iriDataChunk | If the remote system is sending this file using IncrementalReadInterface, then this is the chunk we just downloaded. It will not exist in memory after this callback. You should either store this to disk, or in memory. If it is 0, then the file is smaller than one chunk, and will be held in memory automatically

unsigned int

iriWriteOffset

Parameters

  [out] | iriWriteOffset | Offset in bytes from the start of the file for the data pointed to by iriDataChunk

OnFileStruct *

onFileStruct

Parameters

  [out] | onFileStruct | General information about this file, such as the filename and the first partLength bytes. You do NOT need to save this data yourself. The complete file will arrive normally.

unsigned int

partCount

Parameters

  [out] | partCount | The zero based index into partTotal. The percentage complete done of this file is 100 * (partCount+1)/partTotal

unsigned int

partTotal

Parameters

  [out] | partTotal | The total number of parts this file was split into. Each part will be roughly the MTU size, minus the UDP header and RakNet headers

RakNetGUID

senderGuid

Parameters

  [out] | Who | sent this file. Not valid when using TCP, only RakPeer (UDP)

SystemAddress

senderSystemAddress

Parameters

  [out] | Who | sent this file

struct SLNet::FileListTransferCBInterface::OnFileStruct

Definition at line 36 of file FileListTransferCBInterface.h.

Class Members
BitSize_t | byteLengthOfThisFile | The amount of data to be downloaded for this file.
unsigned | byteLengthOfThisSet | The total length of the transmitted files for this set, after being uncompressed.
BitSize_t | bytesDownloadedForThisFile | How many bytes of this file has been downloaded.
unsigned | bytesDownloadedForThisSet | The total length, in bytes, downloaded for this set.
FileListNodeContext | context | User data passed to one of the functions in the FileList class. However, on error, this is instead changed to one of the enumerations in the PatchContext structure.
char * | fileData | The data pointed to by the file.
unsigned | fileIndex | The index into the set of files, from 0 to numberOfFilesInThisSet.
char | fileName | The name of the file.
unsigned | numberOfFilesInThisSet | The number of files that are in this set.
RakNetGUID | senderGuid | Who sent this file. Not valid when using TCP, only RakPeer (UDP)
SystemAddress | senderSystemAddress | Who sent this file.
unsigned short | setID | Files are transmitted in sets, where more than one set of files can be transmitted at the same time. This is the identifier for the set, which is returned by FileListTransfer::SetupReceive

## Constructor & Destructor Documentation

SLNet::FileListTransferCBInterface::FileListTransferCBInterface | ( |  | ) |

inline

Definition at line 121 of file FileListTransferCBInterface.h.

virtual SLNet::FileListTransferCBInterface::~FileListTransferCBInterface | ( |  | ) |

inlinevirtual

Definition at line 122 of file FileListTransferCBInterface.h.

## Member Function Documentation

virtual void SLNet::FileListTransferCBInterface::OnDereference | ( | void |  | ) |

inlinevirtual

This function is called when this instance is about to be dereferenced by the FileListTransfer plugin.

Update will no longer be called. It will will be deleted automatically if true was passed to FileListTransfer::SetupReceive::deleteHandler Otherwise it is up to you to delete it yourself.

Definition at line 153 of file FileListTransferCBInterface.h.

virtual bool SLNet::FileListTransferCBInterface::OnDownloadComplete | ( | DownloadCompleteStruct * | dcs | ) |

inlinevirtual

Called when the download is completed.

If you are finished with this class, return false. At that point OnDereference will be called and the class will no longer be maintained by the FileListTransfer plugin. Otherwise return true, and Update will continue to be called.

Definition at line 147 of file FileListTransferCBInterface.h.

virtual bool SLNet::FileListTransferCBInterface::OnFile | ( | OnFileStruct * | onFileStruct | ) |

pure virtual

Got a file.

This structure is only valid for the duration of this function call.

Returns
  Return true to have RakNet delete the memory allocated to hold this file for this function call.

virtual void SLNet::FileListTransferCBInterface::OnFileProgress | ( | FileProgressStruct * | fps | ) |

pure virtual

Got part of a big file internally in RakNet.

This is called in one of two circumstances: Either the transport layer is returning ID_PROGRESS_NOTIFICATION, or you got a block via IncrementalReadInterface If the transport layer is returning ID_PROGRESS_NOTIFICATION (see RakPeer::SetSplitMessageProgressInterval()) then FileProgressStruct::iriDataChunk will be 0. If this is a block via IncrementalReadInterface, then iriDataChunk will point to the block just downloaded. If not using IncrementalReadInterface, then you only care about partCount and partTotal to tell how far the download has progressed. YOu can use firstDataChunk to read the first part of the file if desired. The file is usable when you get the OnFile callback. If using IncrementalReadInterface and you let RakNet buffer the files in memory (default), then it is the same as above. The file is usable when you get the OnFile callback. If using IncrementalReadInterface and you do not let RakNet buffer the files in memory, then set allocateIrIDataChunkAutomatically to false. Write the file to disk whenever you get OnFileProgress and iriDataChunk is not 0, and ignore OnFile.

virtual bool SLNet::FileListTransferCBInterface::Update | ( | void |  | ) |

inlinevirtual

Called while the handler is active by FileListTransfer.

Return false when you are done with the class. At that point OnDereference will be called and the class will no longer be maintained by the FileListTransfer plugin.

Definition at line 141 of file FileListTransferCBInterface.h.

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

- Source/include/slikenet/FileListTransferCBInterface.h