1 /*****************************************************************************
3 * OBJECTS.H - Header file for object addition/search functions
5 * Copyright (c) 1999-2007 Ethan Galstad (nagios@nagios.org)
6 * Last Modified: 11-10-2007
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *****************************************************************************/
38 /*************** CURRENT OBJECT REVISION **************/
40 #define CURRENT_OBJECT_STRUCTURE_VERSION 307 /* increment when changes are made to data structures... */
41 /* Nagios 3 starts at 300, Nagios 4 at 400, etc. */
45 /***************** OBJECT SIZE LIMITS *****************/
47 #define MAX_STATE_HISTORY_ENTRIES 21 /* max number of old states to keep track of for flap detection */
48 #define MAX_CONTACT_ADDRESSES 6 /* max number of custom addresses a contact can have */
52 /***************** SKIP LISTS ****************/
54 #define NUM_OBJECT_SKIPLISTS 12
56 #define HOST_SKIPLIST 0
57 #define SERVICE_SKIPLIST 1
58 #define COMMAND_SKIPLIST 2
59 #define TIMEPERIOD_SKIPLIST 3
60 #define CONTACT_SKIPLIST 4
61 #define CONTACTGROUP_SKIPLIST 5
62 #define HOSTGROUP_SKIPLIST 6
63 #define SERVICEGROUP_SKIPLIST 7
64 #define HOSTDEPENDENCY_SKIPLIST 8
65 #define SERVICEDEPENDENCY_SKIPLIST 9
66 #define HOSTESCALATION_SKIPLIST 10
67 #define SERVICEESCALATION_SKIPLIST 11
70 /****************** DATA STRUCTURES *******************/
72 typedef struct host_struct host
;
73 typedef struct service_struct service
;
74 typedef struct contact_struct contact
;
76 /* OBJECT LIST STRUCTURE */
77 typedef struct objectlist_struct
{
79 struct objectlist_struct
*next
;
83 /* TIMERANGE structure */
84 typedef struct timerange_struct
{
85 unsigned long range_start
;
86 unsigned long range_end
;
87 struct timerange_struct
*next
;
91 /* DATERANGE structure */
92 typedef struct daterange_struct
{
94 int syear
; /* start year */
95 int smon
; /* start month */
96 int smday
; /* start day of month (may 3rd, last day in feb) */
97 int swday
; /* start day of week (thursday) */
98 int swday_offset
; /* start weekday offset (3rd thursday, last monday in jan) */
106 struct daterange_struct
*next
;
110 /* TIMEPERIODEXCLUSION structure */
111 typedef struct timeperiodexclusion_struct
{
112 char *timeperiod_name
;
113 struct timeperiod_struct
*timeperiod_ptr
;
114 struct timeperiodexclusion_struct
*next
;
115 }timeperiodexclusion
;
118 /* TIMEPERIOD structure */
119 typedef struct timeperiod_struct
{
123 daterange
*exceptions
[DATERANGE_TYPES
];
124 timeperiodexclusion
*exclusions
;
125 struct timeperiod_struct
*next
;
126 struct timeperiod_struct
*nexthash
;
130 /* CONTACTSMEMBER structure */
131 typedef struct contactsmember_struct
{
134 contact
*contact_ptr
;
136 struct contactsmember_struct
*next
;
140 /* CONTACTGROUP structure */
141 typedef struct contactgroup_struct
{
144 contactsmember
*members
;
145 struct contactgroup_struct
*next
;
146 struct contactgroup_struct
*nexthash
;
150 /* CONTACTGROUPSMEMBER structure */
151 typedef struct contactgroupsmember_struct
{
154 contactgroup
*group_ptr
;
156 struct contactgroupsmember_struct
*next
;
157 }contactgroupsmember
;
160 /* CUSTOMVARIABLESMEMBER structure */
161 typedef struct customvariablesmember_struct
{
163 char *variable_value
;
164 int has_been_modified
;
165 struct customvariablesmember_struct
*next
;
166 }customvariablesmember
;
169 /* COMMAND structure */
170 typedef struct command_struct
{
173 struct command_struct
*next
;
174 struct command_struct
*nexthash
;
178 /* COMMANDSMEMBER structure */
179 typedef struct commandsmember_struct
{
182 command
*command_ptr
;
184 struct commandsmember_struct
*next
;
188 /* CONTACT structure */
189 struct contact_struct
{
194 char *address
[MAX_CONTACT_ADDRESSES
];
195 commandsmember
*host_notification_commands
;
196 commandsmember
*service_notification_commands
;
197 int notify_on_service_unknown
;
198 int notify_on_service_warning
;
199 int notify_on_service_critical
;
200 int notify_on_service_recovery
;
201 int notify_on_service_flapping
;
202 int notify_on_service_downtime
;
203 int notify_on_host_down
;
204 int notify_on_host_unreachable
;
205 int notify_on_host_recovery
;
206 int notify_on_host_flapping
;
207 int notify_on_host_downtime
;
208 char *host_notification_period
;
209 char *service_notification_period
;
210 int host_notifications_enabled
;
211 int service_notifications_enabled
;
212 int can_submit_commands
;
213 int retain_status_information
;
214 int retain_nonstatus_information
;
215 customvariablesmember
*custom_variables
;
217 time_t last_host_notification
;
218 time_t last_service_notification
;
219 unsigned long modified_attributes
;
220 unsigned long modified_host_attributes
;
221 unsigned long modified_service_attributes
;
223 timeperiod
*host_notification_period_ptr
;
224 timeperiod
*service_notification_period_ptr
;
225 objectlist
*contactgroups_ptr
;
227 struct contact_struct
*next
;
228 struct contact_struct
*nexthash
;
232 /* SERVICESMEMBER structure */
233 typedef struct servicesmember_struct
{
235 char *service_description
;
237 service
*service_ptr
;
239 struct servicesmember_struct
*next
;
243 /* HOSTSMEMBER structure */
244 typedef struct hostsmember_struct
{
249 struct hostsmember_struct
*next
;
253 /* HOSTGROUP structure */
254 typedef struct hostgroup_struct
{
257 hostsmember
*members
;
261 struct hostgroup_struct
*next
;
262 struct hostgroup_struct
*nexthash
;
272 hostsmember
*parent_hosts
;
273 hostsmember
*child_hosts
;
274 servicesmember
*services
;
275 char *host_check_command
;
277 double check_interval
;
278 double retry_interval
;
281 contactgroupsmember
*contact_groups
;
282 contactsmember
*contacts
;
283 double notification_interval
;
284 double first_notification_delay
;
286 int notify_on_unreachable
;
287 int notify_on_recovery
;
288 int notify_on_flapping
;
289 int notify_on_downtime
;
290 char *notification_period
;
292 int flap_detection_enabled
;
293 double low_flap_threshold
;
294 double high_flap_threshold
;
295 int flap_detection_on_up
;
296 int flap_detection_on_down
;
297 int flap_detection_on_unreachable
;
300 int stalk_on_unreachable
;
302 int freshness_threshold
;
303 int process_performance_data
;
305 int accept_passive_host_checks
;
306 int event_handler_enabled
;
307 int retain_status_information
;
308 int retain_nonstatus_information
;
309 int failure_prediction_enabled
;
310 char *failure_prediction_options
;
311 int obsess_over_host
;
316 char *icon_image_alt
;
318 char *statusmap_image
;
327 customvariablesmember
*custom_variables
;
329 int problem_has_been_acknowledged
;
330 int acknowledgement_type
;
336 char *long_plugin_output
;
340 unsigned long current_event_id
;
341 unsigned long last_event_id
;
342 unsigned long current_problem_id
;
343 unsigned long last_problem_id
;
345 double execution_time
;
348 int notifications_enabled
;
349 time_t last_host_notification
;
350 time_t next_host_notification
;
352 int should_be_scheduled
;
354 time_t last_state_change
;
355 time_t last_hard_state_change
;
357 time_t last_time_down
;
358 time_t last_time_unreachable
;
359 int has_been_checked
;
360 int is_being_freshened
;
361 int notified_on_down
;
362 int notified_on_unreachable
;
363 int current_notification_number
;
364 int no_more_notifications
;
365 unsigned long current_notification_id
;
366 int check_flapping_recovery_notification
;
367 int scheduled_downtime_depth
;
368 int pending_flex_downtime
;
369 int state_history
[MAX_STATE_HISTORY_ENTRIES
]; /* flap detection */
370 int state_history_index
;
371 time_t last_state_history_update
;
373 unsigned long flapping_comment_id
;
374 double percent_state_change
;
376 unsigned long total_service_check_interval
;
377 unsigned long modified_attributes
;
378 int circular_path_checked
;
379 int contains_circular_path
;
381 command
*event_handler_ptr
;
382 command
*check_command_ptr
;
383 timeperiod
*check_period_ptr
;
384 timeperiod
*notification_period_ptr
;
385 objectlist
*hostgroups_ptr
;
387 struct host_struct
*next
;
388 struct host_struct
*nexthash
;
392 /* SERVICEGROUP structure */
393 typedef struct servicegroup_struct
{
396 servicesmember
*members
;
400 struct servicegroup_struct
*next
;
401 struct servicegroup_struct
*nexthash
;
405 /* SERVICE structure */
406 struct service_struct
{
410 char *service_check_command
;
413 double check_interval
;
414 double retry_interval
;
417 contactgroupsmember
*contact_groups
;
418 contactsmember
*contacts
;
419 double notification_interval
;
420 double first_notification_delay
;
421 int notify_on_unknown
;
422 int notify_on_warning
;
423 int notify_on_critical
;
424 int notify_on_recovery
;
425 int notify_on_flapping
;
426 int notify_on_downtime
;
428 int stalk_on_warning
;
429 int stalk_on_unknown
;
430 int stalk_on_critical
;
432 char *notification_period
;
434 int flap_detection_enabled
;
435 double low_flap_threshold
;
436 double high_flap_threshold
;
437 int flap_detection_on_ok
;
438 int flap_detection_on_warning
;
439 int flap_detection_on_unknown
;
440 int flap_detection_on_critical
;
441 int process_performance_data
;
443 int freshness_threshold
;
444 int accept_passive_service_checks
;
445 int event_handler_enabled
;
447 int retain_status_information
;
448 int retain_nonstatus_information
;
449 int notifications_enabled
;
450 int obsess_over_service
;
451 int failure_prediction_enabled
;
452 char *failure_prediction_options
;
457 char *icon_image_alt
;
458 customvariablesmember
*custom_variables
;
460 int problem_has_been_acknowledged
;
461 int acknowledgement_type
;
462 int host_problem_at_last_check
;
468 char *long_plugin_output
;
472 int should_be_scheduled
;
475 unsigned long current_event_id
;
476 unsigned long last_event_id
;
477 unsigned long current_problem_id
;
478 unsigned long last_problem_id
;
479 time_t last_notification
;
480 time_t next_notification
;
481 int no_more_notifications
;
482 int check_flapping_recovery_notification
;
483 time_t last_state_change
;
484 time_t last_hard_state_change
;
486 time_t last_time_warning
;
487 time_t last_time_unknown
;
488 time_t last_time_critical
;
489 int has_been_checked
;
490 int is_being_freshened
;
491 int notified_on_unknown
;
492 int notified_on_warning
;
493 int notified_on_critical
;
494 int current_notification_number
;
495 unsigned long current_notification_id
;
497 double execution_time
;
500 int scheduled_downtime_depth
;
501 int pending_flex_downtime
;
502 int state_history
[MAX_STATE_HISTORY_ENTRIES
]; /* flap detection */
503 int state_history_index
;
505 unsigned long flapping_comment_id
;
506 double percent_state_change
;
507 unsigned long modified_attributes
;
510 command
*event_handler_ptr
;
511 char *event_handler_args
;
512 command
*check_command_ptr
;
513 char *check_command_args
;
514 timeperiod
*check_period_ptr
;
515 timeperiod
*notification_period_ptr
;
516 objectlist
*servicegroups_ptr
;
518 struct service_struct
*next
;
519 struct service_struct
*nexthash
;
523 /* SERVICE ESCALATION structure */
524 typedef struct serviceescalation_struct
{
527 int first_notification
;
528 int last_notification
;
529 double notification_interval
;
530 char *escalation_period
;
531 int escalate_on_recovery
;
532 int escalate_on_warning
;
533 int escalate_on_unknown
;
534 int escalate_on_critical
;
535 contactgroupsmember
*contact_groups
;
536 contactsmember
*contacts
;
538 service
*service_ptr
;
539 timeperiod
*escalation_period_ptr
;
541 struct serviceescalation_struct
*next
;
542 struct serviceescalation_struct
*nexthash
;
546 /* SERVICE DEPENDENCY structure */
547 typedef struct servicedependency_struct
{
549 char *dependent_host_name
;
550 char *dependent_service_description
;
552 char *service_description
;
553 char *dependency_period
;
558 int fail_on_critical
;
561 int circular_path_checked
;
562 int contains_circular_path
;
564 service
*master_service_ptr
;
565 service
*dependent_service_ptr
;
566 timeperiod
*dependency_period_ptr
;
568 struct servicedependency_struct
*next
;
569 struct servicedependency_struct
*nexthash
;
573 /* HOST ESCALATION structure */
574 typedef struct hostescalation_struct
{
576 int first_notification
;
577 int last_notification
;
578 double notification_interval
;
579 char *escalation_period
;
580 int escalate_on_recovery
;
581 int escalate_on_down
;
582 int escalate_on_unreachable
;
583 contactgroupsmember
*contact_groups
;
584 contactsmember
*contacts
;
587 timeperiod
*escalation_period_ptr
;
589 struct hostescalation_struct
*next
;
590 struct hostescalation_struct
*nexthash
;
594 /* HOST DEPENDENCY structure */
595 typedef struct hostdependency_struct
{
597 char *dependent_host_name
;
599 char *dependency_period
;
603 int fail_on_unreachable
;
606 int circular_path_checked
;
607 int contains_circular_path
;
609 host
*master_host_ptr
;
610 host
*dependent_host_ptr
;
611 timeperiod
*dependency_period_ptr
;
613 struct hostdependency_struct
*next
;
614 struct hostdependency_struct
*nexthash
;
620 /****************** HASH STRUCTURES ********************/
622 typedef struct host_cursor_struct
{
623 int host_hashchain_iterator
;
624 host
*current_host_pointer
;
631 /********************* FUNCTIONS **********************/
633 /**** Top-level input functions ****/
634 int read_object_config_data(char *,int,int,int); /* reads all external configuration data of specific types */
637 /**** Object Creation Functions ****/
638 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 */
639 commandsmember
*add_service_notification_command_to_contact(contact
*,char *); /* adds a service notification command to a contact definition */
640 commandsmember
*add_host_notification_command_to_contact(contact
*,char *); /* adds a host notification command to a contact definition */
641 customvariablesmember
*add_custom_variable_to_contact(contact
*,char *,char *); /* adds a custom variable to a service definition */
642 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 */
643 hostsmember
*add_parent_host_to_host(host
*,char *); /* adds a parent host to a host definition */
644 hostsmember
*add_child_link_to_host(host
*,host
*); /* adds a child host to a host definition */
645 contactgroupsmember
*add_contactgroup_to_host(host
*,char *); /* adds a contactgroup to a host definition */
646 contactsmember
*add_contact_to_host(host
*,char *); /* adds a contact to a host definition */
647 customvariablesmember
*add_custom_variable_to_host(host
*,char *,char *); /* adds a custom variable to a host definition */
648 timeperiod
*add_timeperiod(char *,char *); /* adds a timeperiod definition */
649 timeperiodexclusion
*add_exclusion_to_timeperiod(timeperiod
*,char *); /* adds an exclusion to a timeperiod */
650 timerange
*add_timerange_to_timeperiod(timeperiod
*,int,unsigned long,unsigned long); /* adds a timerange to a timeperiod definition */
651 daterange
*add_exception_to_timeperiod(timeperiod
*,int,int,int,int,int,int,int,int,int,int,int,int);
652 timerange
*add_timerange_to_daterange(daterange
*,unsigned long,unsigned long);
653 hostgroup
*add_hostgroup(char *,char *,char *,char *,char *); /* adds a hostgroup definition */
654 hostsmember
*add_host_to_hostgroup(hostgroup
*, char *); /* adds a host to a hostgroup definition */
655 servicegroup
*add_servicegroup(char *,char *,char *,char *,char *); /* adds a servicegroup definition */
656 servicesmember
*add_service_to_servicegroup(servicegroup
*,char *,char *); /* adds a service to a servicegroup definition */
657 contactgroup
*add_contactgroup(char *,char *); /* adds a contactgroup definition */
658 contactsmember
*add_contact_to_contactgroup(contactgroup
*,char *); /* adds a contact to a contact group definition */
659 command
*add_command(char *,char *); /* adds a command definition */
660 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 */
661 contactgroupsmember
*add_contactgroup_to_service(service
*,char *); /* adds a contact group to a service definition */
662 contactsmember
*add_contact_to_service(service
*,char *); /* adds a contact to a host definition */
663 serviceescalation
*add_serviceescalation(char *,char *,int,int,double,char *,int,int,int,int); /* adds a service escalation definition */
664 contactgroupsmember
*add_contactgroup_to_serviceescalation(serviceescalation
*,char *); /* adds a contact group to a service escalation definition */
665 contactsmember
*add_contact_to_serviceescalation(serviceescalation
*,char *); /* adds a contact to a service escalation definition */
666 customvariablesmember
*add_custom_variable_to_service(service
*,char *,char *); /* adds a custom variable to a service definition */
667 servicedependency
*add_service_dependency(char *,char *,char *,char *,int,int,int,int,int,int,int,char *); /* adds a service dependency definition */
668 hostdependency
*add_host_dependency(char *,char *,int,int,int,int,int,int,char *); /* adds a host dependency definition */
669 hostescalation
*add_hostescalation(char *,int,int,double,char *,int,int,int); /* adds a host escalation definition */
670 contactsmember
*add_contact_to_hostescalation(hostescalation
*,char *); /* adds a contact to a host escalation definition */
671 contactgroupsmember
*add_contactgroup_to_hostescalation(hostescalation
*,char *); /* adds a contact group to a host escalation definition */
673 contactsmember
*add_contact_to_object(contactsmember
**,char *); /* adds a contact to an object */
674 customvariablesmember
*add_custom_variable_to_object(customvariablesmember
**,char *,char *); /* adds a custom variable to an object */
677 servicesmember
*add_service_link_to_host(host
*,service
*);
680 /*** Object Skiplist Functions ****/
681 int init_object_skiplists(void);
682 int free_object_skiplists(void);
683 int skiplist_compare_text(const char *val1a
, const char *val1b
, const char *val2a
, const char *val2b
);
684 int skiplist_compare_host(void *a
, void *b
);
685 int skiplist_compare_service(void *a
, void *b
);
686 int skiplist_compare_command(void *a
, void *b
);
687 int skiplist_compare_timeperiod(void *a
, void *b
);
688 int skiplist_compare_contact(void *a
, void *b
);
689 int skiplist_compare_contactgroup(void *a
, void *b
);
690 int skiplist_compare_hostgroup(void *a
, void *b
);
691 int skiplist_compare_servicegroup(void *a
, void *b
);
692 int skiplist_compare_hostescalation(void *a
, void *b
);
693 int skiplist_compare_serviceescalation(void *a
, void *b
);
694 int skiplist_compare_hostdependency(void *a
, void *b
);
695 int skiplist_compare_servicedependency(void *a
, void *b
);
697 int get_host_count(void);
698 int get_service_count(void);
702 /**** Object Hash Functions ****/
703 int add_servicedependency_to_hashlist(servicedependency
*);
706 /**** Object Search Functions ****/
707 timeperiod
* find_timeperiod(char *); /* finds a timeperiod object */
708 host
* find_host(char *); /* finds a host object */
709 hostgroup
* find_hostgroup(char *); /* finds a hostgroup object */
710 servicegroup
* find_servicegroup(char *); /* finds a servicegroup object */
711 contact
* find_contact(char *); /* finds a contact object */
712 contactgroup
* find_contactgroup(char *); /* finds a contactgroup object */
713 command
* find_command(char *); /* finds a command object */
714 service
* find_service(char *,char *); /* finds a service object */
717 /**** Object Traversal Functions ****/
718 hostescalation
*get_first_hostescalation_by_host(char *, void **);
719 hostescalation
*get_next_hostescalation_by_host(char *,void **);
720 serviceescalation
*get_first_serviceescalation_by_service(char *,char *, void **);
721 serviceescalation
*get_next_serviceescalation_by_service(char *,char *,void **);
722 hostdependency
*get_first_hostdependency_by_dependent_host(char *, void **);
723 hostdependency
*get_next_hostdependency_by_dependent_host(char *, void **);
724 servicedependency
*get_first_servicedependency_by_dependent_service(char *,char *, void **);
725 servicedependency
*get_next_servicedependency_by_dependent_service(char *,char *,void **);
728 int add_object_to_objectlist(objectlist
**,void *);
729 int free_objectlist(objectlist
**);
733 /**** Object Query Functions ****/
734 int is_host_immediate_child_of_host(host
*,host
*); /* checks if a host is an immediate child of another host */
735 int is_host_primary_immediate_child_of_host(host
*,host
*); /* checks if a host is an immediate child (and primary child) of another host */
736 int is_host_immediate_parent_of_host(host
*,host
*); /* checks if a host is an immediate child of another host */
737 int is_host_member_of_hostgroup(hostgroup
*,host
*); /* tests whether or not a host is a member of a specific hostgroup */
738 int is_host_member_of_servicegroup(servicegroup
*,host
*); /* tests whether or not a service is a member of a specific servicegroup */
739 int is_service_member_of_servicegroup(servicegroup
*,service
*); /* tests whether or not a service is a member of a specific servicegroup */
740 int is_contact_member_of_contactgroup(contactgroup
*, contact
*); /* tests whether or not a contact is a member of a specific contact group */
741 int is_contact_for_hostgroup(hostgroup
*,contact
*); /* tests whether or not a contact is a member of a specific hostgroup */
742 int is_contact_for_servicegroup(servicegroup
*,contact
*); /* tests whether or not a contact is a member of a specific servicegroup */
743 int is_contact_for_host(host
*,contact
*); /* tests whether or not a contact is a contact member for a specific host */
744 int is_escalated_contact_for_host(host
*,contact
*); /* checks whether or not a contact is an escalated contact for a specific host */
745 int is_contact_for_service(service
*,contact
*); /* tests whether or not a contact is a contact member for a specific service */
746 int is_escalated_contact_for_service(service
*,contact
*); /* checks whether or not a contact is an escalated contact for a specific service */
747 int is_host_immediate_parent_of_host(host
*,host
*); /* tests whether or not a host is an immediate parent of another host */
749 int number_of_immediate_child_hosts(host
*); /* counts the number of immediate child hosts for a particular host */
750 int number_of_total_child_hosts(host
*); /* counts the number of total child hosts for a particular host */
751 int number_of_immediate_parent_hosts(host
*); /* counts the number of immediate parents hosts for a particular host */
752 int number_of_total_parent_hosts(host
*); /* counts the number of total parents hosts for a particular host */
755 int check_for_circular_host_path(host
*,host
*); /* checks if a circular path exists for a given host */
756 int check_for_circular_servicedependency_path(servicedependency
*,servicedependency
*,int); /* checks if a circular dependency exists for a given service */
757 int check_for_circular_hostdependency_path(hostdependency
*,hostdependency
*,int); /* checks if a circular dependency exists for a given host */
761 /**** Object Cleanup Functions ****/
762 int free_object_data(void); /* frees all allocated memory for the object definitions */