Qorus Integration Engine® Enterprise Edition 6.0.16_prod
Loading...
Searching...
No Matches
OMQ::AbstractFtpHandler Class Reference

this class is used to customize and control the behavior of Qorus FTP servers attached to services More...

Collaboration diagram for OMQ::AbstractFtpHandler:
[legend]

Public Member Methods

 constructor (*string root, bool bin=False, HttpServer::AbstractAuthenticator auth=new DefaultQorusRBACAuthenticator())
 creates the object with the given arguments More...
 
 addListener (int port)
 adds a listener from a port number; listener will start up on all interfaces on the given port More...
 
 addListener (string bind)
 adds a listener from a bind string in the format: "address:port" (ex: "192.168.20.1:8011") More...
 
 addListeners (list< auto > l)
 adds a list of listeners from a list of bind addresses More...
 
string authReceiveFile (string cwd, string orig, string path)
 this method is run when the server receives a "STOR" command from the client but before the server opens the data channel to receive the file More...
 
*string authReceiveFile (string cwd, string orig, reference< string > path)
 this method is run when the server receives a "STOR" command from the client but before the server opens the data channel to receive the file; return no value if the server should accept the file, otherwise return a string that will be passed back to the client with a 500 error code rejecting the "STOR" request More...
 
 fileDataReceived (string path, data data)
 this method is called when the server has received a file and no root directory is set More...
 
 fileReceived (string path)
 this method is called when the server has received a file More...
 
string authSendFile (string cwd, string orig, string path)
 this method is run when the server receives a "RETR" command from the client but before the server opens the data channel to send the file More...
 
*string authSendFile (string cwd, string orig, reference< string > path)
 this method is run when the server receives a "RETR" command from the client but before the server opens the data channel to receive the file; return no value if the server should accept the file, otherwise return a string that will be passed back to the client with a 500 error code rejecting the request More...
 
data sendFile (string path)
 this method is called when the server should send a file More...
 
int size (string cwd, string orig, string path)
 this method is called when the "SIZE" command is received More...
 
*string size (string cwd, string orig, string path, reference< int > size)
 this method is called when the "SIZE" command is received More...
 
date modifiedTime (string cwd, string orig, string path)
 this method is called when the "MDTM" command is received More...
 
*string modifiedTime (string cwd, string orig, string path, reference< date > mdate)
 this method is called when the "MDTM" command is received More...
 
 fileSent (string path)
 this method is called when the server has sent a file More...
 
string authChangeDir (string cwd, string orig, string path)
 this method is run when the server receives a "CWD" command from the client but before the server updates the current working directory More...
 
*string authChangeDir (string cwd, string orig, reference< string > path)
 this method is run when the server receives a "CWD" command from the client but before the server updates the current working directory; return no value if the server should accept the change directory request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the "CWD" request More...
 
string authRename (string cwd, string orig, string path)
 this method is run when the server receives a "RNFR" command from the client More...
 
*string authRename (string cwd, string orig, reference< string > path)
 this method is run when the server receives a "RNFR" command from the client; return no value if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the "RNFR" request More...
 
*string rename (string cwd, string orig_to, string from, string to)
 this method is run when the server receives a "RNTO" command from the client; return no value if the server should accept the request (and thie method has already effected the rename of the file), otherwise return a string that will be passed back to the client with a 550 error code rejecting the request More...
 
string list (string cwd, *string path)
 this method is run when the server receives a "LIST" command from the client More...
 
*string list (string cwd, *string path, reference< string > output)
 this method is run when the server receives a "LIST" command from the client; return no value and set the output reference if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request More...
 
string nlst (string cwd, *string path)
 this method is run when the server receives a "NLST" command from the client; return no value and set the output reference if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request More...
 
*string nlst (string cwd, *string path, reference< string > output)
 this method is run when the server receives a "NLST" command from the client; return no value and set the output reference if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request More...
 
string machineListFile (string cwd, *string orig, string path)
 this method is run when the server receives a "MLST" command from the client More...
 
*string machineListFile (string cwd, *string orig, string path, reference< string > output)
 this method is run when the server receives a "MLST" command from the client; return no value and set the output reference if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request More...
 
string machineListDir (string cwd, *string orig, string path)
 this method is run when the server receives a "MLSD" command from the client More...
 
