File: xodtemplate.h

package info (click to toggle)
icinga 1.14.2%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 49,264 kB
  • sloc: ansic: 108,564; sql: 9,656; sh: 4,945; perl: 3,439; makefile: 1,213; php: 581; xml: 104
file content (1081 lines) | stat: -rw-r--r-- 37,604 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
/*****************************************************************************
 *
 * XODTEMPLATE.H - Template-based object configuration data header file
 *
 * Copyright (c) 1999-2009 Ethan Galstad (egalstad@nagios.org)
 * Copyright (c) 2009-2013 Nagios Core Development Team and Community Contributors
 * Copyright (c) 2009-2015 Icinga Development Team (http://www.icinga.org)
 *
 * License:
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *****************************************************************************/


#ifndef _XODTEMPLATE_H
#define _XODTEMPLATE_H



/*********** GENERAL DEFINITIONS ************/

#define XODTEMPLATE_NULL                  "null"

#define MAX_XODTEMPLATE_INPUT_BUFFER      1024

#define MAX_XODTEMPLATE_CONTACT_ADDRESSES 6

#define XODTEMPLATE_NONE                  0
#define XODTEMPLATE_TIMEPERIOD            1
#define XODTEMPLATE_COMMAND               2
#define XODTEMPLATE_CONTACT               3
#define XODTEMPLATE_CONTACTGROUP          4
#define XODTEMPLATE_HOST                  5
#define XODTEMPLATE_HOSTGROUP             6
#define XODTEMPLATE_SERVICE               7
#define XODTEMPLATE_SERVICEDEPENDENCY     8
#define XODTEMPLATE_HOSTGROUPESCALATION   9      /* no longer implemented */
#define XODTEMPLATE_SERVICEESCALATION     10
#define XODTEMPLATE_HOSTESCALATION        11
#define XODTEMPLATE_HOSTDEPENDENCY        12
#define XODTEMPLATE_HOSTEXTINFO           13
#define XODTEMPLATE_SERVICEEXTINFO        14
#define XODTEMPLATE_SERVICEGROUP          15
#define XODTEMPLATE_MODULE                16



/***************** SKIP LISTS ****************/

#define NUM_XOBJECT_SKIPLISTS                  16

#define X_HOST_SKIPLIST                        1
#define X_SERVICE_SKIPLIST                     2
#define X_COMMAND_SKIPLIST                     3
#define X_TIMEPERIOD_SKIPLIST                  4
#define X_CONTACT_SKIPLIST                     5
#define X_CONTACTGROUP_SKIPLIST                6
#define X_HOSTGROUP_SKIPLIST                   7
#define X_SERVICEGROUP_SKIPLIST                8
#define X_HOSTDEPENDENCY_SKIPLIST              9
#define X_SERVICEDEPENDENCY_SKIPLIST           10
#define X_HOSTESCALATION_SKIPLIST              11
#define X_SERVICEESCALATION_SKIPLIST           12
#define X_HOSTEXTINFO_SKIPLIST                 13
#define X_SERVICEEXTINFO_SKIPLIST              14
#define X_MODULE_SKIPLIST                      15


/********** STRUCTURE DEFINITIONS **********/

/* CUSTOMVARIABLESMEMBER structure */
typedef struct xodtemplate_customvariablesmember_struct{
	char    *variable_name;
	char    *variable_value;
	struct xodtemplate_customvariablesmember_struct *next;
        }xodtemplate_customvariablesmember;


/* DATERANGE structure */
typedef struct xodtemplate_daterange_struct{
	int type;
	int syear;          /* start year */
	int smon;           /* start month */
	int smday;          /* start day of month (may 3rd, last day in feb) */
	int swday;          /* start day of week (thursday) */
	int swday_offset;   /* start weekday offset (3rd thursday, last monday in jan) */
	int eyear;
	int emon;
	int emday;
	int ewday;
	int ewday_offset;
	int skip_interval;
	char *timeranges;
	struct xodtemplate_daterange_struct *next;
	}xodtemplate_daterange;


/* TIMEPERIOD TEMPLATE STRUCTURE */
typedef struct xodtemplate_timeperiod_struct{
	char       *template;
	char       *name;
	int        _config_file;
	int        _start_line;

	char       *timeperiod_name;
	char       *alias;
	char       *timeranges[7];
	xodtemplate_daterange *exceptions[DATERANGE_TYPES];
	char       *exclusions;

	int        has_been_resolved;
	int        register_object;
	struct xodtemplate_timeperiod_struct *next;
        }xodtemplate_timeperiod;


/* COMMAND TEMPLATE STRUCTURE */
typedef struct xodtemplate_command_struct{
	char       *template;
	char       *name;
	int        _config_file;
	int        _start_line;

	char       *command_name;
	char       *command_line;

	int        has_been_resolved;
	int        register_object;
	struct xodtemplate_command_struct *next;
        }xodtemplate_command;


