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 - 2014 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();
DLLEXPORT void clearWarningQueue(ExceptionSink* xsink);
DLLEXPORT void setWarningQueue(ExceptionSink* xsink, int64 warning_ms, int64 warning_bs, class Queue* wq, AbstractQoreNode* arg, int64 min_ms = 1000);
DLLEXPORT QoreHashNode* getUsageInfo() const;
DLLEXPORT void clearStats();
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
QoreFtpClient::setControlEventQueue
DLLLOCAL void setControlEventQueue(Queue *cbq, ExceptionSink *xsink)
sets the event queue for the control socket
QoreFtpClient::mkdir
DLLEXPORT int mkdir(const char *remotepath, ExceptionSink *xsink)
creates a directory on the remote server
QoreFtpClient::priv
struct qore_ftp_private * priv
private implementation of the object
Definition: QoreFtpClient.h:63
QoreFtpClient::list
DLLEXPORT QoreStringNode * list(const char *path, bool long_list, ExceptionSink *xsink)
returns a string listing the directory contents on the remote host (caller owns the reference count r...
QoreFtpClient::setModeEPSV
DLLEXPORT void setModeEPSV()
sets the connection mode for the next connection to &quot;EPSV&quot; (extended passive mode) ...
QoreFtpClient::disconnect
DLLEXPORT int disconnect()
disconnects from the remote host if connected
QoreHashNode
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:41
QoreFtpClient::setInsecure
DLLEXPORT int setInsecure()
unsets the secure connection parameter flag (to use the FTP protocol)
QoreFtpClient::QoreFtpClient
DLLEXPORT QoreFtpClient()
creates the object with no connection parameters
QoreFtpClient::getAsBinary
DLLEXPORT BinaryNode * getAsBinary(const char *remotepath, ExceptionSink *xsink)
gets a file from the remote server and returns it as a binary node
QoreFtpClient::~QoreFtpClient
DLLEXPORT ~QoreFtpClient()
disconnects from the host if necessary and frees all memory associated with the object ...
QoreFtpClient::getAsString
DLLEXPORT QoreStringNode * getAsString(const char *remotepath, ExceptionSink *xsink)
gets a file from the remote server and returns it as a string
QoreFtpClient::setPassword
DLLEXPORT void setPassword(const char *p)
sets the password connection parameter
AbstractQoreNode
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:47
QoreFtpClient::setModeAuto
DLLEXPORT void setModeAuto()
sets the connection mode for the next connection to &quot;auto&quot;
qore_size_t
size_t qore_size_t
used for sizes (same range as a pointer)
Definition: common.h:62
QoreFtpClient
provides thread-safe access to FTP servers through Qore data structures
Definition: QoreFtpClient.h:60
QoreFtpClient::isSecure
DLLEXPORT bool isSecure() const
returns the secure connection parameter flag
QoreFtpClient::pwd
DLLEXPORT QoreStringNode * pwd(ExceptionSink *xsink)
returns the working directory on the remote host (caller owns the reference count returned) ...
QoreFtpClient::verifyPeerCertificate
DLLEXPORT long verifyPeerCertificate() const
returns the peer certificate verification code
QoreFtpClient::putData
DLLEXPORT int putData(const void *data, qore_size_t len, const char *remotename, ExceptionSink *xsink)
sends a file data io the remote server
QoreString
Qore&#39;s string type supported by the QoreEncoding class.
Definition: QoreString.h:42
QoreStringNode
Qore&#39;s string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:40
QoreFtpClient::getURL
DLLEXPORT QoreStringNode * getURL() const
returns a URL string representing the current connection parameters, caller owns the reference count ...
QoreFtpClient::setDataEventQueue
DLLLOCAL void setDataEventQueue(Queue *cbq, ExceptionSink *xsink)
sets the event queue for the data socket
QoreFtpClient::setHostName
DLLEXPORT void setHostName(const char *h)
sets the host name connection parameter
QoreFtpClient::del
DLLEXPORT int del(const char *file, ExceptionSink *xsink)
deletes the given file on the remote server
QoreFtpClient::connect
DLLEXPORT int connect(ExceptionSink *xsink)
connects to the remote host and logs in
QoreFtpClient::operator=
DLLLOCAL QoreFtpClient & operator=(const QoreFtpClient &)
this function is not implemented; it is here as a private function in order to prohibit it from being...
QoreFtpClient::setModePASV
DLLEXPORT void setModePASV()
sets the connection mode for the next connection to &quot;PASV&quot; (passive mode)
QoreFtpClient::getPort
DLLEXPORT int getPort() const
returns the port number connection parameter
QoreFtpClient::setInsecureData
DLLEXPORT int setInsecureData()
sets the secure data connection parameter flag
QoreFtpClient::rename
DLLEXPORT int rename(const char *from, const char *to, ExceptionSink *xsink)
renames/moves a file on the remote server
ExceptionSink
container for holding Qore-language exception information and also for registering a &quot;thread_exit&quot; ca...
Definition: ExceptionSink.h:35
QoreFtpClient::getHostName
DLLEXPORT const char * getHostName() const
returns the hostname connection parameter
QoreFtpClient::getUserName
DLLEXPORT const char * getUserName() const
returns the user name connection parameter
QoreFtpClient::setPort
DLLEXPORT void setPort(int p)
sets the port connection parameter
QoreFtpClient::setModePORT
DLLEXPORT void setModePORT()
sets the connection mode for the next connection to &quot;PORT&quot;
QoreFtpClient::getPassword
DLLEXPORT const char * getPassword() const
returns the password connection parameter
QoreFtpClient::setURL
DLLEXPORT void setURL(const QoreString *url, ExceptionSink *xsink)
sets the connection parameters from a URL
QoreFtpClient::getSSLCipherVersion
DLLEXPORT const char * getSSLCipherVersion() const
returns the version string of the SSL Cipher for the currently-connected control connection, or 0 if there is none
QoreFtpClient::isDataSecure
DLLEXPORT bool isDataSecure() const
returns the secure data connection parameter flag
QoreFtpClient::setUserName
DLLEXPORT void setUserName(const char *u)
sets the user name connection parameter
QoreFtpClient::setEventQueue
DLLLOCAL void setEventQueue(Queue *cbq, ExceptionSink *xsink)
sets the same event queue for data and control sockets
QoreFtpClient::put
DLLEXPORT int put(const char *localpath, const char *remotename, ExceptionSink *xsink)
sends a file from the local filesystem to the remote server
QoreFtpClient::setSecure
DLLEXPORT int setSecure()
sets the secure connection parameter flag (to use the FTPS protocol)
QoreFtpClient::rmdir
DLLEXPORT int rmdir(const char *remotepath, ExceptionSink *xsink)
removes a directory on the remote server
QoreFtpClient::cwd
DLLEXPORT int cwd(const char *dir, ExceptionSink *xsink)
changes the working directory on the remote host
BinaryNode
holds arbitrary binary data
Definition: BinaryNode.h:33
QoreFtpClient::getSSLCipherName
DLLEXPORT const char * getSSLCipherName() const
returns the name of the SSL Cipher for the currently-connected control connection, or 0 if there is none