/************************************************************************
 *
 * Nagios Main Header File
 * Written By: Ethan Galstad (nagios@nagios.org)
 * Last Modified: 08-07-2002
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 ************************************************************************/

#ifndef _NAGIOS_H
#define _NAGIOS_H

#include <stdio.h>
#include <stdlib.h>
#include "../common/locations.h"
#include "../common/common.h"
#include "../common/config.h"
#include "../common/objects.h"

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


#define MAX_COMMAND_ARGUMENTS			16	/* maximum number of $ARGx$ macros */
#define MAX_USER_MACROS				32	/* maximum number of $USERx$ macros */

#define MAX_STATE_LENGTH			32	/* length definitions used in macros */
#define MAX_STATETYPE_LENGTH			24
#define MAX_NOTIFICATIONTYPE_LENGTH		32
#define MAX_NOTIFICATIONNUMBER_LENGTH		8
#define MAX_ATTEMPT_LENGTH			8
#define MAX_EXECUTIONTIME_LENGTH		10
#define MAX_LATENCY_LENGTH			10

#define DEFAULT_LOG_LEVEL			1	/* log all events to main log file */
#define DEFAULT_USE_SYSLOG			1	/* log events to syslog? 1=yes, 0=no */
#define DEFAULT_SYSLOG_LEVEL			2	/* log only severe events to syslog */

#define DEFAULT_NOTIFICATION_LOGGING		1	/* log notification events? 1=yes, 0=no */

#define DEFAULT_INTER_CHECK_DELAY		5.0	/* seconds between initial service check scheduling */
#define DEFAULT_INTERLEAVE_FACTOR      		1       /* default interleave to use when scheduling checks */
#define DEFAULT_SLEEP_TIME      		1      	/* seconds between event run checks */
#define DEFAULT_INTERVAL_LENGTH 		60     	/* seconds per interval unit for check scheduling */
#define DEFAULT_RETRY_INTERVAL  		30	/* services are retried in 30 seconds if they're not OK */
#define DEFAULT_COMMAND_CHECK_INTERVAL		-1	/* interval to check for external commands (default = as often as possible) */
#define DEFAULT_SERVICE_REAPER_INTERVAL		10	/* interval in seconds to reap service check results */
#define DEFAULT_MAX_REAPER_TIME                 30      /* maximum number of seconds to spend reaping service checks before we break out for a while */
#define DEFAULT_MAX_PARALLEL_SERVICE_CHECKS 	0	/* maximum number of service checks we can have running at any given time (0=unlimited) */
#define DEFAULT_RETENTION_UPDATE_INTERVAL	60	/* minutes between auto-save of retention data */
#define DEFAULT_STATUS_UPDATE_INTERVAL		60	/* seconds between aggregated status data updates */
#define DEFAULT_FRESHNESS_CHECK_INTERVAL        60      /* seconds between service result freshness checks */

#define DEFAULT_NOTIFICATION_TIMEOUT		30	/* max time in seconds to wait for notification commands to complete */
#define DEFAULT_EVENT_HANDLER_TIMEOUT		30	/* max time in seconds to wait for event handler commands to complete */
#define DEFAULT_HOST_CHECK_TIMEOUT		30	/* max time in seconds to wait for host check commands to complete */
#define DEFAULT_SERVICE_CHECK_TIMEOUT		60	/* max time in seconds to wait for service check commands to complete */
#define DEFAULT_OCSP_TIMEOUT			15	/* max time in seconds to wait for obsessive compulsive processing commands to complete */
#define DEFAULT_PERFDATA_TIMEOUT                5       /* max time in seconds to wait for performance data commands to complete */
#define DEFAULT_TIME_CHANGE_THRESHOLD		900	/* compensate for time changes of more than 15 minutes */