/* CONTACT TEMPLATE STRUCTURE */
typedef struct xodtemplate_contact_struct{
	char      *template;
	char      *name;
	int        _config_file;
	int        _start_line;

	char      *contact_name;
	char      *alias;
	char      *contact_groups;
	char      *email;
	char      *pager;
	char      *address[MAX_XODTEMPLATE_CONTACT_ADDRESSES];
	char      *host_notification_period;
	char      *host_notification_commands;
	int       notify_on_host_down;
	int       notify_on_host_unreachable;
	int       notify_on_host_recovery;
	int       notify_on_host_flapping;
	int       notify_on_host_downtime;
	char      *service_notification_period;
	char      *service_notification_commands;
	int       notify_on_service_unknown;
	int       notify_on_service_warning;
	int       notify_on_service_critical;
	int       notify_on_service_recovery;
	int       notify_on_service_flapping;
	int       notify_on_service_downtime;
	int       host_notifications_enabled;
	int       service_notifications_enabled;
	int       can_submit_commands;
	int       retain_status_information;
	int       retain_nonstatus_information;
	xodtemplate_customvariablesmember *custom_variables;

	int       have_contact_groups;
	int       have_email;
	int       have_pager;
	int       have_address[MAX_XODTEMPLATE_CONTACT_ADDRESSES];
	int       have_host_notification_period;
	int       have_host_notification_commands;
	int       have_service_notification_period;
	int       have_service_notification_commands;

	int       have_host_notification_options;
	int       have_service_notification_options;
	int       have_host_notifications_enabled;
	int       have_service_notifications_enabled;
	int       have_can_submit_commands;
	int       have_retain_status_information;
	int       have_retain_nonstatus_information;

	int       has_been_resolved;
	int       register_object;
	struct xodtemplate_contact_struct *next;
        }xodtemplate_contact;


/* CONTACTGROUP TEMPLATE STRUCTURE */
typedef struct xodtemplate_contactgroup_struct{
	char      *template;
	char      *name;
	int        _config_file;
	int        _start_line;

	char      *contactgroup_name;
	char      *alias;
        char      *members;
	char      *contactgroup_members;

	int       have_members;
	int       have_contactgroup_members;

	int       has_been_resolved;
	int       register_object;
	struct xodtemplate_contactgroup_struct *next;
        }xodtemplate_contactgroup;


/* HOST TEMPLATE STRUCTURE */
typedef struct xodtemplate_host_struct{
	char      *template;
	char      *name;
	int        _config_file;
	int        _start_line;

	char      *host_name;
	char      *display_name;
	char      *alias;
	char      *address;
	char      *parents;
	char      *host_groups;
	char      *check_command;
	char      *check_period;
	int       initial_state;
	double    check_interval;
	double    retry_interval;
	int       max_check_attempts;
	int       active_checks_enabled;
	int       passive_checks_enabled;
	int       obsess_over_host;
	char      *event_handler;
	int       event_handler_enabled;
	int       check_freshness;
	int       freshness_threshold;
	float     low_flap_threshold;
	float     high_flap_threshold;
	int       flap_detection_enabled;
	int       flap_detection_on_up;
	int       flap_detection_on_down;
	int       flap_detection_on_unreachable;
	char      *contact_groups;
	char      *contacts;
	int       notify_on_down;
	int       notify_on_unreachable;
	int       notify_on_recovery;
	int       notify_on_flapping;
	int       notify_on_downtime;
	int       notifications_enabled;
	char      *notification_period;
	double    notification_interval;
	double    first_notification_delay;
	int       stalk_on_up;
	int       stalk_on_down;
	int       stalk_on_unreachable;
	int       process_perf_data;
	int       failure_prediction_enabled;
	char      *failure_prediction_options;
	char      *notes;
	char      *notes_url;
	char      *action_url;
	char      *icon_image;
	char      *icon_image_alt;
	char      *vrml_image;
	char      *statusmap_image;
	int       x_2d;
	int       y_2d;
	double    x_3d;
	double    y_3d;
	double    z_3d;
	int       retain_status_information;
	int       retain_nonstatus_information;
	xodtemplate_customvariablesmember *custom_variables;

	int       have_display_name;
	int       have_parents;
	int       have_host_groups;
	int       have_check_command;
	int       have_check_period;
	int       have_event_handler;
	int       have_contact_groups;
	int       have_contacts;
	int       have_notification_period;
	int       have_failure_prediction_options;
	int       have_notes;
	int       have_notes_url;
	int       have_action_url;
	int       have_icon_image;
	int       have_icon_image_alt;
	int       have_vrml_image;
	int       have_statusmap_image;

	int       have_initial_state;
	int       have_check_interval;
	int       have_retry_interval;
	int       have_max_check_attempts;
	int       have_active_checks_enabled;
	int       have_passive_checks_enabled;
	int       have_obsess_over_host;
	int       have_event_handler_enabled;
	int       have_check_freshness;
	int       have_freshness_threshold;
	int       have_low_flap_threshold;
	int       have_high_flap_threshold;
	int       have_flap_detection_enabled;
	int       have_flap_detection_options;
	int       have_notification_options;
	int       have_notifications_enabled;
	int       have_notification_interval;
	int       have_first_notification_delay;
	int       have_stalking_options;
	int       have_process_perf_data;
	int       have_failure_prediction_enabled;
	int       have_2d_coords;
	int       have_3d_coords;
	int       have_retain_status_information;
	int       have_retain_nonstatus_information;

	int       has_been_resolved;
	int       register_object;
	struct xodtemplate_host_struct *next;
	/* 2011-02-07 MF: added for dualstack IPv6 support as
	   $HOSTADDRESS6$ macro  */
	char    *address6;
        }xodtemplate_host;


