8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / auditd / plugin.h
blob02d195d2de1d0d0c98b6eef28e75b8b50a246e9c
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
25 #ifndef _PLUGIN_H
26 #define _PLUGIN_H
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 #include <security/auditd.h>
33 #include "queue.h"
35 typedef struct thd {
36 pthread_cond_t thd_cv;
37 pthread_mutex_t thd_mutex;
38 int thd_waiting;
39 } thr_data_t;
41 typedef struct plg plugin_t;
42 struct plg {
43 boolean_t plg_initialized; /* if threads, pools created */
44 boolean_t plg_reopen; /* call auditd_plugin_open */
46 * removed is 1 if last read of audit configuration didn't list this
47 * plugin or the plugin is marked as "inactive"; it needs to be removed.
49 boolean_t plg_removed; /* plugin removed */
50 boolean_t plg_to_be_removed; /* tentative removal state */
52 char *plg_path; /* plugin path */
53 void *plg_dlptr; /* dynamic lib pointer */
54 auditd_rc_t (*plg_fplugin)(const char *, size_t, uint64_t, char **);
55 auditd_rc_t (*plg_fplugin_open)(const kva_t *, char **, char **);
56 auditd_rc_t (*plg_fplugin_close)(char **);
58 kva_t *plg_kvlist; /* plugin inputs */
59 size_t plg_qmax; /* max queue size */
60 size_t plg_qmin; /* min queue size */
62 uint64_t plg_sequence; /* buffer counter */
63 uint64_t plg_last_seq_out; /* buffer counter (debug) */
64 uint32_t plg_tossed; /* discards (debug) */
65 uint32_t plg_queued; /* count buffers queued */
66 uint32_t plg_output; /* count of buffers output */
67 int plg_priority; /* current priority */
69 au_queue_t plg_pool; /* buffer pool */
70 au_queue_t plg_queue; /* queue drawn from pool */
71 int plg_q_threshold; /* max preallocated queue */
72 audit_q_t *plg_save_q_copy; /* tmp holding for a record */
74 pthread_t plg_tid; /* thread id */
75 pthread_cond_t plg_cv;
76 pthread_mutex_t plg_mutex;
77 int plg_waiting; /* output thread wait state */
79 int plg_cnt; /* continue policy */
81 int plg_retry_time; /* retry (seconds) */
83 plugin_t *plg_next; /* null is end of list */
86 int auditd_thread_init();
87 void auditd_thread_close();
88 void auditd_exit(int);
90 extern plugin_t *plugin_head;
91 extern pthread_mutex_t plugin_mutex;
93 #ifdef __cplusplus
95 #endif
97 #endif /* _PLUGIN_H */