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