|
Namespaces |
namespace | mcs |
namespace | std |
Classes |
class | mcs::B64_Codec |
| A Base 64 encoder/decoder. More...
|
class | mcs::BaseThread |
| Base class for MCS threaded objects. More...
|
class | mcs::Buffer |
| High level buffer. More...
|
class | mcs::Client |
| Connect to a MCS server as a client. More...
|
class | mcs::ClientInfo |
| Class holding information about a client connection. More...
|
class | mcs::CommandParser |
| Parse command lines. More...
|
class | mcs::Conf |
| Read and write configuration files. More...
|
class | mcs::Data |
| A general purpose data type. More...
|
class | mcs::DateTime |
| A class to hold date time information. More...
|
class | mcs::DBConn |
| Handle database connection. More...
|
class | mcs::Dynamic_Array< BASE > |
| A thread safe, template class to handle an array of objects. More...
|
class | mcs::Env |
| Hold all environment variables. More...
|
class | mcs::Event |
| Hold informations about an event. More...
|
class | mcs::FITSReader |
| Read a FITS file. More...
|
class | mcs::FITSWriter |
| Write a fits file. More...
|
class | mcs::HostInfo |
| Retrieve informations about a network host. More...
|
class | mcs::LocalThread |
| Server side administrative thread. More...
|
class | mcs::NetInterface |
| Retrieve informations about network interfaces. More...
|
class | mcs::Pipe |
| A high level class to use system pipes. More...
|
class | mcs::Query |
| Execute queries on the database. More...
|
class | mcs::Record |
| A dynamic array of Data objects. More...
|
class | mcs::RecordSet |
| The base class that implement the data abstraction layer. More...
|
class | mcs::Serializable |
| Serialize memory buffers or files into chunks. More...
|
class | mcs::Server |
| Main server class for a MCS-based application. More...
|
class | mcs::ServerSocket |
| Manage TCP server sockets. More...
|
class | mcs::Socket |
| Manage TCP sockets. More...
|
class | mcs::Synchro |
| A simple class to implement "critical sections". More...
|
class | mcs::Table |
| A class to directly set and retrieve value from a database table. More...
|
class | mcs::Thread |
| A class to create separate threads. More...
|
class | mcs::ThreadFunc |
class | mcs::ThreadSpecificData< BASE > |
class | mcs::URLReader |
| A class that provide a uniform access to file retrieving. More...
|
class | mcs::UserThread |
| The server side client thread. More...
|
Defines |
#define | csz c_str() |
| Macro to extract a C-style, null terminated string from a string object.
|
#define | DYNAMIC_ARRAY_DEFAULT_STEP 10 |
| Size of allocation block for the Dynamic_Array class.
|
#define | MCS_(TYPE, rest...) mcs::Event(__FILE__, __LINE__, TYPE , ## rest) |
| Facility to easily pass all necessary parameter to an Event constructor.
|
#define | MCS_B64_DECODE 1 |
#define | MCS_B64_DECODEINPLACE 2 |
#define | MCS_B64_DEF_LINE 72 |
#define | MCS_B64_ENCODE 0 |
#define | MCS_B64_MIN_LINE 4 |
#define | MCS_BANNER "\nMy Customizable Server (MCS) ver. " PACKAGE_VERSION "\n" |
| MCS banner.
|
#define | MCS_CLIENT_DATA 2 |
#define | MCS_CLIENT_DISCONNECT 4 |
#define | MCS_CLIENT_ERROR 1 |
#define | MCS_CLIENT_FILE 3 |
#define | MCS_CMD_CID "CID" |
| Command: Retrieve the Client identifier.
|
#define | MCS_CMD_CID_HELP |
#define | MCS_CMD_CLIENT_INFO "CLINFO" |
| Command: Return server status information.
|
#define | MCS_CMD_CLIENT_INFO_HELP "Return all client informations." |
#define | MCS_CMD_CLOSECLIENT "BYE" |
| Command: Close the session.
|
#define | MCS_CMD_CLOSECLIENT_HELP |
#define | MCS_CMD_DBCONNECT "CON" |
| Command: Finalize the authentication process and log in.
|
#define | MCS_CMD_DBCONNECT_HELP |
#define | MCS_CMD_DBNAME "DBN" |
| Command: Provide the application (database) name.
|
#define | MCS_CMD_DBNAME_HELP |
#define | MCS_CMD_EXEC "EXEC" |
| Command: Execute an external program, script, SQL or batch file.
|
#define | MCS_CMD_EXEC_HELP |
#define | MCS_CMD_GET "GET" |
| Command: Download a file from the work directory.
|
#define | MCS_CMD_GET_HELP |
#define | MCS_CMD_GETDATA "GDATA" |
| Command: Download Data objects.
|
#define | MCS_CMD_GETDATA_HELP |
#define | MCS_CMD_MAX_TOKENS 100 |
| Max number of tokens for a command line.
|
#define | MCS_CMD_NOP "NOP" |
| Command: No operation (dummy) command.
|
#define | MCS_CMD_NOP_HELP "No operation (dummy) command." |
#define | MCS_CMD_PASSWORD "PWD" |
| Command: Provide password.
|
#define | MCS_CMD_PASSWORD_HELP |
#define | MCS_CMD_PUT "PUT" |
| Command: Upload a file to the work directory.
|
#define | MCS_CMD_PUT_HELP |
#define | MCS_CMD_PUTDATA "PDATA" |
| Command: Upload Data objects.
|
#define | MCS_CMD_PUTDATA_HELP |
#define | MCS_CMD_QUERY "QRY" |
| Command: Execute queries on the database.
|
#define | MCS_CMD_QUERY_HELP |
#define | MCS_CMD_RECORD "FETCH" |
#define | MCS_CMD_RECORD_HELP |
#define | MCS_CMD_SENDQUERYRES "QRES" |
| Command: Retrieve a file with an ASCII dump of the entire set of records returned by the last query.
|
#define | MCS_CMD_SENDQUERYRES_HELP |
#define | MCS_CMD_TABLEINFO "TINFO" |
| Command: Retrieve information about a table.
|
#define | MCS_CMD_TABLEINFO_HELP |
#define | MCS_CMD_TABLELIST "TLIST" |
| Command: Retrieve the list of tables actually present in the database.
|
#define | MCS_CMD_TABLELIST_HELP |
#define | MCS_CMD_USERNAME "USR" |
| Command: Provide user name.
|
#define | MCS_CMD_USERNAME_HELP |
#define | MCS_COMMBUFSIZE 1024 |
| Max length of a message being sent between client and server.
|
#define | MCS_CRITICAL_SECTION(BLOCK...) |
| Execute a list of commands inside a critical section.
|
#define | MCS_CRITICAL_SECTION_BEGIN enter(); try { |
| Start a critical section, there must be no "return" or "goto" instruction inside the section.
|
#define | MCS_CRITICAL_SECTION_END } catch(Event e) { leave(); throw e; } leave(); |
| End a critical section, there must be no "return" or "goto" instruction inside the section.
|
#define | MCS_CRITICAL_SECTION_END_RETURN(What...) |
#define | MCS_CUSTOM_LOCAL(CLASS) |
#define | MCS_CUSTOM_LOCAL_END(CLASS) }; |
#define | MCS_CUSTOM_SERVER(CLIENT, LOCAL) |
| Macro to define a Server derived class, that works with UserThread and LocalThread derived objects.
|
#define | MCS_CUSTOM_USER(CLASS) |
| Wait for a MCS server termination.
|
#define | MCS_CUSTOM_USER_END(CLASS) }; |
#define | MCS_DATA_NDIM 15 |
#define | MCS_DEFAULT_CLIENT_TIMEOUT 10 * 60 * 1000 |
| Default client connection timeout, in milliseconds: 10 minutes.
|
#define | MCS_DEFAULT_MAX_USERS 100 |
| Default max number of clients connected.
|
#define | MCS_DEFAULT_PORT 6523 |
| Default port on which the server is listening.
|
#define | MCS_DEFAULTCHUNKSIZE 16384 |
| File chunk size.
|
#define | MCS_ERROR(A, rest...) mcs::Event(__FILE__, __LINE__, mcs::ERROR, A, ## rest) |
| Facility to easily pass all necessary parameter to an Event constructor.
|
#define | MCS_FATAL(A, rest...) mcs::Event(__FILE__, __LINE__, mcs::FATAL, A, ## rest) |
| Facility to easily pass all necessary parameter to an Event constructor.
|
#define | MCS_FT_BATCH 1 |
| Return value for BaseThread.fileType(), batch file.
|
#define | MCS_FT_BIN 4 |
| Return value for BaseThread.fileType(), binary file.
|
#define | MCS_FT_SCRIPT 3 |
| Return value for BaseThread.fileType(), script file.
|
#define | MCS_FT_SQL 2 |
| Return value for BaseThread.fileType(), SQL file.
|
#define | MCS_FT_UNKNOWN 0 |
| Return value for BaseThread.fileType(), unknown type.
|
#define | MCS_GRANT_ADMIN 256 |
#define | MCS_GRANT_ALL 511 |
#define | MCS_GRANT_BATCH 16 |
#define | MCS_GRANT_GET 32 |
#define | MCS_GRANT_LOGIN 1 |
#define | MCS_GRANT_NO_GRANTS 0 |
#define | MCS_GRANT_PUT 64 |
#define | MCS_GRANT_QUERY 8 |
#define | MCS_GRANT_SCRIPTS 4 |
#define | MCS_GRANT_SQL_SCRIPTS 2 |
#define | MCS_GRANT_SYS 128 |
#define | MCS_ID_CLIENT -3 |
#define | MCS_ID_LOCAL -2 |
#define | MCS_ID_UNKNOWN -1 |
#define | MCS_MISSING_ASSIGNMENT_OPERATOR(CLASS) CLASS& operator=(const CLASS&); |
#define | MCS_MISSING_COPY_CONSTRUCTOR(CLASS) CLASS(const CLASS&); |
#define | MCS_MKDIR_PROTECT S_IRUSR | S_IWUSR | S_IXUSR |
#define | MCS_MKDIR_UMASK 0 |
#define | MCS_OK(A, rest...) mcs::Event(__FILE__, __LINE__, mcs::OK, A, ## rest) |
| Facility to easily pass all necessary parameter to an Event constructor.
|
#define | MCS_OPT_ALL_ERRORS "werr" |
| Option: Turns all warning into errors, so that a warning can stop the execution.
|
#define | MCS_OPT_ALL_ERRORS_HELP |
#define | MCS_OPT_FORCE "force" |
| Option: Continue execution of commands even if an error occur.
|
#define | MCS_OPT_FORCE_HELP |
#define | MCS_OPT_HELP "help" |
| Option: Return a quick help for a command or an option.
|
#define | MCS_OPT_LOOP "loop" |
| Option: Put a copy of thr recevied Data object in the "send" vector.
|
#define | MCS_OPT_LOOP_HELP |
#define | MCS_OPT_SAVEQUERYASCII "sqascii" |
| Option: Save query result in ASCII format.
|
#define | MCS_OPT_SAVEQUERYASCII_HELP |
#define | MCS_OPT_SAVEQUERYFITS "sqfits" |
| Option: Save query result in FITS format.
|
#define | MCS_OPT_SAVEQUERYFITS_HELP |
#define | MCS_PAB_INSERT 1 |
#define | MCS_PAB_REPLACE 3 |
#define | MCS_PAB_UPDATE 2 |
#define | MCS_PRE "#" |
| Prefix of a message for the client, this is the first character.
|
#define | MCS_PROMPT_ERROR MCS_PRE "0E-" |
| Prompt sent after a command raised one error.
|
#define | MCS_PROMPT_OK MCS_PRE "0--" |
| Prompt sent after a command has been executed correctly.
|
#define | MCS_PROMPT_WARN MCS_PRE "0W-" |
| Prompt sent after a command raised one or more warnings.
|
#define | MCS_RS_ACCUM 1 |
| Flag for RecordSet::init().
|
#define | MCS_RS_INSERT 16 |
| Flag for RecordSet::init().
|
#define | MCS_RS_KNOW_NROWS 4 |
| Flag for RecordSet::init().
|
#define | MCS_RS_RANDOM 8 |
| Flag for RecordSet::init().
|
#define | MCS_RS_USEMETAREC 2 |
| Flag for RecordSet::init().
|
#define | MCS_SELECT_READ 0 |
#define | MCS_SELECT_WRITE 1 |
#define | MCS_SEP "|" |
| This character is used to split a message into "fields".
|
#define | MCS_SERIAL_BUFFER 1 |
#define | MCS_SERIAL_FILENAME 2 |
#define | MCS_SERIAL_UNKNOWN 0 |
#define | MCS_SSLCERT "mcscert.pem" |
#define | MCS_SSLPRIV "mcspkey.pem" |
#define | MCS_STATE_CREATED 1 |
| Thread state: the object has been created ut the separate thread has not been started.
|
#define | MCS_STATE_END 4 |
| Thread state: the separate thread had terminated its execution.
|
#define | MCS_STATE_RUNNING 2 |
| Thread state: the separate thread is executing the run() method.
|
#define | MCS_STATE_TERMINATING 3 |
| Thread state: the exit() method is executing, the separate thread is going to execute the final() method.
|
#define | MCS_SUBST_LEADING 4 |
| To be used with subst(), substitute only if "what" is at the beginning. See subst().
|
#define | MCS_SUBST_QUOTE_WITH 1 |
| To be used with subst(), doubles each backslash in "with". See subst().
|
#define | MCS_SUBST_TRAILING 8 |
| To be used with subst(), substitute only if "what" is at the end. See subst().
|
#define | MCS_SYNCHRO_LOCK 1 |
| To be used with Synchro.enter(): enter a critical section.
|
#define | MCS_SYNCHRO_TRY_LOCK 2 |
| To be used with Synchro.enter(): try to enter a critical section.
|
#define | MCS_SYNCHRO_TRY_TIMED 3 |
| To be used with Synchro.enter(): try to enter a critical section with timeout facility.
|
#define | MCS_VMSG_SIZE 1000 |
| Size of the Event.vmsg static array.
|
#define | MCS_WARN(A, rest...) mcs::Event(__FILE__, __LINE__, mcs::WARN, A, ## rest) |
| Facility to easily pass all necessary parameter to an Event constructor.
|
#define | my_mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N))) |
| Some systems doesn't have mempcpy, so we provide it here.
|
#define | MYSQL_SOCK NULL |
Typedefs |
typedef enum Types | mcs::Types |
Enumerations |
enum | mcs::BufferFreeOnDestroy { mcs::AUTO_FREE,
mcs::DONT_FREE
} |
| Values to be used in Buffer class constructor. More...
|
enum | mcs::RetValue { mcs::OK,
mcs::WARN,
mcs::ERROR,
mcs::FATAL
} |
| Return value for MCS routines. More...
|
enum | mcs::ThrowExceptions { mcs::DONT_THROW,
mcs::THROW
} |
| Values to be used with throwexc parameters. More...
|
enum | mcs::TimeMode { mcs::UTC,
mcs::LOCAL
} |
| Enumerate operational mode for a DateTime object. More...
|
enum | mcs::Types {
mcs::TINY,
mcs::SMALL,
mcs::MEDIUM,
mcs::INT,
mcs::BIGINT,
mcs::FLOAT,
mcs::DOUBLE,
mcs::STRING,
mcs::TIME,
mcs::TINY_BLOB,
mcs::BLOB,
mcs::POINTER
} |
| Enumeration of base type for Data. More...
|
Functions |
string | mcs::btos (bool b) |
| Convert a boolean to a string containing "true" or "false".
|
string | mcs::chomp (string s) |
| Remove any trailing newlines.
|
int | mcs::copy (char *OLDNAME, char *NEWNAME) |
| Copy a file from OLDNAME to NEWNAME.
|
string | mcs::dtos (double f) |
| Convert an floating point number to a string.
|
int | mcs::extractCode (const char *msg) |
| Extract the numeric code from a server reply.
|
bool | mcs::File_Dir_Exist (string fn, unsigned int &size) |
| Check if a file or directory exists.
|
bool | mcs::FITS2Types (int fits, Types &dbt, bool &isunsigned) |
| Convert a FITSIO type into a MCS type.
|
string | mcs::fitsError (int status) |
| Return a description of a FITS error.
|
bool | mcs::FloatType (Types type) |
| Tell if "type" is a float type.
|
string | mcs::hexDump (const void *buf, unsigned int size) |
| Return a string with an hex dump of the buffer pointed by "buf", with a length of "size".
|
bool | mcs::IntType (Types type) |
| Tell if "type" is an integer type.
|
string | mcs::itos (int i) |
| Convert an integer to a string.
|
void | mcs::ls2Record (string fn, Record &v) |
| Fill a vector with a list of file.
|
Env * | mcs::mcsStart (string appname, string inipath="", Server *(*cb_newServer)(Env *)=NULL) |
| Start a MCS server.
|
bool | mcs::mkDir (string path, mode_t perm=0, enum ThrowExceptions throwexc=THROW) |
| Create a directory.
|
int | mcs::move (char *OLDNAME, char *NEWNAME) |
| Move a file from OLDNAME to NEWNAME.
|
time_t | mcs::my_timelocal (struct tm *tm) |
string | mcs::MYSQL2Str (enum_field_types type) |
| Return the name of the MySQL type given in "type".
|
bool | mcs::MYSQL2Types (enum_field_types mtype, Types &type) |
| Convert a MySQL type into a MCS type.
|
string | mcs::Pwd () |
| Return the current working dir.
|
mode_t | mcs::read_umask () |
| Read the file creation mask of the current process.
|
string | mcs::remLeading (string &s, const char *p) |
| Remove any leading character "p".
|
string | mcs::remTabs (string s) |
| Remove any tab.
|
string | mcs::remTrailing (string &s, const char *p) |
| Remove any trailing character "p".
|
bool | mcs::rmDir (string path, enum ThrowExceptions throwexc=THROW) |
| Removes a directory.
|
int | mcs::Select (int fd[], int nfd, unsigned int sec_timeout, unsigned int usec_timeout, int op) |
int | mcs::Select (int fd, unsigned int sec_timeout, unsigned int usec_timeout, int op) |
void | mcs::sleep_ms (unsigned int millisec) |
| A millisecond resolution sleep function.
|
vector< string > | mcs::split (string s, string sep=" ") |
| Split a string into tokens.
|
int | mcs::stoi (string s, int errval) |
| Convert a string to an integer.
|
int | mcs::stoi (string s) |
| Convert a string to an integer.
|
string | mcs::subst (string s, string what, string with, int op=0) |
| Perform substitutions on a string.
|
string | mcs::trim (string s) |
| Remove any leading or trailing blanks.
|
bool | mcs::Types2FITS (Types dbt, bool isunsigned, int &fits) |
| Convert a MCS type into a FITSIO type.
|
bool | mcs::Types2MYSQL (Types &type, enum_field_types &mtype) |
| Convert a MCS type into a MySQL type.
|
string | mcs::Types2MYSQLStr (Types &type, bool isunsigned) |
| Convert a MCS type into a MySQL type.
|
bool | mcs::Types2S_FITS (Types dbt, int len, bool isunsigned, string &fits) |
| Convert a MCS type into a FITSIO type code.
|
string | mcs::Types2Str (Types type, bool isunsigned) |
| Return the name of the type given in "type" and "isunsigned".
|
bool | mcs::VarLenType (Types type) |
| Tell if "type" is a variable length type.
|
string | mcs::vtos (vector< string > vec) |
| Join a vector of strings in a single string using newlines.
|