*string machineListDir (string cwd, *string orig, string path, *reference< string > output, *reference< bool > isdir)
 this method is run when the server receives a "MLSD" command from the client; return no value and set the output reference if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request More...
 
string getTargetPath (string path)
 returns the real path on the filesystem for the given virtual path
 
*string makeDir (string cwd, string orig, string path)
 this method is run when the server receives a "MKD" command from the client; return no value if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request More...
 
*string removeDir (string cwd, string orig, string path)
 this method is run when the server receives a "RMD" command from the client; return no value if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request More...
 
*string deleteFile (string cwd, string orig, string path)
 this method is run when the server receives a "DELE" command from the client; return no value if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request More...
 
 logFatal (softstring msg)
 writes the message to the service log file if the log level is equal or lower More...
 
 logError (softstring msg)
 writes the message to the service log file if the log level is equal or lower More...
 
 logWarn (softstring msg)
 writes the message to the service log file if the log level is equal or lower More...
 
 logInfo (softstring msg)
 writes the message to the service log file if the log level is equal or lower More...
 
 logDebug (softstring msg)
 writes the message to the service log file if the log level is equal or lower More...
 
 logTrace (softstring msg)
 writes the message to the service log file if the log level is equal or lower More...
 

Public Attributes

*string root
 the root directory for file-based FTP servers More...
 
bool bin
 if False (the default), then files are received as strings, if True, then as binary objects More...
 
list< auto > listeners = ()
 list of listener info More...
 
HttpServer::AbstractAuthenticator auth
 authentication object
 

Private Member Methods

int sizeImpl (string cwd, string orig, string path)
 this method is called when the "SIZE" command is received More...
 
date modifiedTimeImpl (string cwd, string orig, string path)
 this method is called when the "MDTM" command is received More...
 
string authChangeDirImpl (string cwd, string orig, string path)
 this method is run when the server receives a "CWD" command from the client but before the server updates the current working directory More...
 
string authRenameImpl (string cwd, string orig, string path)
 this method is run when the server receives a "RNFR" command from the client More...
 
 renameImpl (string cwd, string orig_to, string from, string to)
 this method is run when the server receives a "RNTO" command from the client; return no value if the server should accept the request (and thie method has already effected the rename of the file), otherwise return a string that will be passed back to the client with a 550 error code rejecting the request More...
 
string listImpl (string cwd, *string path)
 this method is run when the server receives a "LIST" command from the client More...
 
string nlstImpl (string cwd, *string path)
 this method is run when the server receives a "NLST" command from the client; return no value and set the output reference if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request More...
 
string machineListFileImpl (string cwd, *string orig, string path)
 this method is run when the server receives a "MLST" command from the client More...
 
string machineListDirImpl (string cwd, *string orig, string path)
 this method is run when the server receives a "MLSD" command from the client More...
 
 makeDirImpl (string cwd, string orig, string path)
 this method is run when the server receives a "MKD" command from the client; return no value if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request More...
 
 removeDirImpl (string cwd, string orig, string path)
 this method is run when the server receives a "RMD" command from the client; return no value if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request More...
 
 deleteFileImpl (string cwd, string orig, string path)
 this method is run when the server receives a "DELE" command from the client More...
 

Static Private Member Methods

static checkCompatErrorResponse (*string errstr)
 Checks for an error response and throws an FTP-RESPONSE-ERROR exception if found. More...
 

Detailed Description

this class is used to customize and control the behavior of Qorus FTP servers attached to services

Note
When used in Stateless services, FTP handlers are matched with a unique ID that is generated from the options used to create the object. To ensure that all stateless services use the same ID, you must ensure that the same options are used in each service's bindFtp() call. Failure to do this, for example my using a randomly-generated directory name, will cause runtime errors.

Member Function Documentation

◆ addListener() [1/2]

OMQ::AbstractFtpHandler::addListener ( int  port)

adds a listener from a port number; listener will start up on all interfaces on the given port

Parameters
portthe port number to listen on; the listener will start up on all interfaces on the given port

◆ addListener() [2/2]

OMQ::AbstractFtpHandler::addListener ( string  bind)

adds a listener from a bind string in the format: "address:port" (ex: "192.168.20.1:8011")

Parameters
bindthe address:port string to bind the listener to

◆ addListeners()

