FC++  v0.9.0-9e9b65
FileCatalyst Fast File Transfers - C++ Library
fc Namespace Reference

Namespaces

 Logging
 The fc::Logging namespace contains helper functions to easily manage the different types of logging available in FC++.
 
 SummaryLog
 The SummaryLog namespace contains helper functions for generating a summary of what happens within FC++.
 

Classes

class  Control
 
class  Exception
 fc::Exception objects represent a C++ exception and usually includes stack traces and optional parameters to describe the internal state of FC++ at the time the exception happened. More...
 
struct  FileDetails
 A collection of file or directory properties returned when a directory listing has been requested. More...
 
class  GlobalStateAndStats
 Combine both state and statistics into a single class which callers can access. More...
 
class  GlobalStats
 GlobalStats is used to track some summary statistics during file transfers. More...
 
class  Local
 The class fc::Local is used to encapsulate local directories or files. More...
 
class  Name
 To prevent mixing up local path and remote path parameters when calling the FC++ API, the path and/or filenames are wrapped using the simple fc::Local and fc::Remote classes. More...
 
class  Options
 fc::Options contains all the default and user-defined settings required by fc::Control to connect to FTP servers. More...
 
class  Remote
 The class fc::Remote is used to encapsulate remote directories or files. More...
 
class  TransferStats
 File transfer statistics. More...
 

Typedefs

typedef std::map< size_t, fc::TransferStatsTransferStatsMap
 Track all of the individual file transfers, where the key is a numeric sequence describing the order of the file transfer. More...
 
typedef void(* StatisticsCallback) (const fc::GlobalStateAndStats &stats, void *ptr)
 Allow a single callback to be specified when the statistics are updated. More...
 
typedef std::list< std::string > StrList
 Defined for convenience: a list of text strings. More...
 
typedef std::vector< std::string > StrVec
 Defined for convenience: a vector of text strings. More...
 
typedef std::map< std::string, std::string > StrMap
 Defined for convenience: an ordered map where both the key and the value are text strings. More...
 
typedef std::set< std::string > StrSet
 Defined for convenience: an ordered set of text strings. More...
 
typedef std::vector< FileDetailsFDVec
 A std::vector of fc::FileDetails. More...
 

Enumerations

enum  EClientIdMajor {
  kInvalidMajorId = 0,
  kCli = 3,
  kApi = 7,
  kMobile = 15
}
 
enum  EClientIdMinor {
  kInvalidMinorId = 0,
  kCliJava = 7,
  kCliCpp = 8,
  kApiCpp = 10,
  kMobileUploaderIos = 13,
  kApiIos = 14
}
 
enum  ETransferMode {
  kInvalidTransferMode = 0,
  kFtp = 1,
  kTcp = kFtp,
  kUdp = 2
}
 
enum  EConnectionMode {
  kInvalidConnectionMode = 0,
  kActive = 1,
  kPassive = 2
}
 
enum  ESslHandshakeMode {
  kInvalidSslHandshake = 0,
  kSslAutoDetect = 1,
  kSslFullHandshake = 2,
  kSslSessionReuse = 3
}
 
enum  ECommonBandwidth {
  kInvalidBandwidth = 0,
  kZero_bps = 0,
  k1_Kbps,
  k1200_bps,
  k2400_bps,
  k4800_bps,
  k9600_bps,
  k14_4_Kbps,
  k28_8_Kbps,
  k33_6_Kbps,
  k56_Kbps,
  k64_Kbps,
  k128_Kbps,
  k144_Kbps,
  k236_8_Kbps,
  k256_Kbps,
  k384_Kbps,
  k640_Kbps,
  k768_Kbps,
  k1_Mbps,
  k1_544_Mbps,
  k2_Mbps,
  k2_048_Mbps,
  k2_5_Mbps,
  k3_152_Mbps,
  k3_5_Mbps,
  k4_Mbps,
  k6_312_Mbps,
  k8_448_Mbps,
  k10_Mbps,
  k11_Mbps,
  k16_Mbps,
  k32_064_Mbps,
  k34_368_Mbps,
  k44_736_Mbps,
  k51_84_Mbps,
  k54_Mbps,
  k89_472,
  k97_728_Mbps,
  k100_Mbps,
  k135_Mbps,
  k139_264_Mbps,
  k155_52_Mbps,
  k274_176_Mbps,
  k397_200_Mbps,
  k400_352_Mbps,
  k466_56_Mbps,
  k565_148_Mbps,
  k600_Mbps,
  k622_08_Mbps,
  k933_12_Mbps,
  k1_Gbps,
  k1244_16_Mbps,
  k1_3_Gbps,
  k1866_24_Mbps,
  k2488_32_Mbps,
  k4976_64_Mbps,
  k6_75_Gbps,
  k9953_28_Mbps,
  k10_Gbps,
  k13_1_Gbps,
  k39_813_Gbps,
  k1200Modem = k1200_bps,
  k2400Modem = k2400_bps,
  k9600Modem = k9600_bps,
  k14KModem = k14_4_Kbps,
  k28KModem = k28_8_Kbps,
  k33KModem = k33_6_Kbps,
  k56KModem = k56_Kbps,
  k64KISDN = k64_Kbps,
  k128KISDN = k128_Kbps,
  k144IDSL = k144_Kbps,
  kDS0 = k64_Kbps,
  kDS1 = k1_544_Mbps,
  kDS2 = k6_312_Mbps,
  kDS3 = k44_736_Mbps,
  kDS4 = k274_176_Mbps,
  kT1 = k1_544_Mbps,
  kE1 = k2_048_Mbps,
  kT2 = k6_312_Mbps,
  kT3 = k44_736_Mbps,
  kT4 = k274_176_Mbps,
  kT5 = k400_352_Mbps,
  kOC1 = k51_84_Mbps,
  kOC3 = k155_52_Mbps,
  kOC9 = k466_56_Mbps,
  kOC12 = k622_08_Mbps,
  kOC18 = k933_12_Mbps,
  kOC24 = k1244_16_Mbps,
  kOC36 = k1866_24_Mbps,
  kOC48 = k2488_32_Mbps,
  kOC96 = k4976_64_Mbps,
  kOC192 = k9953_28_Mbps,
  kOC256 = k13_1_Gbps,
  kOC768 = k39_813_Gbps,
  k10BaseX = k10_Mbps,
  k100BaseX = k100_Mbps,
  k1000BaseX = k1_Gbps,
  k10GBaseX = k10_Gbps,
  kEthernet = k10BaseX,
  kFastEthernet = k100BaseX,
  kGigabit = k1000BaseX,
  k10Gigabit = k10GBaseX,
  k80211 = k2_Mbps,
  k80211a = k54_Mbps,
  k80211b = k11_Mbps,
  k80211g = k54_Mbps,
  k80211n = k600_Mbps,
  k80211ac = k1_3_Gbps,
  k80211ad = k6_75_Gbps,
  k1G = k1200_bps,
  k2G = k14_4_Kbps,
  k2_5G = k56_Kbps,
  k2_75G = k236_8_Kbps,
  k3G = k384_Kbps,
  k4G = k100_Mbps
}
 Enumerations for several common bandwidth values. More...
 
