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 5*11704SJan.Friedel@Sun.COM * Common Development and Distribution License (the "License"). 6*11704SJan.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*11704SJan.Friedel@Sun.COM * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate * 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _PLUGIN_H 280Sstevel@tonic-gate #define _PLUGIN_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifdef __cplusplus 310Sstevel@tonic-gate extern "C" { 320Sstevel@tonic-gate #endif 330Sstevel@tonic-gate 340Sstevel@tonic-gate #include <security/auditd.h> 350Sstevel@tonic-gate #include "queue.h" 360Sstevel@tonic-gate 370Sstevel@tonic-gate typedef struct thd { 380Sstevel@tonic-gate pthread_cond_t thd_cv; 390Sstevel@tonic-gate pthread_mutex_t thd_mutex; 400Sstevel@tonic-gate int thd_waiting; 410Sstevel@tonic-gate } thr_data_t; 420Sstevel@tonic-gate 430Sstevel@tonic-gate typedef struct plg plugin_t; 440Sstevel@tonic-gate struct plg { 450Sstevel@tonic-gate boolean_t plg_initialized; /* if threads, pools created */ 460Sstevel@tonic-gate boolean_t plg_reopen; /* call auditd_plugin_open */ 470Sstevel@tonic-gate /* 480Sstevel@tonic-gate * removed is 1 if last read of audit_control didn't list this 490Sstevel@tonic-gate * plugin; it needs to be removed. 500Sstevel@tonic-gate */ 510Sstevel@tonic-gate boolean_t plg_removed; /* plugin removed */ 520Sstevel@tonic-gate boolean_t plg_to_be_removed; /* tentative removal state */ 530Sstevel@tonic-gate 540Sstevel@tonic-gate char *plg_path; /* plugin path */ 550Sstevel@tonic-gate void *plg_dlptr; /* dynamic lib pointer */ 56*11704SJan.Friedel@Sun.COM auditd_rc_t (*plg_fplugin)(const char *, size_t, uint64_t, char **); 570Sstevel@tonic-gate auditd_rc_t (*plg_fplugin_open)(const kva_t *, char **, char **); 580Sstevel@tonic-gate auditd_rc_t (*plg_fplugin_close)(char **); 590Sstevel@tonic-gate 600Sstevel@tonic-gate kva_t *plg_kvlist; /* plugin inputs */ 610Sstevel@tonic-gate size_t plg_qmax; /* max queue size */ 620Sstevel@tonic-gate size_t plg_qmin; /* min queue size */ 630Sstevel@tonic-gate 64*11704SJan.Friedel@Sun.COM uint64_t plg_sequence; /* buffer counter */ 65*11704SJan.Friedel@Sun.COM uint64_t plg_last_seq_out; /* buffer counter (debug) */ 660Sstevel@tonic-gate uint32_t plg_tossed; /* discards (debug) */ 670Sstevel@tonic-gate uint32_t plg_queued; /* count buffers queued */ 680Sstevel@tonic-gate uint32_t plg_output; /* count of buffers output */ 690Sstevel@tonic-gate int plg_priority; /* current priority */ 700Sstevel@tonic-gate 710Sstevel@tonic-gate au_queue_t plg_pool; /* buffer pool */ 720Sstevel@tonic-gate au_queue_t plg_queue; /* queue drawn from pool */ 730Sstevel@tonic-gate int plg_q_threshold; /* max preallocated queue */ 740Sstevel@tonic-gate audit_q_t *plg_save_q_copy; /* tmp holding for a record */ 750Sstevel@tonic-gate 760Sstevel@tonic-gate pthread_t plg_tid; /* thread id */ 770Sstevel@tonic-gate pthread_cond_t plg_cv; 780Sstevel@tonic-gate pthread_mutex_t plg_mutex; 790Sstevel@tonic-gate int plg_waiting; /* output thread wait state */ 800Sstevel@tonic-gate 810Sstevel@tonic-gate int plg_cnt; /* continue policy */ 820Sstevel@tonic-gate 830Sstevel@tonic-gate int plg_retry_time; /* retry (seconds) */ 840Sstevel@tonic-gate 850Sstevel@tonic-gate plugin_t *plg_next; /* null is end of list */ 860Sstevel@tonic-gate }; 870Sstevel@tonic-gate 880Sstevel@tonic-gate int auditd_thread_init(); 890Sstevel@tonic-gate void auditd_thread_close(); 900Sstevel@tonic-gate void auditd_exit(int); 910Sstevel@tonic-gate 920Sstevel@tonic-gate extern plugin_t *plugin_head; 930Sstevel@tonic-gate extern pthread_mutex_t plugin_mutex; 940Sstevel@tonic-gate 950Sstevel@tonic-gate #ifdef __cplusplus 960Sstevel@tonic-gate } 970Sstevel@tonic-gate #endif 980Sstevel@tonic-gate 990Sstevel@tonic-gate #endif /* _PLUGIN_H */ 100