All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreFtpClient.h
/* -*- mode: c++; indent-tabs-mode: nil -*- */
/*
QoreFtpClient.h
thread-safe Qore QoreFtpClient object
Qore Programming Language
Copyright 2003 - 2013 David Nichols
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _QORE_QOREFTPCLIENT_H
#define _QORE_QOREFTPCLIENT_H
#define DEFAULT_FTP_CONTROL_PORT 21
#define DEFAULT_FTP_DATA_PORT 20
#define DEFAULT_USERNAME "anonymous"
#define DEFAULT_PASSWORD "qore@nohost.com"
class FtpResp;
class Queue;
class QoreFtpClient {
protected:
struct qore_ftp_private *priv;
DLLLOCAL QoreFtpClient(const QoreFtpClient&);
DLLLOCAL QoreFtpClient& operator=(const QoreFtpClient&);
public:
DLLEXPORT QoreFtpClient(const QoreString *url, ExceptionSink *xsink);
DLLEXPORT QoreFtpClient();
DLLEXPORT ~QoreFtpClient();
DLLEXPORT int connect(ExceptionSink *xsink);
DLLEXPORT int disconnect();
DLLEXPORT int cwd(const char *dir, ExceptionSink *xsink);
DLLEXPORT QoreStringNode *pwd(ExceptionSink *xsink);
DLLEXPORT int put(const char *localpath, const char *remotename, ExceptionSink *xsink);
DLLEXPORT int get(const char *remotepath, const char *localname, ExceptionSink *xsink);
DLLEXPORT int putData(const void *data, qore_size_t len, const char *remotename, ExceptionSink *xsink);
DLLEXPORT QoreStringNode *getAsString(const char *remotepath, ExceptionSink *xsink);
DLLEXPORT BinaryNode *getAsBinary(const char *remotepath, ExceptionSink *xsink);
DLLEXPORT int rename(const char *from, const char *to, ExceptionSink *xsink);
DLLEXPORT QoreStringNode *list(const char *path, bool long_list, ExceptionSink *xsink);
DLLEXPORT int del(const char *file, ExceptionSink *xsink);
DLLEXPORT int mkdir(const char *remotepath, ExceptionSink *xsink);
DLLEXPORT int rmdir(const char *remotepath, ExceptionSink *xsink);
DLLEXPORT int getPort() const;
DLLEXPORT const char *getUserName() const;
DLLEXPORT const char *getPassword() const;
DLLEXPORT const char *getHostName() const;
DLLEXPORT void setURL(const QoreString *url, ExceptionSink *xsink);
DLLEXPORT QoreStringNode *getURL() const;
DLLEXPORT void setPort(int p);
DLLEXPORT void setUserName(const char *u);
DLLEXPORT void setPassword(const char *p);
DLLEXPORT void setHostName(const char *h);
DLLEXPORT int setSecure();
DLLEXPORT int setInsecure();
DLLEXPORT int setInsecureData();
DLLEXPORT bool isSecure() const;
DLLEXPORT bool isDataSecure() const;
DLLEXPORT const char *getSSLCipherName() const;
DLLEXPORT const char *getSSLCipherVersion() const;
DLLEXPORT long verifyPeerCertificate() const;
DLLEXPORT void setModeAuto();
DLLEXPORT void setModeEPSV();
DLLEXPORT void setModePASV();
DLLEXPORT void setModePORT();
DLLLOCAL void setEventQueue(Queue *cbq, ExceptionSink *xsink);
DLLLOCAL void setDataEventQueue(Queue *cbq, ExceptionSink *xsink);
DLLLOCAL void setControlEventQueue(Queue *cbq, ExceptionSink *xsink);
DLLLOCAL void cleanup(ExceptionSink *xsink);
};
#endif // _QORE_OBJECTS_FTPCLIENT_H