enum  FtpServerReplyCodes {
  k110RestartMarkerReply = 110,
  k120ServiceReadyInMinutes = 120,
  k125DataConnectionAlreadyOpen = 125,
  k150FileStatusOkayOpenDataConnection = 150,
  k200CommandOkay = 200,
  k202CommandNotImplemented = 202,
  k211SystemStatus = 211,
  k212DirectoryStatus = 212,
  k213FileStatus = 213,
  k214HelpMessage = 214,
  k215OperatingSystem = 215,
  k220ReadyForNewUser = 220,
  k221ClosingConnectionLoggedOut = 221,
  k225DataConnectionOpen = 225,
  k226ClosingDataConnectionTransferDone = 226,
  k227ServerOpenedPassiveConnection = 227,
  k228ServerEnteringLongPassiveMode = 228,
  k229ServerEnteringExtendedPassiveMode = 229,
  k230UserLoggedIn = 230,
  k231UserLoggedOut = 231,
  k232WillLogoutWhenTransferCompletes = 232,
  k234SecurityDataExchangeComplete = 234,
  k250RequestedActionOkay = 250,
  k252Echo = 252,
  k255InTargetDirectoryAlready = 255,
  k257PathCreatedOrDirectoryStatus = 257,
  k331SendPassword = 331,
  k332NeedAccountForLogin = 332,
  k350RequestedActionPendingFurtherInfo = 350,
  k421ServiceNotAvailableClosingControl = 421,
  k425CannotOpenDataConnection = 425,
  k426DataConnectionClosedAbnormally = 426,
  k430InvalidUsernameOrPassword = 430,
  k431TemporarilyUnableToProcessSecurity = 431,
  k434RequestedHostUnavailable = 434,
  k450ActionNotTakenBusyOrUnavailable = 450,
  k451ActionAbortedLocalError = 451,
  k452ActionNotTakenOutOfDiskSpace = 452,
  k500CommandNotRecognized = 500,
  k501ErrorInParametersOrArguments = 501,
  k502CommandNotImplemented = 502,
  k503BadSequenceOfCommands = 503,
  k504CommandNotImplementedWithParm = 504,
  k521DataConnectionCannotBeOpened = 521,
  k530NotLoggedIn = 530,
  k532NeedAccount = 532,
  k533CommandProtectionLevelDenied = 533,
  k534RequestDeniedDueToPolicy = 534,
  k550RequestAbortedFileOrDirectoryError = 550,
  k551RequestAbortedPageTypeUnknown = 551,
  k552RequestAbortedOutOfDiskSpace = 552,
  k553RequestAbortedIllegalFilename = 553,
  kInvalid = 0,
  k1xxMore = -1,
  k2xxOkay = -2,
  k3xxPending = -3,
  kAny = -4,
  kOkay = -5,
  kNotOkay = -6,
  kDataConnectionReady = -7,
  kNone = -8
}
 An enum to represent possible FTP server reply code. More...
 

Functions

uint64_t bps (const fc::ECommonBandwidth &bandwidth)
 Convert the common bandwidth enum value to a usable bps value. More...
 
std::string formatTransferStatsEState (const fc::TransferStats::EState state)
 Format the MD5 and transfer state enums into text strings. More...
 
time_t to_time_t (const std::chrono::high_resolution_clock::time_point &tp)
 Convenience function to convert time_point objects to traditional time_t values (seconds since 1970-01-01 00:00:00 UTC). More...
 
std::string formatTimeRecent (const std::chrono::high_resolution_clock::time_point &tp)
 Format the time in an easy-to-read text string. More...
 
std::string formatTimeRecent (const time_t tt)
 Format the absolute time in an easy-to-read text string. More...
 
std::string formatTimeDuration (const std::chrono::high_resolution_clock::duration &d)
 Format the "time remaining" statistic as a number followed by a common 1-letter description. More...
 
std::string formatTimeDuration (const time_t tt)
 Format the relative "time remaining" statistic as a number followed by a common 1-letter description. More...
 
std::string formatTimeDuration2 (const std::chrono::high_resolution_clock::duration &d)
 Format the "time remaining" statistic as a common time string, such as HH:MM:SS. More...
 
std::string formatTimeDuration2 (const time_t tt)
 Format the relative "time remaining" statistic as a common time string, such as HH:MM:SS. More...
 
std::string formatTimestamp (std::chrono::high_resolution_clock::time_point tp)
 Format the absolute time point using "YYYY:MM:DD HH:MM:SS". More...
 
std::string formatTimestamp2 (std::chrono::high_resolution_clock::time_point tp)
 Format the absolute time point using "YYYY:MM:DD HH:MM:SS.mmmmmm" where mmmmmm is microseconds. More...
 
std::string formatTransferRate (const uint64_t bps)
 Format the transfer rate statistic using the common descriptions Kbps, Mbps, etc. More...
 
std::string formatTransferRate (const fc::ECommonBandwidth &bandwidth)
 Similar to the other fc::formatTransferRate(), but takes a bandwidth enum so the enumerator doesn't get converted to a numeric value. More...
 