#define DEFAULT_LOG_HOST_RETRIES		0	/* don't log host retries */
#define DEFAULT_LOG_SERVICE_RETRIES		0	/* don't log service retries */
#define DEFAULT_LOG_EVENT_HANDLERS		1	/* log event handlers */
#define DEFAULT_LOG_INITIAL_STATES		0	/* don't log initial service and host states */
#define DEFAULT_LOG_EXTERNAL_COMMANDS		1	/* log external commands */
#define DEFAULT_LOG_PASSIVE_CHECKS		1	/* log passive service checks */

#define DEFAULT_AGGRESSIVE_HOST_CHECKING	1	/* use "aggressive" host checking */
#define DEFAULT_CHECK_EXTERNAL_COMMANDS		0 	/* don't check for external commands */
#define DEFAULT_CHECK_ORPHANED_SERVICES		0	/* don't check for orphaned services */
#define DEFAULT_ENABLE_FLAP_DETECTION           0       /* don't enable flap detection */
#define DEFAULT_PROCESS_PERFORMANCE_DATA        0       /* don't process performance data */
#define DEFAULT_CHECK_SERVICE_FRESHNESS         1       /* check service result freshness */

#define DEFAULT_LOW_SERVICE_FLAP_THRESHOLD	20.0	/* low threshold for detection of service flapping */
#define DEFAULT_HIGH_SERVICE_FLAP_THRESHOLD	30.0	/* high threshold for detection of service flapping */
#define DEFAULT_LOW_HOST_FLAP_THRESHOLD		20.0	/* low threshold for detection of host flapping */
#define DEFAULT_HIGH_HOST_FLAP_THRESHOLD	30.0	/* high threshold for detection of host flapping */



/******************* LOGGING TYPES ********************/

#define NSLOG_RUNTIME_ERROR		1
#define NSLOG_RUNTIME_WARNING		2

#define NSLOG_VERIFICATION_ERROR	4
#define NSLOG_VERIFICATION_WARNING	8

#define NSLOG_CONFIG_ERROR		16
#define NSLOG_CONFIG_WARNING		32

#define NSLOG_PROCESS_INFO		64
#define NSLOG_EVENT_HANDLER		128
/*#define NSLOG_NOTIFICATION		256*/	/* NOT USED ANYMORE - CAN BE REUSED */
#define NSLOG_EXTERNAL_COMMAND		512

#define NSLOG_HOST_UP      		1024
#define NSLOG_HOST_DOWN			2048
#define NSLOG_HOST_UNREACHABLE		4096

#define NSLOG_SERVICE_OK		8192
#define NSLOG_SERVICE_UNKNOWN		16384
#define NSLOG_SERVICE_WARNING		32768
#define NSLOG_SERVICE_CRITICAL		65536

#define NSLOG_PASSIVE_CHECK		131072

#define NSLOG_INFO_MESSAGE		262144

#define NSLOG_HOST_NOTIFICATION		524288
#define NSLOG_SERVICE_NOTIFICATION	1048576


/******************** HOST STATUS *********************/

#define HOST_UP				0
#define HOST_DOWN			1
#define HOST_UNREACHABLE		2	


/************ SERVICE DEPENDENCY VALUES ***************/

#define DEPENDENCIES_OK			0
#define DEPENDENCIES_FAILED		1


/*********** ROUTE CHECK PROPAGATION TYPES ************/

#define PROPAGATE_TO_PARENT_HOSTS	1
#define PROPAGATE_TO_CHILD_HOSTS	2


/****************** SERVICE STATES ********************/

#define STATE_OK			0
#define STATE_WARNING			1
#define STATE_CRITICAL			2
#define STATE_UNKNOWN			3       /* changed from -1 on 02/24/2001 */



/******************* EVENT TYPES **********************/

