/* * Copyright (C) 2007-2012 Groundwork Open Source * Originally written by Daniel Emmanuel Feinsmith * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * 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., 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301, USA. * * File: bronx.h * Author: dfeinsmith * * 2007-07-11 DEF; Created. * 2012-05-14 GH; Added BRONX_ABORT code. */ #ifndef _BRONX_H #define _BRONX_H /* include some NAGIOS stuff */ /* // A critical piece of this is that the Nagios "common.h" file defines // the _REENTRANT symbol, which MUST be defined before including system // header files. Which means that if Bronx depends on this one place to set // that symbol rather than setting it on the compiler command line, we MUST // insist that "bronx.h" be #include'd before any other header file in every // one of our .c files, AND we need to make sure that even here in bronx.h // that we #include "common.h" before #include'ing any system header files, // and we must make sure that all the Nagios code itself does the same thing. // // "common.h" also defines _THREAD_SAFE, which is a symbol equivalent to // _REENTRANT which is supposedly used under AIX and OSF1 and perhaps other // platforms to similarly invoke multi-threaded support. */ #define NSCORE #include "common.h" #include "config.h" #include "nagios.h" #include "objects.h" /* Generic includes */ #include // Include our types #include // Include support for our FIFO Special Files #include // Include support for our sockets #include #include #include #include // Set DEBUG to 1 if you want a profusion of output in your [nagios.log] and console, // otherwise, set it to 0, and it will complain only when there is something wrong. // (Huh? I don't see any support for that claim. Where is this symbol used??) #define DEBUG 1 // Define off64_t for non-64-bit platforms, for use with apr 1.0 or higher #ifndef off64_t #define off64_t long #endif /* Include required APR libraries */ #include #include #include #include #include #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif // VARIOUS #define BRONX_ABORT -2 #define BRONX_ERROR -1 #define BRONX_OK 0 #define BRONX_STALE_TIMEOUT (unsigned long)300 // OUR TYPES #define MSG_TYPE_HOST_STATUS 1 #define MSG_TYPE_SERVICE_STATUS 2 #define MSG_TYPE_SYSTEM_CONFIG 3 #define MSG_TYPE_NAGIOS_LOG 4 #define MSG_TYPE_ACKNOWLEDGEMENT 5 #define MSG_TYPE_NOTIFICATION 6 // OUR ERRORS #define BRONX_EINVALIDTYPE 1 // What are the columns in our message table #define BRONXDB_ID_COL 0 #define BRONXDB_MESSAGE_COL 1 #define BRONXDB_TIMESTAMP_COL 2 typedef struct last_object_state_struc { int last_state; int last_state_type; } last_object_state; /* Our message structure declaration */ struct message_struc { apr_pool_t *pool; int type; // Type of Message. apr_hash_t *properties; // Hash Table. }; typedef struct message_struc message; /* A structure to hold a result id. populated when executing a sql select statement and iterating through the results. */ struct resultid_struc { char *id; apr_pool_t *pool; }; typedef struct resultid_struc resultid; // Pool and Queue Data. // extern apr_thread_mutex_t *_queue_mutex; // extern apr_queue_t *_queue; // Routing Data. // extern apr_thread_cond_t *_route_thread_cond_signal; // extern int _msg_sequence; #ifdef __cplusplus } #endif #endif /* _BRONX_H */