nrpe.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /****************************************************************************
  2. *
  3. * nrpe.h - Nagios Remote Plugin Executor 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 <limits.h>
  27. typedef struct command_struct {
  28. char *command_name;
  29. char *command_line;
  30. struct command_struct *next;
  31. } command;
  32. int init(void);
  33. void init_ssl(void);
  34. void log_ssl_startup(void);
  35. void usage(int);
  36. void run_inetd(void);
  37. void run_src(void);
  38. void run_daemon(void);
  39. void set_stdio_sigs(void);
  40. void cleanup(void);
  41. int read_config_file(char *);
  42. int read_config_dir(char *);
  43. int get_log_facility(char *);
  44. int add_command(char *,char *);
  45. command *find_command(char *);
  46. void create_listener(struct addrinfo *ai);
  47. void wait_for_connections(void);
  48. void setup_wait_conn(void);
  49. int wait_conn_fork(int sock);
  50. void conn_check_peer(int sock);
  51. void handle_connection(int);
  52. void init_handle_conn(void);
  53. int handle_conn_ssl(int sock, void *ssl_ptr);
  54. int read_packet(int sock, void *ssl_ptr, v2_packet *v2_pkt, v3_packet **v3_pkt);
  55. void free_memory(void);
  56. int my_system(char*, int, int*, char**); /* executes a command via popen(), but also protects against timeouts */
  57. void my_system_sighandler(int); /* handles timeouts when executing commands via my_system() */
  58. void my_connection_sighandler(int); /* handles timeouts of connection */
  59. int drop_privileges(char *,char *, int);
  60. int write_pid_file(void);
  61. int remove_pid_file(void);
  62. int check_privileges(void);
  63. void sighandler(int);
  64. void child_sighandler(int);
  65. int validate_request(v2_packet *, v3_packet *);
  66. int contains_nasty_metachars(char *);
  67. int process_macros(char *,char *,int);
  68. int process_arguments(int,char **);