fgms 0.11.8
The
FlightGear MultiPlayer Server
project
main.cxx File Reference

Main Program. More...

#include <cstdlib>
#include <sys/wait.h>
#include <signal.h>
#include "fg_server.hxx"
#include "fg_config.hxx"
#include "daemon.hxx"
#include "fg_util.hxx"

Go to the source code of this file.

Macros

#define DEF_CONF_FILE   "fgms.conf"
 The default config file to load unless overriden on command_line. More...
 
#define DEF_LOG_CLASS   (SG_FGMS|SG_FGTRACKER)
 
#define DEF_LOG_LEVEL   SG_INFO
 
#define M_IS_DIR   S_IFDIR
 
#define SYSCONFDIR   "/usr/etc"
 The default config directory. More...
 

Functions

int main (int argc, char *argv[])
 MAIN routine. More...
 
int ParseParams (int argcount, char *argvars[])
 Parse commandline parameters. More...
 
void PrintHelp ()
 Print a help screen for command line parameters, see command_line. More...
 
bool ProcessConfig (const string &ConfigName)
 Read a config file and set internal variables accordingly. More...
 
int ReadConfigs (bool ReInit=false)
 (re)Read config files More...
 
void SigHUPHandler (int SigType)
 If we receive a SIGHUP, reinit application. More...
 

Variables

bool AddCLI
 
static bool bHadConfig = false
 Must have a config file, with server name. More...
 
sgDebugClass curr_class = (sgDebugClass)DEF_LOG_CLASS
 
sgDebugPriority curr_priority = DEF_LOG_LEVEL
 
cDaemon Myself
 An instance of cDaemon. More...
 
bool RunAsDaemon
 Flag whether instance is a Daemon. More...
 
FG_SERVER Servant
 The running FG_SERVER server process. More...
 

Detailed Description

Main Program.

Author
Oliver Schroeder

Definition in file main.cxx.

Macro Definition Documentation

#define DEF_CONF_FILE   "fgms.conf"

The default config file to load unless overriden on command_line.

Definition at line 68 of file main.cxx.

Referenced by main(), and ReadConfigs().

#define DEF_LOG_CLASS   (SG_FGMS|SG_FGTRACKER)

Definition at line 85 of file main.cxx.

#define DEF_LOG_LEVEL   SG_INFO

Definition at line 79 of file main.cxx.

#define M_IS_DIR   S_IFDIR

Definition at line 56 of file main.cxx.

#define SYSCONFDIR   "/usr/etc"

The default config directory.

Definition at line 75 of file main.cxx.

Referenced by ReadConfigs().

Function Documentation

int main ( int  argc,
char *  argv[] 
)

MAIN routine.

Parameters
argc
argv*[]

Definition at line 641 of file main.cxx.

int ParseParams ( int  argcount,
char *  argvars[] 
)

Parse commandline parameters.

Parameters
argcount
argvars
Return values
int1 on success

Definition at line 462 of file main.cxx.

Referenced by main().

void PrintHelp ( )

Print a help screen for command line parameters, see command_line.

Definition at line 97 of file main.cxx.

Referenced by ParseParams().

bool ProcessConfig ( const string &  ConfigName)

Read a config file and set internal variables accordingly.

Parameters
ConfigNamePath of config file to load
Return values
int– todo–

Definition at line 173 of file main.cxx.

Referenced by ParseParams(), ReadConfigs(), and SigHUPHandler().

int ReadConfigs ( bool  ReInit = false)

(re)Read config files

Parameters
ReInitTrue to reinitialize

Definition at line 555 of file main.cxx.

Referenced by main(), and SigHUPHandler().

void SigHUPHandler ( int  SigType)

If we receive a SIGHUP, reinit application.

Parameters
SigTypeint with signal type

Definition at line 603 of file main.cxx.

Referenced by FG_SERVER::check_files(), and main().

Variable Documentation

bool AddCLI

Definition at line 60 of file fg_server.cxx.

Referenced by FG_SERVER::check_files(), FG_SERVER::Loop(), and ProcessConfig().

bool bHadConfig = false
static

Must have a config file, with server name.

Definition at line 62 of file main.cxx.

Referenced by main(), ProcessConfig(), and SigHUPHandler().

Definition at line 90 of file main.cxx.

Referenced by ParseParams().

sgDebugPriority curr_priority = DEF_LOG_LEVEL

Definition at line 89 of file main.cxx.

Referenced by ParseParams(), and PrintHelp().

cDaemon Myself

An instance of cDaemon.

Definition at line 56 of file fg_server.cxx.

bool RunAsDaemon

Flag whether instance is a Daemon.

Definition at line 59 of file fg_server.cxx.

Referenced by FG_SERVER::Loop(), main(), ParseParams(), and ProcessConfig().

FG_SERVER Servant

The running FG_SERVER server process.

Definition at line 48 of file main.cxx.