10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 511704SJan.Friedel@Sun.COM * Common Development and Distribution License (the "License"). 611704SJan.Friedel@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*12918SJan.Friedel@Sun.COM * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 230Sstevel@tonic-gate */ 240Sstevel@tonic-gate 250Sstevel@tonic-gate #ifndef _PLUGIN_H 260Sstevel@tonic-gate #define _PLUGIN_H 270Sstevel@tonic-gate 280Sstevel@tonic-gate #ifdef __cplusplus 290Sstevel@tonic-gate extern "C" { 300Sstevel@tonic-gate #endif 310Sstevel@tonic-gate 320Sstevel@tonic-gate #include <security/auditd.h> 330Sstevel@tonic-gate #include "queue.h" 340Sstevel@tonic-gate 350Sstevel@tonic-gate typedef struct thd { 360Sstevel@tonic-gate pthread_cond_t thd_cv; 370Sstevel@tonic-gate pthread_mutex_t thd_mutex; 380Sstevel@tonic-gate int thd_waiting; 390Sstevel@tonic-gate } thr_data_t; 400Sstevel@tonic-gate 410Sstevel@tonic-gate typedef struct plg plugin_t; 420Sstevel@tonic-gate struct plg { 430Sstevel@tonic-gate boolean_t plg_initialized; /* if threads, pools created */ 440Sstevel@tonic-gate boolean_t plg_reopen; /* call auditd_plugin_open */ 450Sstevel@tonic-gate /* 46*12918SJan.Friedel@Sun.COM * removed is 1 if last read of audit configuration didn't list this 47*12918SJan.Friedel@Sun.COM * plugin or the plugin is marked as "inactive"; it needs to be removed. 480Sstevel@tonic-gate */ 490Sstevel@tonic-gate boolean_t plg_removed; /* plugin removed */ 500Sstevel@tonic-gate boolean_t plg_to_be_removed; /* tentative removal state */ 510Sstevel@tonic-gate 520Sstevel@tonic-gate char *plg_path; /* plugin path */ 530Sstevel@tonic-gate void *plg_dlptr; /* dynamic lib pointer */ 5411704SJan.Friedel@Sun.COM auditd_rc_t (*plg_fplugin)(const char *, size_t, uint64_t, char **); 550Sstevel@tonic-gate auditd_rc_t (*plg_fplugin_open)(const kva_t *, char **, char **); 560Sstevel@tonic-gate auditd_rc_t (*plg_fplugin_close)(char **); 570Sstevel@tonic-gate 580Sstevel@tonic-gate kva_t *plg_kvlist; /* plugin inputs */ 590Sstevel@tonic-gate size_t plg_qmax; /* max queue size */ 600Sstevel@tonic-gate size_t plg_qmin; /* min queue size */ 610Sstevel@tonic-gate 6211704SJan.Friedel@Sun.COM uint64_t plg_sequence; /* buffer counter */ 6311704SJan.Friedel@Sun.COM uint64_t plg_last_seq_out; /* buffer counter (debug) */ 640Sstevel@tonic-gate uint32_t plg_tossed; /* discards (debug) */ 650Sstevel@tonic-gate uint32_t plg_queued; /* count buffers queued */ 660Sstevel@tonic-gate uint32_t plg_output; /* count of buffers output */ 670Sstevel@tonic-gate int plg_priority; /* current priority */ 680Sstevel@tonic-gate 690Sstevel@tonic-gate au_queue_t plg_pool; /* buffer pool */ 700Sstevel@tonic-gate au_queue_t plg_queue; /* queue drawn from pool */ 710Sstevel@tonic-gate int plg_q_threshold; /* max preallocated queue */ 720Sstevel@tonic-gate audit_q_t *plg_save_q_copy; /* tmp holding for a record */ 730Sstevel@tonic-gate 740Sstevel@tonic-gate pthread_t plg_tid; /* thread id */ 750Sstevel@tonic-gate pthread_cond_t plg_cv; 760Sstevel@tonic-gate pthread_mutex_t plg_mutex; 770Sstevel@tonic-gate int plg_waiting; /* output thread wait state */ 780Sstevel@tonic-gate 790Sstevel@tonic-gate int plg_cnt; /* continue policy */ 800Sstevel@tonic-gate 810Sstevel@tonic-gate int plg_retry_time; /* retry (seconds) */ 820Sstevel@tonic-gate 830Sstevel@tonic-gate plugin_t *plg_next; /* null is end of list */ 840Sstevel@tonic-gate }; 850Sstevel@tonic-gate 860Sstevel@tonic-gate int auditd_thread_init(); 870Sstevel@tonic-gate void auditd_thread_close(); 880Sstevel@tonic-gate void auditd_exit(int); 890Sstevel@tonic-gate 900Sstevel@tonic-gate extern plugin_t *plugin_head; 910Sstevel@tonic-gate extern pthread_mutex_t plugin_mutex; 920Sstevel@tonic-gate 930Sstevel@tonic-gate #ifdef __cplusplus 940Sstevel@tonic-gate } 950Sstevel@tonic-gate #endif 960Sstevel@tonic-gate 970Sstevel@tonic-gate #endif /* _PLUGIN_H */ 98