std::string formatBytesSI (const uint64_t bytes)
 Format the payload bytes using SI units (1000 bytes per "K"). More...
 
std::string formatBytesIEC (const uint64_t bytes)
 Format the payload bytes using IEC units (1024 bytes per "K"). More...
 
std::string formatBytesOldStyle (const uint64_t bytes)
 Format the payload bytes using IEC units (1024 bytes per "K"), similar to IEC but leave out the middle "i". More...
 
const StrMapemptyMap ()
 Function that always returns an empty map. Used internally by FC++. More...
 
std::string baseVersionStr ()
 Return a simple version string. More...
 
std::string libfcVersionStr ()
 Return the version string of the FC++ library. More...
 
int libfcBitSize ()
 Determine if the library was built for a 32-bit or 64-bit platform. More...
 
std::string opensslVersionStr ()
 Determine the version of OpenSSL used by FC++. More...
 
fc::FtpServerReplyCodes getCodeFromServerReply (const std::string &reply)
 Parse the given string and return the 3-digit FTP status code. More...
 
std::string getTextFromServerReply (const std::string &reply)
 Parse the given string and return only the last line of text following the 3-digit FTP status code. More...
 

Detailed Description

All of the FileCatalyst classes and objects are declared within the fc namespace.

Typedef Documentation

◆ TransferStatsMap

typedef std::map<size_t, fc::TransferStats> fc::TransferStatsMap

Track all of the individual file transfers, where the key is a numeric sequence describing the order of the file transfer.

◆ StatisticsCallback

typedef void(* fc::StatisticsCallback) (const fc::GlobalStateAndStats &stats, void *ptr)

Allow a single callback to be specified when the statistics are updated.

During active file transfers, most of the file statistics and global statistics are updated exactly once per second. A callback can be defined which will be called every second immediately after these statistics have been updated.

Warning
This callback interrupts the active file transfer! The file transfer is effectively "paused" while the callback is executing. To prevent negatively affecting the throughput, or causing the transfer to abort, the callback should locally copy the statistics it expects to use and immediately return to ensure the transfer can proceed.

This will normally be used as follows:

static fc::TransferStats singleFileStats;
void myFileTransferStatsCallback( const fc::GlobalStateAndStats &stats, void *ptr )
{
// copy only the current file stats we need and ignore the rest
singleFileStats = stats.fileStatsMap[ stats.fileStatsIdx ];
// signal another app thread to indicate new statistics have been received
...
// quickly return execution control to FC++ to complete the transfer
return;
}
fc::Control control;
control.setStatsCallback( myFileTransferStatsCallback, NULL );
...

◆ StrList

typedef std::list<std::string> fc::StrList

Defined for convenience: a list of text strings.

◆ StrVec

typedef std::vector<std::string> fc::StrVec

Defined for convenience: a vector of text strings.

◆ StrMap

typedef std::map<std::string, std::string> fc::StrMap

Defined for convenience: an ordered map where both the key and the value are text strings.

◆ StrSet

typedef std::set<std::string> fc::StrSet

Defined for convenience: an ordered set of text strings.

◆ FDVec

typedef std::vector<FileDetails> fc::FDVec

Enumeration Type Documentation

◆ EClientIdMajor

See also
fc::Options::setClientId()
Enumerator
kInvalidMajorId 
kCli 

3 FC CLI tool

kApi 

7 FC API (e.g., C++ API)

kMobile 

15 FC Mobile (e.g., iOS app)

◆ EClientIdMinor

See also
fc::Options::setClientId()
Enumerator
kInvalidMinorId 
kCliJava 

7 Java application

kCliCpp 

8 C++ CLI tool

kApiCpp 

10 C++ API

kMobileUploaderIos 

13 iPhone/iOS tool

kApiIos 

14 C++ API on iPhone/iOS

◆ ETransferMode

See also
fc::Options::setMode()
Enumerator
kInvalidTransferMode 
kFtp 

1 TCP/FTP (original FTP mode)

kTcp 

1 TCP/FTP (original FTP mode)

kUdp 

2 UDP (FileCatalyst mode)

◆ EConnectionMode

See also
fc::Options::setMode()
Enumerator
kInvalidConnectionMode 
kActive 

server connects to client for transfer (not supported in FC++)

kPassive 

client asks server for a port to which it connects to transfer files

◆ ESslHandshakeMode

See also
fc::Options::setSslHandshake()
Enumerator
kInvalidSslHandshake 
kSslAutoDetect 

ssl handshake is chosen depending on the server type

kSslFullHandshake 

do not re-use ssl sessions; do the full ssl handshake

kSslSessionReuse 

re-use the ssl session and bypass the ssl handshake

◆ ECommonBandwidth

Enumerations for several common bandwidth values.

Warning
Several of the higher-bps values require more than 32 bits. Meaning this code wont work as expected:
// Problem: In this next line, the value for 10 Gbps will be truncated
// or cause a compiler warning if "int" is only 32 bits wide.
int my_bps = fc::k10_Gbps;
...
options.setBandwidth( my_bps );

Instead, you'll want to pass the enum directly, or use a 64-bit unsigned integer for bps values:

uint64_t my_bps = fc::k10_Gbps; // no truncation
options.setBandwidth( my_bps ); // this will work correctly
// this would also work:
my_bps = fc::bps( fc::k10_Gbps );
options.setBandwidth( my_bps );
// these three would also work correctly:
options.setBandwidth( 10000000000 );
options.setBandwidth( fc::Gbps(10) );
See also
fc::bps()
fc::Options::setBandwidth()
Enumerator
kInvalidBandwidth 

same as kZero_bps

kZero_bps 

0 bps

k1_Kbps 

1000 bps

k1200_bps 

1200 bps

k2400_bps 

2400 bps

k4800_bps 

4800 bps

k9600_bps 

9600 bps

k14_4_Kbps 

14400 bps

k28_8_Kbps 

28800 bps

k33_6_Kbps 

36600 bps

k56_Kbps 

56000 bps

k64_Kbps 

64000 bps

k128_Kbps 

128000 bps

k144_Kbps 

144000 bps

k236_8_Kbps 

