MCS  0.3.3-alpha7
mcs::Env Class Reference

Hold all environment variables. More...

#include <mcs.hh>

Public Member Functions

 Env (string app="mcs", string inipath="mcs.conf")
 Env constructor. More...
 
 Env (const Env &)
 Declared to avoid using of default copy constructor. More...
 
Envoperator= (const Env &)
 Declared to avoid using of default assignment operator. More...
 
 ~Env ()
 Destructor. More...
 

Public Attributes

string appname
 Application name. More...
 
string appvers
 Application version. More...
 
bool cl_autoexec
 Auto execute batch file "auto". More...
 
int cl_chunksize
 Default size of a chunk of a Serializable object, that is chunks that goes through the network. More...
 
bool cl_clean_logout
 Clean work dir on user logout. More...
 
bool cl_createlocal
 Create local thread. More...
 
bool cl_custom_auth
 Activate custom authentication. More...
 
bool cl_have_db
 Activate DB facilities. More...
 
bool cl_local_kills_mcs
 When the local thread dies the server will be stopped. More...
 
bool cl_logfile
 Use log file. More...
 
bool cl_logstdout
 Copy log on stdout. More...
 
bool cl_read_grants
 Read grants from the DB table (deprecated). More...
 
bool cl_restartlocal
 Resart local thread when it dies. More...
 
bool cl_use_ssl
 Use secure connections. More...
 
bool cl_work
 Use private (per user) working dir, otherwise use path. More...
 
bool cl_work_cid
 Work path is created using cid if true, otherwise with the user name. More...
 
Confcnf
 Pointer to the Conf object used to read the configuration file. More...
 
string db_host
 Host running database server. More...
 
string db_name
 Database name. More...
 
string db_pass
 Password. More...
 
string db_user
 User name for the local thread access to DB. More...
 
ofstream * flog
 Stream to write the log file. More...
 
string inipath
 Application ini file. More...
 
string interface
 Server interface name. More...
 
LocalThreadlocal
 
string localhost
 Host name. More...
 
int max_users
 How many clients can be connected at the same time. More...
 
string path
 Main server path (APPD). More...
 
int port
 Server port number. More...
 
Serverserver
 
void * ssl_ctx
 Pointer to the global SSL context object, used if cl_use_ssl is true. More...
 
string sslcert
 Path to the SSL certificate file, used if cl_use_ssl = 1. More...
 
string sslpriv
 Path to the SSL private key file, used if cl_use_ssl = 1. More...
 
unsigned int timeout
 Timeout for client operations, in millisecond. More...
 

Private Member Functions

void chkTree ()
 Check the entire MCS tree. More...
 
void DumpConf ()
 Dump environment to configuration file. More...
 
void LoadConf ()
 Load configuration entries. More...
 

Private Attributes

DBConn db
 

Detailed Description

Hold all environment variables.

This class reads a configuration file named "mcs.conf" that must be in the working directory of execution, which contains all environment variables for the execution of a MCS-based application. You can see an example of a configuration file in the MCS distribution tree "share/test/mcs.conf". The file will be read using the Conf class. If one of the environment variable, or the entire file, aren't found then a default value will be assumed.

An Env object (or a derived one) must be istantiated in the main program, then used as parameter for the Server constructor.

See also
Server

Definition at line 6867 of file mcs.hh.

Constructor & Destructor Documentation

◆ Env() [1/2]

mcs::Env::Env ( string  app = "mcs",
string  inipath = "mcs.conf" 
)

Env constructor.

Parameters
appApplication name, configuration entries will be searched under a "MCS_Generic" section for first, then under a section whose name is equal to tis parameter;
inipathPath for configuration file, default is "./mcs.conf".

Definition at line 136 of file Env.cc.

◆ Env() [2/2]

mcs::Env::Env ( const Env )

Declared to avoid using of default copy constructor.

Warning
This constructor is declared but not implemented. If you try to use it you will get a compilation error.

◆ ~Env()

mcs::Env::~Env ( )

Destructor.

Definition at line 201 of file Env.cc.

Member Function Documentation

◆ chkTree()

void mcs::Env::chkTree ( )
private

Check the entire MCS tree.

Definition at line 29 of file Env.cc.

◆ DumpConf()

void mcs::Env::DumpConf ( )
private

Dump environment to configuration file.

Definition at line 102 of file Env.cc.

◆ LoadConf()

void mcs::Env::LoadConf ( )
private

Load configuration entries.

Definition at line 43 of file Env.cc.

◆ operator=()

Env& mcs::Env::operator= ( const Env )

Declared to avoid using of default assignment operator.

Warning
This operator is declared but not implemented. If you try to use it you will get a compilation error.

