#include <file_transfer.h>
|
| static bool | is_safe_relative_path (const std::string &p) |
| | A relative path from a peer's directory manifest is safe only if it stays inside the destination: non-empty, not absolute, no drive letter, and no "."/".." component.
|
| |
Definition at line 67 of file file_transfer.h.
◆ CompleteHandler
◆ OfferHandler
◆ ProgressHandler
◆ Direction
◆ Status
| Enumerator |
|---|
| Pending | |
| Active | |
| Paused | |
| Completed | |
| Failed | |
| Cancelled | |
Definition at line 79 of file file_transfer.h.
◆ FileTransfer() [1/2]
| librats::FileTransfer::FileTransfer |
( |
std::string |
temp_dir = "." | ) |
|
|
explicit |
◆ FileTransfer() [2/2]
| librats::FileTransfer::FileTransfer |
( |
Config |
config | ) |
|
|
explicit |
◆ ~FileTransfer()
| librats::FileTransfer::~FileTransfer |
( |
| ) |
|
|
override |
◆ accept()
| void librats::FileTransfer::accept |
( |
const PeerId & |
from, |
|
|
uint64_t |
id, |
|
|
const std::string & |
dest_path |
|
) |
| |
Accept an offered transfer.
For a single file, dest_path is the file path; for a directory, it is the destination directory. (from, id) names the offer.
◆ attach()
| void librats::FileTransfer::attach |
( |
NodeContext & |
ctx | ) |
|
|
overridevirtual |
◆ cancel()
| bool librats::FileTransfer::cancel |
( |
const PeerId & |
peer, |
|
|
uint64_t |
id |
|
) |
| |
Control a live transfer (works from either side); (peer, id) names it.
◆ is_safe_relative_path()
| static bool librats::FileTransfer::is_safe_relative_path |
( |
const std::string & |
p | ) |
|
|
static |
A relative path from a peer's directory manifest is safe only if it stays inside the destination: non-empty, not absolute, no drive letter, and no "."/".." component.
Public + static so it can be unit-tested directly.
◆ on_complete()
◆ on_offer()
| void librats::FileTransfer::on_offer |
( |
OfferHandler |
handler | ) |
|
|
inline |
◆ on_progress()
◆ pause()
| bool librats::FileTransfer::pause |
( |
const PeerId & |
peer, |
|
|
uint64_t |
id |
|
) |
| |
◆ reject()
| void librats::FileTransfer::reject |
( |
const PeerId & |
from, |
|
|
uint64_t |
id |
|
) |
| |
◆ resume()
| bool librats::FileTransfer::resume |
( |
const PeerId & |
peer, |
|
|
uint64_t |
id |
|
) |
| |
◆ send_directory()
| uint64_t librats::FileTransfer::send_directory |
( |
const PeerId & |
to, |
|
|
const std::string & |
dir_path |
|
) |
| |
Offer a directory tree. Returns the transfer id (0 if the dir is unusable).
◆ send_file()
| uint64_t librats::FileTransfer::send_file |
( |
const PeerId & |
to, |
|
|
const std::string & |
path |
|
) |
| |
Offer a single file. Returns the transfer id (0 if the file is unusable).
◆ start()
| void librats::FileTransfer::start |
( |
| ) |
|
|
overridevirtual |
◆ stats()
| Stats librats::FileTransfer::stats |
( |
| ) |
const |
◆ stop()
| void librats::FileTransfer::stop |
( |
| ) |
|
|
overridevirtual |
The documentation for this class was generated from the following file: