main.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_MAIN_H
  3. #define NETDATA_MAIN_H 1
  4. #include "common.h"
  5. extern struct config netdata_config;
  6. /**
  7. * This struct contains information about command line options.
  8. */
  9. struct option_def {
  10. /** The option character */
  11. const char val;
  12. /** The name of the long option. */
  13. const char *description;
  14. /** Short description what the option does */
  15. /** Name of the argument displayed in SYNOPSIS */
  16. const char *arg_name;
  17. /** Default value if not set */
  18. const char *default_value;
  19. };
  20. void cancel_main_threads(void);
  21. int killpid(pid_t pid);
  22. void netdata_cleanup_and_exit(int ret) NORETURN;
  23. void send_statistics(const char *action, const char *action_result, const char *action_data);
  24. typedef enum {
  25. ABILITY_DATA_QUERIES = (1 << 0),
  26. ABILITY_WEB_REQUESTS = (1 << 1),
  27. ABILITY_STREAMING_CONNECTIONS = (1 << 2),
  28. SERVICE_MAINTENANCE = (1 << 3),
  29. SERVICE_COLLECTORS = (1 << 4),
  30. SERVICE_REPLICATION = (1 << 5),
  31. SERVICE_WEB_SERVER = (1 << 6),
  32. SERVICE_ACLK = (1 << 7),
  33. SERVICE_HEALTH = (1 << 8),
  34. SERVICE_STREAMING = (1 << 9),
  35. SERVICE_CONTEXT = (1 << 10),
  36. SERVICE_ANALYTICS = (1 << 11),
  37. SERVICE_EXPORTERS = (1 << 12),
  38. SERVICE_ACLKSYNC = (1 << 13),
  39. SERVICE_HTTPD = (1 << 14)
  40. } SERVICE_TYPE;
  41. typedef enum {
  42. SERVICE_THREAD_TYPE_NETDATA,
  43. SERVICE_THREAD_TYPE_LIBUV,
  44. SERVICE_THREAD_TYPE_EVENT_LOOP,
  45. } SERVICE_THREAD_TYPE;
  46. typedef void (*force_quit_t)(void *data);
  47. typedef void (*request_quit_t)(void *data);
  48. void service_exits(void);
  49. bool service_running(SERVICE_TYPE service);
  50. struct service_thread *service_register(SERVICE_THREAD_TYPE thread_type, request_quit_t request_quit_callback, force_quit_t force_quit_callback, void *data, bool update __maybe_unused);
  51. #endif /* NETDATA_MAIN_H */