include/objects.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  *
00003  * OBJECTS.H - Header file for object addition/search functions
00004  *
00005  * Copyright (c) 1999-2009 Ethan Galstad (egalstad@nagios.org)
00006  * Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
00007  * Copyright (c) 2009-2011 Icinga Development Team (http://www.icinga.org)
00008  *
00009  * License:
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License version 2 as
00013  * published by the Free Software Foundation.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00023  *
00024  *****************************************************************************/
00025 
00026 
00027 #ifndef _OBJECTS_H
00028 #define _OBJECTS_H
00029 
00030 #include "config.h"
00031 #include "common.h"
00032 
00033 #ifdef __cplusplus
00034   extern "C" {
00035 #endif
00036 
00037 
00038 
00039 /*************** CURRENT OBJECT REVISION **************/
00040 
00041 #define CURRENT_OBJECT_STRUCTURE_VERSION        307     /* increment when changes are made to data structures... */
00042                                                         /* Nagios 3 starts at 300, Nagios 4 at 400, etc. */
00043 
00044 
00045 
00046 /***************** OBJECT SIZE LIMITS *****************/
00047 
00048 #define MAX_STATE_HISTORY_ENTRIES               21      /* max number of old states to keep track of for flap detection */
00049 #define MAX_CONTACT_ADDRESSES                   6       /* max number of custom addresses a contact can have */
00050 
00051 
00052 
00053 /***************** SKIP LISTS ****************/
00054 
00055 #define NUM_OBJECT_SKIPLISTS                   12
00056 
00057 #define HOST_SKIPLIST                          0
00058 #define SERVICE_SKIPLIST                       1
00059 #define COMMAND_SKIPLIST                       2
00060 #define TIMEPERIOD_SKIPLIST                    3
00061 #define CONTACT_SKIPLIST                       4
00062 #define CONTACTGROUP_SKIPLIST                  5
00063 #define HOSTGROUP_SKIPLIST                     6
00064 #define SERVICEGROUP_SKIPLIST                  7
00065 #define HOSTDEPENDENCY_SKIPLIST                8
00066 #define SERVICEDEPENDENCY_SKIPLIST             9
00067 #define HOSTESCALATION_SKIPLIST                10
00068 #define SERVICEESCALATION_SKIPLIST             11
00069 
00070 /****************** DEFINITIONS *******************/
00071 /*#define VOLATILE_FALSE 0 - uses FALSE*/
00072 /*#define VOLATILE_TRUE  1 - uses TRUE */
00073 #define VOLATILE_WITH_RENOTIFICATION_INTERVAL 2
00074 
00075 
00076 /******** escalation condition connectors ******/
00077 #define EC_CONNECTOR_NO                   0
00078 #define EC_CONNECTOR_OR                   1
00079 #define EC_CONNECTOR_AND                  2
00080 
00081 /****************** DATA STRUCTURES *******************/
00082 
00083 typedef struct host_struct host;
00084 typedef struct service_struct service;
00085 typedef struct contact_struct contact;
00086 
00087 /* OBJECT LIST STRUCTURE */
00088 typedef struct objectlist_struct{
00089         void      *object_ptr;
00090         struct objectlist_struct *next;
00091         }objectlist;
00092 
00093 
00094 /* TIMERANGE structure */
00095 typedef struct timerange_struct{
00096         unsigned long range_start;
00097         unsigned long range_end;
00098         struct timerange_struct *next;
00099         }timerange;
00100 
00101 
00102 /* DATERANGE structure */
00103 typedef struct daterange_struct{
00104         int type;
00105         int syear;          /* start year */
00106         int smon;           /* start month */
00107         int smday;          /* start day of month (may 3rd, last day in feb) */
00108         int swday;          /* start day of week (thursday) */
00109         int swday_offset;   /* start weekday offset (3rd thursday, last monday in jan) */
00110         int eyear;
00111         int emon;
00112         int emday;
00113         int ewday;
00114         int ewday_offset;
00115         int skip_interval;
00116         timerange *times;
00117         struct daterange_struct *next;
00118         }daterange;
00119 
00120 
00121 /* TIMEPERIODEXCLUSION structure */
00122 typedef struct timeperiodexclusion_struct{
00123         char  *timeperiod_name;
00124         struct timeperiod_struct *timeperiod_ptr;
00125         struct timeperiodexclusion_struct *next;
00126         }timeperiodexclusion;
00127 
00128 
00129 /* TIMEPERIOD structure */
00130 typedef struct timeperiod_struct{
00131         char    *name;
00132         char    *alias;
00133         timerange *days[7];
00134         daterange *exceptions[DATERANGE_TYPES];
00135         timeperiodexclusion *exclusions;
00136         struct  timeperiod_struct *next;
00137         struct  timeperiod_struct *nexthash;
00138         }timeperiod;
00139 
00140 
00141 /* CONTACTSMEMBER structure */
00142 typedef struct contactsmember_struct{
00143         char    *contact_name;
00144 #ifdef NSCORE
00145         contact *contact_ptr;
00146 #endif
00147         struct  contactsmember_struct *next;
00148         }contactsmember;
00149 
00150 
00151 /* CONTACTGROUP structure */
00152 typedef struct contactgroup_struct{
00153         char    *group_name;
00154         char    *alias;
00155         contactsmember *members;
00156         struct  contactgroup_struct *next;
00157         struct  contactgroup_struct *nexthash;
00158         }contactgroup;
00159 
00160 
00161 /* CONTACTGROUPSMEMBER structure */
00162 typedef struct contactgroupsmember_struct{
00163         char    *group_name;
00164 #ifdef NSCORE
00165         contactgroup *group_ptr;
00166 #endif
00167         struct contactgroupsmember_struct *next;
00168         }contactgroupsmember;
00169 
00170 
00171 /* CUSTOMVARIABLESMEMBER structure */
00172 typedef struct customvariablesmember_struct{
00173         char    *variable_name;
00174         char    *variable_value;
00175         int     has_been_modified;
00176         struct customvariablesmember_struct *next;
00177         }customvariablesmember;
00178 
00179 
00180 /* COMMAND structure */
00181 typedef struct command_struct{
00182         char    *name;
00183         char    *command_line;
00184         struct command_struct *next;
00185         struct command_struct *nexthash;
00186         }command;
00187 
00188 
00189 /* COMMANDSMEMBER structure */
00190 typedef struct commandsmember_struct{
00191         char    *command;
00192 #ifdef NSCORE
00193         command *command_ptr;
00194 #endif
00195         struct  commandsmember_struct *next;
00196         }commandsmember;
00197 
00198 
00199 /* CONTACT structure */
00200 struct contact_struct{
00201         char    *name;
00202         char    *alias;
00203         char    *email;
00204         char    *pager;
00205         char    *address[MAX_CONTACT_ADDRESSES];
00206         commandsmember *host_notification_commands;
00207         commandsmember *service_notification_commands;  
00208         int     notify_on_service_unknown;
00209         int     notify_on_service_warning;
00210         int     notify_on_service_critical;
00211         int     notify_on_service_recovery;
00212         int     notify_on_service_flapping;
00213         int     notify_on_service_downtime;
00214         int     notify_on_host_down;
00215         int     notify_on_host_unreachable;
00216         int     notify_on_host_recovery;
00217         int     notify_on_host_flapping;
00218         int     notify_on_host_downtime;
00219         char    *host_notification_period;
00220         char    *service_notification_period;
00221         int     host_notifications_enabled;
00222         int     service_notifications_enabled;
00223         int     can_submit_commands;
00224         int     retain_status_information;
00225         int     retain_nonstatus_information;
00226         customvariablesmember *custom_variables;
00227 #ifdef NSCORE
00228         time_t  last_host_notification;
00229         time_t  last_service_notification;
00230         unsigned long modified_attributes;
00231         unsigned long modified_host_attributes;
00232         unsigned long modified_service_attributes;
00233 
00234         timeperiod *host_notification_period_ptr;
00235         timeperiod *service_notification_period_ptr;
00236         objectlist *contactgroups_ptr;
00237 #endif
00238         struct  contact_struct *next;
00239         struct  contact_struct *nexthash;
00240         };
00241 
00242 
00243 /* SERVICESMEMBER structure */
00244 typedef struct servicesmember_struct{
00245         char    *host_name;
00246         char    *service_description;
00247 #ifdef NSCORE
00248         service *service_ptr;
00249 #endif
00250         struct servicesmember_struct *next;
00251         }servicesmember;
00252 
00253 
00254 /* HOSTSMEMBER structure */
00255 typedef struct hostsmember_struct{
00256         char    *host_name;
00257 #ifdef NSCORE
00258         host    *host_ptr;
00259 #endif
00260         struct hostsmember_struct *next;
00261         }hostsmember;
00262 
00263 
00264 /* HOSTGROUP structure */
00265 typedef struct hostgroup_struct{
00266         char    *group_name;
00267         char    *alias;
00268         hostsmember *members;
00269         char    *notes;
00270         char    *notes_url;
00271         char    *action_url;
00272         struct  hostgroup_struct *next;
00273         struct  hostgroup_struct *nexthash;
00274         }hostgroup;
00275 
00276 
00277 /* HOST structure */
00278 struct host_struct{
00279         char    *name;
00280         char    *display_name;
00281         char    *alias;
00282         char    *address;
00283         hostsmember *parent_hosts;
00284         hostsmember *child_hosts;
00285         servicesmember *services;
00286         char    *host_check_command;
00287         int     initial_state;
00288         double  check_interval;
00289         double  retry_interval;
00290         int     max_attempts;
00291         char    *event_handler;
00292         contactgroupsmember *contact_groups;
00293         contactsmember *contacts;
00294         double  notification_interval;
00295         double  first_notification_delay;
00296         int     notify_on_down;
00297         int     notify_on_unreachable;
00298         int     notify_on_recovery;
00299         int     notify_on_flapping;
00300         int     notify_on_downtime;
00301         char    *notification_period;
00302         char    *check_period;
00303         int     flap_detection_enabled;
00304         double  low_flap_threshold;
00305         double  high_flap_threshold;
00306         int     flap_detection_on_up;
00307         int     flap_detection_on_down;
00308         int     flap_detection_on_unreachable;
00309         int     stalk_on_up;
00310         int     stalk_on_down;
00311         int     stalk_on_unreachable;
00312         int     check_freshness;
00313         int     freshness_threshold;
00314         int     process_performance_data;
00315         int     checks_enabled;
00316         int     accept_passive_host_checks;
00317         int     event_handler_enabled;
00318         int     retain_status_information;
00319         int     retain_nonstatus_information;
00320         int     failure_prediction_enabled;
00321         char    *failure_prediction_options;
00322         int     obsess_over_host;
00323         char    *notes;
00324         char    *notes_url;
00325         char    *action_url;
00326         char    *icon_image;
00327         char    *icon_image_alt;
00328         char    *vrml_image;
00329         char    *statusmap_image;
00330         int     have_2d_coords;
00331         int     x_2d;
00332         int     y_2d;
00333         int     have_3d_coords;
00334         double  x_3d;
00335         double  y_3d;
00336         double  z_3d;
00337         int     should_be_drawn;
00338         customvariablesmember *custom_variables;
00339 #ifdef NSCORE
00340         int     problem_has_been_acknowledged;
00341         int     acknowledgement_type;
00342         int     check_type;
00343         int     current_state;
00344         int     last_state;
00345         int     last_hard_state;
00346         char    *plugin_output;
00347         char    *long_plugin_output;
00348         char    *perf_data;
00349         int     state_type;
00350         int     current_attempt;
00351         unsigned long current_event_id;
00352         unsigned long last_event_id;
00353         unsigned long current_problem_id;
00354         unsigned long last_problem_id;
00355         double  latency;
00356         double  execution_time;
00357         int     is_executing;
00358         int     check_options;
00359         int     notifications_enabled;
00360         time_t  last_host_notification;
00361         time_t  next_host_notification;
00362         time_t  next_check;
00363         int     should_be_scheduled;
00364         time_t  last_check;
00365         time_t  last_state_change;
00366         time_t  last_hard_state_change;
00367         time_t  last_time_up;
00368         time_t  last_time_down;
00369         time_t  last_time_unreachable;
00370         int     has_been_checked;
00371         int     is_being_freshened;
00372         int     notified_on_down;
00373         int     notified_on_unreachable;
00374         int     current_notification_number;
00375 #ifdef USE_ST_BASED_ESCAL_RANGES
00376         int     current_down_notification_number;
00377         int     current_unreachable_notification_number;
00378 #endif
00379         int     no_more_notifications;
00380         unsigned long current_notification_id;
00381         int     check_flapping_recovery_notification;
00382         int     scheduled_downtime_depth;
00383         int     pending_flex_downtime;
00384         int     state_history[MAX_STATE_HISTORY_ENTRIES];    /* flap detection */
00385         int     state_history_index;
00386         time_t  last_state_history_update;
00387         int     is_flapping;
00388         unsigned long flapping_comment_id;
00389         double  percent_state_change;
00390         int     total_services;
00391         unsigned long total_service_check_interval;
00392         unsigned long modified_attributes;
00393         int     circular_path_checked;
00394         int     contains_circular_path;
00395 
00396         command *event_handler_ptr;
00397         command *check_command_ptr;
00398         timeperiod *check_period_ptr;
00399         timeperiod *notification_period_ptr;
00400         objectlist *hostgroups_ptr;
00401 #endif
00402         struct  host_struct *next;
00403         struct  host_struct *nexthash;
00404         /* 2011-02-07 MF: added for keeping the command for NEB callback
00405            PROCESSED state on host|service checks  */
00406         char    *processed_command;
00407         /* 2011-02-07 MF: added for dualstack IPv6 support as
00408            $HOSTADDRESS6$ macro  */
00409         char    *address6;
00410         };
00411 
00412 
00413 /* SERVICEGROUP structure */
00414 typedef struct servicegroup_struct{
00415         char    *group_name;
00416         char    *alias;
00417         servicesmember *members;
00418         char    *notes;
00419         char    *notes_url;
00420         char    *action_url;
00421         struct  servicegroup_struct *next;
00422         struct  servicegroup_struct *nexthash;
00423         }servicegroup;
00424 
00425 
00426 /* SERVICE structure */
00427 struct service_struct{
00428         char    *host_name;
00429         char    *description;
00430         char    *display_name;
00431         char    *service_check_command;
00432         char    *event_handler;
00433         int     initial_state;
00434         double  check_interval;
00435         double  retry_interval;
00436         int     max_attempts;
00437         int     parallelize;
00438         contactgroupsmember *contact_groups;
00439         contactsmember *contacts;
00440         double  notification_interval;
00441         double  first_notification_delay;
00442         int     notify_on_unknown;
00443         int     notify_on_warning;
00444         int     notify_on_critical;
00445         int     notify_on_recovery;
00446         int     notify_on_flapping;
00447         int     notify_on_downtime;
00448         int     stalk_on_ok;
00449         int     stalk_on_warning;
00450         int     stalk_on_unknown;
00451         int     stalk_on_critical;
00452         int     is_volatile;
00453         char    *notification_period;
00454         char    *check_period;
00455         int     flap_detection_enabled;
00456         double  low_flap_threshold;
00457         double  high_flap_threshold;
00458         int     flap_detection_on_ok;
00459         int     flap_detection_on_warning;
00460         int     flap_detection_on_unknown;
00461         int     flap_detection_on_critical;
00462         int     process_performance_data;
00463         int     check_freshness;
00464         int     freshness_threshold;
00465         int     accept_passive_service_checks;
00466         int     event_handler_enabled;
00467         int     checks_enabled;
00468         int     retain_status_information;
00469         int     retain_nonstatus_information;
00470         int     notifications_enabled;
00471         int     obsess_over_service;
00472         int     failure_prediction_enabled;
00473         char    *failure_prediction_options;
00474         char    *notes;
00475         char    *notes_url;
00476         char    *action_url;
00477         char    *icon_image;
00478         char    *icon_image_alt;
00479         customvariablesmember *custom_variables;
00480 #ifdef NSCORE
00481         int     problem_has_been_acknowledged;
00482         int     acknowledgement_type;
00483         int     host_problem_at_last_check;
00484         int     check_type;
00485         int     current_state;
00486         int     last_state;
00487         int     last_hard_state;
00488         char    *plugin_output;
00489         char    *long_plugin_output;
00490         char    *perf_data;
00491         int     state_type;
00492         time_t  next_check;
00493         int     should_be_scheduled;
00494         time_t  last_check;
00495         int     current_attempt;
00496         unsigned long current_event_id;
00497         unsigned long last_event_id;
00498         unsigned long current_problem_id;
00499         unsigned long last_problem_id;
00500         time_t  last_notification;
00501         time_t  next_notification;
00502         int     no_more_notifications;
00503         int     check_flapping_recovery_notification;
00504         time_t  last_state_change;
00505         time_t  last_hard_state_change;
00506         time_t  last_time_ok;
00507         time_t  last_time_warning;
00508         time_t  last_time_unknown;
00509         time_t  last_time_critical;
00510         int     has_been_checked;
00511         int     is_being_freshened;
00512         int     notified_on_unknown;
00513         int     notified_on_warning;
00514         int     notified_on_critical;
00515         int     current_notification_number;
00516 #ifdef USE_ST_BASED_ESCAL_RANGES
00517         int     current_warning_notification_number;
00518         int     current_critical_notification_number;
00519         int     current_unknown_notification_number;
00520 #endif
00521         unsigned long current_notification_id;
00522         double  latency;
00523         double  execution_time;
00524         int     is_executing;
00525         int     check_options;
00526         int     scheduled_downtime_depth;
00527         int     pending_flex_downtime;
00528         int     state_history[MAX_STATE_HISTORY_ENTRIES];    /* flap detection */
00529         int     state_history_index;
00530         int     is_flapping;
00531         unsigned long flapping_comment_id;
00532         double  percent_state_change;
00533         unsigned long modified_attributes;
00534 
00535         host *host_ptr;
00536         command *event_handler_ptr;
00537         char *event_handler_args;
00538         command *check_command_ptr;
00539         char *check_command_args;
00540         timeperiod *check_period_ptr;
00541         timeperiod *notification_period_ptr;
00542         objectlist *servicegroups_ptr;
00543 #endif
00544         struct service_struct *next;
00545         struct service_struct *nexthash;
00546         /* 2011-02-07 MF: added for keeping the command for NEB callback
00547            PROCESSED state on host|service checks  */
00548         char    *processed_command;
00549         };
00550 
00551 /* ESCALATION CONDITION STRUCTURE 
00552  * Vitali Voroth, 25.10.2009
00553  * A condition is written this way:
00554  * escalation_condition        host linux01 = c
00555  * More than one condition are connected via & OR | :
00556  * escalation_condition        host linux01 = c | service linux01.SSH = c,w
00557  * where & is an AND connection and | is and OR connection.
00558 */
00559 typedef struct escalation_condition_struct{
00560         char      *host_name;
00561         char      *service_description;
00562        
00563         /* Connects this and the next condition either with an AND or with an OR.
00564          *      0: EC_CONNECTOR_NO
00565          *  1: EC_CONNECTOR_AND
00566          *  2: EC_CONNECTOR_OR
00567         */
00568         int       connector;
00569        
00570         int       escalate_on_down;
00571         int       escalate_on_unreachable;
00572         int       escalate_on_warning;
00573         int       escalate_on_unknown;
00574         int       escalate_on_critical;
00575         int       escalate_on_ok;
00576         
00577         struct escalation_condition_struct *next;
00578         }escalation_condition;
00579 
00580 /* SERVICE ESCALATION structure */
00581 typedef struct serviceescalation_struct{
00582         char    *host_name;
00583         char    *description;
00584         int     first_notification;
00585         int     last_notification;
00586 #ifdef USE_ST_BASED_ESCAL_RANGES
00587         int     first_warning_notification;
00588         int     last_warning_notification;
00589         int     first_critical_notification;
00590         int     last_critical_notification;
00591         int     first_unknown_notification;
00592         int     last_unknown_notification;
00593 #endif
00594         double  notification_interval;
00595         char    *escalation_period;
00596         int     escalate_on_recovery;
00597         int     escalate_on_warning;
00598         int     escalate_on_unknown;
00599         int     escalate_on_critical;
00600         escalation_condition *condition;
00601         contactgroupsmember *contact_groups;
00602         contactsmember *contacts;
00603 #ifdef NSCORE
00604         service *service_ptr;
00605         timeperiod *escalation_period_ptr;
00606 #endif
00607         struct  serviceescalation_struct *next;
00608         struct  serviceescalation_struct *nexthash;
00609         }serviceescalation;
00610 
00611 
00612 /* SERVICE DEPENDENCY structure */
00613 typedef struct servicedependency_struct{
00614         int     dependency_type;
00615         char    *dependent_host_name;
00616         char    *dependent_service_description;
00617         char    *host_name;
00618         char    *service_description;
00619         char    *dependency_period;
00620         int     inherits_parent;
00621         int     fail_on_ok;
00622         int     fail_on_warning;
00623         int     fail_on_unknown;
00624         int     fail_on_critical;
00625         int     fail_on_pending;
00626 #ifdef NSCORE
00627         int     circular_path_checked;
00628         int     contains_circular_path;
00629 
00630         service *master_service_ptr;
00631         service *dependent_service_ptr;
00632         timeperiod *dependency_period_ptr;
00633 #endif
00634         struct servicedependency_struct *next;
00635         struct servicedependency_struct *nexthash;
00636         }servicedependency;
00637 
00638 
00639 /* HOST ESCALATION structure */
00640 typedef struct hostescalation_struct{
00641         char    *host_name;
00642         int     first_notification;
00643         int     last_notification;
00644 #ifdef USE_ST_BASED_ESCAL_RANGES
00645         int     first_down_notification;
00646         int     last_down_notification;
00647         int     first_unreachable_notification;
00648         int     last_unreachable_notification;
00649 #endif
00650         double  notification_interval;
00651         char    *escalation_period;
00652         int     escalate_on_recovery;
00653         int     escalate_on_down;
00654         int     escalate_on_unreachable;
00655         escalation_condition *condition;
00656         contactgroupsmember *contact_groups;
00657         contactsmember *contacts;
00658 #ifdef NSCORE
00659         host    *host_ptr;
00660         timeperiod *escalation_period_ptr;
00661 #endif
00662         struct  hostescalation_struct *next;
00663         struct  hostescalation_struct *nexthash;
00664         }hostescalation;
00665 
00666 
00667 /* HOST DEPENDENCY structure */
00668 typedef struct hostdependency_struct{
00669         int     dependency_type;
00670         char    *dependent_host_name;
00671         char    *host_name;
00672         char    *dependency_period;
00673         int     inherits_parent;
00674         int     fail_on_up;
00675         int     fail_on_down;
00676         int     fail_on_unreachable;
00677         int     fail_on_pending;
00678 #ifdef NSCORE
00679         int     circular_path_checked;
00680         int     contains_circular_path;
00681 
00682         host    *master_host_ptr;
00683         host    *dependent_host_ptr;
00684         timeperiod *dependency_period_ptr;
00685 #endif
00686         struct hostdependency_struct *next;
00687         struct hostdependency_struct *nexthash;
00688         }hostdependency;
00689 
00690 
00691 
00692 
00693 /****************** HASH STRUCTURES ********************/
00694 
00695 typedef struct host_cursor_struct{
00696         int     host_hashchain_iterator;
00697         host    *current_host_pointer;
00698         }host_cursor;
00699 
00700 
00701 
00702 
00703 
00704 /********************* FUNCTIONS **********************/
00705 
00706 /**** Top-level input functions ****/
00707 int read_object_config_data(char *,int,int,int);        /* reads all external configuration data of specific types */
00708 
00709 
00710 /**** Object Creation Functions ****/
00711 contact *add_contact(char *,char *,char *,char *,char **,char *,char *,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int);        /* adds a contact definition */
00712 commandsmember *add_service_notification_command_to_contact(contact *,char *);                          /* adds a service notification command to a contact definition */
00713 commandsmember *add_host_notification_command_to_contact(contact *,char *);                             /* adds a host notification command to a contact definition */
00714 customvariablesmember *add_custom_variable_to_contact(contact *,char *,char *);                         /* adds a custom variable to a service definition */
00715 host *add_host(char *,char *,char *,char *,char *,char *,int,double,double,int,int,int,int,int,int,double,double,char *,int,char *,int,int,char *,int,int,double,double,int,int,int,int,int,int,int,int,char *,int,int,char *,char *,char *,char *,char *,char *,char *,int,int,int,double,double,double,int,int,int,int,int);  /* adds a host definition */
00716 hostsmember *add_parent_host_to_host(host *,char *);                                                    /* adds a parent host to a host definition */
00717 hostsmember *add_child_link_to_host(host *,host *);                                                     /* adds a child host to a host definition */
00718 contactgroupsmember *add_contactgroup_to_host(host *,char *);                                           /* adds a contactgroup to a host definition */
00719 contactsmember *add_contact_to_host(host *,char *);                                                     /* adds a contact to a host definition */
00720 customvariablesmember *add_custom_variable_to_host(host *,char *,char *);                               /* adds a custom variable to a host definition */
00721 timeperiod *add_timeperiod(char *,char *);                                                              /* adds a timeperiod definition */
00722 timeperiodexclusion *add_exclusion_to_timeperiod(timeperiod *,char *);                                  /* adds an exclusion to a timeperiod */
00723 timerange *add_timerange_to_timeperiod(timeperiod *,int,unsigned long,unsigned long);                   /* adds a timerange to a timeperiod definition */
00724 daterange *add_exception_to_timeperiod(timeperiod *,int,int,int,int,int,int,int,int,int,int,int,int);
00725 timerange *add_timerange_to_daterange(daterange *,unsigned long,unsigned long);
00726 hostgroup *add_hostgroup(char *,char *,char *,char *,char *);                                           /* adds a hostgroup definition */
00727 hostsmember *add_host_to_hostgroup(hostgroup *, char *);                                                /* adds a host to a hostgroup definition */
00728 servicegroup *add_servicegroup(char *,char *,char *,char *,char *);                                     /* adds a servicegroup definition */
00729 servicesmember *add_service_to_servicegroup(servicegroup *,char *,char *);                              /* adds a service to a servicegroup definition */
00730 contactgroup *add_contactgroup(char *,char *);                                                          /* adds a contactgroup definition */
00731 contactsmember *add_contact_to_contactgroup(contactgroup *,char *);                                     /* adds a contact to a contact group definition */
00732 command *add_command(char *,char *);                                                                    /* adds a command definition */
00733 service *add_service(char *,char *,char *,char *,int,int,int,int,double,double,double,double,char *,int,int,int,int,int,int,int,int,char *,int,char *,int,int,double,double,int,int,int,int,int,int,int,int,int,int,char *,int,int,char *,char *,char *,char *,char *,int,int,int);     /* adds a service definition */
00734 contactgroupsmember *add_contactgroup_to_service(service *,char *);                                     /* adds a contact group to a service definition */
00735 contactsmember *add_contact_to_service(service *,char *);                                               /* adds a contact to a host definition */
00736 #ifndef USE_ST_BASED_ESCAL_RANGES
00737 serviceescalation *add_serviceescalation(char *,char *,int,int,double,char *,int,int,int,int);          /* adds a service escalation definition */
00738 #else
00739 serviceescalation *add_serviceescalation(char *,char *,int,int,int,int,int,int,int,int,double,char *,int,int,int,int);  /* adds a service escalation definition */
00740 #endif
00741 contactgroupsmember *add_contactgroup_to_serviceescalation(serviceescalation *,char *);                 /* adds a contact group to a service escalation definition */
00742 contactsmember *add_contact_to_serviceescalation(serviceescalation *,char *);                           /* adds a contact to a service escalation definition */
00743 customvariablesmember *add_custom_variable_to_service(service *,char *,char *);                         /* adds a custom variable to a service definition */
00744 servicedependency *add_service_dependency(char *,char *,char *,char *,int,int,int,int,int,int,int,char *);     /* adds a service dependency definition */
00745 hostdependency *add_host_dependency(char *,char *,int,int,int,int,int,int,char *);                             /* adds a host dependency definition */
00746 #ifndef USE_ST_BASED_ESCAL_RANGES
00747 hostescalation *add_hostescalation(char *,int,int,double,char *,int,int,int);                           /* adds a host escalation definition */
00748 #else 
00749 hostescalation *add_hostescalation(char *,int,int,int,int,int,int,double,char *,int,int,int);                           /* adds a host escalation definition */
00750 #endif
00751 contactsmember *add_contact_to_hostescalation(hostescalation *,char *);                                 /* adds a contact to a host escalation definition */
00752 contactgroupsmember *add_contactgroup_to_hostescalation(hostescalation *,char *);                       /* adds a contact group to a host escalation definition */
00753 
00754 contactsmember *add_contact_to_object(contactsmember **,char *);                                        /* adds a contact to an object */ 
00755 customvariablesmember *add_custom_variable_to_object(customvariablesmember **,char *,char *);           /* adds a custom variable to an object */
00756 
00757 
00758 servicesmember *add_service_link_to_host(host *,service *);
00759 
00760 escalation_condition *add_serviceescalation_condition(serviceescalation *, escalation_condition *, char *, char *, int, int, int, int, int, int, int); /* add a condition to a service escalation in memory */
00761 escalation_condition *add_hostescalation_condition(hostescalation *, escalation_condition *, char *, char *, int, int, int, int, int, int, int); /* add a condition to a host escalation in memory */
00762 
00763 /*** Object Skiplist Functions ****/
00764 int init_object_skiplists(void);
00765 int free_object_skiplists(void);
00766 int skiplist_compare_text(const char *val1a, const char *val1b, const char *val2a, const char *val2b);
00767 int skiplist_compare_host(void *a, void *b);
00768 int skiplist_compare_service(void *a, void *b);
00769 int skiplist_compare_command(void *a, void *b);
00770 int skiplist_compare_timeperiod(void *a, void *b);
00771 int skiplist_compare_contact(void *a, void *b);
00772 int skiplist_compare_contactgroup(void *a, void *b);
00773 int skiplist_compare_hostgroup(void *a, void *b);
00774 int skiplist_compare_servicegroup(void *a, void *b);
00775 int skiplist_compare_hostescalation(void *a, void *b);
00776 int skiplist_compare_serviceescalation(void *a, void *b);
00777 int skiplist_compare_hostdependency(void *a, void *b);
00778 int skiplist_compare_servicedependency(void *a, void *b);
00779 
00780 int get_host_count(void);
00781 int get_service_count(void);
00782 
00783 
00784 
00785 /**** Object Search Functions ****/
00786 timeperiod * find_timeperiod(char *);                                                           /* finds a timeperiod object */
00787 host * find_host(char *);                                                                       /* finds a host object */
00788 hostgroup * find_hostgroup(char *);                                                             /* finds a hostgroup object */
00789 servicegroup * find_servicegroup(char *);                                                       /* finds a servicegroup object */
00790 contact * find_contact(char *);                                                                 /* finds a contact object */
00791 contactgroup * find_contactgroup(char *);                                                       /* finds a contactgroup object */
00792 command * find_command(char *);                                                                 /* finds a command object */
00793 service * find_service(char *,char *);                                                          /* finds a service object */
00794 
00795 
00796 /**** Object Traversal Functions ****/
00797 hostescalation *get_first_hostescalation_by_host(char *, void **);
00798 hostescalation *get_next_hostescalation_by_host(char *,void **);
00799 serviceescalation *get_first_serviceescalation_by_service(char *,char *, void **);
00800 serviceescalation *get_next_serviceescalation_by_service(char *,char *,void **);
00801 hostdependency *get_first_hostdependency_by_dependent_host(char *, void **);
00802 hostdependency *get_next_hostdependency_by_dependent_host(char *, void **);
00803 servicedependency *get_first_servicedependency_by_dependent_service(char *,char *, void **);
00804 servicedependency *get_next_servicedependency_by_dependent_service(char *,char *,void **);
00805 
00806 #ifdef NSCORE
00807 int add_object_to_objectlist(objectlist **,void *);
00808 int free_objectlist(objectlist **);
00809 #endif
00810 
00811 /**** Object Hash Functions ****/
00812 int add_servicedependency_to_hashlist(servicedependency *);
00813 
00814 
00815 /**** Object Query Functions ****/
00816 int is_host_immediate_child_of_host(host *,host *);                     /* checks if a host is an immediate child of another host */    
00817 int is_host_primary_immediate_child_of_host(host *,host *);             /* checks if a host is an immediate child (and primary child) of another host */
00818 int is_host_immediate_parent_of_host(host *,host *);                    /* checks if a host is an immediate child of another host */    
00819 int is_host_member_of_hostgroup(hostgroup *,host *);                    /* tests whether or not a host is a member of a specific hostgroup */
00820 int is_host_member_of_servicegroup(servicegroup *,host *);              /* tests whether or not a service is a member of a specific servicegroup */
00821 int is_service_member_of_servicegroup(servicegroup *,service *);        /* tests whether or not a service is a member of a specific servicegroup */
00822 int is_contact_member_of_contactgroup(contactgroup *, contact *);       /* tests whether or not a contact is a member of a specific contact group */
00823 int is_contact_for_hostgroup(hostgroup *,contact *);                    /* tests whether or not a contact is a member of a specific hostgroup */
00824 int is_contact_for_servicegroup(servicegroup *,contact *);              /* tests whether or not a contact is a member of a specific servicegroup */
00825 int is_contact_for_host(host *,contact *);                              /* tests whether or not a contact is a contact member for a specific host */
00826 int is_escalated_contact_for_host(host *,contact *);                    /* checks whether or not a contact is an escalated contact for a specific host */
00827 int is_contact_for_service(service *,contact *);                        /* tests whether or not a contact is a contact member for a specific service */
00828 int is_escalated_contact_for_service(service *,contact *);              /* checks whether or not a contact is an escalated contact for a specific service */
00829 int is_host_immediate_parent_of_host(host *,host *);                    /* tests whether or not a host is an immediate parent of another host */
00830 
00831 int number_of_immediate_child_hosts(host *);                            /* counts the number of immediate child hosts for a particular host */
00832 int number_of_total_child_hosts(host *);                                /* counts the number of total child hosts for a particular host */
00833 int number_of_immediate_parent_hosts(host *);                           /* counts the number of immediate parents hosts for a particular host */
00834 int number_of_total_parent_hosts(host *);                               /* counts the number of total parents hosts for a particular host */
00835 
00836 #ifdef NSCORE
00837 int check_for_circular_servicedependency_path(servicedependency *,servicedependency *,int);   /* checks if a circular dependency exists for a given service */
00838 int check_for_circular_hostdependency_path(hostdependency *,hostdependency *,int);   /* checks if a circular dependency exists for a given host */
00839 #endif
00840 
00841 
00842 /**** Object Cleanup Functions ****/
00843 int free_object_data(void);                             /* frees all allocated memory for the object definitions */
00844 
00845 
00846 
00847 
00848 #ifdef __cplusplus
00849   }
00850 #endif
00851 
00852 #endif

Generated on Wed Mar 30 17:22:22 2011 for icinga-core by  doxygen 1.4.7