common.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /************************************************************************
  2. *
  3. * COMMON.H - NRPE Common Include File
  4. * Copyright (c) 1999-2007 Ethan Galstad (nagios@nagios.org)
  5. * Last Modified: 04-21-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 PROGRAM_VERSION "3.0-beta1"
  25. #define MODIFICATION_DATE "04-21-2016"
  26. #define OK 0
  27. #define ERROR -1
  28. #define TRUE 1
  29. #define FALSE 0
  30. #define STATE_UNKNOWN 3 /* service state return codes */
  31. #define STATE_CRITICAL 2
  32. #define STATE_WARNING 1
  33. #define STATE_OK 0
  34. #define DEFAULT_SOCKET_TIMEOUT 10 /* timeout after 10 seconds */
  35. #define DEFAULT_CONNECTION_TIMEOUT 300 /* timeout if daemon is waiting for connection more than this time */
  36. #define MAX_INPUT_BUFFER 2048 /* max size of most buffers we use */
  37. #define MAX_FILENAME_LENGTH 256
  38. #define MAX_HOST_ADDRESS_LENGTH 256 /* max size of a host address */
  39. #define MAX_COMMAND_ARGUMENTS 16
  40. #define NRPE_HELLO_COMMAND "_NRPE_CHECK"
  41. /**************** PACKET STRUCTURE DEFINITION **********/
  42. #define QUERY_PACKET 1 /* id code for a packet containing a query */
  43. #define RESPONSE_PACKET 2 /* id code for a packet containing a response */
  44. #define NRPE_PACKET_VERSION_3 3 /* packet version identifier */
  45. #define NRPE_PACKET_VERSION_2 2
  46. #define NRPE_PACKET_VERSION_1 1 /* older packet version identifiers (no longer supported) */
  47. #define MAX_PACKETBUFFER_LENGTH 1024 /* amount of data to send in one query/response vor version 2 */
  48. typedef struct _v2_packet {
  49. int16_t packet_version;
  50. int16_t packet_type;
  51. u_int32_t crc32_value;
  52. int16_t result_code;
  53. char buffer[MAX_PACKETBUFFER_LENGTH];
  54. } v2_packet;
  55. typedef struct _v3_packet {
  56. int16_t packet_version;
  57. int16_t packet_type;
  58. u_int32_t crc32_value;
  59. int16_t result_code;
  60. int16_t alignment;
  61. int32_t buffer_length;
  62. char buffer[1];
  63. } v3_packet;
  64. /**************** OPERATING SYSTEM SPECIFIC DEFINITIONS **********/
  65. #if defined(__sun) || defined(__hpux)
  66. # ifndef LOG_AUTHPRIV
  67. # define LOG_AUTHPRIV LOG_AUTH
  68. # endif
  69. # ifndef LOG_FTP
  70. # define LOG_FTP LOG_DAEMON
  71. # endif
  72. #elif defined(_AIX)
  73. # include <sys/select.h>
  74. # ifndef LOG_FTP
  75. # define LOG_FTP LOG_DAEMON
  76. # endif
  77. #endif