audit_filter.h revision 161630
1/*- 2 * Copyright (c) 2006 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * This software was developed by Robert Watson for the TrustedBSD Project. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $P4: //depot/projects/trustedbsd/openbsm/bsm/audit_filter.h#4 $ 29 */ 30 31#ifndef _BSM_AUDIT_FILTER_H_ 32#define _BSM_AUDIT_FILTER_H_ 33 34/* 35 * Module interface for audit filter modules. 36 * 37 * audit_filter_attach_t - filter module is being attached with arguments 38 * audit_filter_reinit_t - arguments to module have changed 39 * audit_filter_record_t - present parsed record to filter module, with 40 * receipt time 41 * audit_filter_rawrecord_t - present BSM format record to filter module, 42 * with receipt time 43 * audit_filter_destach_t - filter module is being detached 44 * 45 * There may be many instances of the same filter, identified by the instance 46 * void pointer maintained by the filter instance. 47 */ 48typedef int (*audit_filter_attach_t)(void *instance, int argc, char *argv[]); 49typedef int (*audit_filter_reinit_t)(void *instance, int argc, char *argv[]); 50typedef void (*audit_filter_record_t)(void *instance, struct timespec *ts, 51 int token_count, const tokenstr_t tok[]); 52typedef void (*audit_filter_rawrecord_t)(void *instance, struct timespec *ts, 53 void *data, u_int len); 54typedef void (*audit_filter_detach_t)(void *instance); 55 56/* 57 * APIs that may be called by audit filters. 58 */ 59void audit_filter_getcookie(void *instance, void **cookie); 60void audit_filter_setcookie(void *instance, void *cookie); 61 62/* 63 * Values to be returned by audit_filter_init_t. 64 */ 65#define AUDIT_FILTER_SUCCESS (0) 66#define AUDIT_FILTER_FAILURE (-1) 67 68/* 69 * Standard name for filter module initialization functions, which will be 70 * found using dlsym(). 71 */ 72#define AUDIT_FILTER_ATTACH audit_filter_attach 73#define AUDIT_FILTER_REINIT audit_filter_reinit 74#define AUDIT_FILTER_RECORD audit_filter_record 75#define AUDIT_FILTER_RAWRECORD audit_filter_rawrecord 76#define AUDIT_FILTER_DETACH audit_filter_detach 77#define AUDIT_FILTER_ATTACH_STRING "audit_filter_attach" 78#define AUDIT_FILTER_REINIT_STRING "audit_filter_reinit" 79#define AUDIT_FILTER_RECORD_STRING "audit_filter_record" 80#define AUDIT_FILTER_RAWRECORD_STRING "audit_filter_rawrecord" 81#define AUDIT_FILTER_DETACH_STRING "audit_filter_detach" 82 83#endif /* !_BSM_AUDIT_FILTER_H_ */ 84