236800 bps

k256_Kbps 

256000 bps

k384_Kbps 

384000 bps

k640_Kbps 

640000 bps

k768_Kbps 

768000 bps

k1_Mbps 

1000000 bps

k1_544_Mbps 

1544000 bps

k2_Mbps 

2000000 bps

k2_048_Mbps 

2048000 bps

k2_5_Mbps 

2500000 bps

k3_152_Mbps 

3152000 bps

k3_5_Mbps 

3500000 bps

k4_Mbps 

4000000 bps

k6_312_Mbps 

6312000 bps

k8_448_Mbps 

8448000 bps

k10_Mbps 

10000000 bps

k11_Mbps 

11000000 bps

k16_Mbps 

16000000 bps

k32_064_Mbps 

32064000 bps

k34_368_Mbps 

34368000 bps

k44_736_Mbps 

44736000 bps

k51_84_Mbps 

51840000 bps

k54_Mbps 

54000000 bps

k89_472 

89472000 bps

k97_728_Mbps 

97728000 bps

k100_Mbps 

100000000 bps

k135_Mbps 

135000000 bps

k139_264_Mbps 

139264000 bps

k155_52_Mbps 

155520000 bps

k274_176_Mbps 

274176000 bps

k397_200_Mbps 

397200000 bps

k400_352_Mbps 

400352000 bps

k466_56_Mbps 

466560000 bps

k565_148_Mbps 

565148000 bps

k600_Mbps 

600000000 bps

k622_08_Mbps 

622080000 bps

k933_12_Mbps 

933120000 bps

k1_Gbps 

1000000000 bps

k1244_16_Mbps 

1244160000 bps

k1_3_Gbps 

1300000000 bps

k1866_24_Mbps 

1866240000 bps

k2488_32_Mbps 

2488320000 bps (this value requires an unsigned 32-bit interger)

k4976_64_Mbps 

4967640000 bps (this value requires a 64-bit integer)

k6_75_Gbps 

6750000000 bps (this value requires a 64-bit integer)

k9953_28_Mbps 

9953280000 bps (this value requires a 64-bit integer)

k10_Gbps 

10000000000 bps (this value requires a 64-bit integer)

k13_1_Gbps 

13178880000 bps (this value requires a 64-bit integer)

k39_813_Gbps 

39813120000 bps (this value requires a 64-bit integer)

k1200Modem 

1200 bps

k2400Modem 

2400 bps

k9600Modem 

9600 bps

k14KModem 

14.4 Kbps

k28KModem 

28.8 Kbps

k33KModem 

33.6 Kbps

k56KModem 

56 Kbps

k64KISDN 

ISDN, 64K.

k128KISDN 

ISDN, 128K.

k144IDSL 

IDSL, 144 Kbps.

kDS0 

DS-0, 64 Kbps.

kDS1 

DS-1, 1.54 Mbps.

kDS2 

DS-2, 6.312 Mbps.

kDS3 

DS-3, 44.74 Mbps.

kDS4 

DS-4, 274.176 Mbps.

kT1 

T1, 1.54 Mbps.

kE1 

E1, 2.048 Mbps.

kT2 

T2, 6.31 Mbps.

kT3 

T3, 44.74 Mbps.

kT4 

T4, 274.18 Mbps.

kT5 

T5, 400.35 Mbps.

kOC1 

OC-1, 51.84 Mbps.

kOC3 

OC-3, 155.52 Mbps.

kOC9 

OC-9, 466.56 Mbps.

kOC12 

OC-12, 0.62 Gbps.

kOC18 

OC-18, 0.93 Gbps.

kOC24 

OC-24, 1.24 Gbps.

kOC36 

OC-36, 1.87 Gbps.

kOC48 

OC-48, 2,49 Gbps.

kOC96 

OC-96, 4.98 Gbps.

kOC192 

OC-192, 9.95 Gbps.

kOC256 

OC-256, 13.1 Gbps.

kOC768 

OC-768, 39.8 Gbps.

k10BaseX 

10 Mbps

k100BaseX 

100 Mbps

k1000BaseX 

1 Gbps

k10GBaseX 

10 Gbps

kEthernet 

10 Mbps

kFastEthernet 

100 Mbps

kGigabit 

1 Gbps

k10Gigabit 

10 Gbps

k80211 

802.11, 2 Mbps

k80211a 

802.11a, 54 Mbps

k80211b 

802.11b, 11 Mbps

k80211g 

802.11g, 54 Mbps

k80211n 

802.11n, 600 Mbps

k80211ac 

802.11ac, 1.3 Gbps

k80211ad 

802.11ad, 6.75 Gbps

k1G 

1G, 1200 bps

k2G 

2G GSM, 14.4 Kbps

k2_5G 

2.5G, GPRS, 56 Kbps

k2_75G 

2.75G, EDGE, 236.8 Kbps

k3G 

3G, UMTS, 384 Kbps

k4G 

4G, 100 Mbps

◆ FtpServerReplyCodes

An enum to represent possible FTP server reply code.

  • Reply codes 100+ means the requested action is being taken. Expect another reply before proceeding with a new command.
  • Reply codes 200+ means the requested action has been successfully completed.
  • Reply codes 300+ means the command has been accepted, but the requested action is being held pending receipt of further information.
  • Reply codes 400+ means the command was not accepted and the requested action did not take place. The error condition may be temporary.
  • Reply codes 500+ means the command was not accepted and the requested action did not take place.
  • Negative values are used in the enum to represent pseudo-responses. These are handled not by directly matching server response codes, but through logic or through range checking. None of these values are for direct public use, nor are they exposed externally by any parts of the FC++ library.
See also
fc::getCodeFromServerReply()
fc::Control::getCurrentServerReplyCode()
Enumerator
k110RestartMarkerReply 
k120ServiceReadyInMinutes 
k125DataConnectionAlreadyOpen 
k150FileStatusOkayOpenDataConnection 
k200CommandOkay 
k202CommandNotImplemented 

also see k502CommandNotImplemented

