xref: /illumos-gate/usr/src/lib/auditd_plugins/auditd.h (revision f8919bdadda3ebb97bd55cc14a16e0271ed57615)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  *
26  * This is an unstable interface; changes may be made without
27  * notice.
28  */
29 
30 #ifndef	_AUDITD_H
31 #define	_AUDITD_H
32 
33 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34 
35 #include <secdb.h>
36 #include <sys/types.h>
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 /*
43  * "WARN" errors trigger calls to audit_warn
44  */
45 enum auditd_rc {
46 	AUDITD_SUCCESS,	/*   ok						*/
47 	AUDITD_RETRY,	/*   retry after a delay	(WARN retry)	*/
48 	AUDITD_NO_MEMORY, /* can't allocate memory	(WARN no_memory) */
49 	AUDITD_INVALID,	/*   bad input			(WARN invalid)	*/
50 	AUDITD_COMM_FAIL, /* communications failure			*/
51 	AUDITD_FATAL,	/*   other error		(WARN failure)	*/
52 	AUDITD_FAIL	/*   other non-fatal error			*/
53 };
54 typedef enum auditd_rc auditd_rc_t;
55 
56 /*
57  * auditd_plugin()
58  *	arg 1 - input buffer, binary Solaris audit record
59  *	arg 2 - input buffer length
60  *	arg 3 - record sequence number
61  *	arg 4 - optional explanation of error return (use NULL,
62  *		not an empty string if not used.)
63  */
64 auditd_rc_t	auditd_plugin(const char *, size_t, uint32_t, char **);
65 /*
66  * auditd_plugin_open()
67  *	arg 1 - attr/val struct, use with kva_match()
68  *	arg 2 - attr/value pair string:  attr1=value1;attr2=value2
69  *	arg 3 - optional explanation of error return (use NULL,
70  *		not an empty string if not used.)
71  *
72  *	make local copy of args 1 and 2; they are trashed after return.
73  */
74 auditd_rc_t	auditd_plugin_open(const kva_t *, char **, char **);
75 
76 /*
77  * auditd_plugin_close()
78  *	arg 1 - optional explanation of error return (use NULL,
79  *		not an empty string if not used.)
80  */
81 auditd_rc_t	auditd_plugin_close(char **);
82 
83 #ifdef	__cplusplus
84 }
85 #endif
86 
87 #endif	/* _AUDITD_H */
88