|
Qore Programming Language
0.8.3
|
00001 /* -*- mode: c++; indent-tabs-mode: nil -*- */ 00002 /* 00003 QoreFtpClient.h 00004 00005 thread-safe Qore QoreFtpClient object 00006 00007 Qore Programming Language 00008 00009 Copyright 2003 - 2011 David Nichols 00010 00011 This library is free software; you can redistribute it and/or 00012 modify it under the terms of the GNU Lesser General Public 00013 License as published by the Free Software Foundation; either 00014 version 2.1 of the License, or (at your option) any later version. 00015 00016 This library is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 Lesser General Public License for more details. 00020 00021 You should have received a copy of the GNU Lesser General Public 00022 License along with this library; if not, write to the Free Software 00023 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 */ 00025 00026 #ifndef _QORE_QOREFTPCLIENT_H 00027 00028 #define _QORE_QOREFTPCLIENT_H 00029 00030 #define DEFAULT_FTP_CONTROL_PORT 21 00031 #define DEFAULT_FTP_DATA_PORT 20 00032 00033 #define DEFAULT_USERNAME "anonymous" 00034 #define DEFAULT_PASSWORD "qore@nohost.com" 00035 00036 class FtpResp; 00037 class Queue; 00038 00040 00060 class QoreFtpClient { 00061 protected: 00063 struct qore_ftp_private *priv; 00064 00066 DLLLOCAL QoreFtpClient(const QoreFtpClient&); 00067 00069 DLLLOCAL QoreFtpClient& operator=(const QoreFtpClient&); 00070 00071 public: 00073 00078 DLLEXPORT QoreFtpClient(const QoreString *url, ExceptionSink *xsink); 00079 00081 DLLEXPORT QoreFtpClient(); 00082 00084 DLLEXPORT ~QoreFtpClient(); 00085 00087 00091 DLLEXPORT int connect(ExceptionSink *xsink); 00092 00094 00097 DLLEXPORT int disconnect(); 00098 00100 00106 DLLEXPORT int cwd(const char *dir, ExceptionSink *xsink); 00107 00109 00113 DLLEXPORT QoreStringNode *pwd(ExceptionSink *xsink); 00114 00116 00122 DLLEXPORT int put(const char *localpath, const char *remotename, ExceptionSink *xsink); 00123 00125 00134 DLLEXPORT int get(const char *remotepath, const char *localname, ExceptionSink *xsink); 00135 00137 00144 DLLEXPORT int putData(const void *data, qore_size_t len, const char *remotename, ExceptionSink *xsink); 00145 00147 00152 DLLEXPORT QoreStringNode *getAsString(const char *remotepath, ExceptionSink *xsink); 00153 00155 00160 DLLEXPORT BinaryNode *getAsBinary(const char *remotepath, ExceptionSink *xsink); 00161 00163 00169 DLLEXPORT int rename(const char *from, const char *to, ExceptionSink *xsink); 00170 00172 00178 DLLEXPORT QoreStringNode *list(const char *path, bool long_list, ExceptionSink *xsink); 00179 00181 00186 DLLEXPORT int del(const char *file, ExceptionSink *xsink); 00187 00189 00194 DLLEXPORT int mkdir(const char *remotepath, ExceptionSink *xsink); 00195 00197 00202 DLLEXPORT int rmdir(const char *remotepath, ExceptionSink *xsink); 00203 00205 DLLEXPORT int getPort() const; 00206 00208 DLLEXPORT const char *getUserName() const; 00209 00211 DLLEXPORT const char *getPassword() const; 00212 00214 DLLEXPORT const char *getHostName() const; 00215 00217 00222 DLLEXPORT void setURL(const QoreString *url, ExceptionSink *xsink); 00223 00225 00228 DLLEXPORT QoreStringNode *getURL() const; 00229 00231 DLLEXPORT void setPort(int p); 00232 00234 DLLEXPORT void setUserName(const char *u); 00235 00237 DLLEXPORT void setPassword(const char *p); 00238 00240 DLLEXPORT void setHostName(const char *h); 00241 00243 00245 DLLEXPORT int setSecure(); 00246 00248 00250 DLLEXPORT int setInsecure(); 00251 00253 00257 DLLEXPORT int setInsecureData(); 00258 00260 00263 DLLEXPORT bool isSecure() const; 00264 00266 00269 DLLEXPORT bool isDataSecure() const; 00270 00272 00275 DLLEXPORT const char *getSSLCipherName() const; 00276 00278 00281 DLLEXPORT const char *getSSLCipherVersion() const; 00282 00284 DLLEXPORT long verifyPeerCertificate() const; 00285 00287 DLLEXPORT void setModeAuto(); 00288 00290 DLLEXPORT void setModeEPSV(); 00291 00293 DLLEXPORT void setModePASV(); 00294 00296 DLLEXPORT void setModePORT(); 00297 00299 DLLLOCAL void setEventQueue(Queue *cbq, ExceptionSink *xsink); 00300 00302 DLLLOCAL void setDataEventQueue(Queue *cbq, ExceptionSink *xsink); 00303 00305 DLLLOCAL void setControlEventQueue(Queue *cbq, ExceptionSink *xsink); 00306 00307 DLLLOCAL void cleanup(ExceptionSink *xsink); 00308 }; 00309 00310 #endif // _QORE_OBJECTS_FTPCLIENT_H