parse_ini.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef _PARSE_INI_H_
  2. #define _PARSE_INI_H_
  3. /*
  4. * parse_ini.h: routines for loading nagios-plugin defaults from ini
  5. * configuration files.
  6. */
  7. /* np_arg_list is a linked list of arguments passed between the ini
  8. * parser and the argument parser to construct the final array */
  9. typedef struct np_arg_el {
  10. char *arg;
  11. struct np_arg_el *next;
  12. } np_arg_list;
  13. /* FIXME: This is in plugins/common.c. Should be eventually moved to lib/
  14. * (although for this particular one a configure settings should be ideal)
  15. */
  16. #ifndef MAX_INPUT_BUFFER
  17. # define MAX_INPUT_BUFFER 8192
  18. #endif /* MAX_INPUT_BUFFER */
  19. /* Filenames (see below) */
  20. #ifndef NP_DEFAULT_INI_FILENAME1
  21. # define NP_DEFAULT_INI_FILENAME1 "plugins.ini"
  22. #endif /* NP_DEFAULT_INI_FILENAME1 */
  23. #ifndef NP_DEFAULT_INI_FILENAME2
  24. # define NP_DEFAULT_INI_FILENAME2 "nagios-plugins.ini"
  25. #endif /* NP_DEFAULT_INI_FILENAME2 */
  26. /* Config paths ending in nagios (search for NP_DEFAULT_INI_FILENAME1) */
  27. #ifndef NP_DEFAULT_INI_NAGIOS_PATH1
  28. # define NP_DEFAULT_INI_NAGIOS_PATH1 "/etc/nagios"
  29. #endif /* NP_DEFAULT_INI_NAGIOS_PATH1 */
  30. #ifndef NP_DEFAULT_INI_NAGIOS_PATH2
  31. # define NP_DEFAULT_INI_NAGIOS_PATH2 "/usr/local/nagios/etc"
  32. #endif /* NP_DEFAULT_INI_NAGIOS_PATH2 */
  33. #ifndef NP_DEFAULT_INI_NAGIOS_PATH3
  34. # define NP_DEFAULT_INI_NAGIOS_PATH3 "/usr/local/etc/nagios"
  35. #endif /* NP_DEFAULT_INI_NAGIOS_PATH3 */
  36. #ifndef NP_DEFAULT_INI_NAGIOS_PATH4
  37. # define NP_DEFAULT_INI_NAGIOS_PATH4 "/etc/opt/nagios"
  38. #endif /* NP_DEFAULT_INI_NAGIOS_PATH4 */
  39. /* Config paths not ending in nagios (search for NP_DEFAULT_INI_FILENAME2) */
  40. #ifndef NP_DEFAULT_INI_PATH1
  41. # define NP_DEFAULT_INI_PATH1 "/etc"
  42. #endif /* NP_DEFAULT_INI_PATH1 */
  43. #ifndef NP_DEFAULT_INI_PATH2
  44. # define NP_DEFAULT_INI_PATH2 "/usr/local/etc"
  45. #endif /* NP_DEFAULT_INI_PATH2 */
  46. #ifndef NP_DEFAULT_INI_PATH3
  47. # define NP_DEFAULT_INI_PATH3 "/etc/opt"
  48. #endif /* NP_DEFAULT_INI_PATH3 */
  49. /* np_load_defaults: load the default configuration (if present) for
  50. * a plugin from the ini file
  51. */
  52. np_arg_list* np_get_defaults(const char *locator, const char *default_section);
  53. #endif /* _PARSE_INI_H_ */