fgms 0.13.5
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

◆ DEF_CONF_FILE

#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().

◆ DEF_LOG_CLASS

#define DEF_LOG_CLASS   (SG_FGMS|SG_FGTRACKER)

Definition at line 85 of file main.cxx.

◆ DEF_LOG_LEVEL

#define DEF_LOG_LEVEL   SG_INFO

Definition at line 79 of file main.cxx.

◆ M_IS_DIR

#define M_IS_DIR   S_IFDIR

Definition at line 56 of file main.cxx.

◆ SYSCONFDIR

#define SYSCONFDIR   "/usr/etc"

The default config directory.

Definition at line 75 of file main.cxx.

Referenced by ReadConfigs().

Function Documentation

◆ main()

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

MAIN routine.

Parameters
argc
argv*[]

Definition at line 712 of file main.cxx.

◆ ParseParams()

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

Parse commandline parameters.

Parameters
argcount
argvars
Return values
int1 on success

Definition at line 533 of file main.cxx.

Referenced by main().

◆ PrintHelp()

void PrintHelp ( )

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

Definition at line 97 of file main.cxx.

Referenced by ParseParams().

◆ ProcessConfig()

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().

◆ ReadConfigs()

int ReadConfigs ( bool  ReInit = false)

(re)Read config files

Parameters
ReInitTrue to reinitialize

Definition at line 626 of file main.cxx.

Referenced by main(), and SigHUPHandler().

◆ SigHUPHandler()

void SigHUPHandler ( int  SigType)

If we receive a SIGHUP, reinit application.

Parameters
SigTypeint with signal type

Definition at line 674 of file main.cxx.

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

Variable Documentation

◆ AddCLI

bool AddCLI

Definition at line 60 of file fg_server.cxx.

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

◆ bHadConfig

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().

◆ curr_class

Definition at line 90 of file main.cxx.

Referenced by ParseParams().

◆ curr_priority

sgDebugPriority curr_priority = DEF_LOG_LEVEL

Definition at line 89 of file main.cxx.

Referenced by ParseParams(), and PrintHelp().

◆ Myself

cDaemon Myself

An instance of cDaemon.

Definition at line 56 of file fg_server.cxx.

◆ RunAsDaemon

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().

◆ Servant

FG_SERVER Servant

The running FG_SERVER server process.

Definition at line 48 of file main.cxx.