#define EVENT_SERVICE_CHECK		0	/* service check */
#define EVENT_COMMAND_CHECK		1	/* external command check */
#define EVENT_LOG_ROTATION		2	/* log file rotation */
#define EVENT_PROGRAM_SHUTDOWN		3	/* program shutdown */
#define EVENT_PROGRAM_RESTART		4	/* program restart */
#define EVENT_ENABLE_NOTIFICATIONS	5	/* enable notifications */
#define EVENT_DISABLE_NOTIFICATIONS	6	/* disable notifications */
#define EVENT_SERVICE_REAPER		7	/* reaps results from service checks */
#define EVENT_ORPHAN_CHECK		8	/* checks for orphaned service checks */
#define EVENT_RETENTION_SAVE		9	/* save (dump) retention data */
#define EVENT_STATUS_SAVE		10	/* save (dump) status data */
#define EVENT_SCHEDULED_DOWNTIME	11	/* scheduled host or service downtime */
#define EVENT_FRESHNESS_CHECK           12      /* checks service result "freshness" */
#define EVENT_EXPIRE_DOWNTIME		13      /* checks for (and removes) expired scheduled downtime */


/******* INTER-CHECK DELAY CALCULATION TYPES **********/

#define ICD_NONE			0	/* no inter-check delay */
#define ICD_DUMB			1	/* dumb delay of 1 second */
#define ICD_SMART			2	/* smart delay */
#define ICD_USER			3       /* user-specified delay */


/******* INTERLEAVE FACTOR CALCULATION TYPES **********/

#define ILF_USER			0	/* user-specified interleave factor */
#define ILF_SMART			1	/* smart interleave */


/************** SERVICE CHECK OPTIONS *****************/

#define CHECK_OPTION_NONE		0	/* no check options */
#define CHECK_OPTION_FORCE_EXECUTION	1	/* force execution of a service check (ignores disabled services, invalid timeperiods) */


/************ SCHEDULED DOWNTIME TYPES ****************/

#define ACTIVE_DOWNTIME                 0       /* active downtime - currently in effect */
#define PENDING_DOWNTIME                1       /* pending downtime - scheduled for the future */


/************** DATE/TIME MACRO TYPES *****************/

#define MACRO_DATETIME_LONGDATE		0
#define MACRO_DATETIME_SHORTDATE	1
#define MACRO_DATETIME_DATE		2
#define MACRO_DATETIME_TIME		3
#define MACRO_DATETIME_TIMET		4
#define MACRO_DATETIME_LASTCHECK	5  	/* time_t format */
#define MACRO_DATETIME_LASTSTATECHANGE	6	/* time_t format */


/************* MACRO CLEANING OPTIONS *****************/

#define STRIP_ILLEGAL_MACRO_CHARS       1
#define ESCAPE_MACRO_CHARS              2



/****************** DATA STRUCTURES *******************/

/* TIMED_EVENT structure */
typedef struct timed_event_struct{
	int event_type;
	int recurring;
	void *event_data;
	time_t run_time;
        struct timed_event_struct *next;
        }timed_event;


/* NOTIFY_LIST structure */
typedef struct notify_list_struct{
	contact *contact;
	struct notify_list_struct *next;
        }notification;


/* SERVICE_MESSAGE structure */
typedef struct service_message_struct{
	char host_name[MAX_HOSTNAME_LENGTH];		/* host name */
	char description[MAX_SERVICEDESC_LENGTH];	/* service description */
	int return_code;				/* plugin return code */
	int exited_ok;					/* did the plugin check return okay? */
	int check_type;					/* was this an active or passive service check? */
	int parallelized;                               /* was this check run in parallel? */
	time_t check_time;				/* time the service was checked */
	time_t finish_time;				/* time the service check completed */
	char output[MAX_PLUGINOUTPUT_LENGTH];		/* plugin output */
	}service_message;


/* SCHED_INFO structure */
typedef struct sched_info_struct{
	int total_services;
	int total_hosts;
	double average_services_per_host;
	unsigned long check_interval_total;
	double average_check_interval;
	double average_inter_check_delay;
	double inter_check_delay;
	int interleave_factor;
	time_t first_service_check;
	time_t last_service_check;
        }sched_info;


