#include <nnet.h>
Inheritance diagram for NNet:
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 ()=0 |
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 | |
NNet (int id, QObject *parent=0, const char *name=0) | |
Creates an NNet object. | |
virtual | ~NNet () |
Virtual destructor. | |
virtual const char * | protocol () const=0 |
Returns the url prefix for the protocol implemented. | |
virtual const char * | name () const |
Returns the name the implementation refers to itself as. | |
virtual int | connectToHost (NHostInfo hInfo, bool batch=false)=0 |
Connects to the host specified. | |
virtual int | sendRawCommand (QString command)=0 |
Send a custom command to the server. | |
virtual int | get (QString file, QString destfile, bool resume=false)=0 |
Retrieves a single file. | |
virtual int | put (QString file, QString sourcefile, bool resume=false)=0 |
Uploads a single file. | |
virtual int | list ()=0 |
Request a directory listing. | |
virtual int | cd (QString dir)=0 |
Changes the current directory. | |
virtual int | move (QString newname, QString oldname)=0 |
Moves a file from one place to another. | |
virtual int | remove (QString name, bool recursive=false)=0 |
Removes a remote file/directory. | |
virtual int | makedir (QString dir)=0 |
Create a directory. | |
virtual int | abort ()=0 |
Abort current operation. | |
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. |
This only provides the specifications for interface, with few exceptions: directory caching logic, connection/operation state variables and a pair of QSockets.
|
|
Specifies the classification of the log().
|
|
Specifies the classification of the current operation.
|
|
Creates an NNet object.
This should never be called directly. Instantiate only from derivatives. |
|
Virtual destructor. Clears directory cache, all else is left to derivative. |
|
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.
Implemented in NFtp. |
|
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.
Implemented in NFtp. |
|
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.
Implemented in NFtp. |
|
Connection opened.
|
|
Connection to the remote system was closed.
|
|
Connects to the host specified.
Implemented in NFtp. |
|
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.
Implemented in NFtp. |
|
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.
Implemented in NFtp. |
|
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.
Implemented in NFtp. |
|
Moves a file from one place to another. Performs a move/rename operation on the remote system, moving oldname to newname.
Implemented in NFtp. |
|
Returns the name the implementation refers to itself as. Defaults to whatever protocol() returns. Reimplemented in NFtp. |
|
Returns the url prefix for the protocol implemented.
Implemented in NFtp. |
|
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.
Implemented in NFtp. |
|
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.
Implemented in NFtp. |
|
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.
Implemented in NFtp. |
|
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.
|