This repository was archived by the owner on Jan 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathshared.h
55 lines (48 loc) · 1.74 KB
/
shared.h
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
#ifndef INCLUDE__shared_h__
#define INCLUDE__shared_h__
#include <time.h>
#include "lib/libnagios.h"
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;
/* 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;
};
extern struct object_count num_objects;
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);
extern char *my_strsep(char **stringp, const char *delim);
extern mmapfile *mmap_fopen(const char *filename);
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