/* PASSIVE_CHECK_RESULT structure */
typedef struct passive_check_result_struct{
	char *host_name;
	char *svc_description;
	int return_code;
	char *output;
	time_t check_time;
	struct passive_check_result_struct *next;
	}passive_check_result;


/* SCHEDULED_DOWNTIME_ENTRY structure */
typedef struct scheduled_downtime_entry_struct{
	int type;
	void *object;
	time_t start_time;
	time_t end_time;
	int is_in_effect;
	int fixed;
	unsigned long duration;
	int comment_id;
	}scheduled_downtime_entry;


/******************** FUNCTIONS **********************/

/**** Configuration Functions ****/
int read_all_config_data(char *);			/* top-level function for reading all config data */
int read_main_config_file(char *);                     	/* reads the main config file (nagios.cfg) */
int read_resource_file(char *);				/* processes macros in resource file */


/**** Setup Functions ****/
int pre_flight_check(void);                          	/* try and verify the configuration data */
void calculate_inter_check_delay(void);              	/* calculate the inter check delay to use when scheduling services */
void calculate_interleave_factor(void);			/* calculate interleave factor for spreading out service checks */
void init_timing_loop(void);                         	/* setup the initial scheduling queue */
void setup_sighandler(void);                         	/* trap signals */
void reset_sighandler(void);                         	/* reset signals to default action */
int daemon_init(void);				     	/* switches to daemon mode */
int drop_privileges(char *,char *);			/* drops priveleges before startup */
void display_scheduling_info(void);			/* displays service check scheduling information */
void display_xdata_modules(void);			/* displays which external data modules are compiled in */


/**** IPC Functions ****/
int read_svc_message(service_message *);		/* reads a service check message from the message pipe */
int write_svc_message(service_message *);		/* writes a service check message to the message pipe */
int open_command_file(void);				/* creates the external command file as a named pipe (FIFO) and opens it for reading */
int close_command_file(void);				/* closes and deletes the external command file (FIFO) */


/**** Monitoring/Event Handler Functions ****/
void schedule_event(timed_event *,timed_event **);   	/* schedule or reschedule an event */
void remove_event(timed_event *,timed_event **);     	/* remove and event from the execution queue */
int event_execution_loop(void);                      	/* main monitoring/event handler loop */
int handle_timed_event(timed_event *);		     	/* top level handler for timed events */
void run_service_check(service *);			/* parallelized service check routine */
void reap_service_checks(void);				/* handles results from service checks */
int check_service_dependencies(service *,int);          /* checks service dependencies */
int check_host_dependencies(host *,int);                /* checks host dependencies */
void check_for_orphaned_services(void);			/* checks for orphaned services */
void check_service_result_freshness(void);              /* checks the "freshness" of service check results */
int my_system(char *,int,int *,char *,int);            	/* executes a command via popen(), but also protects against timeouts */
void compensate_for_system_time_change(unsigned long,unsigned long);	/* attempts to compensate for a change in the system time */


/**** Flap Detection Functions ****/
void check_for_service_flapping(service *);		/* determines whether or not a service is "flapping" between states */
void check_for_host_flapping(host *);			/* determines whether or not a host is "flapping" between states */
void set_service_flap(service *,double,double);		/* handles a service that is flapping */
void clear_service_flap(service *,double,double);	/* handles a service that has stopped flapping */
void set_host_flap(host *,double,double);		/* handles a host that is flapping */
void clear_host_flap(host *,double,double);		/* handles a host that has stopped flapping */
void enable_flap_detection_routines(void);		/* enables flap detection on a program-wide basis */
void disable_flap_detection_routines(void);		/* disables flap detection on a program-wide basis */
void enable_host_flap_detection(host *);		/* enables flap detection for a particular host */
void disable_host_flap_detection(host *);		/* disables flap detection for a particular host */
void enable_service_flap_detection(service *);		/* enables flap detection for a particular service */
void disable_service_flap_detection(service *);		/* disables flap detection for a particular service */


