Added copyright notices to src/multicast.[ch] and src/collectd.[ch] in trunk
[collectd.git] / src / collectd.h
1 /**
2  * collectd - src/collectd.h
3  * Copyright (C) 2005  Florian octo Forster
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  *
19  * Authors:
20  *   Florian octo Forster <octo at verplant.org>
21  **/
22
23 #ifndef COLLECTD_H
24 #define COLLECTD_H
25
26 #if HAVE_CONFIG_H
27 # include <config.h>
28 #endif
29
30 #include <stdio.h>
31 #if HAVE_SYS_TYPES_H
32 # include <sys/types.h>
33 #endif
34 #if HAVE_SYS_STAT_H
35 # include <sys/stat.h>
36 #endif
37 #if STDC_HEADERS
38 #include <stdlib.h>
39 #include <stddef.h>
40 #else
41 # if HAVE_STDLIB_H
42 #  include <stdlib.h>
43 # endif
44 #endif
45 #if HAVE_STRING_H
46 # if !STDC_HEADERS && HAVE_MEMORY_H
47 #  include <memory.h>
48 # endif
49 # include <string.h>
50 #endif
51 #if HAVE_STRINGS_H
52 # include <strings.h>
53 #endif
54 #if HAVE_INTTYPES_H
55 # include <inttypes.h>
56 #endif
57 #if HAVE_STDINT_H
58 # include <stdint.h>
59 #endif
60 #if HAVE_UNISTD_H
61 # include <unistd.h>
62 #endif
63 #if HAVE_SYS_WAIT_H
64 # include <sys/wait.h>
65 #endif
66 #ifndef WEXITSTATUS
67 # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
68 #endif
69 #ifndef WIFEXITED
70 # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
71 #endif
72 #if HAVE_SIGNAL_H
73 # include <signal.h>
74 #endif
75 #if HAVE_FCNTL_H
76 # include <fcntl.h>
77 #endif
78 #if HAVE_ERRNO_H
79 # include <errno.h>
80 #endif
81 #if HAVE_SYSLOG_H
82 # include <syslog.h>
83 #endif
84 #if HAVE_LIMITS_H
85 # include <limits.h>
86 #endif
87 #if TIME_WITH_SYS_TIME
88 # include <sys/time.h>
89 # include <time.h>
90 #else
91 # if HAVE_SYS_TIME_H
92 #  include <sys/time.h>
93 # else
94 #  include <time.h>
95 # endif
96 #endif
97
98 #if HAVE_DIRENT_H
99 # include <dirent.h>
100 # define NAMLEN(dirent) strlen((dirent)->d_name)
101 #else
102 # define dirent direct
103 # define NAMLEN(dirent) (dirent)->d_namlen
104 # if HAVE_SYS_NDIR_H
105 #  include <sys/ndir.h>
106 # endif
107 # if HAVE_SYS_DIR_H
108 #  include <sys/dir.h>
109 # endif
110 # if HAVE_NDIR_H
111 #  include <ndir.h>
112 # endif
113 #endif
114
115 #if HAVE_STDARG_H
116 # include <stdarg.h>
117 #endif
118 #if HAVE_CTYPE_H
119 # include <ctype.h>
120 #endif
121
122 #ifndef HAVE_RRD_H
123 #undef HAVE_LIBRRD
124 #endif
125
126 #ifdef HAVE_LIBRRD
127 #include <rrd.h>
128 #endif /* HAVE_LIBRRD */
129
130 /* Won't work without the header file */
131 #ifndef HAVE_KSTAT_H
132 #undef HAVE_LIBKSTAT
133 #endif
134
135 #ifdef HAVE_LIBKSTAT
136 #include <kstat.h>
137 #include <sys/param.h>
138 #endif /* HAVE_LIBKSTAT */
139
140 /* Won't work without the header file */
141 #ifndef HAVE_STATGRAB_H
142 #undef HAVE_LIBSTATGRAB
143 #endif
144
145 #ifdef HAVE_LIBSTATGRAB
146 #include <statgrab.h>
147 #endif
148
149 #ifndef LOCALSTATEDIR
150 #define LOCALSTATEDIR "/opt/collectd/var"
151 #endif
152
153 #ifndef DATADIR
154 #define DATADIR LOCALSTATEDIR"/lib/collectd"
155 #endif
156
157 #ifndef PLUGINDIR
158 #define PLUGINDIR "/opt/collectd/lib/collectd"
159 #endif
160
161 #ifndef PIDFILE
162 #define PIDFILE LOCALSTATEDIR"/run/collectd.pid"
163 #endif
164
165 #define MODE_SERVER 0x01
166 #define MODE_CLIENT 0x02
167 #define MODE_LOCAL  0x03
168
169 extern time_t curtime;
170 extern int operating_mode;
171
172 #endif /* COLLECTD_H */