OMQ::AbstractFtpHandler::addListeners ( list< auto >  l)

adds a list of listeners from a list of bind addresses

Parameters
llist of listeners; each element should be either a bind string in the format: "address:port" (ex: "192.168.20.1:8011") or an integer port, meaning to bind on all interfaces on that port

◆ authChangeDir() [1/2]

*string OMQ::AbstractFtpHandler::authChangeDir ( string  cwd,
string  orig,
reference< string >  path 
)

this method is run when the server receives a "CWD" command from the client but before the server updates the current working directory; return no value if the server should accept the change directory request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the "CWD" request

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha reference to a string giving the normalized version of the directory name sent by the client (normalized means that it is a complete path from "/" without any references to ".." or "."); the actual directory name can be changed by this method by modifying the value of the reference (and returning NOTHING to authorize the change directory command)
Returns
no value if the server will accept the change directory request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request; note that the default is to return no value and therefore accept the request
an error message or NOTHING for no error
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (500)
Note
calls modifiedTimeImpl() for the actual logic
methods with references have been deprecated, as lvalue references are not supported bewtween remote processes and also not in some other supported programming languages

◆ authChangeDir() [2/2]

string OMQ::AbstractFtpHandler::authChangeDir ( string  cwd,
string  orig,
string  path 
)

this method is run when the server receives a "CWD" command from the client but before the server updates the current working directory

Example:
class MyHandler inherits AbstractFtpHandler {
# ...
string authChangeDir(string cwd, string orig, string path) {
log(LoggerLevel::INFO, "cwd: %n orig: %n path: %n", cwd, orig, path);
return AbstractFtpHandler::authChangeDirImpl(cwd, orig, path);
}
}
Parameters
cwdthe current working directory
origthe original literal argument passed by the client
paththe normalized version of the directory name sent by the client (normalized means that it is a complete path from "/" without any references to ".." or ".")
Returns
the actual path to use
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Note
by default this method calls the authChangeDir() variant taking a reference for backwards compatibility
See also
authChangeDirImpl()
Since
Qorus 5.0

◆ authChangeDirImpl()

string OMQ::AbstractFtpHandler::authChangeDirImpl ( string  cwd,
string  orig,
string  path 
)
private

this method is run when the server receives a "CWD" command from the client but before the server updates the current working directory

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
paththe normalized version of the directory name sent by the client (normalized means that it is a complete path from "/" without any references to ".." or ".")
Returns
the actual path to use
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)

◆ authReceiveFile() [1/2]

*string OMQ::AbstractFtpHandler::authReceiveFile ( string  cwd,
string  orig,
reference< string >  path 
)

this method is run when the server receives a "STOR" command from the client but before the server opens the data channel to receive the file; return no value if the server should accept the file, otherwise return a string that will be passed back to the client with a 500 error code rejecting the "STOR" request

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha reference to a string giving the normalized path for the file that the client would like to send to the server; the actual file name can be changed by this method by modifying the value of the reference (and returning NOTHING to authorize the receipt of the file)
Returns
no value if the server will accept the file, otherwise return a string that will be passed back to the client with a 500 error code rejecting the "STOR" request; note that the default is to return no value and therefore accept the file from the client
Example:
*string MyFtpHandler::authReceiveFile(string cwd, string orig, reference<string> path) {
log(LoggerLevel::INFO, "authorizing receipt of file %s -> %s", path, path + ".tmp");
path += ".tmp";
}

◆ authReceiveFile() [2/2]

string OMQ::AbstractFtpHandler::authReceiveFile ( string  cwd,
string  orig,
string  path 
)

this method is run when the server receives a "STOR" command from the client but before the server opens the data channel to receive the file

Example:
class MyHandler inherits AbstractFtpHandler {
# ...
string authReceiveFile(string cwd, string orig, string path) {
path += ".tmp";
log(LoggerLevel::INFO, "authorizing receipt of file %s -> %s", path, path);
return path;
}
}
Parameters
cwdthe current working directory
origthe original literal argument passed by the client
paththe normalized path for the file that the client would like to send to the server; the actual file name can be changed by this method by returning a path key in the response value
Returns
the actual path to use
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value
Note
by default this method calls the authReceiveFile() variant taking a reference for backwards compatibility; set the exception arg value to an integer error code to override the default (500)
Since
Qorus 5.0

