1 |
torben |
328 |
/*************************************************************************** |
2 |
|
|
* Copyright (C) 2006 by Torben H. Nielsen * |
3 |
|
|
* torben@t-hoerup.dk * |
4 |
|
|
* * |
5 |
|
|
* This program is free software; you can redistribute it and/or modify * |
6 |
|
|
* it under the terms of the GNU General Public License as published by * |
7 |
|
|
* the Free Software Foundation; either version 2 of the License, or * |
8 |
|
|
* (at your option) any later version. * |
9 |
|
|
* * |
10 |
|
|
* This program is distributed in the hope that it will be useful, * |
11 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
12 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
13 |
|
|
* GNU General Public License for more details. * |
14 |
|
|
* * |
15 |
|
|
* You should have received a copy of the GNU General Public License * |
16 |
|
|
* along with this program; if not, write to the * |
17 |
|
|
* Free Software Foundation, Inc., * |
18 |
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
19 |
|
|
***************************************************************************/ |
20 |
|
|
|
21 |
|
|
#ifndef DAEMON_H |
22 |
|
|
#define DAEMON_H |
23 |
|
|
|
24 |
|
|
/* daemon.[hc] indeholder alle daemon relaterede functioner incl. |
25 |
|
|
* getConfig(); |
26 |
|
|
* daemonize(); |
27 |
|
|
* writelog(); |
28 |
|
|
*/ |
29 |
|
|
|
30 |
|
|
typedef enum { |
31 |
|
|
ALREADY_LOCKED = 1, |
32 |
|
|
CANT_OPEN_LOCK = 2, |
33 |
|
|
FORK_ERROR = 3 |
34 |
|
|
} errorlevels; |
35 |
|
|
|
36 |
|
|
typedef struct { |
37 |
|
|
short debug; |
38 |
|
|
char logfile[60]; |
39 |
|
|
char lock[60];; |
40 |
|
|
char rundir[60]; |
41 |
|
|
|
42 |
|
|
char dbuser[30]; |
43 |
|
|
char dbpass[30]; |
44 |
|
|
char dbhost[30]; |
45 |
|
|
char dbname[30]; |
46 |
|
|
int dbport; |
47 |
|
|
} downloadd_config; |
48 |
|
|
|
49 |
|
|
extern downloadd_config *CONFIG; |
50 |
|
|
|
51 |
|
|
void log_message(char *message); |
52 |
|
|
void signal_handler(int sig); |
53 |
|
|
void read_config_file(char *configfile); |
54 |
|
|
void daemon_shutdown(int errorlevel); |
55 |
|
|
|
56 |
|
|
#endif //DAEMON_H |