/* HOSTGROUP TEMPLATE STRUCTURE */
typedef struct xodtemplate_hostgroup_struct{
	char      *template;
	char      *name;
	int        _config_file;
	int        _start_line;

	char      *hostgroup_name;
	char      *alias;
	char      *members;
	char      *hostgroup_members;
	char      *notes;
	char      *notes_url;
	char      *action_url;

	int       have_members;
	int       have_hostgroup_members;
	int       have_notes;
	int       have_notes_url;
	int       have_action_url;

	int       has_been_resolved;
	int       register_object;
	struct xodtemplate_hostgroup_struct *next;
        }xodtemplate_hostgroup;


/* SERVICE TEMPLATE STRUCTURE */
typedef struct xodtemplate_service_struct{
        char       *template;
	char       *name;
	int        _config_file;
	int        _start_line;

	char       *host_name;
	char       *service_description;
	char       *display_name;
	char       *hostgroup_name;
	char       *service_groups;
	char       *check_command;
	int        initial_state;
	int        max_check_attempts;
        double     check_interval;
        double     retry_interval;
        char       *check_period;
        int        active_checks_enabled;
        int        passive_checks_enabled;
        int        parallelize_check;
	int        is_volatile;
	int        obsess_over_service;
	char       *event_handler;
	int        event_handler_enabled;
	int        check_freshness;
	int        freshness_threshold;
	double     low_flap_threshold;
	double     high_flap_threshold;
	int        flap_detection_enabled;
	int        flap_detection_on_ok;
	int        flap_detection_on_warning;
	int        flap_detection_on_unknown;
	int        flap_detection_on_critical;
	int        notify_on_unknown;
	int        notify_on_warning;
	int        notify_on_critical;
	int        notify_on_recovery;
	int        notify_on_flapping;
	int        notify_on_downtime;
	int        notifications_enabled;
	char       *notification_period;
	double     notification_interval;
	double     first_notification_delay;
	char       *contact_groups;
	char       *contacts;
	int        stalk_on_ok;
	int        stalk_on_unknown;
	int        stalk_on_warning;
	int        stalk_on_critical;
	int        process_perf_data;
	int        failure_prediction_enabled;
	char       *failure_prediction_options;
	char       *notes;
	char       *notes_url;
	char       *action_url;
	char       *icon_image;
	char       *icon_image_alt;
	int        retain_status_information;
	int        retain_nonstatus_information;
	xodtemplate_customvariablesmember *custom_variables;

	int        have_host_name;
	int        have_service_description;
	int        have_display_name;
	int        have_hostgroup_name;
	int        have_service_groups;
	int        have_check_command;
	int        have_important_check_command;
	int        have_check_period;
	int        have_event_handler;
	int        have_notification_period;
	int        have_contact_groups;
	int        have_contacts;
	int        have_failure_prediction_options;
	int        have_notes;
	int        have_notes_url;
	int        have_action_url;
	int        have_icon_image;
	int        have_icon_image_alt;

	int        have_initial_state;
	int        have_max_check_attempts;
	int        have_check_interval;
	int        have_retry_interval;
        int        have_active_checks_enabled;
        int        have_passive_checks_enabled;
        int        have_parallelize_check;
	int        have_is_volatile;
	int        have_obsess_over_service;
	int        have_event_handler_enabled;
	int        have_check_freshness;
	int        have_freshness_threshold;
	int        have_low_flap_threshold;
	int        have_high_flap_threshold;
	int        have_flap_detection_enabled;
	int        have_flap_detection_options;
	int        have_notification_options;
	int        have_notifications_enabled;
	int        have_notification_dependencies;
	int        have_notification_interval;
	int        have_first_notification_delay;
	int        have_stalking_options;
	int        have_process_perf_data;
	int        have_failure_prediction_enabled;
	int        have_retain_status_information;
	int        have_retain_nonstatus_information;
	
	int        has_been_resolved;
	int        register_object;
	struct xodtemplate_service_struct *next;
        }xodtemplate_service;