◆ authRename() [1/2]

*string OMQ::AbstractFtpHandler::authRename ( string  cwd,
string  orig,
reference< string >  path 
)

this method is run when the server receives a "RNFR" command from the client; return no value if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the "RNFR" request

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha reference to a string giving the normalized version of the path (normalized means that it is a complete path from "/" without any references to ".." or "."); the actual path can be changed by this method by modifying the value of the reference (and returning NOTHING to authorize the command)
Returns
an error message or NOTHING for no error
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Note
calls authRenameImpl() for the actual logic
methods with references have been deprecated, as lvalue references are not supported bewtween remote processes and also not in some other supported programming languages

◆ authRename() [2/2]

string OMQ::AbstractFtpHandler::authRename ( string  cwd,
string  orig,
string  path 
)

this method is run when the server receives a "RNFR" command from the client

Example:
class MyHandler inherits AbstractFtpHandler {
# ...
string authRename(string cwd, string orig, string path) {
log(LoggerLevel::INFO, "cwd: %n orig: %n path: %n", cwd, orig, path);
return AstractFtpHandler::authRenameImpl(cwd, orig, path);
}
}
Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha reference to a string giving the normalized version of the path (normalized means that it is a complete path from "/" without any references to ".." or "."); the actual path can be changed by this method by modifying the value of the reference (and returning NOTHING to authorize the command)
Returns
the actual path to use
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Note
by default this method calls the authRenameDir() variant taking a reference for backwards compatibility
See also
authChangeDirImpl()
Since
Qorus 5.0

◆ authRenameImpl()

string OMQ::AbstractFtpHandler::authRenameImpl ( string  cwd,
string  orig,
string  path 
)
private

this method is run when the server receives a "RNFR" command from the client

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha reference to a string giving the normalized version of the path (normalized means that it is a complete path from "/" without any references to ".." or "."); the actual path can be changed by this method by modifying the value of the reference (and returning NOTHING to authorize the command)
Returns
the actual path to use
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Since
Qorus 5.0

◆ authSendFile() [1/2]

*string OMQ::AbstractFtpHandler::authSendFile ( string  cwd,
string  orig,
reference< string >  path 
)

this method is run when the server receives a "RETR" command from the client but before the server opens the data channel to receive the file; return no value if the server should accept the file, otherwise return a string that will be passed back to the client with a 500 error code rejecting the request

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha reference to a string giving the normalized path for the file that the client would like to receive from the server; the actual file name can be changed by this method by modifying the value of the reference (and returning NOTHING to authorize sending of the file)
Returns
no value if the server will accept the file, otherwise return a string that will be passed back to the client with a 500 error code rejecting the "STOR" request; note that the default is to return no value and therefore accept the file from the client

◆ authSendFile() [2/2]

string OMQ::AbstractFtpHandler::authSendFile ( string  cwd,
string  orig,
string  path 
)

this method is run when the server receives a "RETR" command from the client but before the server opens the data channel to send the file

Example:
class MyHandler inherits AbstractFtpHandler {
# ...
string authSendFile(string cwd, string orig, string path) {
path += ".tmp";
log(LoggerLevel::INFO, "authorizing sending of file %s -> %s", path, path);
return path;
}
}
Parameters
cwdthe current working directory
origthe original literal argument passed by the client
paththe normalized path for the file that the client would like to receive from the server; the actual file name can be changed by this method by returning a path key in the response value
Returns
the actual path to use
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value
Note
by default this method calls the authSendFile() variant taking a reference for backwards compatibility; set the exception arg value to an integer error code to override the default (500)
Since
Qorus 5.0

◆ checkCompatErrorResponse()

static OMQ::AbstractFtpHandler::checkCompatErrorResponse ( *string  errstr)
staticprivate

Checks for an error response and throws an FTP-RESPONSE-ERROR exception if found.

Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value
Since
Qorus 5.0

◆ constructor()

OMQ::AbstractFtpHandler::constructor ( *string  root,
bool  bin = False,
HttpServer::AbstractAuthenticator  auth = new DefaultQorusRBACAuthenticator() 
)

creates the object with the given arguments

