web_api.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_WEB_API_H
  3. #define NETDATA_WEB_API_H 1
  4. #include "daemon/common.h"
  5. #include "web/api/badges/web_buffer_svg.h"
  6. #include "web/api/formatters/rrd2json.h"
  7. #include "web/api/health/health_cmdapi.h"
  8. #include "web/api/queries/weights.h"
  9. extern bool netdata_is_protected_by_bearer;
  10. extern DICTIONARY *netdata_authorized_bearers;
  11. bool api_check_bearer_token(struct web_client *w);
  12. bool extract_bearer_token_from_request(struct web_client *w, char *dst, size_t dst_len);
  13. void bearer_tokens_init(void);
  14. struct web_api_command {
  15. const char *command;
  16. uint32_t hash;
  17. WEB_CLIENT_ACL acl;
  18. int (*callback)(RRDHOST *host, struct web_client *w, char *url);
  19. };
  20. struct web_client;
  21. int web_client_api_request_vX(RRDHOST *host, struct web_client *w, char *url_path_endpoint, struct web_api_command *api_commands);
  22. static inline void fix_google_param(char *s) {
  23. if(unlikely(!s || !*s)) return;
  24. for( ; *s ;s++) {
  25. if(!isalnum(*s) && *s != '.' && *s != '_' && *s != '-')
  26. *s = '_';
  27. }
  28. }
  29. int web_client_api_request_weights(RRDHOST *host, struct web_client *w, char *url, WEIGHTS_METHOD method, WEIGHTS_FORMAT format, size_t api_version);
  30. bool web_client_interrupt_callback(void *data);
  31. #include "web_api_v1.h"
  32. #include "web_api_v2.h"
  33. #endif //NETDATA_WEB_API_H