/**** Route/Host Check Functions ****/
int verify_route_to_host(host *);                    	/* checks if a host is up, down, or unreachable */
int check_host(host *,int);                            	/* checks if a host is up or down */
int run_host_check(host *);                             /* runs a host check */
int handle_host_state(host *,int,int);               	/* top level host state handler */


/**** Event Handler Functions ****/
int obsessive_compulsive_service_check_processor(service *,int);	/* distributed monitoring craziness... */
int handle_service_event(service *,int);			/* top level service event logic */
int run_service_event_handler(service *,command *,int);		/* runs the event handler for a specific service */
int run_global_service_event_handler(service *,int);		/* runs the global service event handler */
int handle_host_event(host *,int,int);				/* top level host event logic */
int run_host_event_handler(host *,command *,int,int);		/* runs the event handler for a specific host */
int run_global_host_event_handler(host *,int,int);		/* runs the global host event handler */
void update_service_state_times(service *);	     	     	/* updates service state times */
void update_host_state_times(host *);	     	     	     	/* updates host state times */


/**** Notification Functions ****/
int check_service_notification_viability(service *,char *);		/* checks viability of notifying all contacts about a service */
int is_valid_escalation_for_service_notification(service *,serviceescalation *);	/* checks if an escalation entry is valid for a particular service notification */
int should_service_notification_be_escalated(service *);		/* checks if a service notification should be escalated */
int service_notification(service *,char *);                        	/* notify all contacts about a service (problem or recovery) */
int check_contact_service_notification_viability(contact *, service *);	/* checks viability of notifying a contact about a service */ 
int notify_contact_of_service(contact *,service *,char *);        	/* notify a single contact about a service */
int check_host_notification_viability(host *,int,char *);		/* checks viability of notifying all contacts about a host */
int is_valid_host_escalation_for_host_notification(host *,int,hostescalation *);	/* checks if an escalation entry is valid for a particular host notification */
int is_valid_hostgroup_escalation_for_host_notification(host *,int,hostgroupescalation *);	/* checks if an escalation entry is valid for a particular host notification */
int should_host_notification_be_escalated(host *,int);			/* checks if a host notification should be escalated */
int host_notification(host *,int, char *);                           	/* notify all contacts about a host (problem or recovery) */
int check_contact_host_notification_viability(contact *, host *, int);	/* checks viability of notifying a contact about a host */ 
int notify_contact_of_host(contact *,host *,int, char *);            	/* notify a single contact about a host */
int create_notification_list_from_host(host *,int);             	/* given a host, create list of contacts to be notified (remove duplicates) */
int create_notification_list_from_service(service *);        	/* given a service, create list of contacts to be notified (remove duplicates) */
int add_notification(contact *);				/* adds a notification instance */
notification * find_notification(char *);			/* finds a notification object */
time_t get_next_host_notification_time(host *,int,time_t);	/* calculates nex acceptable re-notification time for a host */
time_t get_next_service_notification_time(service *,time_t);	/* calculates nex acceptable re-notification time for a service */


/**** Logging Functions ****/
int write_to_logs_and_console(char *,unsigned long,int);
int write_to_log(char *,unsigned long);                	/* write a string to the main log file */
int write_to_syslog(char *,unsigned long);             	/* write a string to the syslog facility */
int log_service_event(service *,int);			/* logs a service event */
int log_host_event(host *,int,int);			/* logs a host event */
int rotate_log_file(time_t);			     	/* rotates the main log file */


/**** Cleanup Functions ****/
void cleanup(void);                                  	/* cleanup after ourselves (before quitting or restarting) */
void free_memory(void);                              	/* free memory allocated to all linked lists in memory */
int reset_variables(void);                           	/* reset all global variables */
void free_notification_list(void);		     	/* frees all memory allocated to the notification list */


