Imported Upstream version 2.4.3
[platform/upstream/audit.git] / audisp / audispd-pconfig.h
1 /* audispd-pconfig.h -- 
2  * Copyright 2007,2013 Red Hat Inc., Durham, North Carolina.
3  * All Rights Reserved.
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 Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  * Authors:
20  *   Steve Grubb <sgrubb@redhat.com>
21  * 
22  */
23
24 #ifndef AUDISPD_PCONFIG_H
25 #define AUDISPD_PCONFIG_H
26
27 #include <sys/types.h>
28 #include "libaudit.h"
29 #define MAX_PLUGIN_ARGS 2
30
31 typedef enum { A_NO, A_YES } active_t;
32 typedef enum { D_UNSET, D_IN, D_OUT } direction_t;
33 typedef enum { S_ALWAYS, S_BUILTIN, S_AF_UNIX, S_SYSLOG } service_t;
34 typedef enum { F_BINARY, F_STRING } format_t;
35
36 typedef struct plugin_conf
37 {
38         active_t active;        /* Current state - active or not */
39         direction_t direction;  /* in or out kind of plugin */
40         const char *path;       /* path to binary */
41         service_t type;         /* builtin or always */
42         char *args[MAX_PLUGIN_ARGS+2];  /* args to be passed to plugin */
43         format_t format;        /* Event format */
44         int plug_pipe[2];       /* Communication pipe for events */
45         pid_t pid;              /* Used to signal children */
46         ino_t inode;            /* Use to see if new binary was installed */
47         int checked;            /* Used for internal housekeeping on HUP */
48         char *name;             /* Used to distinguish plugins for HUP */
49         unsigned restart_cnt;   /* Number of times its crashed */
50 } plugin_conf_t;
51
52 void clear_pconfig(plugin_conf_t *config);
53 int  load_pconfig(plugin_conf_t *config, char *file);
54 void free_pconfig(plugin_conf_t *config);
55
56 #endif
57