xref: /illumos-gate/usr/src/cmd/auditreduce/auditr.h (revision 2a8bcb4efb45d99ac41c94a75c396b362c414f7f)
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
545916cd2Sjpk  * Common Development and Distribution License (the "License").
645916cd2Sjpk  * 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 /*
2245916cd2Sjpk  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
2345916cd2Sjpk  * 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 #ifdef __cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <sys/types.h>
347c478bd9Sstevel@tonic-gate #include <stdio.h>
357c478bd9Sstevel@tonic-gate #include <sys/types.h>
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #include <grp.h>
387c478bd9Sstevel@tonic-gate #include <pwd.h>
397c478bd9Sstevel@tonic-gate #include <signal.h>
407c478bd9Sstevel@tonic-gate #include <string.h>
417c478bd9Sstevel@tonic-gate #include <values.h>
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #include <dirent.h>
447c478bd9Sstevel@tonic-gate #include <sys/errno.h>
457c478bd9Sstevel@tonic-gate #include <sys/file.h>
467c478bd9Sstevel@tonic-gate #include <sys/param.h>
477c478bd9Sstevel@tonic-gate #include <sys/stat.h>
487c478bd9Sstevel@tonic-gate #include <sys/socket.h>
497c478bd9Sstevel@tonic-gate #include <sys/wait.h>
507c478bd9Sstevel@tonic-gate #include <sys/time.h>
517c478bd9Sstevel@tonic-gate #include <tzfile.h>
527c478bd9Sstevel@tonic-gate #include <sys/resource.h>
537c478bd9Sstevel@tonic-gate #include <netdb.h>
547c478bd9Sstevel@tonic-gate #include <unistd.h>
557c478bd9Sstevel@tonic-gate #include <libgen.h>
567c478bd9Sstevel@tonic-gate #include <stdlib.h>
57*103b2b15Sgww #include <libscf_priv.h>
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate #include <bsm/audit.h>
607c478bd9Sstevel@tonic-gate #include <bsm/audit_record.h>
617c478bd9Sstevel@tonic-gate #include <bsm/libbsm.h>
627c478bd9Sstevel@tonic-gate 
6345916cd2Sjpk #include <tsol/label.h>
6445916cd2Sjpk 
657c478bd9Sstevel@tonic-gate #include "auditrt.h"
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate /*
687c478bd9Sstevel@tonic-gate  * Flags for on/off code.
697c478bd9Sstevel@tonic-gate  * The release setting would be 0 0 0 1.
707c478bd9Sstevel@tonic-gate  */
717c478bd9Sstevel@tonic-gate #define	AUDIT_PROC_TRACE	0	/* process trace code */
727c478bd9Sstevel@tonic-gate #define	AUDIT_FILE		0	/* file trace code (use -V also) */
737c478bd9Sstevel@tonic-gate #define	AUDIT_REC		0	/* record trace code (very verbose) */
747c478bd9Sstevel@tonic-gate #define	AUDIT_RENAME		1	/* rename output file w/time stamps */
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate #define	TRUE	1
777c478bd9Sstevel@tonic-gate #define	FALSE	0
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate #define	FM_ALLDIR	1	/* f_mode in o.c - all dirs in this dir */
807c478bd9Sstevel@tonic-gate #define	FM_ALLFILE	0	/* f_mode in o.c - all audit files in dir */
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate #define	MAXFILELEN	(MAXPATHLEN+MAXNAMLEN+1)
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate /*
857c478bd9Sstevel@tonic-gate  * Initial size of a record buffer.
867c478bd9Sstevel@tonic-gate  * Never smaller than (2 * sizeof (short)).
877c478bd9Sstevel@tonic-gate  * If a buffer is too small for the record being read then the
887c478bd9Sstevel@tonic-gate  * current buffer is freed and a large-enough one is allocated.
897c478bd9Sstevel@tonic-gate  */
907c478bd9Sstevel@tonic-gate #define	AUDITBUFSIZE	512	/* size of default record buffer */
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate /*
937c478bd9Sstevel@tonic-gate  * Controls size of audit_pcbs[] array.
947c478bd9Sstevel@tonic-gate  * INITSIZE is the initial allocation for the array.
957c478bd9Sstevel@tonic-gate  * INC is the growth jump when the array becomes too small.
967c478bd9Sstevel@tonic-gate  */
977c478bd9Sstevel@tonic-gate #define	PCB_INITSIZE	100
987c478bd9Sstevel@tonic-gate #define	PCB_INC		50
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate /*
1027c478bd9Sstevel@tonic-gate  * Memory allocation functions.
1037c478bd9Sstevel@tonic-gate  * audit calloc that checks for NULL return
1047c478bd9Sstevel@tonic-gate  */
1057c478bd9Sstevel@tonic-gate extern void	*a_calloc(int, size_t);
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate /*
1087c478bd9Sstevel@tonic-gate  * Statistical reporting for error conditions.
1097c478bd9Sstevel@tonic-gate  */
1107c478bd9Sstevel@tonic-gate extern void	audit_stats(void);
1117c478bd9Sstevel@tonic-gate extern int	errno;
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1147c478bd9Sstevel@tonic-gate }
1157c478bd9Sstevel@tonic-gate #endif
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate #endif /* _AUDITR_H */
118