/* MediaMtx (C++) - control API (MediaMTX: internal/api, the same v3 URLs for the parts that exist here) GET /v3/paths/list paths with their state GET /v3/paths/get/{name} GET /v3/config/paths/list path configurations GET /v3/config/paths/get/{name} POST /v3/config/paths/add/{name} {"source":"rtsp://...","record":true,"rtspTransport":"tcp"} PATCH /v3/config/paths/patch/{name} the same fields, only those given are changed POST /v3/config/paths/replace/{name} DELETE /v3/config/paths/delete/{name} A change is applied at once (only the changed path restarts) and saved to the paths file. */ #pragma once #include #include #include #include "../conf/conf.h" #include "../core/pathManager.h" #include "../protocols/httpp/httpServer.h" namespace mtx { class Api : public LogParent { public: // applyConfs: replaces the path list (validated), returns false + err on failure typedef std::function &, std::string &)> ApplyFn; Api(const Conf & global, PathManager * paths, ApplyFn apply); ~Api(); bool start(std::string & err); void stop(); private: void handle(const HttpRequest & req, HttpResponse & res); Conf m_global; PathManager * m_pPaths; ApplyFn m_apply; HttpServer m_http; }; } // namespace mtx