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__) 53 #define off64_t __darwin_off_t 55 #define fseeko64 fseeko 60 #include <openssl/ssl.h> 69 typedef int (*FtpCallbackXfer)(off64_t xfered,
void *arg);
70 typedef int (*FtpCallbackIdle)(
void *arg);
71 typedef void (*FtpCallbackLog)(
char *str,
void* arg,
bool out);
74 typedef bool (*FtpCallbackCert)(
void *arg, X509 *cert);
85 struct timeval idletime;
86 FtpCallbackXfer xfercb;
87 FtpCallbackIdle idlecb;
100 FtpCallbackCert certcb;
146 char* LastResponse();
147 int Connect(
const char *host);
148 int Login(
const char *user,
const char *pass);
149 int Site(
const char *cmd);
150 int Raw(
const char *cmd);
151 int SysType(
char *buf,
int max);
152 int Mkdir(
const char *path);
153 int Chdir(
const char *path);
155 int Rmdir(
const char *path);
156 int Pwd(
char *path,
int max);
157 int Nlst(
const char *outputfile,
const char *path);
158 int Dir(
const char *outputfile,
const char *path);
159 int Size(
const char *path,
int *size, transfermode mode);
160 int ModDate(
const char *path,
char *dt,
int max);
161 int Get(
const char *outputfile,
const char *path, transfermode mode, off64_t offset = 0);
162 int Put(
const char *inputfile,
const char *path, transfermode mode, off64_t offset = 0);
163 int Rename(
const char *src,
const char *dst);
164 int Delete(
const char *path);
165 int TestControlConnection();
167 int SetDataEncryption(dataencryption enc);
168 int NegotiateEncryption();
169 void SetCallbackCertFunction(FtpCallbackCert pointer);
172 void SetCallbackIdleFunction(FtpCallbackIdle pointer);
173 void SetCallbackLogFunction(FtpCallbackLog pointer);
174 void SetCallbackXferFunction(FtpCallbackXfer pointer);
175 void SetCallbackArg(
void *arg);
176 void SetCallbackBytes(off64_t bytes);
177 void SetCorrectPasv(
bool b) { mp_ftphandle->correctpasv = b; };
178 void SetCallbackIdletime(
int time);
179 void SetConnmode(connmode mode);
180 static int Fxp(
ftplib* src,
ftplib* dst,
const char *pathSrc,
const char *pathDst, transfermode mode, fxpmethod method);
182 ftphandle* RawOpen(
const char *path, accesstype type, transfermode mode);
184 int RawWrite(
void* buf,
int len,
ftphandle* handle);
185 int RawRead(
void* buf,
int max,
ftphandle* handle);
190 int FtpXfer(
const char *localfile,
const char *path,
ftphandle *nControl, accesstype type, transfermode mode);
191 int FtpOpenPasv(
ftphandle *nControl,
ftphandle **nData, transfermode mode,
int dir,
char *cmd);
192 int FtpSendCmd(
const char *cmd,
char expresp,
ftphandle *nControl);
194 int FtpOpenPort(
ftphandle *nControl,
ftphandle **nData, transfermode mode,
int dir,
char *cmd);
195 int FtpRead(
void *buf,
int max,
ftphandle *nData);
196 int FtpWrite(
void *buf,
int len,
ftphandle *nData);
197 int FtpAccess(
const char *path, accesstype type, transfermode mode,
ftphandle *nControl,
ftphandle **nData);
201 int readline(
char *buf,
int max,
ftphandle *ctl);
202 int writeline(
char *buf,
int len,
ftphandle *nData);
203 int readresp(
char c,
ftphandle *nControl);
206 int CorrectPasvResponse(
unsigned char *v);