Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CNetFileTransferer Class Reference

Handles transferring files between clients and servers. More...

#include <NetFileTransfer.h>

Collaboration diagram for CNetFileTransferer:

Classes

struct  AsyncFileReceiveTask
 
struct  CNetFileSendTask
 Asynchronous file-sending task. More...
 

Public Member Functions

 CNetFileTransferer (INetSession *session)
 
Status HandleMessageReceive (const CNetMessage &message)
 Should be called when a message is received from the network. More...
 
void StartTask (std::function< void(std::string)> task)
 Registers a file-receiving task. More...
 
void StartResponse (u32 requestID, const std::string &data)
 Registers data to be sent in response to a request. More...
 
void Poll ()
 Call frequently (e.g. More...
 

Private Types

using FileReceiveTasksMap = std::unordered_map< u32, AsyncFileReceiveTask >
 
using FileSendTasksMap = std::map< u32, CNetFileSendTask >
 

Private Member Functions

Status OnFileTransferResponse (const CFileTransferResponseMessage &message)
 
Status OnFileTransferData (const CFileTransferDataMessage &message)
 
Status OnFileTransferAck (const CFileTransferAckMessage &message)
 

Private Attributes

INetSessionm_Session
 
u32 m_NextRequestID
 
FileReceiveTasksMap m_FileReceiveTasks
 
FileSendTasksMap m_FileSendTasks
 
double m_LastProgressReportTime
 

Detailed Description

Handles transferring files between clients and servers.

Member Typedef Documentation

◆ FileReceiveTasksMap

◆ FileSendTasksMap

Constructor & Destructor Documentation

◆ CNetFileTransferer()

CNetFileTransferer::CNetFileTransferer ( INetSession session)
inline

Member Function Documentation

◆ HandleMessageReceive()

Status CNetFileTransferer::HandleMessageReceive ( const CNetMessage message)

Should be called when a message is received from the network.

Returns INFO::SKIPPED if the message is not one that this class handles. Returns INFO::OK if the message is handled successfully, or ERR::FAIL if handled unsuccessfully.

◆ OnFileTransferAck()

Status CNetFileTransferer::OnFileTransferAck ( const CFileTransferAckMessage &  message)
private

◆ OnFileTransferData()

Status CNetFileTransferer::OnFileTransferData ( const CFileTransferDataMessage &  message)
private

◆ OnFileTransferResponse()

Status CNetFileTransferer::OnFileTransferResponse ( const CFileTransferResponseMessage &  message)
private

◆ Poll()

void CNetFileTransferer::Poll ( )

Call frequently (e.g.

once per frame) to trigger any necessary packet processing.

◆ StartResponse()

void CNetFileTransferer::StartResponse ( u32  requestID,
const std::string &  data 
)

Registers data to be sent in response to a request.

(Callers are expected to have their own mechanism for receiving requests and deciding what to respond with.)

◆ StartTask()

void CNetFileTransferer::StartTask ( std::function< void(std::string)>  task)

Registers a file-receiving task.

Member Data Documentation

◆ m_FileReceiveTasks

FileReceiveTasksMap CNetFileTransferer::m_FileReceiveTasks
private

◆ m_FileSendTasks

FileSendTasksMap CNetFileTransferer::m_FileSendTasks
private

◆ m_LastProgressReportTime

double CNetFileTransferer::m_LastProgressReportTime
private

◆ m_NextRequestID

u32 CNetFileTransferer::m_NextRequestID
private

◆ m_Session

INetSession* CNetFileTransferer::m_Session
private

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