/*****************************************************************************
*
* COMMENTS.C - Comment functions for Nagios
*
* Copyright (c) 1999-2006 Ethan Galstad (nagios@nagios.org)
* Last Modified: 10-09-2006
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
#include "../include/config.h"
#include "../include/common.h"
#include "../include/comments.h"
#include "../include/objects.h"
/***** IMPLEMENTATION-SPECIFIC INCLUDES *****/
#ifdef USE_XCDDEFAULT
#include "../xdata/xcddefault.h"
#endif
#ifdef NSCORE
#include "../include/nagios.h"
#include "../include/broker.h"
#endif
#ifdef NSCGI
#include "../include/cgiutils.h"
#endif
comment *comment_list=NULL;
comment **comment_hashlist=NULL;
#ifdef NSCORE
/******************************************************************/
/**************** INITIALIZATION/CLEANUP FUNCTIONS ****************/
/******************************************************************/
/* initializes comment data */
int initialize_comment_data(char *config_file){
int result=OK;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XCDDEFAULT
result=xcddefault_initialize_comment_data(config_file);
#endif
return result;
}
/* removes old/invalid comments */
int cleanup_comment_data(char *config_file){
int result=OK;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XCDDEFAULT
result=xcddefault_cleanup_comment_data(config_file);
#endif
return result;
}
/******************************************************************/
/****************** COMMENT OUTPUT FUNCTIONS **********************/
/******************************************************************/
/* adds a new host or service comment */
int add_new_comment(int type, int entry_type, char *host_name, char *svc_description, time_t entry_time, char *author_name, char *comment_data, int persistent, int source, int expires, time_t expire_time, unsigned long *comment_id){
int result=OK;
unsigned long new_comment_id=0L;
if(type==HOST_COMMENT)
result=add_new_host_comment(entry_type,host_name,entry_time,author_name,comment_data,persistent,source,expires,expire_time,&new_comment_id);
else
result=add_new_service_comment(entry_type,host_name,svc_description,entry_time,author_name,comment_data,persistent,source,expires,expire_time,&new_comment_id);
=1= |