k211SystemStatus 
k212DirectoryStatus 
k213FileStatus 
k214HelpMessage 
k215OperatingSystem 
k220ReadyForNewUser 
k221ClosingConnectionLoggedOut 
k225DataConnectionOpen 
k226ClosingDataConnectionTransferDone 
k227ServerOpenedPassiveConnection 

(h1,h2,h3,h4,p1,p2)

k228ServerEnteringLongPassiveMode 

(long address, port)

k229ServerEnteringExtendedPassiveMode 

(|||port|)

k230UserLoggedIn 
k231UserLoggedOut 
k232WillLogoutWhenTransferCompletes 
k234SecurityDataExchangeComplete 
k250RequestedActionOkay 
k252Echo 
k255InTargetDirectoryAlready 
k257PathCreatedOrDirectoryStatus 
k331SendPassword 
k332NeedAccountForLogin 
k350RequestedActionPendingFurtherInfo 
k421ServiceNotAvailableClosingControl 
k425CannotOpenDataConnection 
k426DataConnectionClosedAbnormally 
k430InvalidUsernameOrPassword 
k431TemporarilyUnableToProcessSecurity 
k434RequestedHostUnavailable 
k450ActionNotTakenBusyOrUnavailable 
k451ActionAbortedLocalError 
k452ActionNotTakenOutOfDiskSpace 
k500CommandNotRecognized 
k501ErrorInParametersOrArguments 
k502CommandNotImplemented 

also see k202CommandNotImplemented

k503BadSequenceOfCommands 
k504CommandNotImplementedWithParm 
k521DataConnectionCannotBeOpened 
k530NotLoggedIn 
k532NeedAccount 
k533CommandProtectionLevelDenied 
k534RequestDeniedDueToPolicy 
k550RequestAbortedFileOrDirectoryError 
k551RequestAbortedPageTypeUnknown 
k552RequestAbortedOutOfDiskSpace 
k553RequestAbortedIllegalFilename 
kInvalid 
k1xxMore 

any 1xx-style response

k2xxOkay 

any 2xx-style positive response

k3xxPending 

any 3xx-style response

kAny 

any response that matches >= 100 and < 600

kOkay 

any response that matches 1xx, 2xx, or 3xx

kNotOkay 

any response that matches < 100 or >= 400

kDataConnectionReady 

matches both k125DataConnectionAlreadyOpen and k150FileStatusOkayOpenDataConnection

kNone 

do not expect a response

See also
cmdABOR()

Function Documentation

◆ bps() [1/3]

uint64_t fc::bps ( const fc::ECommonBandwidth bandwidth)

Convert the common bandwidth enum value to a usable bps value.

See also
fc::formatTransferRate() to convert bps to a string.
fc::Kbps()
fc::Mbps()
fc::Gbps()
Warning
Some of the high bandwidth values cannot be represented using a 31-bit int, or a 32-bit uint. You must use uint64_t to store bps.
uint64_t bps = fc::bps( fc::k10_Mbps );
bps *= 3;
std::cout << fc::formatTransferRate( bps ) << std::endl;
// this should output "30.00 Mbps"

References k100_Mbps, k10_Gbps, k10_Mbps, k11_Mbps, k1200_bps, k1244_16_Mbps, k128_Kbps, k135_Mbps, k139_264_Mbps, k13_1_Gbps, k144_Kbps, k14_4_Kbps, k155_52_Mbps, k16_Mbps, k1866_24_Mbps, k1_3_Gbps, k1_544_Mbps, k1_Gbps, k1_Kbps, k1_Mbps, k236_8_Kbps, k2400_bps, k2488_32_Mbps, k256_Kbps, k274_176_Mbps, k28_8_Kbps, k2_048_Mbps, k2_5_Mbps, k2_Mbps, k32_064_Mbps, k33_6_Kbps, k34_368_Mbps, k384_Kbps, k397_200_Mbps, k39_813_Gbps, k3_152_Mbps, k3_5_Mbps, k400_352_Mbps, k44_736_Mbps, k466_56_Mbps, k4800_bps, k4976_64_Mbps, k4_Mbps, k51_84_Mbps, k54_Mbps, k565_148_Mbps, k56_Kbps, k600_Mbps, k622_08_Mbps, k640_Kbps, k64_Kbps, k6_312_Mbps, k6_75_Gbps, k768_Kbps, k89_472, k8_448_Mbps, k933_12_Mbps, k9600_bps, k97_728_Mbps, k9953_28_Mbps, and kZero_bps.

Here is the caller graph for this function:

◆ bps() [2/3]

uint64_t fc::bps ( const int  rate)
inline

Convert easy-to-use numerical values to bps values.

For example, these bandwidth lines all produce the same results. Choose the style you prefer:

fc::Options options;
options.setBandwidth( fc::bps( 600000000 ) );
options.setBandwidth( fc::Kbps( 600000 ) );
options.setBandwidth( fc::Mbps( 600 ) );
options.setBandwidth( fc::Gbps( 0.6 ) );
See also
fc::bps()
fc::Kbps()
fc::Mbps()
fc::Gbps()

◆ bps() [3/3]

uint64_t fc::bps ( const double  rate)
inline

Convert easy-to-use numerical values to bps values.

For example, these bandwidth lines all produce the same results. Choose the style you prefer:

fc::Options options;
options.setBandwidth( fc::bps( 600000000 ) );
options.setBandwidth( fc::Kbps( 600000 ) );
options.setBandwidth( fc::Mbps( 600 ) );
options.setBandwidth( fc::Gbps( 0.6 ) );
See also
fc::bps()
fc::Kbps()
fc::Mbps()
fc::Gbps()

◆ Kbps() [1/2]

uint64_t fc::Kbps ( const int  rate)
inline

Convert easy-to-use numerical values to bps values.

For example, these bandwidth lines all produce the same results. Choose the style you prefer:

fc::Options options;
options.setBandwidth( fc::bps( 600000000 ) );
options.setBandwidth( fc::Kbps( 600000 ) );
options.setBandwidth( fc::Mbps( 600 ) );
options.setBandwidth( fc::Gbps( 0.6 ) );
See also
fc::bps()
fc::Kbps()
fc::Mbps()
fc::Gbps()

References bps(), and k1_Kbps.

