libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
debugserver.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_HTTP
13#include <promeki/namespace.h>
14#include <promeki/objectbase.h>
15#include <promeki/error.h>
16#include <promeki/result.h>
18#include <promeki/string.h>
19#include <promeki/httpserver.h>
20#include <promeki/httpapi.h>
21
22PROMEKI_NAMESPACE_BEGIN
23
75class DebugServer : public ObjectBase {
76 PROMEKI_OBJECT(DebugServer, ObjectBase)
77 public:
79 static const String DefaultApiPrefix;
80
82 static const String DefaultBindHost;
83
85 explicit DebugServer(ObjectBase *parent = nullptr);
86
88 ~DebugServer() override;
89
94 Error listen(const SocketAddress &address);
95
103 Error listen(uint16_t port);
104
106 void close();
107
109 bool isListening() const;
110
112 SocketAddress serverAddress() const;
113
115 HttpServer &httpServer() { return _server; }
116
118 const HttpServer &httpServer() const { return _server; }
119
128 HttpApi &httpApi() { return _api; }
129
131 const HttpApi &httpApi() const { return _api; }
132
150 void installDefaultModules();
151
164 static Result<SocketAddress> parseSpec(const String &spec);
165
166 private:
167 HttpServer _server;
168 HttpApi _api;
169};
170
171PROMEKI_NAMESPACE_END
172
173#endif // PROMEKI_ENABLE_HTTP