#include "DcGlobals.h"
#include "DcParameters.h"
#include "DcConnectionThread.h"
#include "DcLoadController.h"
#include "DcEnginesBank.h"
#include "DcLogger.h"
#include "Interfaces/DcAdapter.h"
Go to the source code of this file.
Functions |
void | PrintString (CdcString str, int level) |
| Thread safe function to print a messages to the console and/or log file.
|
int | ProgramMain () |
| This is the real main function of the server.
|
void | InitProgram () |
| Initialize classes of the server by calling some class static functions.
|
void | ControlUsers (int argc, char *argv[]) |
| Add, Change password and Remove users from the users database.
|
void | main (int argc, char *argv[]) |
| The Main function.
|
Variables |
bool | gbRunAsApp |
| True when the program runs as a regular application.
|
CdcLogger | oLogger |
| The Logger object (just one for the entire application).
|
Function Documentation
void ControlUsers |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Add, Change password and Remove users from the users database.
usage:
logins add 'username' 'password'.
logins change 'username' 'old_password' 'new_password'.
logins remove 'username' 'password'.
Definition at line 121 of file Main.cpp.
Initialize classes of the server by calling some class static functions.
- Exceptions:
-
(CdcException) | from the initialization functions. |
Definition at line 95 of file Main.cpp.
void main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
The Main function.
It checks the command line arguments.
install - will register this program as a demon/service.
uninstall - will unregister this program.
run - will run the program as regular console application.
logins - will add, remove and change password of users.
if no argument exists, it start the program as a demon/service.
- Returns:
- Zero on successful exit, or none zero if failed.
Definition at line 161 of file Main.cpp.
void PrintString |
( |
CdcString |
str, |
|
|
int |
level = 0 |
|
) |
| |
Thread safe function to print a messages to the console and/or log file.
This is just a wrapper to CdcLogger::PrintString
- Parameters:
-
str | The message to print. |
level | Optional logging level (default is zero - always print). |
Definition at line 43 of file Main.cpp.
This is the real main function of the server.
it creates a CdcSocketServer object by calling the static function CdcSocketserver::GetSocketServer. Then it inserts a loop and listens to the selected port for incoming connections. When a new request is available Listen returns with a pointer to a CdcSocket object. Then the function will create a new CdcConnectionThread with the new socket, and call CdcConnectionThread::Start. The new thread will do the work while Main will return to listen on the port.
- Returns:
- (int) -1 if exit because of an error, otherwise it returns 0.
Definition at line 46 of file Main.cpp.
Variable Documentation
True when the program runs as a regular application.
Definition at line 38 of file Main.cpp.
The Logger object (just one for the entire application).
Definition at line 40 of file Main.cpp.