common.h.in 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /************************************************************************
  2. *
  3. * COMMON.H - NRPE Common Include File
  4. * Copyright (c) 1999-2007 Ethan Galstad (nagios@nagios.org)
  5. * Last Modified: 09-08-2016
  6. *
  7. * License:
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. ************************************************************************/
  23. #include "config.h"
  24. #define SSL_TYPE_@SSL_TYPE@
  25. #ifdef HAVE_SSL
  26. #include <@SSL_INC_PREFIX@@SSL_HDR@>
  27. # ifdef SSL_TYPE_openssl
  28. # include <@SSL_INC_PREFIX@err.h>
  29. # include <@SSL_INC_PREFIX@rand.h>
  30. # endif
  31. #endif
  32. #define PROGRAM_VERSION "3.0.1"
  33. #define MODIFICATION_DATE "09-08-2016"
  34. #define OK 0
  35. #define ERROR -1
  36. #define TRUE 1
  37. #define FALSE 0
  38. #define STATE_UNKNOWN 3 /* service state return codes */
  39. #define STATE_CRITICAL 2
  40. #define STATE_WARNING 1
  41. #define STATE_OK 0
  42. #define DEFAULT_SOCKET_TIMEOUT 10 /* timeout after 10 seconds */
  43. #define DEFAULT_CONNECTION_TIMEOUT 300 /* timeout if daemon is waiting for connection more than this time */
  44. #define MAX_INPUT_BUFFER 2048 /* max size of most buffers we use */
  45. #define MAX_FILENAME_LENGTH 256
  46. #define MAX_HOST_ADDRESS_LENGTH 256 /* max size of a host address */
  47. #define MAX_COMMAND_ARGUMENTS 16
  48. #define NRPE_HELLO_COMMAND "_NRPE_CHECK"
  49. /**************** PACKET STRUCTURE DEFINITION **********/
  50. #define QUERY_PACKET 1 /* id code for a packet containing a query */
  51. #define RESPONSE_PACKET 2 /* id code for a packet containing a response */
  52. #define NRPE_PACKET_VERSION_3 3 /* packet version identifier */
  53. #define NRPE_PACKET_VERSION_2 2
  54. #define NRPE_PACKET_VERSION_1 1 /* older packet version identifiers (no longer supported) */
  55. #define MAX_PACKETBUFFER_LENGTH 1024 /* amount of data to send in one query/response vor version 2 */
  56. typedef struct _v2_packet {
  57. int16_t packet_version;
  58. int16_t packet_type;
  59. u_int32_t crc32_value;
  60. int16_t result_code;
  61. char buffer[MAX_PACKETBUFFER_LENGTH];
  62. } v2_packet;
  63. typedef struct _v3_packet {
  64. int16_t packet_version;
  65. int16_t packet_type;
  66. u_int32_t crc32_value;
  67. int16_t result_code;
  68. int16_t alignment;
  69. int32_t buffer_length;
  70. char buffer[1];
  71. } v3_packet;
  72. /**************** OPERATING SYSTEM SPECIFIC DEFINITIONS **********/
  73. #if defined(__sun) || defined(__hpux)
  74. # ifndef LOG_AUTHPRIV
  75. # define LOG_AUTHPRIV LOG_AUTH
  76. # endif
  77. # ifndef LOG_FTP
  78. # define LOG_FTP LOG_DAEMON
  79. # endif
  80. #elif defined(_AIX)
  81. # include <sys/select.h>
  82. # ifndef LOG_FTP
  83. # define LOG_FTP LOG_DAEMON
  84. # endif
  85. #endif