Parameters
rootthe root directory for file-based FTP handlers; if this argument is not set, then the filesystem is not directly accessed by this object; instead data will be provided or requested directly (see fileDataReceived())
binif True then each file received will be read in as a binary object (only has an effect when no root directory is set)
auththe HttpServer::AbstractAuthenticator for the object; if no argument is passed, then the system RBAC authenticator is used; meaning that Qorus application users are required to connect, and the users must have the OMQ::QR_LOGIN role to connect as well
Example:
class MyFtpHandler inherits public OMQ::AbstractFtpHandler {
constructor() : AbstractFtpHandler("/opt/myftproot") {
}
}
main Qorus namespace
Definition: QorusRbacAuth.qm:21

◆ deleteFile()

*string OMQ::AbstractFtpHandler::deleteFile ( string  cwd,
string  orig,
string  path 
)

this method is run when the server receives a "DELE" command from the client; return no value if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request

Example:
class MyFtpHandler {
# ...
*string deleteFile(string cwd, string orig, string path) {
AbstractFtpHandler::removeDirImpl(cwd, orig, path);
}
}
Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha string giving the normalized version of the path (normalized means that it is a complete path from "/" without any references to ".." or ".")
Returns
no value if the server will accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request; note that the default is to return no value and therefore accept the request
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)

◆ deleteFileImpl()

OMQ::AbstractFtpHandler::deleteFileImpl ( string  cwd,
string  orig,
string  path 
)
private

this method is run when the server receives a "DELE" command from the client

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha string giving the normalized version of the path (normalized means that it is a complete path from "/" without any references to ".." or ".")
Returns
no value if the server will accept the request
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Since
Qorus 5.0

◆ fileDataReceived()

OMQ::AbstractFtpHandler::fileDataReceived ( string  path,
data  data 
)

this method is called when the server has received a file and no root directory is set

Parameters
paththe complete path of the file including the current working directory (starting from default "/" if the client did not issue any CWD commands) with the filename as given by the FTP client
datathe file data; will be a string if bin is False, otherwise it will be a binary object
See also
fileReceived()

◆ fileReceived()

OMQ::AbstractFtpHandler::fileReceived ( string  path)

this method is called when the server has received a file

Parameters
paththe complete path of the file that was saved to the filesystem including the current working directory (starting from default "/" if the client did not issue any CWD commands) with the filename as given by the FTP client; the path does not include the FTP handler base directory, so a path of "/" is based in the top-level directory of root
Example:
MyFtpHandler::fileReceived(string path) {
++stats."in".files;
log(LoggerLevel::INFO, "received file: dir=%n fn=%n", dirname(path), basename(path));
}
See also
fileDataReceived()

◆ fileSent()

OMQ::AbstractFtpHandler::fileSent ( string  path)

this method is called when the server has sent a file

Parameters
paththe complete path of the file that was sent including the current working directory (starting from default "/") with the filename as given by the FTP client; the path does not include the FTP handler base directory, so a path of "/" is based in the top-level directory of root
See also
sendFile()

◆ list() [1/2]

string OMQ::AbstractFtpHandler::list ( string  cwd,
*string  path 
)

this method is run when the server receives a "LIST" command from the client

Parameters
cwdthe current working directory
paththe original literal argument passed by the client
Returns
the output to return to the client
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Note
by default this method calls the list() variant taking a reference for backwards compatibility
See also
listImpl()
Since
Qorus 5.0

◆ list() [2/2]

*string OMQ::AbstractFtpHandler::list ( string  cwd,
*string  path,
reference< string >  output 
)

this method is run when the server receives a "LIST" command from the client; return no value and set the output reference if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request

Parameters
cwdthe current working directory
paththe original literal argument passed by the client
outputassign an output string to this reference for the output to be returned to the client
Returns
an error message or NOTHING for no error
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Note
calls listImpl() for the actual logic
methods with references have been deprecated, as lvalue references are not supported bewtween remote processes and also not in some other supported programming languages

◆ listImpl()

string OMQ::AbstractFtpHandler::listImpl ( string  cwd,
*string  path 
)
private

this method is run when the server receives a "LIST" command from the client

Parameters
cwdthe current working directory
paththe original literal argument passed by the client
Returns
the output to return to the client
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Since
Qorus 5.0

◆ logDebug()

OMQ::AbstractFtpHandler::logDebug ( softstring  msg)

writes the message to the service log file if the log level is equal or lower

