/*	$CoreSDI: audconf.h,v 1.13 2001/08/28 23:06:06 claudio Exp $	*/

/*
 *   Copyright (c) 2000, 2001, Core SDI S.A., Argentina
 *   All rights reserved
 *  
 *   Redistribution and use in source and binary forms, with or without
 *   modification, are permitted provided that the following conditions
 *   are met:
 *  
 *   1. Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *   2. Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *   3. Neither name of the Core SDI S.A. nor the names of its contributors
 *      may be used to endorse or promote products derived from this software
 *      without specific prior written permission.
 *  
 *   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 *   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 *   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 *   IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 *   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 *   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 *   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef AUDCONF_H
#define AUDCONF_H

#ifndef WIN32
#include <sys/param.h>
#include <syslog.h>
#endif

#include "log.h"

#ifndef DEFAULT_CONFIG_FILE
#define DEFAULT_CONFIG_FILE		"/etc/auditd.conf"
#endif

#ifndef DEFAULT_MODULES_PATH
#define DEFAULT_MODULES_PATH		"/usr/local/lib/alat"
#endif

#ifndef DEFAULT_FACILITY
#define DEFAULT_FACILITY		LOG_DAEMON
#endif

#ifndef AUDITD_PID_FILE
#define AUDITD_PID_FILE			"/var/run/auditd.pid"
#endif

#ifndef DEFAULT_TIMEOUT
#define DEFAULT_TIMEOUT			10
#endif

#ifndef DEFAULT_COMMAND_TIMEOUT
#define DEFAULT_COMMAND_TIMEOUT		120
#endif

#ifndef DEFAULT_RESOURCES_MODULE
#define DEFAULT_RESOURCES_MODULE	"local"
#endif

#ifndef DEFAULT_ADDRESS
#define DEFAULT_ADDRESS			INADDR_ANY
#endif


/*
 * Auditd Options
 */
typedef struct {
	/* Private internal option */
	char pidfile[MAXPATHLEN];

	/* Public options */
	char confile[MAXPATHLEN];	/* Configuration file		*/
	LOGFLAGS flags;			/* Log flags			*/
	struct sockaddr_in addr;	/* Listen address and port	*/
/*	struct addrinfo *ai;		/ * XXX				*/
	char modpath[MAXPATHLEN];	/* Dynamic modules path		*/
	int sysfac;			/* Syslog facility		*/
	unsigned int timeout;		/* Timeout (in seconds)		*/
	unsigned int command_timeout;	/* Command timeout (in seconds)	*/
	int auth_modules;		/* Items on auth_list		*/
	char **auth_list;		/* Auth modules name list	*/
	int ia_modules;			/* Items on ia_list		*/
	char **ia_list;			/* Ia modules name list		*/
	char resmodule[MAXPATHLEN];	/* Resource module name		*/
} AUDITD_OPTIONS;


/*
 * Auditd options codes
 */
typedef enum {
	AOC_LOG_SESSION,
	AOC_LOG_DEBUG,
	AOC_LOG_VERBOSE,
	AOC_LOG_QUIET,
        AOC_SYSLOG_FACILITY,
        AOC_PORT,
	AOC_ADDRESS,
	AOC_CONFIG_FILE,
        AOC_MODULES_PATH,
	AOC_TIMEOUT,
	AOC_COMMAND_TIMEOUT,
        AOC_AUTH_MODULE,
        AOC_IA_MODULE,
	AOC_RESOURCE_MODULE,
} AUDITD_OPTIONS_CODES;


/*
 * Auditd configuration functions
 */
void	auditd_set_default_options (AUDITD_OPTIONS *);
int	auditd_load_configuration (AUDITD_OPTIONS *);
int	auditd_set_option (AUDITD_OPTIONS *, AUDITD_OPTIONS_CODES, char *);
void	auditd_release_options (AUDITD_OPTIONS *);


#endif