/**** Miscellaneous Functions ****/
void sighandler(int);                                	/* handles signals */
void service_check_sighandler(int);                     /* handles timeouts when executing service checks */
void my_system_sighandler(int);				/* handles timeouts when executing commands via my_system() */
void file_lock_sighandler(int);				/* handles timeouts while waiting for file locks */
void strip(char *);                                  	/* strips whitespace from string */  
char *my_strtok(char *,char *);                      	/* my replacement for strtok() function (doesn't skip consecutive tokens) */
char *my_strsep(char **,const char *);		     	/* Solaris doesn't have strsep(), so I took this from the glibc source code */
int contains_illegal_object_chars(char *);		/* tests whether or not an object name (host, service, etc.) contains illegal characters */
int my_rename(char *,char *);                           /* renames a file - works across filesystems */
void get_raw_command_line(char *,char *,int);        	/* given a raw command line, determine the actual command to run */
int check_time_against_period(time_t,char *);		/* check to see if a specific time is covered by a time period */
void get_next_valid_time(time_t, time_t *,char *);	/* get the next valid time in a time period */
void get_datetime_string(time_t *,char *,int,int);	/* get a date/time string for use in output */
void get_next_log_rotation_time(time_t *);	     	/* determine the next time to schedule a log rotation */


/**** Macro Functions ****/
int process_macros(char *,char *,int,int);             	/* replace macros with their actual values */
char *clean_macro_chars(char *,int);                    /* cleans macros characters before insertion into output string */
int grab_service_macros(service *);                  	/* updates the service macro data */
int grab_host_macros(host *);                        	/* updates the host macro data */
int grab_contact_macros(contact *);                  	/* updates the contact macro data */
int grab_datetime_macros(void);				/* updates date/time macros */
int clear_volatile_macros(void);                     	/* clear all "volatile" macros that change between service/host checks */
int clear_nonvolatile_macros(void);                  	/* clear all "nonvolatile" macros which remain relatively constant */


/**** External Command Functions ****/
void check_for_external_commands(void);			/* checks for any external commands */
void process_external_command(int,time_t,char *);	/* process an external command */


/**** External Command Implementations ****/
int cmd_add_comment(int,time_t,char *);			/* add a service or host comment */
int cmd_delete_comment(int,char *);			/* delete a service or host comment */
int cmd_delete_all_comments(int,char *);		/* delete all comments associated with a host or service */
int cmd_delay_notification(int,char *);			/* delay a service or host notification */
int cmd_schedule_service_check(int,char *,int);		/* schedule an immediate or delayed service check */
int cmd_schedule_host_service_checks(int,char *,int);	/* schedule an immediate or delayed check of all services on a host */
int cmd_enable_disable_service_check(int,char *);			/* enable/disable a service check */
int cmd_enable_disable_host_service_checks(int,char *);			/* enable/disable all service checks associated with a host */
int cmd_signal_process(int,char *);					/* schedules a program shutdown or restart */
int cmd_enable_disable_notifications(int,char *);			/* enables/disables notifications */
int cmd_enable_disable_service_notifications(int,char *);		/* enables/disables notifications for a service */
int cmd_enable_disable_host_notifications(int,char *);			/* enables/disables notifications for a host */
int cmd_enable_disable_and_propagate_notifications(int, char *);	/* enables/disables notifications for all hosts and services beyond a given host */
int cmd_process_service_check_result(int,time_t,char *);		/* processes a passive service check */
int cmd_enable_disable_host_service_notifications(int,char *);		/* enables/disables notifications for all services on a host */
int cmd_acknowledge_problem(int,char *);			/* acknowledges a host or service problem */
int cmd_remove_acknowledgement(int,char *);			/* removes a host or service acknowledgement */
int cmd_start_stop_executing_service_checks(int);		/* starts or stops executing service checks */
int cmd_start_stop_accepting_passive_checks(int);		/* starts or stops accepting passive service check results */
int cmd_enable_disable_passive_service_checks(int,char *);	/* enables/disables passive checks for a particular service */
int cmd_enable_disable_service_event_handler(int,char *);	/* enables/disables the event handler for a particular service */
int cmd_enable_disable_host_event_handler(int,char *);		/* enables/disables the event handler for a particular host */
int cmd_enable_disable_host_check(int,char *);			/* enables/disables checks of a particular host */
int cmd_start_stop_obsessing_over_service_checks(int);		/* start/stop obsessing about service check results */
int cmd_schedule_downtime(int,time_t,char *);                   /* schedules host or service downtime */
int cmd_enable_disable_host_flap_detection(int, char *);	/* enables/disables flap detection for a particular host */
int cmd_enable_disable_service_flap_detection(int, char *);	/* enables/disables flap detection for a particular service */
int cmd_delete_downtime(int, char *);				/* cancels active/pending host or service scheduled downtime */
int cmd_schedule_host_service_downtime(int,time_t,char *);      /* schedules downtimes for all services on a particular host */