Member Data Documentation

◆ appname

string mcs::Env::appname

Application name.

Definition at line 6923 of file mcs.hh.

◆ appvers

string mcs::Env::appvers

Application version.

Definition at line 6926 of file mcs.hh.

◆ cl_autoexec

bool mcs::Env::cl_autoexec

Auto execute batch file "auto".

Definition at line 6985 of file mcs.hh.

◆ cl_chunksize

int mcs::Env::cl_chunksize

Default size of a chunk of a Serializable object, that is chunks that goes through the network.

Definition at line 7015 of file mcs.hh.

◆ cl_clean_logout

bool mcs::Env::cl_clean_logout

Clean work dir on user logout.

Definition at line 6979 of file mcs.hh.

◆ cl_createlocal

bool mcs::Env::cl_createlocal

Create local thread.

Definition at line 6973 of file mcs.hh.

◆ cl_custom_auth

bool mcs::Env::cl_custom_auth

Activate custom authentication.

Definition at line 6958 of file mcs.hh.

◆ cl_have_db

bool mcs::Env::cl_have_db

Activate DB facilities.

Definition at line 6955 of file mcs.hh.

◆ cl_local_kills_mcs

bool mcs::Env::cl_local_kills_mcs

When the local thread dies the server will be stopped.

Definition at line 6952 of file mcs.hh.

◆ cl_logfile

bool mcs::Env::cl_logfile

Use log file.

Definition at line 6961 of file mcs.hh.

◆ cl_logstdout

bool mcs::Env::cl_logstdout

Copy log on stdout.

Definition at line 6970 of file mcs.hh.

◆ cl_read_grants

bool mcs::Env::cl_read_grants

Read grants from the DB table (deprecated).

Definition at line 6982 of file mcs.hh.

◆ cl_restartlocal

bool mcs::Env::cl_restartlocal

Resart local thread when it dies.

Definition at line 6976 of file mcs.hh.

◆ cl_use_ssl

bool mcs::Env::cl_use_ssl

Use secure connections.

Definition at line 6988 of file mcs.hh.

◆ cl_work

bool mcs::Env::cl_work

Use private (per user) working dir, otherwise use path.

Definition at line 6964 of file mcs.hh.

◆ cl_work_cid

bool mcs::Env::cl_work_cid

Work path is created using cid if true, otherwise with the user name.

Definition at line 6967 of file mcs.hh.

◆ cnf

Conf* mcs::Env::cnf

Pointer to the Conf object used to read the configuration file.

Definition at line 6920 of file mcs.hh.

◆ db_host

string mcs::Env::db_host

Host running database server.

Definition at line 7009 of file mcs.hh.

◆ db_name

string mcs::Env::db_name

Database name.

Definition at line 7006 of file mcs.hh.

◆ db_pass

string mcs::Env::db_pass

Password.

Definition at line 7003 of file mcs.hh.

◆ db_user

string mcs::Env::db_user

User name for the local thread access to DB.

Definition at line 7000 of file mcs.hh.

◆ flog

ofstream* mcs::Env::flog

Stream to write the log file.

Definition at line 6997 of file mcs.hh.

◆ inipath

string mcs::Env::inipath

Application ini file.

Definition at line 6932 of file mcs.hh.

◆ interface

string mcs::Env::interface

Server interface name.

Definition at line 6938 of file mcs.hh.

◆ localhost

string mcs::Env::localhost

Host name.

Definition at line 6935 of file mcs.hh.

◆ max_users

int mcs::Env::max_users

How many clients can be connected at the same time.

Definition at line 6949 of file mcs.hh.

◆ path

string mcs::Env::path

Main server path (APPD).

Definition at line 6929 of file mcs.hh.

◆ port

int mcs::Env::port

Server port number.

Definition at line 6941 of file mcs.hh.

◆ ssl_ctx

void* mcs::Env::ssl_ctx

Pointer to the global SSL context object, used if cl_use_ssl is true.

Definition at line 7018 of file mcs.hh.

◆ sslcert

string mcs::Env::sslcert

Path to the SSL certificate file, used if cl_use_ssl = 1.

Definition at line 6991 of file mcs.hh.

◆ sslpriv

string mcs::Env::sslpriv

Path to the SSL private key file, used if cl_use_ssl = 1.

Definition at line 6994 of file mcs.hh.

◆ timeout

unsigned int mcs::Env::timeout

Timeout for client operations, in millisecond.

Definition at line 7012 of file mcs.hh.


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

mcslogo

MCS (My Customizable Server) ver. 0.3.3-alpha7
Documentation generated on Mon May 28 07:39:41 UTC 2018