Here is the call graph for this function:

◆ Kbps() [2/2]

uint64_t fc::Kbps ( const double  rate)
inline

Convert easy-to-use numerical values to bps values.

For example, these bandwidth lines all produce the same results. Choose the style you prefer:

fc::Options options;
options.setBandwidth( fc::bps( 600000000 ) );
options.setBandwidth( fc::Kbps( 600000 ) );
options.setBandwidth( fc::Mbps( 600 ) );
options.setBandwidth( fc::Gbps( 0.6 ) );
See also
fc::bps()
fc::Kbps()
fc::Mbps()
fc::Gbps()

References bps(), and k1_Kbps.

Here is the call graph for this function:

◆ Mbps() [1/2]

uint64_t fc::Mbps ( const int  rate)
inline

Convert easy-to-use numerical values to bps values.

For example, these bandwidth lines all produce the same results. Choose the style you prefer:

fc::Options options;
options.setBandwidth( fc::bps( 600000000 ) );
options.setBandwidth( fc::Kbps( 600000 ) );
options.setBandwidth( fc::Mbps( 600 ) );
options.setBandwidth( fc::Gbps( 0.6 ) );
See also
fc::bps()
fc::Kbps()
fc::Mbps()
fc::Gbps()

References bps(), and k1_Mbps.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mbps() [2/2]

uint64_t fc::Mbps ( const double  rate)
inline

Convert easy-to-use numerical values to bps values.

For example, these bandwidth lines all produce the same results. Choose the style you prefer:

fc::Options options;
options.setBandwidth( fc::bps( 600000000 ) );
options.setBandwidth( fc::Kbps( 600000 ) );
options.setBandwidth( fc::Mbps( 600 ) );
options.setBandwidth( fc::Gbps( 0.6 ) );
See also
fc::bps()
fc::Kbps()
fc::Mbps()
fc::Gbps()

References bps(), and k1_Mbps.

Here is the call graph for this function:

◆ Gbps() [1/2]

uint64_t fc::Gbps ( const int  rate)
inline

Convert easy-to-use numerical values to bps values.

For example, these bandwidth lines all produce the same results. Choose the style you prefer:

fc::Options options;
options.setBandwidth( fc::bps( 600000000 ) );
options.setBandwidth( fc::Kbps( 600000 ) );
options.setBandwidth( fc::Mbps( 600 ) );
options.setBandwidth( fc::Gbps( 0.6 ) );
See also
fc::bps()
fc::Kbps()
fc::Mbps()
fc::Gbps()

References bps(), and k1_Gbps.

Here is the call graph for this function:

◆ Gbps() [2/2]

uint64_t fc::Gbps ( const double  rate)
inline

Convert easy-to-use numerical values to bps values.

For example, these bandwidth lines all produce the same results. Choose the style you prefer:

fc::Options options;
options.setBandwidth( fc::bps( 600000000 ) );
options.setBandwidth( fc::Kbps( 600000 ) );
options.setBandwidth( fc::Mbps( 600 ) );
options.setBandwidth( fc::Gbps( 0.6 ) );
See also
fc::bps()
fc::Kbps()
fc::Mbps()
fc::Gbps()

References bps(), and k1_Gbps.

Here is the call graph for this function:

◆ formatTransferStatsEState()

std::string fc::formatTransferStatsEState ( const fc::TransferStats::EState  state)

◆ to_time_t()

time_t fc::to_time_t ( const std::chrono::high_resolution_clock::time_point &  tp)

Convenience function to convert time_point objects to traditional time_t values (seconds since 1970-01-01 00:00:00 UTC).

Returns
Once converted, the time_t values can used with legacy 'C' APIs. If the time point object isn't a valid timestamp, then a value of zero is returned.
Here is the caller graph for this function:

◆ formatTimeRecent() [1/2]

std::string fc::formatTimeRecent ( const std::chrono::high_resolution_clock::time_point &  tp)

Format the time in an easy-to-read text string.

The specified time can be in the past or in the future. The further from now, the more precision will be sacrificed for ease of readability.

fc::Control ftp( ... );
...
const fc::TransferStats &stats = ftp.getMostRecentFileStats();
std::cout << fc::formatTimeRecent(stats.timeTransferFinished) << std::endl;

For example, the text returned could be:

  • "in 3 hours"
  • "10 minutes ago"
  • "in 45 seconds"
Returns
"unknown" if the timepoint is invalid

References to_time_t().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatTimeRecent() [2/2]

std::string fc::formatTimeRecent ( const time_t  tt)

Format the absolute time in an easy-to-read text string.

The specified time can be in the past or in the future. The further from now, the more precision will be sacrificed for ease of readability.

time_t tt = time(nullptr) - 10800;
std::cout << fc::formatTimeRecent(tt) << std::endl;
// should result in the text string "3 hours ago"

For example, the text returned could be:

  • "in 3 hours"
  • "10 minutes ago"
  • "in 45 seconds"
Parameters
[in]ttThe time "tt" is absolute (not relative) meaning it must contain the number of seconds since 1970-01-01 0:00:00.
Returns
"unknown" if the time is more than 10 days ago, or more than 10 days from now.

◆ formatTimeDuration() [1/2]

std::string fc::formatTimeDuration ( const std::chrono::high_resolution_clock::duration &  d)

Format the "time remaining" statistic as a number followed by a common 1-letter description.

fc::Control ftp( ... );
...
const fc::TransferStats &stats = ftp.getMostRecentFileStats();
std::cout << fc::formatTimeDuration(stats.timeRemaining) << std::endl;

For example, the text returned could be:

  • 10s
  • 45m
  • 3h
Here is the caller graph for this function:

◆ formatTimeDuration() [2/2]

std::string fc::formatTimeDuration ( const time_t  tt)

Format the relative "time remaining" statistic as a number followed by a common 1-letter description.

time_t tt = 420; // seconds
std::cout << fc::formatTimeDuration(tt) << std::endl;
// should result in the text string "7m"

For example, the text returned could be:

  • 10s
  • 45m
  • 3h
Parameters
[in]ttThe time "tt" is relative (not absolute) meaning it is relative to now, not since epoch (1970-01-01 0:00:00).