/* SERVICEGROUP TEMPLATE STRUCTURE */
typedef struct xodtemplate_servicegroup_struct{
	char      *template;
	char      *name;
	int        _config_file;
	int        _start_line;

	char      *servicegroup_name;
	char      *alias;
	char      *members;
	char      *servicegroup_members;
	char      *notes;
	char      *notes_url;
	char      *action_url;

	int       have_members;
	int       have_servicegroup_members;
	int       have_notes;
	int       have_notes_url;
	int       have_action_url;

	int       has_been_resolved;
	int       register_object;
	struct xodtemplate_servicegroup_struct *next;
        }xodtemplate_servicegroup;

 /* ESCALATION CONDITION STRUCTURE 
  * Vitali Voroth, 09.10.2009
  * A condition is written this way:
  * escalation_condition        host linux01 = c
  * More than one condition are connected via & OR | :
  * escalation_condition        host linux01 = c | service linux01.SSH = c,w
  * where & is an AND connection and | is and OR connection.
 */
 typedef struct xodtemplate_escalation_condition_struct{
        char      *host_name;
        char      *service_description;
        /*
        int       have_host_name;
        int       have_service_description;
        */
        /* Connects this and the next condition either with an AND or with an OR.
         * (constants defined in objects.h)
         *      0: EC_CONNECTOR_NO
         *  1: EC_CONNECTOR_AND
         *  2: EC_CONNECTOR_OR
        */
        int       connector;
        
        int       escalate_on_down;
        int       escalate_on_unreachable;
        int       escalate_on_warning;
        int       escalate_on_unknown;
        int       escalate_on_critical;
        int       escalate_on_ok;
        
        struct xodtemplate_escalation_condition_struct *next;
        }xodtemplate_escalation_condition;

/* SERVICEDEPENDENCY TEMPLATE STRUCTURE */
typedef struct xodtemplate_servicedependency_struct{
	char       *template;
        char       *name;
	int        _config_file;
	int        _start_line;

	char       *host_name;
	char       *service_description;
	char       *dependent_host_name;
	char       *dependent_service_description;
	char       *servicegroup_name;
	char       *hostgroup_name;
	char       *dependent_servicegroup_name;
	char       *dependent_hostgroup_name;
	char       *dependency_period;
	int        inherits_parent;
	int        fail_notify_on_ok;
	int        fail_notify_on_unknown;
	int        fail_notify_on_warning;
	int        fail_notify_on_critical;
	int        fail_notify_on_pending;
	int        fail_execute_on_ok;
	int        fail_execute_on_unknown;
	int        fail_execute_on_warning;
	int        fail_execute_on_critical;
	int        fail_execute_on_pending;

	int        have_host_name;
	int        have_service_description;
	int        have_dependent_host_name;
	int        have_dependent_service_description;
	int        have_servicegroup_name;
	int        have_hostgroup_name;
	int        have_dependent_servicegroup_name;
	int        have_dependent_hostgroup_name;
	int        have_dependency_period;

	int        have_inherits_parent;
	int        have_notification_dependency_options;
	int        have_execution_dependency_options;

	int        has_been_resolved;
	int        register_object;

	struct xodtemplate_servicedependency_struct *next;
        }xodtemplate_servicedependency;


/* SERVICEESCALATION TEMPLATE STRUCTURE */
typedef struct xodtemplate_serviceescalation_struct{
	char      *template;
	char      *name;
	int        _config_file;
	int        _start_line;

	char      *host_name;
	char      *service_description;
	char      *servicegroup_name;
	char      *hostgroup_name;
	int       first_notification;
	int       last_notification;
	double    notification_interval;
	char      *escalation_period;
	int       escalate_on_warning;
	int       escalate_on_unknown;
	int       escalate_on_critical;
	int       escalate_on_recovery;
	char      *contact_groups;
	char      *contacts;

	int       have_host_name;
	int       have_service_description;
	int       have_servicegroup_name;
	int       have_hostgroup_name;
	int       have_escalation_period;
	int       have_contact_groups;
	int       have_contacts;

	int       have_first_notification;
	int       have_last_notification;
	int       have_notification_interval;
	int       have_escalation_options;

	int       has_been_resolved;
	int       register_object;

        xodtemplate_escalation_condition *condition;
	struct xodtemplate_serviceescalation_struct *next;
	/*
	 * we'll use compiler tricks again, putting this at the end,
	 * invisible, in order to stay compatible with neb modules
	 */
	int       first_warning_notification;
	int       last_warning_notification;
	int       first_critical_notification;
	int       last_critical_notification;
	int       first_unknown_notification;
	int       last_unknown_notification;
	int       have_first_warning_notification;
	int       have_last_warning_notification;
	int       have_first_critical_notification;
	int       have_last_critical_notification;
	int       have_first_unknown_notification;
	int       have_last_unknown_notification;
        }xodtemplate_serviceescalation;


