web_server.h 1.9 KB

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