◆ formatTimeDuration2() [1/2]

std::string fc::formatTimeDuration2 ( const std::chrono::high_resolution_clock::duration &  d)

Format the "time remaining" statistic as a common time string, such as HH:MM:SS.

If HH is zero, then only MM:SS will be returned.

fc::Control ftp( ... );
...
const fc::TransferStats &stats = ftp.getMostRecentFileStats();
std::cout << fc::formatTimeDuration2(stats.timeRemaining) << std::endl;

For example, the text returned could be:

  • 0:10
  • 3:00:18
Here is the caller graph for this function:

◆ formatTimeDuration2() [2/2]

std::string fc::formatTimeDuration2 ( const time_t  tt)

Format the relative "time remaining" statistic as a common time string, such as HH:MM:SS.

If HH is zero, then only MM:SS will be returned.

time_t tt = 432; // seconds
std::cout << fc::formatTimeDuration2(tt) << std::endl;
// should result in the text string "7:12"

For example, the text returned could be:

  • 0:10
  • 3:00:18
Parameters
[in]ttThe time "tt" is relative (not absolute) meaning it is relative to now, not since epoch (1970-01-01 0:00:00).

◆ formatTimestamp()

std::string fc::formatTimestamp ( std::chrono::high_resolution_clock::time_point  tp)

Format the absolute time point using "YYYY:MM:DD HH:MM:SS".

fc::Control ftp( ... );
...
const fc::TransferStats &stats = ftp.getMostRecentFileStats();
std::cout << fc::formatTimestamp(stats.timeTransferBegan) << std::endl;

For example, the text returned could be:

  • 2014-09-17 08:53:16

References to_time_t().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatTimestamp2()

std::string fc::formatTimestamp2 ( std::chrono::high_resolution_clock::time_point  tp)

Format the absolute time point using "YYYY:MM:DD HH:MM:SS.mmmmmm" where mmmmmm is microseconds.

Reminder:

  • 1 second == 1,000 milliseconds
  • 1 second == 1,000,000 microseconds
  • 1 second == 1,000,000,000 nanoseconds

So a valid microsecond value ranges from 0 to 999,999.

For example, the text returned could be:

  • 2014-09-17 08:53:16.073211

References formatTimestamp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatTransferRate() [1/2]

std::string fc::formatTransferRate ( const uint64_t  bps)

Format the transfer rate statistic using the common descriptions Kbps, Mbps, etc.

Note
The divisor is 1000, not 1024.

For example:

Input Value Output String
125800 "125.80 Kbps"
9576328 "9.58 Mbps"

References bps(), and convertNumberToSiOrIecString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatTransferRate() [2/2]

std::string fc::formatTransferRate ( const fc::ECommonBandwidth bandwidth)

Similar to the other fc::formatTransferRate(), but takes a bandwidth enum so the enumerator doesn't get converted to a numeric value.

References bps(), and formatTransferRate().

Here is the call graph for this function:

◆ formatBytesSI()

std::string fc::formatBytesSI ( const uint64_t  bytes)

Format the payload bytes using SI units (1000 bytes per "K").

For example:

Input Value Output String
2000 bytes "2.00 KB"
2048 bytes "2.05 KB"
See also
formatBytesIEC()

References:

Decimal SI prefixes:

Units Power
KB 1000^1
MB 1000^2
GB 1000^3
TB 1000^4
PB ...etc...

Different formatting options for bytes:

FC++ API Base Example Input Example Output Reference
fc::formatBytesSI() 1000 1048576 "1.05 MB" http://en.wikipedia.org/wiki/Metric_prefix
fc::formatBytesIEC() 1024 1048576 "1.00 MiB" http://en.wikipedia.org/wiki/Binary_prefix
fc::formatBytesOldStyle() 1024 1048576 "1.00 MB" http://en.wikipedia.org/wiki/Binary_prefix#Inconsistent_use_of_units

References convertNumberToSiOrIecString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatBytesIEC()

std::string fc::formatBytesIEC ( const uint64_t  bytes)

Format the payload bytes using IEC units (1024 bytes per "K").

For example:

Input Value Output String
2000 bytes "1.95 KiB"
2048 bytes "2.00 KiB"
See also
formatBytesSI()

References:

Binary IEC prefixes:

Units Power
KiB 1024^1
MiB 1024^2
GiB 1024^3
TiB 1024^4
PiB ...etc...

Different formatting options for bytes:

FC++ API Base Example Input Example Output Reference
fc::formatBytesSI() 1000 1048576 "1.05 MB" http://en.wikipedia.org/wiki/Metric_prefix
fc::formatBytesIEC() 1024 1048576 "1.00 MiB" http://en.wikipedia.org/wiki/Binary_prefix
fc::formatBytesOldStyle() 1024 1048576 "1.00 MB" http://en.wikipedia.org/wiki/Binary_prefix#Inconsistent_use_of_units

References convertNumberToSiOrIecString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatBytesOldStyle()

std::string fc::formatBytesOldStyle ( const uint64_t  bytes)

Format the payload bytes using IEC units (1024 bytes per "K"), similar to IEC but leave out the middle "i".

Note
This is the formatting style popularized in the 1980s and 1990s but replaced in 1998 by the International Electrotechnical Commission (IEC). It shouldn't be used anymore; consider using fc::formatBytesIEC() instead.

For example:

Input Value Output String
2000 bytes "1.95 KB"
2048 bytes "2.00 KB"
See also
fc::formatBytesSI()
fc::formatBytesIEC()

Different formatting options for bytes:

FC++ API Base Example Input Example Output Reference
fc::formatBytesSI() 1000 1048576 "1.05 MB" http://en.wikipedia.org/wiki/Metric_prefix
fc::formatBytesIEC() 1024 1048576 "1.00 MiB" http://en.wikipedia.org/wiki/Binary_prefix
fc::formatBytesOldStyle() 1024 1048576 "1.00 MB" http://en.wikipedia.org/wiki/Binary_prefix#Inconsistent_use_of_units

References convertNumberToSiOrIecString().

Here is the call graph for this function:

◆ emptyMap()