/* HOSTDEPENDENCY TEMPLATE STRUCTURE */
typedef struct xodtemplate_hostdependency_struct{
	char      *template;
        char      *name;
	int        _config_file;
	int        _start_line;

	char      *host_name;
	char      *dependent_host_name;
	char      *hostgroup_name;
	char      *dependent_hostgroup_name;
	char      *dependency_period;
	int       inherits_parent;
	int       fail_notify_on_up;
	int       fail_notify_on_down;
	int       fail_notify_on_unreachable;
	int       fail_notify_on_pending;
	int       fail_execute_on_up;
	int       fail_execute_on_down;
	int       fail_execute_on_unreachable;
	int       fail_execute_on_pending;

	int       have_host_name;
	int       have_dependent_host_name;
	int       have_hostgroup_name;
	int       have_dependent_hostgroup_name;
	int       have_dependency_period;

	int       have_inherits_parent;
	int       have_notification_dependency_options;
	int       have_execution_dependency_options;

	int       has_been_resolved;
	int       register_object;
	struct xodtemplate_hostdependency_struct *next;
        }xodtemplate_hostdependency;


/* HOSTESCALATION TEMPLATE STRUCTURE */
typedef struct xodtemplate_hostescalation_struct{
	char      *template;
	char      *name;
	int        _config_file;
	int        _start_line;

	char      *host_name;
	char      *hostgroup_name;
	int       first_notification;
	int       last_notification;
	double    notification_interval;
	char      *escalation_period;
	int       escalate_on_down;
	int       escalate_on_unreachable;
	int       escalate_on_recovery;
	char      *contact_groups;
	char      *contacts;

	int       have_host_name;
	int       have_hostgroup_name;
	int       have_escalation_period;
	int       have_contact_groups;
	int       have_contacts;

	int       have_first_notification;
	int       have_last_notification;
	int       have_notification_interval;
	int       have_escalation_options;

	int       has_been_resolved;
	int       register_object;

        xodtemplate_escalation_condition *condition;
	struct xodtemplate_hostescalation_struct *next;
	/*
	 * we'll use compiler tricks again, putting this at the end,
	 * invisible, in order to stay compatible with neb modules
	 */
	int       first_down_notification;
	int       last_down_notification;
	int       first_unreachable_notification;
	int       last_unreachable_notification;
	int       have_first_down_notification;
	int       have_last_down_notification;
	int       have_first_unreachable_notification;
	int       have_last_unreachable_notification;
        }xodtemplate_hostescalation;


/* HOSTEXTINFO TEMPLATE STRUCTURE */
typedef struct xodtemplate_hostextinfo_struct{
	char       *template;
	char       *name;
	int        _config_file;
	int        _start_line;

	char       *host_name;
	char       *hostgroup_name;
	char       *notes;
	char       *notes_url;
	char       *action_url;
	char       *icon_image;
	char       *icon_image_alt;
	char       *vrml_image;
	char       *statusmap_image;
	int        x_2d;
	int        y_2d;
	double     x_3d;
	double     y_3d;
	double     z_3d;

	int        have_host_name;
	int        have_hostgroup_name;
	int        have_notes;
	int        have_notes_url;
	int        have_action_url;
	int        have_icon_image;
	int        have_icon_image_alt;
	int        have_vrml_image;
	int        have_statusmap_image;
	
	int        have_2d_coords;
	int        have_3d_coords;

	int        has_been_resolved;
	int        register_object;
	struct xodtemplate_hostextinfo_struct *next;
        }xodtemplate_hostextinfo;


/* SERVICEEXTINFO TEMPLATE STRUCTURE */
typedef struct xodtemplate_serviceextinfo_struct{
	char       *template;
	char       *name;
	int        _config_file;
	int        _start_line;

	char       *host_name;
	char       *hostgroup_name;
	char       *service_description;
	char       *notes;
	char       *notes_url;
	char       *action_url;
	char       *icon_image;
	char       *icon_image_alt;

	int        have_host_name;
	int        have_hostgroup_name;
	int        have_service_description;
	int        have_notes;
	int        have_notes_url;
	int        have_action_url;
	int        have_icon_image;
	int        have_icon_image_alt;

	int        has_been_resolved;
	int        register_object;
	struct xodtemplate_serviceextinfo_struct *next;
        }xodtemplate_serviceextinfo;


/* MODULE TEMPLATE STRUCTURE */
typedef struct xodtemplate_module_struct{
        char       *template;
        char       *name;
        int        _config_file;
        int        _start_line;

        char       *module_name;
        char       *module_type;
        char       *path;
        char       *args;

        int        has_been_resolved;
        int        register_object;
        struct xodtemplate_module_struct *next;
        }xodtemplate_module;


/* CONTACT LIST STRUCTURE */
typedef struct xodtemplate_contactlist_struct{
	char      *contact_name;
	struct xodtemplate_contactlist_struct *next;
        }xodtemplate_contactlist;


