00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _COMMENTS_H
00028 #define _COMMENTS_H
00029
00030 #include "config.h"
00031 #include "common.h"
00032 #include "objects.h"
00033
00034
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038
00039
00040
00041 #define COMMENTSOURCE_INTERNAL 0
00042 #define COMMENTSOURCE_EXTERNAL 1
00043
00044
00045
00046
00047
00048 #define HOST_COMMENT 1
00049 #define SERVICE_COMMENT 2
00050 #define ANY_COMMENT 3
00051
00052
00053
00054
00055 #define USER_COMMENT 1
00056 #define DOWNTIME_COMMENT 2
00057 #define FLAPPING_COMMENT 3
00058 #define ACKNOWLEDGEMENT_COMMENT 4
00059
00060
00061
00062
00063 #define COMMENT_HASHSLOTS 1024
00064
00065
00066
00067
00068
00069
00070
00071 typedef struct comment_struct{
00072 int comment_type;
00073 int entry_type;
00074 unsigned long comment_id;
00075 int source;
00076 int persistent;
00077 time_t entry_time;
00078 int expires;
00079 time_t expire_time;
00080 char *host_name;
00081 char *service_description;
00082 char *author;
00083 char *comment_data;
00084 struct comment_struct *next;
00085 struct comment_struct *nexthash;
00086 }comment;
00087
00088
00089 #ifdef NSCORE
00090 int initialize_comment_data(char *);
00091 int cleanup_comment_data(char *);
00092 int add_new_comment(int,int,char *,char *,time_t,char *,char *,int,int,int,time_t,unsigned long *);
00093 int add_new_host_comment(int,char *,time_t,char *,char *,int,int,int,time_t,unsigned long *);
00094 int add_new_service_comment(int,char *,char *,time_t,char *,char *,int,int,int,time_t,unsigned long *);
00095 int delete_comment(int,unsigned long);
00096 int delete_host_comment(unsigned long);
00097 int delete_service_comment(unsigned long);
00098 int delete_all_comments(int,char *,char *);
00099 int delete_all_host_comments(char *);
00100 int delete_host_acknowledgement_comments(host *);
00101 int delete_all_service_comments(char *,char *);
00102 int delete_service_acknowledgement_comments(service *);
00103
00104 int check_for_expired_comment(unsigned long);
00105 #endif
00106
00107 comment *find_comment(unsigned long,int);
00108 comment *find_service_comment(unsigned long);
00109 comment *find_host_comment(unsigned long);
00110 comment *find_comment_by_similar_content(int,char *,char *,char *,char *);
00111
00112 comment *get_first_comment_by_host(char *);
00113 comment *get_next_comment_by_host(char *,comment *);
00114
00115 int number_of_host_comments(char *);
00116 int number_of_service_comments(char *, char *);
00117
00118
00119
00120
00121
00122 extern int defer_comment_sorting;
00123 int add_comment(int,int,char *,char *,time_t,char *,char *,unsigned long,int,int,time_t,int);
00124 int sort_comments(void);
00125 int add_host_comment(int,char *,time_t,char *,char *,unsigned long,int,int,time_t,int);
00126 int add_service_comment(int,char *,char *,time_t,char *,char *,unsigned long,int,int,time_t,int);
00127
00128 int add_comment_to_hashlist(comment *);
00129
00130 void free_comment_data(void);
00131
00132 #ifdef __cplusplus
00133 }
00134 #endif
00135
00136 #endif