33 #pragma warning(disable: 4996) //< Disable warnings "... deprecated API...". 35 #include <sys/socket.h> 36 #include <netinet/in.h> 38 #include <arpa/inet.h> 39 #include <sys/ioctl.h> 51 #if defined(__APPLE__) 52 #define off64_t __darwin_off_t 53 #define fseeko64 fseeko 58 #include <openssl/ssl.h> 67 typedef int (*FtpCallbackXfer)(off64_t xfered,
void *arg);
68 typedef int (*FtpCallbackIdle)(
void *arg);
69 typedef void (*FtpCallbackLog)(
char *str,
void* arg,
bool out);
72 typedef bool (*FtpCallbackCert)(
void *arg, X509 *cert);
83 struct timeval idletime;
84 FtpCallbackXfer xfercb;
85 FtpCallbackIdle idlecb;
98 FtpCallbackCert certcb;
144 char* LastResponse();
145 int Connect(
const char *host);
146 int Login(
const char *user,
const char *pass);
147 int Site(
const char *cmd);
148 int Raw(
const char *cmd);
149 int SysType(
char *buf,
int max);
150 int Mkdir(
const char *path);
151 int Chdir(
const char *path);
153 int Rmdir(
const char *path);
154 int Pwd(
char *path,
int max);
155 int Nlst(
const char *outputfile,
const char *path);
156 int Dir(
const char *outputfile,
const char *path);
157 int Size(
const char *path,
int *size, transfermode mode);
158 int ModDate(
const char *path,
char *dt,
int max);
159 int Get(
const char *outputfile,
const char *path, transfermode mode, off64_t offset = 0);
160 int Put(
const char *inputfile,
const char *path, transfermode mode, off64_t offset = 0);
161 int Rename(
const char *src,
const char *dst);
162 int Delete(
const char *path);
163 int TestControlConnection();
165 int SetDataEncryption(dataencryption enc);
166 int NegotiateEncryption();
167 void SetCallbackCertFunction(FtpCallbackCert pointer);
170 void SetCallbackIdleFunction(FtpCallbackIdle pointer);
171 void SetCallbackLogFunction(FtpCallbackLog pointer);
172 void SetCallbackXferFunction(FtpCallbackXfer pointer);
173 void SetCallbackArg(
void *arg);
174 void SetCallbackBytes(off64_t bytes);
175 void SetCorrectPasv(
bool b) { mp_ftphandle->correctpasv = b; };
176 void SetCallbackIdletime(
int time);
177 void SetConnmode(connmode mode);
178 static int Fxp(
ftplib* src,
ftplib* dst,
const char *pathSrc,
const char *pathDst, transfermode mode, fxpmethod method);
180 ftphandle* RawOpen(
const char *path, accesstype type, transfermode mode);
182 int RawWrite(
void* buf,
int len,
ftphandle* handle);
183 int RawRead(
void* buf,
int max,
ftphandle* handle);
188 int FtpXfer(
const char *localfile,
const char *path,
ftphandle *nControl, accesstype type, transfermode mode);
189 int FtpOpenPasv(
ftphandle *nControl,
ftphandle **nData, transfermode mode,
int dir,
char *cmd);
190 int FtpSendCmd(
const char *cmd,
char expresp,
ftphandle *nControl);
192 int FtpOpenPort(
ftphandle *nControl,
ftphandle **nData, transfermode mode,
int dir,
char *cmd);
193 int FtpRead(
void *buf,
int max,
ftphandle *nData);
194 int FtpWrite(
void *buf,
int len,
ftphandle *nData);
195 int FtpAccess(
const char *path, accesstype type, transfermode mode,
ftphandle *nControl,
ftphandle **nData);
199 int readline(
char *buf,
int max,
ftphandle *ctl);
200 int writeline(
char *buf,
int len,
ftphandle *nData);
201 int readresp(
char c,
ftphandle *nControl);
204 int CorrectPasvResponse(
unsigned char *v);