/* HOST LIST STRUCTURE */
typedef struct xodtemplate_hostlist_struct{
	char      *host_name;
	struct xodtemplate_hostlist_struct *next;
        }xodtemplate_hostlist;


/* SERVICE LIST STRUCTURE */
typedef struct xodtemplate_servicelist_struct{
	char      *host_name;
	char      *service_description;
	struct xodtemplate_servicelist_struct *next;
        }xodtemplate_servicelist;


/* MEMBER LIST STRUCTURE */
typedef struct xodtemplate_memberlist_struct{
	char      *name1;
	char      *name2;
	struct xodtemplate_memberlist_struct *next;
        }xodtemplate_memberlist;

/* CONFIG DEBUG INFO */
typedef struct debuginfo_struct{
	void      *cookie;
	char      *file;
	int       line;
	struct debuginfo_struct *next;
	}debuginfo;


/***** CHAINED HASH DATA STRUCTURES ******/

typedef struct xodtemplate_service_cursor_struct{
	int xodtemplate_service_iterator;
	xodtemplate_service *current_xodtemplate_service;
        }xodtemplate_service_cursor;


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

int xodtemplate_read_config_data(char *,int,int,int);       /* top-level routine processes all config files */
int xodtemplate_grab_config_info(char *);                   /* grabs variables from main config file */
int xodtemplate_process_config_file(char *,int);            /* process data in a specific config file */
int xodtemplate_process_config_dir(char *,int);             /* process all files in a specific config directory */

debuginfo *get_debuginfo(void *cookie);
const char *format_debuginfo(void *cookie);
void set_debuginfo(void *cookie, const char *file, int line);
void purge_debuginfo(void);
void xodtemplate_set_debuginfo(void *object, void *xodtemplate);

#ifdef NSCORE
xodtemplate_memberlist *xodtemplate_expand_contactgroups_and_contacts(char *,char *,int,int);
int xodtemplate_expand_contactgroups(xodtemplate_memberlist **,xodtemplate_memberlist **,char *,int,int);
int xodtemplate_expand_contacts(xodtemplate_memberlist **,xodtemplate_memberlist **,char *,int,int);
int xodtemplate_add_contactgroup_members_to_memberlist(xodtemplate_memberlist **,xodtemplate_contactgroup *,int,int);

int xodtemplate_expand_hostgroups_and_hosts(xodtemplate_memberlist **,char *,char *,int,int);
int xodtemplate_expand_hostgroups(xodtemplate_memberlist **,xodtemplate_memberlist **,char *,int,int);
int xodtemplate_expand_hosts(xodtemplate_memberlist **,xodtemplate_memberlist **,char *,int,int);
int xodtemplate_add_hostgroup_members_to_memberlist(xodtemplate_memberlist **,xodtemplate_hostgroup *,int,int);
int xodtemplate_reject_hosts_from_hostgroup(xodtemplate_memberlist **, xodtemplate_memberlist **);

xodtemplate_memberlist *xodtemplate_expand_servicegroups_and_services(char *,char *,char *,int,int);
int xodtemplate_expand_servicegroups(xodtemplate_memberlist **,xodtemplate_memberlist **,char *,int,int);
int xodtemplate_expand_services(xodtemplate_memberlist **,xodtemplate_memberlist **,char *,char *,int,int);
int xodtemplate_add_servicegroup_members_to_memberlist(xodtemplate_memberlist **,xodtemplate_servicegroup *,int,int);

char *xodtemplate_process_contactgroup_names(char *,int,int);
int xodtemplate_get_contactgroup_names(xodtemplate_memberlist **,xodtemplate_memberlist **,char *,int,int);

char *xodtemplate_process_hostgroup_names(char *,int,int);
int xodtemplate_get_hostgroup_names(xodtemplate_memberlist **,xodtemplate_memberlist **,char *,int,int);

char *xodtemplate_process_servicegroup_names(char *,int,int);
int xodtemplate_get_servicegroup_names(xodtemplate_memberlist **,xodtemplate_memberlist **,char *,int,int);

int xodtemplate_add_member_to_memberlist(xodtemplate_memberlist **,char *,char *);
int xodtemplate_free_memberlist(xodtemplate_memberlist **);
void xodtemplate_remove_memberlist_item(xodtemplate_memberlist *,xodtemplate_memberlist **);
#endif


int xodtemplate_begin_object_definition(char *,int,int,int);
int xodtemplate_add_object_property(char *,int);
int xodtemplate_end_object_definition(int);

int xodtemplate_parse_timeperiod_directive(xodtemplate_timeperiod *,char *,char *);
xodtemplate_daterange *xodtemplate_add_exception_to_timeperiod(xodtemplate_timeperiod *,int,int,int,int,int,int,int,int,int,int,int,int,char *);
int xodtemplate_get_month_from_string(char *,int *);
int xodtemplate_get_weekday_from_string(char *,int *);

