+ // Returns a pair of content and content-type.
+ using EndpointCallback = std::function<std::pair<std::string, std::string>()>;
+
+ HTTPD();
+ ~HTTPD();
+
+ enum StreamType {
+ MAIN_STREAM,
+ MULTICAM_STREAM,
+ NUM_STREAM_TYPES
+ };
+
+ // Should be called before start().
+ void set_header(StreamType stream_type, const std::string &data) {
+ header[stream_type] = data;
+ }
+
+ // Should be called before start() (due to threading issues).
+ enum CORSPolicy {
+ NO_CORS_POLICY,
+ ALLOW_ALL_ORIGINS
+ };
+ void add_endpoint(const std::string &url, const EndpointCallback &callback, CORSPolicy cors_policy) {
+ endpoints[url] = Endpoint{ callback, cors_policy };
+ }
+