utils.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /************************************************************************************************
  2. *
  3. * UTILS.H - NRPE Utilities Include File
  4. *
  5. * License: GPL
  6. * Copyright (c) 1999-2006 Ethan Galstad (nagios@nagios.org)
  7. *
  8. * Last Modified: 12-11-2006
  9. *
  10. * Description:
  11. *
  12. * This file contains common include files and function definitions used in many of the plugins.
  13. *
  14. * License Information:
  15. *
  16. * This program is free software; you can redistribute it and/or modify
  17. * it under the terms of the GNU General Public License as published by
  18. * the Free Software Foundation; either version 2 of the License, or
  19. * (at your option) any later version.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, write to the Free Software
  28. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  29. *
  30. ************************************************************************************************/
  31. #ifndef NRPE_UTILS_H_INCLUDED
  32. #define NRPE_UTILS_H_INCLUDED
  33. #include "../include/config.h"
  34. void generate_crc32_table(void);
  35. unsigned long calculate_crc32(char*, int);
  36. void randomize_buffer(char*,int);
  37. int my_tcp_connect(char*, int, int*);
  38. #ifdef HAVE_STRUCT_SOCKADDR_STORAGE
  39. int my_connect(const char*, struct sockaddr_storage*, u_short, int, const char*);
  40. #else
  41. int my_connect(const char*, struct sockaddr*, u_short, int, const char*);
  42. #endif
  43. void add_listen_addr(struct addrinfo**, int, char*, int);
  44. int clean_environ(const char *keep_env_vars, const char *nrpe_user);
  45. char* strip(char*);
  46. int sendall(int, char*, int*);
  47. int recvall(int, char*, int*, int);
  48. char *my_strsep(char**, const char*);
  49. void open_log_file();
  50. void logit(int priority, const char *format, ...);
  51. void close_log_file();
  52. void display_license(void);
  53. #endif