2017-05-19 23:37:19 +02:00
|
|
|
#ifndef NAGIOS_SHARED_H_INCLUDED
|
|
|
|
#define NAGIOS_SHARED_H_INCLUDED
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
#include <time.h>
|
2017-05-19 23:37:19 +02:00
|
|
|
#include "lib/libnagios.h"
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
NAGIOS_BEGIN_DECL
|
|
|
|
|
|
|
|
/* mmapfile structure - used for reading files via mmap() */
|
|
|
|
typedef struct mmapfile_struct {
|
|
|
|
char *path;
|
|
|
|
int mode;
|
|
|
|
int fd;
|
|
|
|
unsigned long file_size;
|
|
|
|
unsigned long current_position;
|
|
|
|
unsigned long current_line;
|
|
|
|
void *mmap_buf;
|
|
|
|
} mmapfile;
|
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
/* official count of first-class objects */
|
|
|
|
struct object_count {
|
|
|
|
unsigned int commands;
|
|
|
|
unsigned int timeperiods;
|
|
|
|
unsigned int hosts;
|
|
|
|
unsigned int hostescalations;
|
|
|
|
unsigned int hostdependencies;
|
|
|
|
unsigned int services;
|
|
|
|
unsigned int serviceescalations;
|
|
|
|
unsigned int servicedependencies;
|
|
|
|
unsigned int contacts;
|
|
|
|
unsigned int contactgroups;
|
|
|
|
unsigned int hostgroups;
|
|
|
|
unsigned int servicegroups;
|
|
|
|
};
|
2017-05-19 22:22:40 +02:00
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
extern struct object_count num_objects;
|
|
|
|
|
|
|
|
extern void init_shared_cfg_vars(int);
|
|
|
|
extern void timing_point(const char *fmt, ...); /* print a message and the time since the first message */
|
|
|
|
extern char *my_strtok(char *buffer, const char *tokens);
|
2019-04-18 17:09:18 +02:00
|
|
|
extern char *my_strtok_with_free(char *buffer, const char *tokens, int free_orig);
|
2017-05-19 22:22:40 +02:00
|
|
|
extern char *my_strsep(char **stringp, const char *delim);
|
2017-05-19 23:37:19 +02:00
|
|
|
extern mmapfile *mmap_fopen(const char *filename);
|
2017-05-19 22:22:40 +02:00
|
|
|
extern int mmap_fclose(mmapfile *temp_mmapfile);
|
|
|
|
extern char *mmap_fgets(mmapfile *temp_mmapfile);
|
|
|
|
extern char *mmap_fgets_multiline(mmapfile * temp_mmapfile);
|
|
|
|
extern void strip(char *buffer);
|
|
|
|
extern int hashfunc(const char *name1, const char *name2, int hashslots);
|
|
|
|
extern int compare_hashdata(const char *val1a, const char *val1b, const char *val2a,
|
|
|
|
const char *val2b);
|
|
|
|
extern void get_datetime_string(time_t *raw_time, char *buffer,
|
|
|
|
int buffer_length, int type);
|
|
|
|
extern void get_time_breakdown(unsigned long raw_time, int *days, int *hours,
|
|
|
|
int *minutes, int *seconds);
|
|
|
|
|
|
|
|
NAGIOS_END_DECL
|
|
|
|
#endif
|