/**** Internal Command Implementations ****/
void disable_service_check(service *);			/* disables a service check */
void enable_service_check(service *);			/* enables a service check */
void schedule_service_check(service *,time_t,int);	/* schedules an immediate or delayed service check */
void enable_all_notifications(void);                    /* enables notifications on a program-wide basis */
void disable_all_notifications(void);                   /* disables notifications on a program-wide basis */
void enable_service_notifications(service *);		/* enables service notifications */
void disable_service_notifications(service *);		/* disables service notifications */
void enable_host_notifications(host *);			/* enables host notifications */
void disable_host_notifications(host *);		/* disables host notifications */
void enable_and_propagate_notifications(host *);	/* enables notifications for all hosts and services beyond a given host */
void disable_and_propagate_notifications(host *);	/* disables notifications for all hosts and services beyond a given host */
void acknowledge_host_problem(host *,char *,int);	/* acknowledges a host problem */
void acknowledge_service_problem(service *,char *,int);	/* acknowledges a service problem */
void remove_host_acknowledgement(host *);		/* removes a host acknowledgement */
void remove_service_acknowledgement(service *);		/* removes a service acknowledgement */
void start_executing_service_checks(void);		/* starts executing service checks */
void stop_executing_service_checks(void);		/* stops executing service checks */
void start_accepting_passive_service_checks(void);	/* starts accepting passive service check results */
void stop_accepting_passive_service_checks(void);	/* stops accepting passive service check results */
void enable_passive_service_checks(service *);	        /* enables passive service checks for a particular service */
void disable_passive_service_checks(service *);         /* disables passive service checks for a particular service */
void start_using_event_handlers(void);			/* enables event handlers on a program-wide basis */
void stop_using_event_handlers(void);			/* disables event handlers on a program-wide basis */
void enable_service_event_handler(service *);		/* enables the event handler for a particular service */
void disable_service_event_handler(service *);		/* disables the event handler for a particular service */
void enable_host_event_handler(host *);			/* enables the event handler for a particular host */
void disable_host_event_handler(host *);		/* disables the event handler for a particular host */
void enable_host_check(host *);				/* enables checks of a particular host */
void disable_host_check(host *);			/* disables checks of a particular host */
void start_obsessing_over_service_checks(void);		/* start obsessing about service check results */
void stop_obsessing_over_service_checks(void);		/* stop obsessing about service check results */
void process_passive_service_checks(void);              /* processes passive service check results */
void enable_all_failure_prediction(void);               /* enables failure prediction on a program-wide basis */
void disable_all_failure_prediction(void);              /* disables failure prediction on a program-wide basis */
void enable_performance_data(void);                     /* enables processing of performance data on a program-wide basis */
void disable_performance_data(void);                    /* disables processing of performance data on a program-wide basis */

#endif