Since
Qorus 4.1.2

◆ logError()

OMQ::AbstractFtpHandler::logError ( softstring  msg)

writes the message to the service log file if the log level is equal or lower

Since
Qorus 4.1.2

◆ logFatal()

OMQ::AbstractFtpHandler::logFatal ( softstring  msg)

writes the message to the service log file if the log level is equal or lower

Since
Qorus 4.1.2

◆ logInfo()

OMQ::AbstractFtpHandler::logInfo ( softstring  msg)

writes the message to the service log file if the log level is equal or lower

Since
Qorus 4.1.2

◆ logTrace()

OMQ::AbstractFtpHandler::logTrace ( softstring  msg)

writes the message to the service log file if the log level is equal or lower

Since
Qorus 4.1.2

◆ logWarn()

OMQ::AbstractFtpHandler::logWarn ( softstring  msg)

writes the message to the service log file if the log level is equal or lower

Since
Qorus 4.1.2

◆ machineListDir() [1/2]

string OMQ::AbstractFtpHandler::machineListDir ( string  cwd,
*string  orig,
string  path 
)

this method is run when the server receives a "MLSD" command from the client

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha string giving the normalized version of the path argument (normalized means that it is a complete path from "/" without any references to ".." or ".")
Returns
the output to return to the client
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (501 or 550)
Note
by default this method calls the machineListDir() variant taking a reference for backwards compatibility
See also
machineListDirImpl()
Since
Qorus 5.0

◆ machineListDir() [2/2]

*string OMQ::AbstractFtpHandler::machineListDir ( string  cwd,
*string  orig,
string  path,
*reference< string >  output,
*reference< bool >  isdir 
)

this method is run when the server receives a "MLSD" command from the client; return no value and set the output reference if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha string giving the normalized version of the path argument (normalized means that it is a complete path from "/" without any references to ".." or ".")
outputassign an output string to this reference for the output to be returned to the client
isdirif False on output and there is an error response, then a 501 code will be generated instead of a 550 code
Returns
no value if the server will accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request; note that the default is to return no value

◆ machineListDirImpl()

string OMQ::AbstractFtpHandler::machineListDirImpl ( string  cwd,
*string  orig,
string  path 
)
private

this method is run when the server receives a "MLSD" command from the client

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha string giving the normalized version of the path argument (normalized means that it is a complete path from "/" without any references to ".." or ".")
Returns
the output to return to the client
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (501 or 550)
Since
Qorus 5.0

◆ machineListFile() [1/2]

string OMQ::AbstractFtpHandler::machineListFile ( string  cwd,
*string  orig,
string  path 
)

this method is run when the server receives a "MLST" command from the client

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha string giving the normalized version of the path argument (normalized means that it is a complete path from "/" without any references to ".." or ".")
Returns
the output to return to the client
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Note
by default this method calls the nlst() variant taking a reference for backwards compatibility
See also
machineListFileImpl()
Since
Qorus 5.0

◆ machineListFile() [2/2]

*string OMQ::AbstractFtpHandler::machineListFile ( string  cwd,
*string  orig,
string  path,
reference< string >  output 
)

this method is run when the server receives a "MLST" command from the client; return no value and set the output reference if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha string giving the normalized version of the path argument (normalized means that it is a complete path from "/" without any references to ".." or ".")
outputassign an output string to this reference for the output to be returned to the client
Returns
an error message or NOTHING for no error
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Note
calls machineListFileImpl() for the actual logic
methods with references have been deprecated, as lvalue references are not supported bewtween remote processes and also not in some other supported programming languages

◆ machineListFileImpl()

string OMQ::AbstractFtpHandler::machineListFileImpl ( string  cwd,
*string  orig,
string  path 
)
private

this method is run when the server receives a "MLST" command from the client

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha string giving the normalized version of the path argument (normalized means that it is a complete path from "/" without any references to ".." or ".")
Returns
the output to return to the client
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Since
Qorus 5.0

◆ makeDir()

*string OMQ::AbstractFtpHandler::makeDir ( string  cwd,
string  orig,
string  path 
)

this method is run when the server receives a "MKD" command from the client; return no value if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request