const fc::StrMap & fc::emptyMap ( )

Function that always returns an empty map. Used internally by FC++.

◆ baseVersionStr()

std::string fc::baseVersionStr ( )

Return a simple version string.

This is the base version of the FileCatalyst software, not the FC++ library version. This should be similar to:

  • "2.8.0"
  • "3.0.0"
  • "3.0.1"
  • "3.4"
  • "3.6"
See also
BASEFCVER in FCVersion.hpp
fc::libfcVersionStr()

References BASEFCVER.

◆ libfcVersionStr()

std::string fc::libfcVersionStr ( )

Return the version string of the FC++ library.

This is not related to the base FileCatalyst software version. Instead, this describes the C++ library build version. For example, this could be:

  • "0.6.2-610"
  • "0.6.5-756"
See also
LIBFCVER in FCVersion.hpp
fc::baseVersionStr()

References LIBFCVER.

Here is the caller graph for this function:

◆ libfcBitSize()

int fc::libfcBitSize ( )

Determine if the library was built for a 32-bit or 64-bit platform.

Returns
32 for IA-32 (Intel x86)
64 for x86-64 (AMD64)
Note
Starting in June 2020, FC++ is only available for 64-bit platforms.

References LIBFCBITSIZE.

Here is the caller graph for this function:

◆ opensslVersionStr()

std::string fc::opensslVersionStr ( )

Determine the version of OpenSSL used by FC++.

For example, this could return "OpenSSL 1.1.1d 10 Sep 2019".

◆ getCodeFromServerReply()

fc::FtpServerReplyCodes fc::getCodeFromServerReply ( const std::string &  reply)

Parse the given string and return the 3-digit FTP status code.

Supports single-line and multi-line replies.

Returns
fc::kInvalid if the reply is not a valid ftp response.
See also
fc::getTextFromServerReply()
fc::Control::getCurrentServerReplyString()
fc::Control::getCurrentServerReplyCode()

References kInvalid.

◆ getTextFromServerReply()

std::string fc::getTextFromServerReply ( const std::string &  reply)

Parse the given string and return only the last line of text following the 3-digit FTP status code.

Supports single-line and multi-line replies.

Returns
an empty string if the reply is not a valid ftp response.
See also
fc::getCodeFromServerReply()
fc::Control::getCurrentServerReplyString()
fc::k10_Gbps
@ k10_Gbps
10000000000 bps (this value requires a 64-bit integer)
Definition: FCOptions.hpp:162
fc::TransferStats::timeRemaining
std::chrono::high_resolution_clock::duration timeRemaining
The amount of time left at the current transfer rate.
Definition: FCTransferStats.hpp:161
fc::TransferStats
File transfer statistics.
Definition: FCTransferStats.hpp:37
fc::TransferStats::timeTransferFinished
std::chrono::high_resolution_clock::time_point timeTransferFinished
The time when the transfer completed.
Definition: FCTransferStats.hpp:171
fc::Mbps
uint64_t Mbps(const int rate)
Convert easy-to-use numerical values to bps values.
Definition: FCOptions.hpp:271
fc::bps
uint64_t bps(const fc::ECommonBandwidth &bandwidth)
Convert the common bandwidth enum value to a usable bps value.
Definition: FCOptions.cpp:12
fc::Options
fc::Options contains all the default and user-defined settings required by fc::Control to connect to ...
Definition: FCOptions.hpp:282
fc::k100_Mbps
@ k100_Mbps
100000000 bps
Definition: FCOptions.hpp:140
fc::GlobalStateAndStats
Combine both state and statistics into a single class which callers can access.
Definition: FCStateAndStats.hpp:114
fc::Gbps
uint64_t Gbps(const int rate)
Convert easy-to-use numerical values to bps values.
Definition: FCOptions.hpp:274
fc::k10_Mbps
@ k10_Mbps
10000000 bps
Definition: FCOptions.hpp:130
fc::formatTimestamp
std::string formatTimestamp(std::chrono::high_resolution_clock::time_point tp)
Format the absolute time point using "YYYY:MM:DD HH:MM:SS".
Definition: FCTransferStats.cpp:478
fc::Kbps
uint64_t Kbps(const int rate)
Convert easy-to-use numerical values to bps values.
Definition: FCOptions.hpp:268
fc::formatTransferRate
std::string formatTransferRate(const uint64_t bps)
Format the transfer rate statistic using the common descriptions Kbps, Mbps, etc.
Definition: FCTransferStats.cpp:621
fc::formatTimeDuration
std::string formatTimeDuration(const std::chrono::high_resolution_clock::duration &d)
Format the "time remaining" statistic as a number followed by a common 1-letter description.
Definition: FCTransferStats.cpp:386
fc::formatTimeDuration2
std::string formatTimeDuration2(const std::chrono::high_resolution_clock::duration &d)
Format the "time remaining" statistic as a common time string, such as HH:MM:SS.
Definition: FCTransferStats.cpp:431
stats
const fc::TransferStats * stats
Definition: example004.cpp:28
fc::Control::setStatsCallback
Control & setStatsCallback(fc::StatisticsCallback callback, void *userCtx=NULL)
Set a C-style callback function to be called once per second when file transfer statistics are update...
Definition: FCControl.cpp:225
fc::TransferStats::timeTransferBegan
std::chrono::high_resolution_clock::time_point timeTransferBegan
The time when the file transfer began.
Definition: FCTransferStats.hpp:136
fc::Options::setBandwidth
virtual Options & setBandwidth(const uint64_t full_bandwidth_bps=fc::bps(fc::kZero_bps), const uint64_t slow_start_bandwidth_bps=fc::bps(fc::kZero_bps))
Set the maximum and initial transfer rates which will be requested from the FileCatalyst server.
Definition: FCOptions.cpp:440
fc::formatTimeRecent
std::string formatTimeRecent(const std::chrono::high_resolution_clock::time_point &tp)
Format the time in an easy-to-read text string.
Definition: FCTransferStats.cpp:302
fc::Control
Definition: FCControl.hpp:52
fc::k600_Mbps
@ k600_Mbps
600000000 bps
Definition: FCOptions.hpp:149