web_server.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 SIMPLE_PATTERN *web_allow_dashboard_from;
  18. extern SIMPLE_PATTERN *web_allow_registry_from;
  19. extern SIMPLE_PATTERN *web_allow_badges_from;
  20. extern SIMPLE_PATTERN *web_allow_streaming_from;
  21. extern SIMPLE_PATTERN *web_allow_netdataconf_from;
  22. extern SIMPLE_PATTERN *web_allow_mgmt_from;
  23. extern WEB_SERVER_MODE web_server_mode;
  24. extern WEB_SERVER_MODE web_server_mode_id(const char *mode);
  25. extern const char *web_server_mode_name(WEB_SERVER_MODE id);
  26. extern void api_listen_sockets_setup(void);
  27. #define DEFAULT_TIMEOUT_TO_RECEIVE_FIRST_WEB_REQUEST 60
  28. #define DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS 60
  29. extern int web_client_timeout;
  30. extern int web_client_first_request_timeout;
  31. extern long web_client_streaming_rate_t;
  32. #ifdef WEB_SERVER_INTERNALS
  33. extern LISTEN_SOCKETS api_sockets;
  34. extern void web_client_update_acl_matches(struct web_client *w);
  35. extern void web_server_log_connection(struct web_client *w, const char *msg);
  36. extern void web_client_initialize_connection(struct web_client *w);
  37. extern struct web_client *web_client_create_on_listenfd(int listener);
  38. #include "web_client_cache.h"
  39. #endif // WEB_SERVER_INTERNALS
  40. #include "static/static-threaded.h"
  41. #include "daemon/common.h"
  42. #endif /* NETDATA_WEB_SERVER_H */