xodtemplate_customvariablesmember *xodtemplate_add_custom_variable_to_host(xodtemplate_host *,char *,char *);
xodtemplate_customvariablesmember *xodtemplate_add_custom_variable_to_service(xodtemplate_service *,char *,char *);
xodtemplate_customvariablesmember *xodtemplate_add_custom_variable_to_contact(xodtemplate_contact *,char *,char *);
xodtemplate_customvariablesmember *xodtemplate_add_custom_variable_to_object(xodtemplate_customvariablesmember **,char *,char *);


int xodtemplate_register_objects(void);
int xodtemplate_free_memory(void);

#ifdef NSCORE
int xodtemplate_duplicate_objects(void);
int xodtemplate_duplicate_services(void);

int xodtemplate_inherit_object_properties(void);

int xodtemplate_resolve_objects(void);

int xodtemplate_sort_objects(void);
int xodtemplate_compare_strings1(char *,char *);
int xodtemplate_compare_strings2(char *,char *,char *,char *);

int xodtemplate_cache_objects(char *);

int xodtemplate_duplicate_service(xodtemplate_service *,char *);
int xodtemplate_duplicate_hostescalation(xodtemplate_hostescalation *,char *);
int xodtemplate_duplicate_serviceescalation(xodtemplate_serviceescalation *,char *,char *);
int xodtemplate_duplicate_hostdependency(xodtemplate_hostdependency *,char *,char *);
int xodtemplate_duplicate_servicedependency(xodtemplate_servicedependency *,char *,char *,char *, char *,char *,char *,char *,char *);
int xodtemplate_duplicate_hostextinfo(xodtemplate_hostextinfo *,char *);
int xodtemplate_duplicate_serviceextinfo(xodtemplate_serviceextinfo *,char *);

int xodtemplate_recombobulate_contactgroups(void);
int xodtemplate_recombobulate_contactgroup_subgroups(xodtemplate_contactgroup *,char **);
int xodtemplate_recombobulate_object_contacts(void);
int xodtemplate_recombobulate_hostgroups(void);
int xodtemplate_recombobulate_hostgroup_subgroups(xodtemplate_hostgroup *, xodtemplate_memberlist **, xodtemplate_memberlist **);
int xodtemplate_recombobulate_servicegroups(void);
int xodtemplate_recombobulate_servicegroup_subgroups(xodtemplate_servicegroup *,char **);

int xodtemplate_resolve_timeperiod(xodtemplate_timeperiod *);
int xodtemplate_resolve_command(xodtemplate_command *);
int xodtemplate_resolve_contactgroup(xodtemplate_contactgroup *);
int xodtemplate_resolve_hostgroup(xodtemplate_hostgroup *);
int xodtemplate_resolve_servicegroup(xodtemplate_servicegroup *);
int xodtemplate_resolve_servicedependency(xodtemplate_servicedependency *);
int xodtemplate_resolve_serviceescalation(xodtemplate_serviceescalation *);
int xodtemplate_resolve_contact(xodtemplate_contact *);
int xodtemplate_resolve_host(xodtemplate_host *);
int xodtemplate_resolve_service(xodtemplate_service *);
int xodtemplate_resolve_hostdependency(xodtemplate_hostdependency *);
int xodtemplate_resolve_hostescalation(xodtemplate_hostescalation *);
int xodtemplate_resolve_hostextinfo(xodtemplate_hostextinfo *);
int xodtemplate_resolve_serviceextinfo(xodtemplate_serviceextinfo *);
int xodtemplate_resolve_module(xodtemplate_module *);

int xodtemplate_sort_timeperiods(void);
int xodtemplate_sort_commands(void);
int xodtemplate_sort_contactgroups(void);
int xodtemplate_sort_hostgroups(void);
int xodtemplate_sort_servicegroups(void);
int xodtemplate_sort_contacts(void);
int xodtemplate_sort_hosts(void);
int xodtemplate_sort_services(void);
int xodtemplate_sort_servicedependencies(void);
int xodtemplate_sort_serviceescalations(void);
int xodtemplate_sort_hostdependencies(void);
int xodtemplate_sort_hostescalations(void);
int xodtemplate_sort_modules(void);

int xodtemplate_merge_extinfo_ojects(void);
int xodtemplate_merge_host_extinfo_object(xodtemplate_host *,xodtemplate_hostextinfo *);
int xodtemplate_merge_service_extinfo_object(xodtemplate_service *,xodtemplate_serviceextinfo *);

