1 /*****************************************************************************
3 * Monitoring Plugins common include file
6 * Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
7 * Copyright (c) 2003-2007 Monitoring Plugins Development Team
11 * This file contains common include files and defines used in many of
15 * This program is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation, either version 3 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29 *****************************************************************************/
36 #ifdef HAVE_FEATURES_H
40 #include <stdio.h> /* obligatory includes */
44 /* This block provides uintmax_t - should be reported to coreutils that this should be added to fsuage.h */
46 # include <inttypes.h>
53 # define UINTMAX_MAX ((uintmax_t) -1)
56 #include <limits.h> /* This is assumed true, because coreutils assume it too */
79 /* GET_NUMBER_OF_CPUS is a macro to return
80 number of CPUs, if we can get that data.
81 Use configure.in to test for various OS ways of
83 Will return -1 if cannot get data
85 #if defined(HAVE_SYSCONF__SC_NPROCESSORS_ONLN)
86 # define GET_NUMBER_OF_CPUS() sysconf(_SC_NPROCESSORS_ONLN)
87 #elif defined (HAVE_SYSCONF__SC_NPROCESSORS_CONF)
88 # define GET_NUMBER_OF_CPUS() sysconf(_SC_NPROCESSORS_CONF)
90 # define GET_NUMBER_OF_CPUS() -1
93 #ifdef TIME_WITH_SYS_TIME
94 # include <sys/time.h>
97 # ifdef HAVE_SYS_TIME_H
98 # include <sys/time.h>
104 #ifdef HAVE_SYS_TYPES_H
105 #include <sys/types.h>
108 #ifdef HAVE_SYS_SOCKET_H
109 #include <sys/socket.h>
122 #ifdef HAVE_SYS_POLL_H
123 # include "sys/poll.h"
133 # define strtol(a,b,c) atol((a))
137 # define strtoul(a,b,c) (unsigned long)atol((a))
140 /* SSL implementations */
141 #ifdef HAVE_GNUTLS_OPENSSL_H
142 # include <gnutls/openssl.h>
144 # define OPENSSL_LOAD_CONF /* See the OPENSSL_config(3) man page. */
153 # ifdef HAVE_OPENSSL_SSL_H
154 # include <openssl/rsa.h>
155 # include <openssl/crypto.h>
156 # include <openssl/x509.h>
157 # include <openssl/pem.h>
158 # include <openssl/ssl.h>
159 # include <openssl/err.h>
164 /* openssl 1.1 does not set OPENSSL_NO_SSL2 by default but ships without ssl2 */
165 #ifdef OPENSSL_VERSION_NUMBER
166 # if OPENSSL_VERSION_NUMBER >= 0x10100000
167 # define OPENSSL_NO_SSL2
177 /* MariaDB 10.2 client does not set MYSQL_PORT */
179 # define MYSQL_PORT 3306
196 DEFAULT_SOCKET_TIMEOUT
= 10, /* timeout after 10 seconds */
197 MAX_INPUT_BUFFER
= 8192, /* max size of most buffers we use */
198 MAX_HOST_ADDRESS_LENGTH
= 256 /* max size of a host address */
203 * Internationalization
207 #define _(String) gettext (String)
210 # define textdomain(Domainname) /* empty */
211 # undef bindtextdomain
212 # define bindtextdomain(Domainname, Dirname) /* empty */
215 /* For non-GNU compilers to ignore __attribute__ */
217 # define __attribute__(x) /* do nothing */
220 #endif /* _COMMON_H_ */