xref: /illumos-gate/usr/src/cmd/auditreduce/auditr.h (revision 45916cd2fec6e79bca5dee0421bd39e3c2910d1e)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*45916cd2Sjpk  * Common Development and Distribution License (the "License").
6*45916cd2Sjpk  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*45916cd2Sjpk  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*45916cd2Sjpk  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _AUDITR_H
277c478bd9Sstevel@tonic-gate #define	_AUDITR_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef __cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #include <sys/types.h>
367c478bd9Sstevel@tonic-gate #include <stdio.h>
377c478bd9Sstevel@tonic-gate #include <sys/types.h>
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #include <grp.h>
407c478bd9Sstevel@tonic-gate #include <pwd.h>
417c478bd9Sstevel@tonic-gate #include <signal.h>
427c478bd9Sstevel@tonic-gate #include <string.h>
437c478bd9Sstevel@tonic-gate #include <values.h>
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate #include <dirent.h>
467c478bd9Sstevel@tonic-gate #include <sys/errno.h>
477c478bd9Sstevel@tonic-gate #include <sys/file.h>
487c478bd9Sstevel@tonic-gate #include <sys/param.h>
497c478bd9Sstevel@tonic-gate #include <sys/stat.h>
507c478bd9Sstevel@tonic-gate #include <sys/socket.h>
517c478bd9Sstevel@tonic-gate #include <sys/wait.h>
527c478bd9Sstevel@tonic-gate #include <sys/time.h>
537c478bd9Sstevel@tonic-gate #include <tzfile.h>
547c478bd9Sstevel@tonic-gate #include <sys/resource.h>
557c478bd9Sstevel@tonic-gate #include <netdb.h>
567c478bd9Sstevel@tonic-gate #include <unistd.h>
577c478bd9Sstevel@tonic-gate #include <libgen.h>
587c478bd9Sstevel@tonic-gate #include <stdlib.h>
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate #include <bsm/audit.h>
617c478bd9Sstevel@tonic-gate #include <bsm/audit_record.h>
627c478bd9Sstevel@tonic-gate #include <bsm/libbsm.h>
637c478bd9Sstevel@tonic-gate 
64*45916cd2Sjpk #include <tsol/label.h>
65*45916cd2Sjpk #include <sys/tsol/label_macro.h>
66*45916cd2Sjpk 
677c478bd9Sstevel@tonic-gate #include "auditrt.h"
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /*
707c478bd9Sstevel@tonic-gate  * Flags for on/off code.
717c478bd9Sstevel@tonic-gate  * The release setting would be 0 0 0 1.
727c478bd9Sstevel@tonic-gate  */
737c478bd9Sstevel@tonic-gate #define	AUDIT_PROC_TRACE	0	/* process trace code */
747c478bd9Sstevel@tonic-gate #define	AUDIT_FILE		0	/* file trace code (use -V also) */
757c478bd9Sstevel@tonic-gate #define	AUDIT_REC		0	/* record trace code (very verbose) */
767c478bd9Sstevel@tonic-gate #define	AUDIT_RENAME		1	/* rename output file w/time stamps */
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate #define	TRUE	1
797c478bd9Sstevel@tonic-gate #define	FALSE	0
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate #define	FM_ALLDIR	1	/* f_mode in o.c - all dirs in this dir */
827c478bd9Sstevel@tonic-gate #define	FM_ALLFILE	0	/* f_mode in o.c - all audit files in dir */
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate #define	MAXFILELEN	(MAXPATHLEN+MAXNAMLEN+1)
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /*
877c478bd9Sstevel@tonic-gate  * Initial size of a record buffer.
887c478bd9Sstevel@tonic-gate  * Never smaller than (2 * sizeof (short)).
897c478bd9Sstevel@tonic-gate  * If a buffer is too small for the record being read then the
907c478bd9Sstevel@tonic-gate  * current buffer is freed and a large-enough one is allocated.
917c478bd9Sstevel@tonic-gate  */
927c478bd9Sstevel@tonic-gate #define	AUDITBUFSIZE	512	/* size of default record buffer */
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate /*
957c478bd9Sstevel@tonic-gate  * Controls size of audit_pcbs[] array.
967c478bd9Sstevel@tonic-gate  * INITSIZE is the initial allocation for the array.
977c478bd9Sstevel@tonic-gate  * INC is the growth jump when the array becomes too small.
987c478bd9Sstevel@tonic-gate  */
997c478bd9Sstevel@tonic-gate #define	PCB_INITSIZE	100
1007c478bd9Sstevel@tonic-gate #define	PCB_INC		50
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate /*
1047c478bd9Sstevel@tonic-gate  * Memory allocation functions.
1057c478bd9Sstevel@tonic-gate  * audit calloc that checks for NULL return
1067c478bd9Sstevel@tonic-gate  */
1077c478bd9Sstevel@tonic-gate extern void	*a_calloc(int, size_t);
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate /*
1107c478bd9Sstevel@tonic-gate  * Statistical reporting for error conditions.
1117c478bd9Sstevel@tonic-gate  */
1127c478bd9Sstevel@tonic-gate extern void	audit_stats(void);
1137c478bd9Sstevel@tonic-gate extern int	errno;
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1167c478bd9Sstevel@tonic-gate }
1177c478bd9Sstevel@tonic-gate #endif
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate #endif /* _AUDITR_H */
120