/************************************************************************
 *
 * Icinga Config Header File
 *
 * Copyright (c) 1999-2009 Ethan Galstad (egalstad@nagios.org)
 * Copyright (c) 2009-2013 Nagios Core Development Team and Community Contributors
 * Copyright (c) 2009-2013 Icinga Development Team (http://www.icinga.org)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 ************************************************************************/


/***** ICINGA STUFF *****/

#define DEFAULT_ICINGA_USER icinga
#define DEFAULT_ICINGA_GROUP icinga

/* stop gcc from bitching about implicit asprintf declarations */
#define _GNU_SOURCE 1

/* Event broker integration */
#undef USE_EVENT_BROKER

/* Embed a PERL interpreter into Nagios with optional cache for compiled code (contributed by Stephen Davies) */
#undef EMBEDDEDPERL
#undef THREADEDPERL
/* 0 = cache, 1 = do not cache */
#define DO_CLEAN		"1"

/* commands used by CGIs */
#undef TRACEROUTE_COMMAND
#undef PING_COMMAND
#undef PING_PACKETS_FIRST

/* Debugging options */
/* function entry and exit */
#undef DEBUG0
/* general info messages */
#undef DEBUG1
/* warning messages */
#undef DEBUG2
/* service and host checks, other events */
#undef DEBUG3
/* service and host notifications */
#undef DEBUG4
/* SQL queries (defunct) */
#undef DEBUG5

/* I/O implementations */
#undef USE_XSDDEFAULT
#undef USE_XCDDEFAULT
#undef USE_XRDDEFAULT
#undef USE_XODTEMPLATE
#undef USE_XPDDEFAULT
#undef USE_XDDDEFAULT

/***** CGI COMPILE OPTIONS *****/
/* should we compile and use the statusmap CGI? */
#undef USE_STATUSMAP
/* should we compile and use the trends CGI? */
#undef USE_TRENDS
/* should we compile and use the histogram CGI? */
#undef USE_HISTOGRAM


/***** FUNCTION DEFINITIONS *****/

#undef HAVE_SETENV
#undef HAVE_UNSETENV
#undef HAVE_SOCKET
#undef HAVE_STRDUP
#undef HAVE_STRSTR
#undef HAVE_STRTOUL
#undef HAVE_INITGROUPS
#undef HAVE_GETLOADAVG
#undef HAVE_GDIMAGECREATETRUECOLOR



/***** ASPRINTF() AND FRIENDS *****/

#undef HAVE_VSNPRINTF
#undef HAVE_SNPRINTF
#undef HAVE_ASPRINTF
#undef HAVE_VASPRINTF
#undef HAVE_C99_VSNPRINTF
#undef HAVE_VA_COPY
#undef HAVE___VA_COPY



/***** MISC DEFINITIONS *****/

#undef USE_NANOSLEEP
#undef STDC_HEADERS
#undef HAVE_TM_ZONE
#undef HAVE_TZNAME
#undef USE_PROC
#define SOCKET_SIZE_TYPE ""
#define GETGROUPS_T ""
#define RETSIGTYPE ""



/***** HEADER FILES *****/

#include <stdio.h>
#include <stdlib.h>

/* needed for the time_t structures we use later... */
/* this include must come before sys/resource.h or we can have problems on some OSes */
#undef TIME_WITH_SYS_TIME
#undef HAVE_SYS_TIME_H
#if TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif

#undef HAVE_SYS_RESOURCE_H
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif

#undef HAVE_LIMITS_H
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif

#undef HAVE_PWD_H
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
 
#undef HAVE_GRP_H
#ifdef HAVE_GRP_H
#include <grp.h>
#endif

#undef HAVE_STRINGS_H
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif

#undef HAVE_STRING_H
#ifdef HAVE_STRINGS_H
#include <string.h>
#endif

#undef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

#undef HAVE_SYSLOG_H
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif

#undef HAVE_SIGNAL_H
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif

#undef HAVE_SYS_STAT_H
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif

#undef HAVE_SYS_MMAN_H
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif

#undef HAVE_FCNTL_H
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif

#undef HAVE_STDARG_H
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif

#undef HAVE_STDINT_H
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif

#undef HAVE_SYS_TYPES_H
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif

#undef HAVE_SYS_WAIT_H
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif

#undef HAVE_ERRNO_H
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif

#undef HAVE_SYS_TIMEB_H
#if HAVE_SYS_TIMEB_H
#include <sys/timeb.h>
#endif

#undef HAVE_SYS_IPC_H
#ifdef HAVE_SYS_IPC_H
#include <sys/ipc.h>
#endif

#undef HAVE_SYS_MSG_H
#ifdef HAVE_SYS_MSG_H
#include <sys/msg.h>
#endif

#undef HAVE_MATH_H
#ifdef HAVE_MATH_H
#include <math.h>
#endif

#undef HAVE_CTYPE_H
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif

#undef HAVE_DIRENT_H
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif

#undef HAVE_PTHREAD_H
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif

#undef HAVE_REGEX_H
#ifdef HAVE_REGEX_H
#include <regex.h>

#undef HAVE_SYS_SOCKET_H
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif

#undef HAVE_SYS_SELECT_H
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif

#undef HAVE_SOCKET
#ifdef HAVE_SOCKET_H
#include <socket.h>
#endif

#undef HAVE_NETINET_IN_H
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

#undef HAVE_ARPA_INET_H
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif

#undef HAVE_NETDB_H
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif

#undef HAVE_LIBGEN_H
#ifdef HAVE_LIBGEN_H
#include <libgen.h>
#endif

#undef HAVE_SYS_UN_H
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif

#undef HAVE_SYS_POLL_H
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif

#undef HAVE_GETOPT_H
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif

#undef HAVE_LINUX_MODULE_H
#ifdef HAVE_LINUX_MODULE_H
#include <linux/module.h>
#endif

#undef HAVE_SSL
#ifdef HAVE_SSL
#include <rsa.h>
#include <crypto.h>
#include <dh.h>
#include <pem.h>
#include <ssl.h>
#include <err.h>
#include <rand.h>
#endif


/* configure script should allow user to override ltdl choice, but this will do for now... */
#undef USE_LTDL
#undef HAVE_LTDL_H
#ifdef HAVE_LTDL_H
#define USE_LTDL
#endif

#ifdef USE_LTDL
#include <ltdl.h>
#else
#undef HAVE_DLFCN_H
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#endif


/* moved to end to prevent AIX compiler warnings */
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif

#ifndef RTLD_NOW
#define RTLD_NOW 0
#endif


/***** MARO DEFINITIONS *****/

/* this needs to come after all system include files, so we don't accidentally attempt to redefine it */
#ifndef WEXITSTATUS
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
#endif
#ifndef WIFEXITED
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#endif

/* Define to 1 if you have the <dbi/dbi.h> header file. */
#undef HAVE_DBI_DBI_H
#undef USE_LIBDBI

/* define to 1 if you have the libpq-fe.h header file. */
#undef HAVE_LIBPQ_FE_H
#undef USE_PGSQL

/* oracle */
#undef USE_ORACLE
#undef HAVE_ORACLE
#ifdef USE_ORACLE
#define HAVE_ORACLE 1
#endif

/* Environment Prefix */
#undef USE_NAGIOS_ENV
#ifdef USE_NAGIOS_ENV
#define ENV_PREFIX	"NAGIOS_"
#else
#define ENV_PREFIX	"ICINGA_"
#endif

/*snprintf workaround*/
#undef SNPRINTF_BROKEN
#include "snprintf.h"
#endif
