0,0 → 1,71 |
/****************************************************************** |
* rebootd. Copyleft 2005 Anatoli Klassen |
******************************************************************/ |
|
#ifndef _REBOOTD_H_ |
#define _REBOOTD_H_ |
|
#include <stdio.h> |
#include <netinet/in.h> |
|
/* project name */ |
#define APP_NAME "rebootd" |
|
#define DEFAULT_PORT 19 |
#define DEFAULT_CFG_FILE "/etc/rebootd.conf" |
#define CMDSIZE 4096 |
#define BUFSIZE 4096 |
#define MAX_CONFIG_LINE 4096 |
#define PORT_MIN 1 |
#define PORT_MAX 65535 |
|
/* return values of functions */ |
#define RESULT_OK 0 |
#define RESULT_EXIT 1 |
#define RESULT_ERROR 2 |
#define RESULT_UNEXPECTED 3 |
|
/* return values for the whole program */ |
#define EXIT_OK 0 |
#define EXIT_USER_ERROR 1 |
#define EXIT_UNEXPECTED 2 |
|
/* command line and config file parameters */ |
#define PARAM_HELP_1 "-h" |
#define PARAM_HELP_2 "--help" |
#define PARAM_VERSION "--version" |
#define PARAM_INTERFACE "--interface" |
#define PARAM_PORT "--port" |
#define PARAM_CONFIG "--config" |
#define PARAM_PID_FILE "--pid" |
#define PARAM_DEBUG "--debug" |
#define CONFIG_INTERFACE "interface" |
#define CONFIG_PORT "port" |
#define CONFIG_PASSWORD "password" |
#define CONFIG_PID_FILE "pid" |
|
/* priority of defferent sources of options */ |
#define CFG_PRIO_CMD 1 |
#define CFG_PRIO_CONFIG 2 |
#define CFG_PRIO_DEFAULT 3 |
|
struct config { |
char config_file[FILENAME_MAX]; |
char config_file_prio; |
struct in_addr interface; |
char interface_prio; |
ushort port; |
char port_prio; |
char password[MAX_CONFIG_LINE]; |
char password_prio; |
char pid_file[FILENAME_MAX]; |
char pid_file_prio; |
char debug_mode; |
}; |
|
extern int daemonized; /* we are already a daemon */ |
extern volatile int reconfig_required; /* we have to stop socket listening and reread config */ |
extern volatile int quit_required; /* we have to stop socket listening and exit */ |
|
#endif /* !_REBOOTD_H_ */ |
|