Example:
class MyFtpHandler {
# ...
*string makeDir(string cwd, string orig, string path) {
AbstractFtpHandler::makeDirImpl(cwd, orig, path);
}
}
Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha string giving the normalized version of the path (normalized means that it is a complete path from "/" without any references to ".." or ".")
Returns
no value if the server will accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request; note that the default is to return no value and therefore accept the request
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)

◆ makeDirImpl()

OMQ::AbstractFtpHandler::makeDirImpl ( string  cwd,
string  orig,
string  path 
)
private

this method is run when the server receives a "MKD" command from the client; return no value if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha string giving the normalized version of the path (normalized means that it is a complete path from "/" without any references to ".." or ".")
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Since
Qorus 5.0

◆ modifiedTime() [1/2]

date OMQ::AbstractFtpHandler::modifiedTime ( string  cwd,
string  orig,
string  path 
)

this method is called when the "MDTM" command is received

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
paththe complete path of the file including the current working directory (starting from default "/") with the filename as given by the FTP client
Returns
the actual modified date to use
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Note
by default this method calls the modifiedTime() variant taking a reference for backwards compatibility
See also
modifiedTimeImpl()
Since
Qorus 5.0

◆ modifiedTime() [2/2]

*string OMQ::AbstractFtpHandler::modifiedTime ( string  cwd,
string  orig,
string  path,
reference< date >  mdate 
)

this method is called when the "MDTM" command is received

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
paththe complete path of the file including the current working directory (starting from default "/") with the filename as given by the FTP client
mdatea reference to a date for the last modified date of the file (output variable)
Returns
an error message or NOTHING for no error
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Note
calls modifiedTimeImpl() for the actual logic
methods with references have been deprecated, as lvalue references are not supported bewtween remote processes and also not in some other supported programming languages

◆ modifiedTimeImpl()

date OMQ::AbstractFtpHandler::modifiedTimeImpl ( string  cwd,
string  orig,
string  path 
)
private

this method is called when the "MDTM" command is received

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
paththe complete path of the file including the current working directory (starting from default "/") with the filename as given by the FTP client
Returns
the file size to return to the FTP client
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (500)

◆ nlst() [1/2]

string OMQ::AbstractFtpHandler::nlst ( string  cwd,
*string  path 
)

this method is run when the server receives a "NLST" command from the client; return no value and set the output reference if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request

Example:
string MyFtpHandler::nlst(string cwd, *string path) {
return AbstractFtpHandler::nlstImpl(cwd, path);
}
Parameters
cwdthe current working directory
paththe original literal argument passed by the client
Returns
the output to return to the client
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Note
by default this method calls the nlst() variant taking a reference for backwards compatibility
See also
nlstImpl()
Since
Qorus 5.0

◆ nlst() [2/2]

*string OMQ::AbstractFtpHandler::nlst ( string  cwd,
*string  path,
reference< string >  output 
)

this method is run when the server receives a "NLST" command from the client; return no value and set the output reference if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request

Parameters
cwdthe current working directory
paththe original literal argument passed by the client
outputassign an output string to this reference for the output to be returned to the client
Returns
an error message or NOTHING for no error
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Note
calls nlstImpl() for the actual logic
methods with references have been deprecated, as lvalue references are not supported bewtween remote processes and also not in some other supported programming languages

◆ nlstImpl()

string OMQ::AbstractFtpHandler::nlstImpl ( string  cwd,
*string  path 
)
private

this method is run when the server receives a "NLST" command from the client; return no value and set the output reference if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request

Parameters
cwdthe current working directory
paththe original literal argument passed by the client
Returns
the output to return to the client
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Since
Qorus 5.0

◆ removeDir()

*string OMQ::AbstractFtpHandler::removeDir ( string  cwd,
string  orig,
string  path 
)

this method is run when the server receives a "RMD" command from the client; return no value if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request

Example:
class MyFtpHandler {
# ...
*string removeDir(string cwd, string orig, string path) {
AbstractFtpHandler::removeDirImpl(cwd, orig, path);
}
}
Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha string giving the normalized version of the path (normalized means that it is a complete path from "/" without any references to ".." or ".")
Returns
no value if the server will accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request; note that the default is to return no value and therefore accept the request
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)

◆ removeDirImpl()

OMQ::AbstractFtpHandler::removeDirImpl ( string  cwd,
string  orig,
string  path 
)
private

