| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef NETDATA_WEB_SERVER_H |
| 4 | #define NETDATA_WEB_SERVER_H 1 |
| 5 | |
| 6 | #include "database/rrd.h" |
| 7 | |
| 8 | #ifndef API_LISTEN_PORT |
| 9 | #define API_LISTEN_PORT 19999 |
| 10 | #endif |
| 11 | |
| 12 | #ifndef API_LISTEN_BACKLOG |
| 13 | #define API_LISTEN_BACKLOG 4096 |
| 14 | #endif |
| 15 | |
| 16 | typedef enum web_server_mode { |
| 17 | WEB_SERVER_MODE_STATIC_THREADED, |
| 18 | WEB_SERVER_MODE_NONE |
| 19 | } WEB_SERVER_MODE; |
| 20 | |
| 21 | extern SIMPLE_PATTERN *web_allow_connections_from; |
| 22 | extern int web_allow_connections_dns; |
| 23 | extern SIMPLE_PATTERN *web_allow_dashboard_from; |
| 24 | extern int web_allow_dashboard_dns; |
| 25 | extern SIMPLE_PATTERN *web_allow_registry_from; |
| 26 | extern int web_allow_registry_dns; |
| 27 | extern SIMPLE_PATTERN *web_allow_badges_from; |
| 28 | extern int web_allow_badges_dns; |
| 29 | extern SIMPLE_PATTERN *web_allow_streaming_from; |
| 30 | extern int web_allow_streaming_dns; |
| 31 | extern SIMPLE_PATTERN *web_allow_netdataconf_from; |
| 32 | extern int web_allow_netdataconf_dns; |
| 33 | extern SIMPLE_PATTERN *web_allow_mgmt_from; |
| 34 | extern int web_allow_mgmt_dns; |
| 35 | |
| 36 | extern WEB_SERVER_MODE web_server_mode; |
| 37 | |
| 38 | WEB_SERVER_MODE web_server_mode_id(const char *mode); |
| 39 | const char *web_server_mode_name(WEB_SERVER_MODE id); |
| 40 | |
| 41 | void web_server_listen_sockets_setup(void); |
| 42 | |
| 43 | #define DEFAULT_TIMEOUT_TO_RECEIVE_FIRST_WEB_REQUEST 60 |
| 44 | #define DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS 60 |
| 45 | extern int web_client_timeout; |
| 46 | extern int web_client_first_request_timeout; |
| 47 | extern long web_client_streaming_rate_t; |
| 48 | |
| 49 | #ifdef WEB_SERVER_INTERNALS |
| 50 | extern LISTEN_SOCKETS api_sockets; |
| 51 | void web_client_update_acl_matches(struct web_client *w); |
| 52 | void web_server_log_connection(struct web_client *w, const char *msg); |
| 53 | struct web_client *web_client_create_on_listenfd(int listener); |
| 54 | |
| 55 | #include "web_client_cache.h" |
| 56 | #endif // WEB_SERVER_INTERNALS |
| 57 | |
| 58 | #include "static/static-threaded.h" |
| 59 | |
| 60 | #endif /* NETDATA_WEB_SERVER_H */ |