{"id":20244292,"url":"https://github.com/mkulke/ftplibpp","last_synced_at":"2025-04-05T08:09:15.007Z","repository":{"id":6650811,"uuid":"7895158","full_name":"mkulke/ftplibpp","owner":"mkulke","description":"Platform independent c++ library providing ftp client functionality.  ","archived":false,"fork":false,"pushed_at":"2024-08-21T11:02:06.000Z","size":86,"stargazers_count":296,"open_issues_count":27,"forks_count":110,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-29T07:07:49.813Z","etag":null,"topics":["ftp","ftps"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkulke.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-01-29T15:44:14.000Z","updated_at":"2025-03-17T08:24:21.000Z","dependencies_parsed_at":"2024-12-01T16:11:19.116Z","dependency_job_id":null,"html_url":"https://github.com/mkulke/ftplibpp","commit_stats":{"total_commits":25,"total_committers":6,"mean_commits":4.166666666666667,"dds":"0.19999999999999996","last_synced_commit":"6be689f5cdfa5d4c16c71a314616023e4ce5617a"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkulke%2Fftplibpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkulke%2Fftplibpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkulke%2Fftplibpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkulke%2Fftplibpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkulke","download_url":"https://codeload.github.com/mkulke/ftplibpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305935,"owners_count":20917208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ftp","ftps"],"created_at":"2024-11-14T09:14:07.397Z","updated_at":"2025-04-05T08:09:14.986Z","avatar_url":"https://github.com/mkulke.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ftplibpp\n\nPlatform independent c++ library providing ftp client functionality.\n\nftplibpp contains a c++ class providing ftp client functionality. It supports all basic ftp functionality plus some advanced features like resuming, fxp, ssl/tls encryption, large file support, or logging to fit todays standards.\n\n## Build\n\n### Docker (Linux)\n\n```\ndocker build -t build-env .\ndocker run -e -v $PWD:/src -w /src build-env make\n```\n\n### MacOS without SSL\n\n```\nNOSSL=1 make\n```\n\n## Documentation\n\nftplibpp provides a c++ class providing ftp client functionality. It supports all basic ftp functionality plus some\nadvanced features like resuming, fxp, ssl/tls encryption, large file support, or logging to fit todays standards. The\nvery base of ftplibpp is Thomas Pfau's [ftplib c library](http://nbpfaus.net/%7Epfau/ftplib/).\n\nEvery ftp session is represented by an ftplib object, whose methods are called to communicate with the ftp server. The\nftp sessions should begin with a call to `myftp.Connect(\"myftp.org:21\")` (and maybe `myftp.NegotiateEncryption()` ), be\nfollowed with `myftp.Login(\"myuser\",\"mypass\")` and ended by `myftp.Quit()`. For the magic in between, read the class\nmethods documentation. Most methods have their tasks pretty much explained in their name. ftplibpp uses OpenSSL for\nencryption functionality, if you don't need it you can set the `NOSSL` flag (e.g. `g++ -c ftplib.cpp -DNOSSL`). If your\nsystem does not feature large file support (or does not need specific LFS functions, because it's built in yet) you can\nuse the `NOLFS` flag (e.g. `g++ -c ftplib.cpp -DNOLFS`). The flag `_FTPLIB_SSL_CLIENT_METHOD_` exists to override the\nopenssl client method in use, the default is `TLSv1_2_client_method`, override by compiling with `-D_FTPLIB_SSL_CLIENT_METHOD_=${SOME_METHOD}`.\n\n### Public types\n\n* [`int (* FtpCallbackIdle )(void *arg)`](#ftpcallbackidle)\n* [`void (* FtpCallbackLog )(char *str, void* arg, bool out)`](#ftpcallbacklog)\n* [`int (* FtpCallbackXfer )(off64_t xfered, void *arg)`](#ftpcallbackxfer)\n* [`bool (* FtpCallbackCert )(void *arg, X509 *cert)`](#ftpcallbackCert)\n* [`enum accesstype`](#accesstype)\n* [`enum transfermode`](#transfermode)\n* [`enum connmode`](#connmode)\n* [`enum fxpmethod`](#fxpmethod)\n* [`enum dataencryption`](#dataencryption)\n\n### Methods\n\n* [`ftplib ()`](#ftplib)\n* [`char* LastResponse ()`](#lastresponse)\n* [`int Connect (const char *host)`](#connect)\n* [`int Login (const char *user, const char *pass)`](#login)\n* [`int Site (const char *cmd)`](#site)\n* [`int Raw (const char *cmd)`](#raw)\n* [`int SysType (char* buf, int max)`](#systype)\n* [`int Mkdir (const char *path)`](#mkdir)\n* [`int Chdir (const char *path)`](#chdir)\n* [`int Cdup ()`](#cdup)\n* [`int Rmdir (const char *path)`](#rmdir)\n* [`int Pwd (char *path, int max)`](#pwd)\n* [`int Nlst (const char *outputfile, const char *path)`](#nlst)\n* [`int Dir (const char *outputfile, const char *path)`](#dir)\n* [`int Size (const char *path, int *size, transfermode mode)`](#size)\n* [`int ModDate (const char *path, char *dt, int max)`](#moddate)\n* [`int Get (const char *outputfile, const char *path, transfermode mode)`](#get)\n* [`int Get (const char *outputfile, const char *path, transfermode mode, off64_t offset)`](#get2)\n* [`int Put (const char *inputfile, const char *path, transfermode mode)`](#put)\n* [`int Put (const char *inputfile, const char *path, transfermode mode, off64_t offset)`](#put2)\n* [`int Rename (const char *src, const char *dst)`](#rename)\n* [`int Delete (const char *path)`](#delete)\n* [`int SetDataEncryption (dataencryption enc)`](#setdataencryption)\n* [`int NegotiateEncryption ()`](#negotiateencryption)\n* [`ftphandle* RawOpen (const char *path, accesstype type, transfermode mode)`](#rawopen)\n* [`int RawRead (void *buf, int max, ftphandle *handle)`](#rawread)\n* [`int RawWrite (void *buf, int len, ftphandle *handle)`](#rawwrite)\n* [`int RawClose (ftphandle *handle)`](#rawclose)\n* [`void Quit ()`](#quit)\n* [`void SetCallbackIdleFunction (FtpCallbackIdle pointer)`](#setcallbackidlefunction)\n* [`void SetCallbackLogFunction (FtpCallbackLog pointer)`](#setcallbacklogfunction)\n* [`void SetCallbackXferFunction (FtpCallbackXfer pointer)`](#setcallbackxferfunction)\n* [`void SetCallbackCertFunction (FtpCallbackCert pointer)`](#setcallbackcertfunction)\n* [`void SetCallbackArg (void *arg)`](#setcallbackarg)\n* [`void SetCallbackBytes (off64_t bytes)`](#setcallbackbytes)\n* [`void SetCallbackIdletime (int time)`](#setcallbackidletime)\n* [`void SetCorrectPasv (bool b)`](#setcorrectpasv)\n* [`void SetConnmode (ftplib::ftp mode)`](#setconnmode)\n\n### Public static methods\n\n* [`static int Fxp (ftplib* src, ftplib* dst, const char *pathSrc, const char *pathDst, ftplib::ftp mode, ftplib::ftp method)`](#fxp)\n\n## Details\n\n\u003ca name=\"ftpcallbackidle\" /\u003e\n\n### int (* FtpCallbackIdle )(void *arg)\n\n[typedef]\n\n`typedef int (*FtpCallbackIdle)(void *arg);`\n\n\u003ca name=\"ftpcallbacklog\" /\u003e\n\n### void (* FtpCallbackLog )(char *str, void* arg, bool out)\n\n[typedef]\n\n`typedef void (* FtpCallbackLog)(char *str, void* arg, bool out);`\n\n#### Notes:\n\n*out* indicates wether the log information in *str* is incoming or outgoing.\n\n\u003ca name=\"ftpcallbackxfer\" /\u003e\n\n### int (* FtpCallbackXfer )(off64_t xfered, void *arg)\n\n[typedef]\n\n`typedef int (*FtpCallbackXfer)(off64_t xfered, void *arg);`\n\n\u003ca name=\"ftpcallbackcert\" /\u003e\n\n### bool (* FtpCallbackCert )(void* arg, X509 *cert)\n\n[typedef]\n\n`typedef int (*FtpCallbackCert)(void *arg, X509 *cert);`\n\n\u003ca name=\"accesstype\" /\u003e\n\n### enum accesstype { dir = 1, dirverbose, fileread, filewrite, filereadappend, filewriteappend };\n\nThis type is used in [RawOpen](#rawopen).\n\n\u003ca name=\"transfermode\" /\u003e\n\n### enum transfermode { ascii = 'A', image = 'I' };\n\nThis type determines how data is transferred.\n\n\u003ca name=\"connmode\" /\u003e\n\n### enum connmode { pasv = 1, port };\n\nThis type determines wether data is to be transferred using the pasv or active mode.\n\n\u003ca name=\"fxpmethod\" /\u003e\n\n### enum fxpmethod { defaultfxp = 0, alternativefxp };\n\nThis type is used in the Fxp method.\n\n\u003ca name=\"dataencryption\" /\u003e\n\n### enum dataencryption { unencrypted = 0, secure };\n\nThis type determines wether data is encrypted or not.\n\n\u003ca name=\"ftplib\" /\u003e\n\n### ftplib()\n\n[constructor]\n\nClass constructor, an ftplib object is responsible for the ftp session.\n\n\u003ca name=\"lastresponse\" /\u003e\n\n### char* LastResponse()\n\nLastResponse returns a pointer to the last response c-styled string sent by the server. This can be parsed by the\nuser program todetermine more information about the last request or can be displayed along with an error message.\n\n#### Returns:\n\nA pointer to the last server response string. Otherwise, `NULL` is returned.\n\n\u003ca name=\"connect\" /\u003e\n\n### int Connect ( const char* host )\n\nConnect establishes a connection to the FTP server on the specified machine and returns a handle which can be used to\ninitiate data transfers. The host name should be specified in the form of `\u003chost\u003e:\u003cport\u003e` `\u003chost\u003e` may be either a host name or ip\naddress. `\u003cport\u003e` may be either a service name or a port number.\n\n#### Parameters:\n\n- `host`: The name of the host machine to connect to and optionally an alternate port number to use (`ftp.myftp.com:321`).\n\n#### Returns:\n\nIf the connection to the remote server if successful, `Connect()` returns `1`. Otherwise, `0` is returned.\n\n\u003ca name=\"login\" /\u003e\n\n### int Login( const char* user, const char* pass )\n\nLogin attempts to login to the remote system with the supplied username and password.\n\n#### Parameters:\n\n- `user`: Specifies the username.\n- `pass`: Specifies the user's password.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"site\" /\u003e\n\n### int Site( const char *cmd )\n\nSite sends the specified command as an argument to a `SITE` command.\n\n#### Parameters:\n\n- `cmd`: A string containing a `SITE` subcommand.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"raw\" /\u003e\n\n### int Raw ( const char *cmd )\n\nRaw sends the specified command unmodified.\n\n#### Parameters:\n\n- `cmd`: A string containing a custom ftp command.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"systype\" /\u003e\n\n### int SysType ( char *buf, int max )\n\nSysType issues a `SYST` command to the remote system and attempts to parse the system type out of the response and return\nit to the user's buffer.\n\n#### Parameters:\n\n- `buf`: A pointer to a buffer where the result will be returned to.\n- `max`: Specifies the size of the user buffer.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"mkdir\" /\u003e\n\n### int Mkdir ( const char* path)\n\nMkdir sends a make directory request to the remote system.\n\n#### Parameters:\n\n- `path`: Specifies the argument to mkdir on the remote system.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"chdir\" /\u003e\n\n### int Chdir ( const char* path)\n\nSends a change working directory request to the server using the specified path.\n\n#### Parameters:\n\n- `path`: Specifies the desired working directory on the server.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"cdup\" /\u003e\n\n### int Cdup ()\n\nCdup sends a CDUP command to the remote server.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"rmdir\" /\u003e\n\n### int Rmdir ( const char* path )\n\nRmdir sends a remove directory request to the remote server.\n\n#### Parameters:\n\n- `path`: A string containing the name of a remote directory.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"pwd\" /\u003e\n\n### int Pwd (char* path, int max )\n\nPwd attempts to determine the current default directory at the server and return it to the user's buffer.\n\n#### Parameters:\n\n- `path`: A pointer to a buffer where the result should be returned.\n- `max`: Specifies the size of the user's buffer.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"nlst\" /\u003e\n\n### int Nlst ( const char* outputfile, const char* path )\n\nPerforms a short form directory listing of the specified path on the remote system. The results are written to the\nspecified file.\n\n#### Parameters:\n\n- `output`: Specifies the name of a file to receive the directory listing. path Specifies an argument to `ls` on the remote system.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"dir\" /\u003e\n\n### int Dir ( const char* outputfile, const char* path )\n\nSends a `LIST -aL` command to the server with the specified path. The response to this is usually a long format directory\nlisting which will be written to the file named in outputfile. If outputfile is specified as `NULL`, the list will be\nwritten to stdout.\n\n#### Parameters:\n\n- `output`: Specifies the name of a file to receive the directory listing.\n- `path`: Specifies an argument to 'ls' on the remote system.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"size\" /\u003e\n\n### int Size ( const char* path, int* size, transfermode mode )\n\nSize attempts to determine the size of a remote file.\n\n#### Parameters:\n\n- `path`: A pointer to a buffer where the result should be returned.\n- `size`: A pointer to an int where the size will be returned.\n- `mode`: Specifies the transfer mode as `ftplib::image` or `ftplib::ascii`.\n\n#### Returns:\n\nIf a good response is received and the size is successfully parsed out of the result, `1` is returned. Otherwise, `0` is returned.\n\n\u003ca name=\"moddate\" /\u003e\n\n### int ModDate ( const char* path, char* dt, int max )\n\nModDate attempts to determine the last access time of a remote file and return it to the user's buffer. The date and\ntime are returned as a string in the format 'YYYYMMDDHHMMSS'.\n\n#### Parameters:\n\n- `path`: Name of remote file to be checked.\n- `buf`: A pointer to a buffer where the result should be returned.\n- `max`: Specifies the size of the user's buffer.\n\n#### Returns:\n\nIf a good response is received and the size is successfully parsed out of the result, `1` is returned. Otherwise, `0` is returned.\n\n\u003ca name=\"get\" /\u003e\n\n### int Get (const char* outputfile, const char *path, transfermode mode )\n\nCopies the contents of a remote file to a local file.\n\n#### Parameters:\n\n- `output`: Name of a local file to receive the contents of the remote file.\n- `path`: Name of remote file to be retrieved.\n- `mode`: Specifies the transfer mode as `ftplib::image` or `ftplib::ascii`.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"get2\" /\u003e\n\n### int Get (const char* outputfile, const char *path, transfermode mode, off64_t offset )\n\nCopies the contents of a remote file from a given offset and appends it to a local file. Not all ftp servers might\nimplement this feature.\n\n#### Parameters:\n\n- `output`: Name of a local file to receive the contents of the remote file.\n- `path`: Name of remote file to be retrieved. mode Specifies the transfer mode as `ftplib::image` or `ftplib::ascii`.\n- `offset`: Point from where the copy is suppossed to begin.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"put\" /\u003e\n\n### int Put ( const char* inputfile, const char *path, transfermode mode )\n\nTransfers a local file to the remote system.\n\n#### Parameters:\n\n- `input`: Specifies the name of a local file to be transfered to the server.\n- `path`: Specifies the name to be given to the file on the remote system.\n- `mode`: Specifies the transfer mode as `ftplib::image` or `ftplib::ascii`.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"put2\" /\u003e\n\n### int Put ( const char* inputfile, const char *path, transfermode mode, off64_t offset )\n\nCopies the contents of a local file from a given offset and appends it to a remote file. Not all ftp servers might\nimplement this feature.\n\n#### Parameters:\n\n- `input`: Specifies the name of a local file to be transfered to the server.\n- `path`: Specifies the name to be given to the file on the remote system.\n- `mode`: Specifies the transfer mode as `ftplib::image` or `ftplib::ascii`.\n- `offset`: Point from where the copy begins.\n\n#### Returns: Returns 1 if successful or 0 on error.\n\n\u003ca name=\"rename\" /\u003e\n\n### int Rename ( const char *src, const char *dst )\n\nFtpRename sends a rename request to the remote server.\n\n#### Parameters:\n\n- `src`: A string containing the current name of the remote file.\n- `dst`: A string containing the desired new name for the remote file.\n\n#### Returns: Returns 1 if successful or 0 on error.\n\n\u003ca name=\"delete\" /\u003e\n\n### int Delete ( const char *path )\n\nRequests that the server remove the specified file from the remote file system.\n\n#### Parameters:\n\n- `path`: The path to the file which is to be removed.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"setdataencryption\" /\u003e\n\n### int SetDataEncryption ( dataencryption enc )\n\nOn an already secured ftp session, SetDataEncryption() specifies if the data connection channel will be secured for the next data transfer.\n\n#### Parameters:\n\n- `enc`: either `ftplib::unencrypted` or `ftplib::secure`.\n\n#### Returns:\n\nReturns `1` if successful and `0` if the control connection isn't secure or on error.\n\n#### Notes:\n\nSee [NegotiateEncryption](#negotiateencryption)\n\n\u003ca name=\"negotiateencryption\" /\u003e\n\n### int NegotiateEncryption ()\n\nThis Method is to be called after Connect and before Login to secure the ftp communication channel.\n\n#### Returns:\n\nReturns `1` if successful and `0` if the ssl negotiation failed.\n\n#### Notes:\n\nThe ftplibpp library uses an ssl/tls encryption approach defined in the RFC4217 standard.\n\n\u003ca name=\"quit\" /\u003e\n\n### void Quit ()\n\nQuit() issues a 'QUIT' command and closes the connection to the remote server.\n\n\u003ca name=\"setcallbackxferfunction\" /\u003e\n\n### void SetCallbackXferFunction ( FtpCallbackXfer pointer )\n\nWhen SetCallbackBytes is set to a bigger value than `0`, a callback function can be called during an ftp data transfer. If\nthe callback function returns 0, the data transfer is aborted. The callback function has two parameters: `xfered` \u0026 `arg`.\n`xfered` is the amount of bytes yet transfered during the data connection and `arg` contains either `NULL` or a custom\npointer set by [SetCallbackArg](#setcallbackarg). If `pointer` is specified as `NULL` the xfer callback is disabled.\n\n#### Parameters:\n\n- `pointer`: A pointer to a static function of the type FtpCallbackXfer.\n\n#### Notes:\n\nSince `FtpCallbackXferFunction` only accepts pointers to static functions, it might appear problematic in an oo c++ context.\nHowever there's an easy way to use it anyway. Using `SetCallbackArg` you supply the class a pointer to the object the method\nof which you'd like to call from the ftplib object. That pointer is then passed back with call to the callback function.\nFrom the static callback function you can perform a cast of `arg` to a pointer of the your desired object, and call its\nmethod. valid code could look like this:\n\n```cpp\n...\nstatic int callback(off64_t xfered, void* arg); // static callback function defined in myclass.h\nvoid mymethod(); // common myclass method\n...\nint myclass::callback(off64_t xfered, void* arg) {\n  ((*myclass)(arg)-\u003emymethod(); // casting the pointers to the correct type and calling class method\n  return 1;\n}\n...\nvoid myclass::mymethod() {\n  DoSomething();\n}\n...\nmyftp.SetCallbackArg(this); // supply the myftp object the pointer to the current (myclass) object\nmyftp.SetCallbackBytes(1024); // issue a xfer callback every kb\nmyftp.SetCallbackXferFunction(class::callback);\n...\n```\n\u003ca name=\"setcallbacklogfunction\" /\u003e\n\n### void SetCallbackLogFunction ( FtpCallbackLog pointer )\n\n`SetCallbackLogFunction` enables the logging callback. Every time there's been data read from the control connection,\n`pointer` is called with a c-styled string and a custom pointer specified in [SetCallbackArg](#setcallbackarg). If\n`pointer` is specified as `NULL` logging callback is disabled.\n\n#### Parameters:\n\n- `pointer`: A pointer to a static function of the type [FtpCallbackLog](#ftpcallbacklog).\n\n#### Notes:\n\nSee SetCallbackIdleFunction.\n\n\u003ca name=\"setcallbackcertfunction\" /\u003e\n\n### bool SetCallbackCertFunction ( FtpCallbackCert pointer )\n\nSetCallbackCertFunction enables the ssl/tls certification callback. When you use encryption and you call this method\nwith a certification callback function, it is called when connecting to the server. In the callback function you decide\nvia the boolean return value whether the certificate is valid or not. Certification checking is an advanced issue, and\nyou should read into the openssl documentation if you plan to implement it. `pointer` is called with a custom pointer\nspecified in [SetCallbackArg](#setcallbackarg) and the certificate from the Server. If pointer is specified as `NULL`\ncertification callback is disabled.\n\n#### Parameters:\n\n- `pointer`: a pointer to a static function of the type [FtpCallbackCert](#ftpcallbackcert).\n\n#### Notes:\n\nSample implementation:\n```cpp\nbool MyCallbackCert(void *arg, X509 *cert) {\n  if (cert == NULL) {\n    printf(\"Peer sent no certificate.\\n\");\n    return false;\n  } else {\n    char peer_CN[265];\n    int len;\n    X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_commonName, peer_CN, 256);\n    printf(\"subject: %s\\n\", peer_CN);\n    X509_NAME_get_text_by_NID(X509_get_issuer_name(cert), NID_commonName, peer_CN, 256);\n    printf(\"issuer: %s\\n\", peer_CN); return true;\n  }\n}\n```\n### void SetCallbackIdleFunction ( FtpCallbackIdle pointer )\n\nSetCallbackLogFunction enables the idle callback. When a connection idles, for a period bigger than 0 set in\n[SetCallbackIdletime](#setcallbackidletime) a callback to the argument function is issued.\n\n#### Parameters:\n\n- `pointer`: A pointer to a static function of the type [FtpCallbackIdle](#ftpcallbackidle).\n\n#### Notes:\n\nSee SetCallbackXferFunction.\n\n\u003ca name=\"setcallbackarg\" /\u003e\n\n### void SetCallbackArg ( void* arg )\n\nSetCallbackArg submits a pointer of custom type to the object, this pointer is returned with a callback function. A good\nidea is to store the ftplib owners (or whatever object should handle the callback) pointer in it to use it the way\ndescribed in the [SetCallbackXferFunction](#setcallbackxferfunction) entry.\n\n#### Parameters:\n\n- `arg`: A pointer of a custom type.\n\n\u003ca name=\"setcallbackbytes\" /\u003e\n\n### void SetCallbackBytes ( off64_t bytes )\n\nSetCallbackBytes specifies the frequency of xfer callbacks. The xfer callback returns the amount of bytes yet transfered\non this transfer.\n\n#### Parameters:\n\n- `bytes`: Specifies the frequency in transfered bytes. A value of 100000 would mean every 100000 bytes an xfer callback is\nissued.\n\n\u003ca name=\"setcallbackidletime\" /\u003e\n\n### void SetCallbackIdletime ( int time )\n\nSetCallbackIdletime specifies how long a data socket can idle, without an idle callback beeing issued.\n\n#### Parameters:\n\n- `time`: Time in msec.\n\n#### Notes:\n\nThe default value of `0`, means that on every idle a callback happens. if you don't want this behaviour you have to set a\n(higher) value.\n\n\u003ca name=\"setconnmode\" /\u003e\n\n### void SetConnmode ( ftplib::ftp mode )\n\nSetConnmode specifies which data connection method is to be used for the next data transfer.\n\n#### Parameters:\n\n- `mode`: Either `ftplib::pasv` (passive mode, default) or `ftplib::port` (active mode).\n\n\u003ca name=\"setcorrectpasv\" /\u003e\n\n### void SetCorrectPasv ( bool b )\n\nSome Ftp-Servers, which run behind a NAT, return their local ip-adresses as PASV replies. When this option is turned on\nPASV replies are corrected using the ip address the ftp session is currently connected to.\n\n#### Parameters:\n\n- `b`: `true` turns the correction on, `false` turns it off.\n\n\u003ca name=\"fxp\" /\u003e\n\n### int Fxp ( ftplib* src, ftplib* dst, const char *pathSrc, const char *pathDst, ftplib::ftp mode, ftplib::ftp method )\n\n[static]\n\nFxp is a static function. It uses two ftp session objects and transfer a certain file between them.\n\n#### Parameters:\n\n- `src`: Source ftplib object.\n- `dst`: Destination ftplib object.\n- `pathSrc`: Path to file to be copied copy (`/incoming/myfile.tar.gz`).\n- `pathDst`: Path to file destination (`/pub/myfile_from_some_ftp.tar.gz`).\n- `mode`: Either `ftplib::ascii` (ascii) or `ftplib::image` (binary). Method either `ftplib::defaultfxp` (`PASV` on `dst`, `PORT` on `src`) or `ftplib::alternativefxp` (`PASV` on `src`, `PORT` on `dst`).\n\n#### Returns:\n\nReturns `1` if successful, `-`1 if initilization failed (\"PORT\" and \"PASV\"), or `0` if the data transfer somehow failed.\n\n#### Notes:\n\nFxp - direct Ftp to Ftp transfer - is rather an exploit than a feature and might thus be prevented by many servers.\nCurrently Fxp does not work with encrypted data connections, so be sure to switch to unencrypted data channels before\nperforming fxp.\n\n\u003ca name=\"rawread\" /\u003e\n### int RawRead ( void* buf, int max, ftphandle *handle )\n\nRawRead copies up to max bytes of data from the specified data connection and returns it to the user's buffer. If the data\nconnection was opened in ascii mode, no more than one line of data will be returned.\n\n#### Parameters:\n\n- `buf`: Specifies the address of a buffer where received data will be written. max Specifies the size of the user's buffer.\n- `handle`: A handle returned by FtpAccess().\n\n#### Returns:\n\nReturns the number of bytes written to the user's buffer or `-1` on error or end of file.\n\n\u003ca name=\"rawwrite\" /\u003e\n\n#### int RawWrite ( void* buf, int len, ftphandle *handle )\n\nRawWrite sends data to a remote file. If the file were accessed in record mode, the necessary conversions are performed.\n\n#### Parameters:\n\n- `buf`: A buffer containing the data to be sent to the remote file.\n- `len`: The number of bytes to be sent from 'buf'.\n- `handle`: A handle returned by [RawOpen()](#rawopen).\n\n#### Returns:\n\nReturns the number of bytes sent from the user's buffer or `-1` on error.\n\n\u003ca name=\"rawopen\" /\u003e\n\n### ftphandle* RawOpen ( const char *path, accesstype type, transfermode mode )\n\nRawOpen() opens a remote file or directory and returns a handle for the calling program to use to transfer data.\n\n#### Parameters:\n\n- `path`: Specifies the name of the remote file or directory to open.\n- `type`: Specifies the type of transfer to be performed. `ftplib::dir` performs a terse directory. `ftplib::dirverbose`\nperforms a verbose directory. `ftplib::fileread` opens a remote file for reading. `ftplib::filewrite` creates a remote\nfile and readies it for writing. `ftplib::filewriteappend` and `ftplib::filereadappend` are for appending file operations.\n- `mode`: Specifies the transfer mode as `ftplib::ascii` or `ftplib::image`.\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n\n\u003ca name=\"rawclose\" /\u003e\n\n### int RawClose ( ftphandle* handle )\n\nCloses the data connection specified by handle and frees associated resources.\n\n#### Parameters:\n\n- `handle`: A handle returned by [RawOpen()](#rawopen).\n\n#### Returns:\n\nReturns `1` if successful or `0` on error.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkulke%2Fftplibpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkulke%2Fftplibpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkulke%2Fftplibpp/lists"}