OpenDNSSEC-enforcer  1.4.7
daemon_util.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2009 Nominet UK. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
17  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
19  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
21  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
23  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  */
26 
27 #ifndef ENFORCER_DAEMON_UTIL_H
28 #define ENFORCER_DAEMON_UTIL_H
29 /*
30  * daemon_util.h code needed to get a daemon up and running
31  *
32  * edit the DAEMONCONFIG and cmlParse function
33  * in daemon_util.[c|h] to add options specific
34  * to your app
35  *
36  * gcc -o daemon daemon_util.c daemon.c
37  *
38  * Most of this is based on stuff I have seen in NSD
39  */
40 
41 #include "daemon.h"
42 #include <stdio.h>
43 
49 #if defined(HAVE_SYSLOG_R) && defined(HAVE_OPENLOG_R) && defined(HAVE_CLOSELOG_R) && defined(HAVE_VSYSLOG_R)
50 extern struct syslog_data sdata;
51 #else
52 #undef HAVE_SYSLOG_R
53 #undef HAVE_OPENLOG_R
54 #undef HAVE_CLOSELOG_R
55 #undef HAVE_VSYSLOG_R
56 #endif
57 
58 void cmdlParse(DAEMONCONFIG*, int*, char**);
59 void log_init(int facility, const char *program_name);
60 void log_switch(int facility, const char *facility_name, const char *program_name, int verbose);
61 void log_msg(DAEMONCONFIG* config, int priority, const char *format, ...);
62 void ksm_log_msg(const char *format);
63 void log_xml_error(void *ignore, const char *format, ...);
64 void log_xml_warn(void *ignore, const char *format, ...);
68 int make_directory(DAEMONCONFIG *config, const char* path);
70 int get_lite_lock(char *lock_filename, FILE* lock_fd);
71 int release_lite_lock(FILE* lock_fd);
72 int get_log_user(const char* username, int* usernumber);
73 
74 #endif /* ENFORCER_DAEMON_UTIL_H */
void log_msg(DAEMONCONFIG *config, int priority, const char *format,...)
Definition: daemon_util.c:294
void log_switch(int facility, const char *facility_name, const char *program_name, int verbose)
Definition: daemon_util.c:275
void log_init(int facility, const char *program_name)
Definition: daemon_util.c:265
void log_xml_error(void *ignore, const char *format,...)
Definition: daemon_util.c:354
void log_xml_warn(void *ignore, const char *format,...)
Definition: daemon_util.c:372
int createPidDir(DAEMONCONFIG *config)
Definition: daemon_util.c:536
int get_log_user(const char *username, int *usernumber)
Definition: daemon_util.c:1218
int release_lite_lock(FILE *lock_fd)
Definition: daemon_util.c:1198
void ksm_log_msg(const char *format)
Definition: daemon_util.c:313
int ReadConfig(DAEMONCONFIG *config, int verbose)
Definition: daemon_util.c:712
int verbose
Definition: kaspcheck.c:49
void cmdlParse(DAEMONCONFIG *, int *, char **)
Definition: daemon_util.c:623
int writepid(DAEMONCONFIG *config)
Definition: daemon_util.c:467
DAEMONCONFIG config
Definition: daemon.c:71
int make_directory(DAEMONCONFIG *config, const char *path)
Definition: daemon_util.c:578
int getPermsForDrop(DAEMONCONFIG *config)
Definition: daemon_util.c:91
int get_lite_lock(char *lock_filename, FILE *lock_fd)
Definition: daemon_util.c:1164