this method is run when the server receives a "RMD" command from the client; return no value if the server should accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
patha string giving the normalized version of the path (normalized means that it is a complete path from "/" without any references to ".." or ".")
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Since
Qorus 5.0

◆ rename()

*string OMQ::AbstractFtpHandler::rename ( string  cwd,
string  orig_to,
string  from,
string  to 
)

this method is run when the server receives a "RNTO" command from the client; return no value if the server should accept the request (and thie method has already effected the rename of the file), otherwise return a string that will be passed back to the client with a 550 error code rejecting the request

Example:
class MyHandler inherits AbstractFtpHandler {
# ...
*string rename(string cwd, string orig_to, string from, string to) {
AbstractFtpHandler::rename(cwd, orig_to, from, to);
}
}
Parameters
cwdthe current working directory
orig_tothe original literal argument passed by the client
froma string giving the normalized version of the "from" (source) path (normalized means that it is a complete path from "/" without any references to ".." or ".")
toa string giving the normalized version of the "to" (target) path (normalized means that it is a complete path from "/" without any references to ".." or ".")
Returns
no value if the server will accept the request, otherwise return a string that will be passed back to the client with a 550 error code rejecting the request; note that the default is to return no value and therefore accept the request
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)

◆ renameImpl()

OMQ::AbstractFtpHandler::renameImpl ( string  cwd,
string  orig_to,
string  from,
string  to 
)
private

this method is run when the server receives a "RNTO" command from the client; return no value if the server should accept the request (and thie method has already effected the rename of the file), otherwise return a string that will be passed back to the client with a 550 error code rejecting the request

Parameters
cwdthe current working directory
orig_tothe original literal argument passed by the client
froma string giving the normalized version of the "from" (source) path (normalized means that it is a complete path from "/" without any references to ".." or ".")
toa string giving the normalized version of the "to" (target) path (normalized means that it is a complete path from "/" without any references to ".." or ".")
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)

◆ sendFile()

data OMQ::AbstractFtpHandler::sendFile ( string  path)

this method is called when the server should send a file

Parameters
paththe complete path of the file including the current working directory (starting from default "/") with the filename as given by the FTP client
Returns
the file data to send
See also
fileReceived()

◆ size() [1/2]

int OMQ::AbstractFtpHandler::size ( string  cwd,
string  orig,
string  path 
)

this method is called when the "SIZE" command is received

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
paththe complete path of the file including the current working directory (starting from default "/") with the filename as given by the FTP client
Returns
the actual size to use
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Note
by default this method calls the size() variant taking a reference for backwards compatibility
See also
sizeImpl()
Since
Qorus 5.0

◆ size() [2/2]

*string OMQ::AbstractFtpHandler::size ( string  cwd,
string  orig,
string  path,
reference< int >  size 
)

this method is called when the "SIZE" command is received

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
paththe complete path of the file including the current working directory (starting from default "/") with the filename as given by the FTP client
sizea reference to an int for the file size (output variable)
Returns
an error message or NOTHING for no error
Exceptions
FTP-RESPONSE-ERRORthrown if the argument has a value; set the exception arg value to an integer error code to override the default (550)
Note
calls sizeImpl() for the actual logic
methods with references have been deprecated, as lvalue references are not supported bewtween remote processes and also not in some other supported programming languages

◆ sizeImpl()

int OMQ::AbstractFtpHandler::sizeImpl ( string  cwd,
string  orig,
string  path 
)
private

this method is called when the "SIZE" command is received

Parameters
cwdthe current working directory
origthe original literal argument passed by the client
paththe complete path of the file including the current working directory (starting from default "/") with the filename as given by the FTP client
Returns
the file size to return to the FTP client

Member Data Documentation

◆ bin

bool OMQ::AbstractFtpHandler::bin

if False (the default), then files are received as strings, if True, then as binary objects

this only affects how file data is passed to the fileDataReceived() method

◆ listeners

list<auto> OMQ::AbstractFtpHandler::listeners = ()

list of listener info

do not write to this list directly, use AbstractFtpHandler::addListener() instead (the internal format may change)

◆ root

*string OMQ::AbstractFtpHandler::root

the root directory for file-based FTP servers

if no value is set, then the file data will be passed to the fileDataReceived() method instead


The documentation for this class was generated from the following file: