Qore Programming Language 0.8.8

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreFtpClient.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3 QoreFtpClient.h
4
5 thread-safe Qore QoreFtpClient object
6
7 Qore Programming Language
8
9 Copyright 2003 - 2013 David Nichols
10
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Lesser General Public
13 License as published by the Free Software Foundation; either
14 version 2.1 of the License, or (at your option) any later version.
15
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public
22 License along with this library; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26 #ifndef _QORE_QOREFTPCLIENT_H
27
28 #define _QORE_QOREFTPCLIENT_H
29
30 #define DEFAULT_FTP_CONTROL_PORT 21
31 #define DEFAULT_FTP_DATA_PORT 20
32
33 #define DEFAULT_USERNAME "anonymous"
34 #define DEFAULT_PASSWORD "qore@nohost.com"
35
36 class FtpResp;
37 class Queue;
38
40
60 class QoreFtpClient {
61 protected:
63 struct qore_ftp_private *priv;
64
66 DLLLOCAL QoreFtpClient(const QoreFtpClient&);
67
69 DLLLOCAL QoreFtpClient& operator=(const QoreFtpClient&);
70
71 public:
73
78 DLLEXPORT QoreFtpClient(const QoreString *url, ExceptionSink *xsink);
79
81 DLLEXPORT QoreFtpClient();
82
84 DLLEXPORT ~QoreFtpClient();
85
87
91 DLLEXPORT int connect(ExceptionSink *xsink);
92
94
97 DLLEXPORT int disconnect();
98
100
106 DLLEXPORT int cwd(const char *dir, ExceptionSink *xsink);
107
109
113 DLLEXPORT QoreStringNode *pwd(ExceptionSink *xsink);
114
116
122 DLLEXPORT int put(const char *localpath, const char *remotename, ExceptionSink *xsink);
123
125
134 DLLEXPORT int get(const char *remotepath, const char *localname, ExceptionSink *xsink);
135
137
144 DLLEXPORT int putData(const void *data, qore_size_t len, const char *remotename, ExceptionSink *xsink);
145
147
152 DLLEXPORT QoreStringNode *getAsString(const char *remotepath, ExceptionSink *xsink);
153
155
160 DLLEXPORT BinaryNode *getAsBinary(const char *remotepath, ExceptionSink *xsink);
161
163
169 DLLEXPORT int rename(const char *from, const char *to, ExceptionSink *xsink);
170
172
178 DLLEXPORT QoreStringNode *list(const char *path, bool long_list, ExceptionSink *xsink);
179
181
186 DLLEXPORT int del(const char *file, ExceptionSink *xsink);
187
189
194 DLLEXPORT int mkdir(const char *remotepath, ExceptionSink *xsink);
195
197
202 DLLEXPORT int rmdir(const char *remotepath, ExceptionSink *xsink);
203
205 DLLEXPORT int getPort() const;
206
208 DLLEXPORT const char *getUserName() const;
209
211 DLLEXPORT const char *getPassword() const;
212
214 DLLEXPORT const char *getHostName() const;
215
217
222 DLLEXPORT void setURL(const QoreString *url, ExceptionSink *xsink);
223
225
228 DLLEXPORT QoreStringNode *getURL() const;
229
231 DLLEXPORT void setPort(int p);
232
234 DLLEXPORT void setUserName(const char *u);
235
237 DLLEXPORT void setPassword(const char *p);
238
240 DLLEXPORT void setHostName(const char *h);
241
243
245 DLLEXPORT int setSecure();
246
248
250 DLLEXPORT int setInsecure();
251
253
257 DLLEXPORT int setInsecureData();
258
260
263 DLLEXPORT bool isSecure() const;
264
266
269 DLLEXPORT bool isDataSecure() const;
270
272
275 DLLEXPORT const char *getSSLCipherName() const;
276
278
281 DLLEXPORT const char *getSSLCipherVersion() const;
282
284 DLLEXPORT long verifyPeerCertificate() const;
285
287 DLLEXPORT void setModeAuto();
288
290 DLLEXPORT void setModeEPSV();
291
293 DLLEXPORT void setModePASV();
294
296 DLLEXPORT void setModePORT();
297
299 DLLLOCAL void setEventQueue(Queue *cbq, ExceptionSink *xsink);
300
302 DLLLOCAL void setDataEventQueue(Queue *cbq, ExceptionSink *xsink);
303
305 DLLLOCAL void setControlEventQueue(Queue *cbq, ExceptionSink *xsink);
306
307 DLLLOCAL void cleanup(ExceptionSink *xsink);
308 };
309
310 #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
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
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:61
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