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

Generated on Tue Apr 13 15:15:28 2010 for DNX by  doxygen 1.5.6