supla-device
Loading...
Searching...
No Matches
web_server.h
1/*
2 Copyright (C) AC SOFTWARE SP. Z O.O.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17*/
18
19#ifndef SRC_SUPLA_NETWORK_WEB_SERVER_H_
20#define SRC_SUPLA_NETWORK_WEB_SERVER_H_
21
22#include <supla/network/html_generator.h>
23#include <supla/network/html_element.h>
24
26
27#define HTML_KEY_LENGTH 16
28#define HTML_VAL_LENGTH 4000
29
30namespace Supla {
31
32extern const unsigned char favico[1150];
33
34class WebServer {
35 public:
36 static WebServer *Instance();
37 explicit WebServer(Supla::HtmlGenerator *);
38 virtual ~WebServer();
39 virtual void start() = 0;
40 virtual void stop() = 0;
41 void setSuplaDeviceClass(SuplaDeviceClass *);
42 void notifyClientConnected(bool isPost = false);
43 virtual void parsePost(const char *postContent,
44 int size,
45 bool lastChunk = true);
46 virtual void resetParser();
47 void setBetaProcessing();
48
49 virtual bool verifyCertificatesFormat();
50
51 Supla::HtmlGenerator *htmlGenerator = nullptr;
52
53 protected:
54 static WebServer *webServerInstance;
55 bool destroyGenerator = false;
56 SuplaDeviceClass *sdc = nullptr;
57 bool keyFound = false;
58 int partialSize = 0;
59 char key[HTML_KEY_LENGTH] = {};
60 char *value = nullptr;
61 enum Supla::HtmlSection excludeSection =
62 Supla::HtmlSection::HTML_SECTION_BETA_FORM;
63};
64
65}; // namespace Supla
66
67#endif // SRC_SUPLA_NETWORK_WEB_SERVER_H_
Definition SuplaDevice.h:95
Definition html_generator.h:35