xodtemplate_timeperiod *xodtemplate_find_timeperiod(char *);
xodtemplate_command *xodtemplate_find_command(char *);
xodtemplate_contactgroup *xodtemplate_find_contactgroup(char *);
xodtemplate_contactgroup *xodtemplate_find_real_contactgroup(char *);
xodtemplate_hostgroup *xodtemplate_find_hostgroup(char *);
xodtemplate_hostgroup *xodtemplate_find_real_hostgroup(char *);
xodtemplate_servicegroup *xodtemplate_find_servicegroup(char *);
xodtemplate_servicegroup *xodtemplate_find_real_servicegroup(char *);
xodtemplate_servicedependency *xodtemplate_find_servicedependency(char *);
xodtemplate_serviceescalation *xodtemplate_find_serviceescalation(char *);
xodtemplate_contact *xodtemplate_find_contact(char *);
xodtemplate_contact *xodtemplate_find_real_contact(char *);
xodtemplate_host *xodtemplate_find_host(char *);
xodtemplate_host *xodtemplate_find_real_host(char *);
xodtemplate_service *xodtemplate_find_service(char *);
xodtemplate_service *xodtemplate_find_real_service(char *,char *);
xodtemplate_hostdependency *xodtemplate_find_hostdependency(char *);
xodtemplate_hostescalation *xodtemplate_find_hostescalation(char *);
xodtemplate_hostextinfo *xodtemplate_find_hostextinfo(char *);
xodtemplate_serviceextinfo *xodtemplate_find_serviceextinfo(char *);
xodtemplate_module *xodtemplate_find_module(char *);

int xodtemplate_get_inherited_string(int *,char **,int *,char **);
int xodtemplate_clean_additive_string(char **);
int xodtemplate_clean_additive_strings(void);
#endif

int xodtemplate_register_timeperiod(xodtemplate_timeperiod *);
int xodtemplate_get_time_ranges(char *,unsigned long *,unsigned long *);
int xodtemplate_register_command(xodtemplate_command *);
int xodtemplate_register_contactgroup(xodtemplate_contactgroup *);
int xodtemplate_register_hostgroup(xodtemplate_hostgroup *);
int xodtemplate_register_servicegroup(xodtemplate_servicegroup *);
int xodtemplate_register_servicedependency(xodtemplate_servicedependency *);
int xodtemplate_register_serviceescalation(xodtemplate_serviceescalation *);
int xodtemplate_register_contact(xodtemplate_contact *);
int xodtemplate_register_host(xodtemplate_host *);
int xodtemplate_register_service(xodtemplate_service *);
int xodtemplate_register_hostdependency(xodtemplate_hostdependency *);
int xodtemplate_register_hostescalation(xodtemplate_hostescalation *);
int xodtemplate_register_module(xodtemplate_module *);


int xodtemplate_init_xobject_skiplists(void);
int xodtemplate_free_xobject_skiplists(void);

int xodtemplate_skiplist_compare_text(const char *val1a, const char *val1b, const char *val2a, const char *val2b);
int xodtemplate_skiplist_compare_host_template(void *a, void *b);
int xodtemplate_skiplist_compare_service_template(void *a, void *b);
int xodtemplate_skiplist_compare_command_template(void *a, void *b);
int xodtemplate_skiplist_compare_timeperiod_template(void *a, void *b);
int xodtemplate_skiplist_compare_contact_template(void *a, void *b);
int xodtemplate_skiplist_compare_contactgroup_template(void *a, void *b);
int xodtemplate_skiplist_compare_hostgroup_template(void *a, void *b);
int xodtemplate_skiplist_compare_servicegroup_template(void *a, void *b);
int xodtemplate_skiplist_compare_hostdependency_template(void *a, void *b);
int xodtemplate_skiplist_compare_servicedependency_template(void *a, void *b);
int xodtemplate_skiplist_compare_hostescalation_template(void *a, void *b);
int xodtemplate_skiplist_compare_serviceescalation_template(void *a, void *b);
int xodtemplate_skiplist_compare_hostextinfo_template(void *a, void *b);
int xodtemplate_skiplist_compare_serviceextinfo_template(void *a, void *b);
int xodtemplate_skiplist_compare_module_template(void *a, void *b);

int xodtemplate_skiplist_compare_host(void *a, void *b);
int xodtemplate_skiplist_compare_service(void *a, void *b);
int xodtemplate_skiplist_compare_contact(void *a, void *b);
int xodtemplate_skiplist_compare_contactgroup(void *a, void *b);
int xodtemplate_skiplist_compare_hostgroup(void *a, void *b);
int xodtemplate_skiplist_compare_servicegroup(void *a, void *b);
int xodtemplate_skiplist_compare_command(void *a, void *b);
int xodtemplate_skiplist_compare_timeperiod(void *a, void *b);
int xodtemplate_skiplist_compare_hostdependency(void *a, void *b);
int xodtemplate_skiplist_compare_servicedependency(void *a, void *b);
int xodtemplate_skiplist_compare_hostescalation(void *a, void *b);
int xodtemplate_skiplist_compare_serviceescalation(void *a, void *b);
int xodtemplate_skiplist_compare_module(void *a, void *b);


#endif