#include <nftp.h>
Inheritance diagram for NFtp:
Public Types | |
enum | logType { NERR = 0, NINFO, NREPLY, NCOMMAND, NCUSTOM, NOTHER } |
Specifies the classification of the log(). More... | |
enum | errorType { ErrNo = 0, ErrHostInvalid, ErrHostNotFound, ErrConnectionRefused, ErrNotConnected, ErrConnected, ErrSocketBusy, ErrFileSeek, ErrUnknown } |
Specifies the classification of the error returned. More... | |
enum | Operations { OpList = 0, OpGet, OpPut, OpCWD, OpFxp, OpRemove, OpRaw, OpIdle, OpConnecting, OpInvalid } |
Specifies the classification of the current operation. More... | |
Public Slots | |
virtual int | closeConnection () |
Disconnect from remote system. | |
Signals | |
void | log (int id, NNet::logType type, QString msg) |
Any commands sent, replies given, errors, warnings, or other info should emit a log signal with a NNet::logType classification and a human readable string. | |
void | connectionClosed (int id, NHostInfo hInfo) |
Connection to the remote system was closed. | |
void | changedDirectory (int id, const QString &dirname) |
Directory on remote system changed. | |
void | connected (int id, NHostInfo hInfo) |
Connection opened. | |
void | transferProgress (int id, unsigned int current, unsigned int total) |
Transfer Progress changed. | |
void | transferComplete (int id, bool finished, uint bytes, int time, double rate) |
Transfer completed. | |
void | directoryListing (int id, const QValueList< QUrlInfo > &dirList) |
Directory listing from remote system. | |
void | loginComplete (int id) |
Login proccess completed. | |
Public Member Functions | |
NFtp (int id, QObject *parent=0, const char *name=0) | |
Create a new NFtp object with an ID of id. | |
virtual const char * | name () const |
Returns the name the implementation refers to itself as. | |
virtual const char * | protocol () const |
Returns the url prefix for the protocol implemented. | |
virtual int | connectToHost (NHostInfo hInfo, bool batch) |
Connects to the host specified. | |
virtual int | sendRawCommand (QString command) |
Send a custom command to the server. | |
virtual int | list () |
Request a directory listing. | |
virtual int | cd (QString dir) |
Changes the current directory. | |
virtual int | move (QString newname, QString oldname) |
Moves a file from one place to another. | |
virtual int | remove (QString name, bool recursive=false) |
Removes a remote file/directory. | |
virtual int | makedir (QString dir) |
Create a directory. | |
virtual int | abort () |
Abort current operation. | |
virtual int | get (QString file, QString sourcefile, bool resume=false) |
Retrieves a single file. | |
virtual int | put (QString file, QString sourcefile, bool resume=false) |
Uploads a single file. | |
virtual const NHostInfo | getHostInfo () const |
Returns the host information for the current connection. | |
virtual bool | isConnected () const |
Returns a boolean affirmation that the object is connected and ready for commands. | |
virtual int | currentOperation () const |
Returns the state of the object in the form of a NNet::Operations enum. | |
Protected Member Functions | |
virtual QCString | findDirCache (QString dir, int timeout=-1) const |
Locate directory cache for the requested directory. | |
virtual void | addDirCache (QString dir, QCString dirListing) |
Adds a directory listing to the cache. | |
virtual void | clearDirCache () |
Clears the directory cache. | |
QString | getAppSetting (QString setName, QString defVal="") const |
Get a setting from the applications settings. | |
int | getAppSetting (QString setName, int defVal) const |
Get a setting from the applications settings. | |
QString | getProtSetting (QString setName, QString defVal="") const |
Get a setting that is specific to the protocol. | |
int | getProtSetting (QString setName, int defVal) const |
Get a setting that is specific to the protocol. | |
QString | getHostSetting (QString setName, QString defVal="") const |
Get a setting that is specific to the hostInfo. | |
int | getHostSetting (QString setName, int defVal) const |
Get a setting that is specific to the hostInfo. | |
Protected Attributes | |
int | _id |
ID of this object. Used for all signals. | |
QSocket * | commandSock |
QSocket for use as the main communications socket. | |
QSocket * | dataSock |
QSocket for the secondary socket if the protocol requires it. | |
NHostInfo | hostInfo |
Holds the most up to date information regarding the connection. | |
bool | commandDelayedClose |
Boolean state marker for if the command socket is performing a delayed close. | |
bool | dataDelayedClose |
Boolean state marker for if the data socket is performing a delayed close. | |
bool | commandReady |
Boolean state marker signifying that the connection is ready to accept operations. | |
bool | expectedClose |
Boolean state marker signifying that a connection close is expected. | |
bool | _batch |
Marks if this object is meant to be used for batch operations, or user interaction. | |
QCString | currentDirListing |
Holds the raw directory listing of the current directory, if available. | |
Operations | currentOp |
Holds the current operation. |
|
|
Specifies the classification of the log().
|
|
Specifies the classification of the current operation.
|
|
Create a new NFtp object with an ID of id.
|
|
Abort current operation. Request an abortion of the current operation from the remote system. The abort should attempt to recover the session into a reusable state.
Implements NNet. |
|
Adds a directory listing to the cache.
|
|
Changes the current directory. Changes the directory on the remote system. If the protocol does not support persistent sessions, the protocol implementation should still remember the "current" directory as known to the object.
Implements NNet. |
|
Directory on remote system changed.
|
|
Clears the directory cache.
|
|
Disconnect from remote system. Disconnect object from any remote connections and return it to a usable, unconnected, state.
Implements NNet. |
|
Connection opened.
|
|
Connection to the remote system was closed.
|
|
Connects to the host specified.
Implements NNet. |
|
Returns the state of the object in the form of a NNet::Operations enum.
|
|
Directory listing from remote system.
|
|
Locate directory cache for the requested directory.
|
|
Retrieves a single file. Requests file from the remote system, and save it to destfile on the local system. Protocol implementation is responsible for file creation. Resume should be attempted if protocol supports it, and resume is true; or if the protocol's AutoResume option is set to on.
Implements NNet. |
|
Get a setting from the applications settings. Overloaded version of above.
|
|
Get a setting from the applications settings.
|
|
Returns the host information for the current connection. Though virtual, the default implementation should be valid for most protocols.
|
|
Get a setting that is specific to the hostInfo. Overloaded version of the above. If the hostInfo does not contain a setting with that name, it will return the getProtSetting() for the same setName.
|
|
Get a setting that is specific to the hostInfo. If the hostInfo does not contain a setting with that name, it will return the getProtSetting() for the same setName.
|
|
Get a setting that is specific to the protocol. Overloaded version of the above.
|
|
Get a setting that is specific to the protocol.
|
|
Returns a boolean affirmation that the object is connected and ready for commands.
|
|
Request a directory listing. Requests a directory listing from the remote system for the current directory. This function should not read from directory cache, but the result should be entered into it.
Implements NNet. |
|
Any commands sent, replies given, errors, warnings, or other info should emit a log signal with a NNet::logType classification and a human readable string.
|
|
Login proccess completed. Implies that the connection sequence is completed and that the object is ready for further usage.
|
|
Create a directory. Create a new directory named dir on the remote system. dir can be relative or absolute, and both should be accepted as valid.
Implements NNet. |
|
Moves a file from one place to another. Performs a move/rename operation on the remote system, moving oldname to newname.
Implements NNet. |
|
Returns the name the implementation refers to itself as. Defaults to whatever protocol() returns. Reimplemented from NNet. |
|
Returns the url prefix for the protocol implemented.
Implements NNet. |
|
Uploads a single file. Attempts to upload file from the remote system, reading it from local file sourcefile. Protocol implementation is responsible for making sure that the sourcefile exists and is readable. Resume should be attempted if the protocol supports it, and resume is true; or if the protocol's AutoResume option is set to on.
Implements NNet. |
|
Removes a remote file/directory. Performs a file deletion on the remote system, of file name. If recursive is true, assume that name is a directory, and delete it and its contents recursively.
Implements NNet. |
|
Send a custom command to the server. Bypassing any internal command manipulation, and reply parsing, send a single command to the remote system and expects replies from this command to come from log() with the NCUSTOM classification.
Implements NNet. |
|
Transfer completed.
|
|
Transfer Progress changed.
|
|
Marks if this object is meant to be used for batch operations, or user interaction.
|
|
ID of this object. Used for all signals.
|
|
Boolean state marker for if the command socket is performing a delayed close.
|
|
Boolean state marker signifying that the connection is ready to accept operations.
|
|
QSocket for use as the main communications socket.
|
|
Holds the raw directory listing of the current directory, if available.
|
|
Holds the current operation.
|
|
Boolean state marker for if the data socket is performing a delayed close.
|
|
QSocket for the secondary socket if the protocol requires it.
|
|
Boolean state marker signifying that a connection close is expected.
|
|
Holds the most up to date information regarding the connection.
|