-
Notifications
You must be signed in to change notification settings - Fork 10
/
HttpServer.h
59 lines (46 loc) · 1.18 KB
/
HttpServer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef __HttpServer__
#define __HttpServer__
#include <string>
#include <vector>
#include <map>
#include <microhttpd.h>
#include "DeviceProber.h"
#include "ImageEncoder.h"
#include "tostring.h"
class HttpServer
{
public:
HttpServer(std::vector<DeviceProber*> deviceProbers);
virtual ~HttpServer() {}
virtual ULONG AddRef(void);
virtual ULONG Release(void);
int requestHandler(
std::string method,
std::string url,
std::map<std::string, std::string>* responseHeaders,
std::stringstream* responseBody
);
private:
static const int PORT = 8042;
int indexRequestHandler(
std::map<std::string, std::string>* responseHeaders,
std::stringstream* responseBody
);
int staticRequestHandler(
std::string filename,
std::map<std::string, std::string>* responseHeaders,
std::stringstream* responseBody
);
int captureRequestHandler(
std::string filename,
std::map<std::string, std::string>* responseHeaders,
std::stringstream* responseBody
);
private:
int32_t m_refCount;
std::vector<DeviceProber*> m_deviceProbers;
std::vector<ImageEncoder*> m_imageEncoders;
char m_hostname[BUFSIZ];
MHD_Daemon* m_daemon;
};
#endif