common.h.in 3.1 KB

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