NetBurner 3.5.0
PDF Version
 
config_server.h
Go to the documentation of this file.
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
27#ifndef __CONFIG_SERVER_H
28#define __CONFIG_SERVER_H
29
30#include <servlets.h>
31
32typedef void(diagserver)(int sock, const char *url);
33extern diagserver *pDiagServer;
34
35/*
36 * Macro used for styling the local discover page
37 * .styleDiv - Style for the DIVs around the table and button, responsible for element placement
38 * .discDiv - Style for DIV around the table, responsible for border and spacing from top of page
39 * .discTab - Style for table
40 * .devTh - Style for text separating devices in table
41 * .devTd - Style for all the table TD elements
42 * .tabTh - Style for column headers in table
43 * .btnCnf - Style for button INPUT element
44 */
45#define DiscoverStyle \
46 "<style>" \
47 ".styleDiv{width:70%; min-width:480px; max-width:900px; font-family:sans-serif; margin-left:auto; margin-right:auto;}" \
48 ".discDiv{border-width:1px; border-style:solid; border-color:#595454; border-radius:5px; margin-top:30px;}" \
49 ".discTab{width:100%; color:#595454; border-spacing:0px;}" \
50 ".devTh{font-weight:bold; border-bottom:2px solid #ddd; padding:8px; border-top:1px solid #595454; color:#333;}" \
51 ".devTd{border-top:1px solid #ddd; padding:8px; color:#333;}" \
52 ".tabTh{padding:8px; background-color:#595454; color:#fff; text-align:left;}" \
53 ".btnCnf{width:125px; height:40px; background-color:#595454; color:#fff; border-radius:5px; margin-top:10px;}" \
54 "</style>"
55
56void StartConfigServer(int prio);
57void ConfigInit();
58int FindValidConfig(); // returns fd for config blob reader
59void AddConfigServlet(servlet *s);
60void ResumeSerialConfig(int fd_cfg = CurrentStdioFD(1), bool persist = true);
61
74
75// Weak reference returns true if pass is ok, passed string with USER:PASS
76bool ConfigAuthenticate(const char *up);
77
78// Weak refernce to set up config servlet. Allows one to override
79void ConfigSetServlets();
80
81// Configuration servlet stuff
82void AddConfigServlet(servlet *s);
83
84// Exposed for expanding WebConfigServlet
85void ConfigIntFillInFD(fd_set &r_set, fd_set &w_set, fd_set &write_fds);
86void ConfigIntProcessSelectResult(fd_set &r_set, fd_set &w_set, fd_set &error_fds);
87
94
98class WebConfigServlet : public servlet
99{
100 int m_cfg_listen;
101 int m_port;
102
103 public:
104 WebConfigServlet(int port = 20034);
105 virtual int AddToSelectSet(fd_set &read_fds, fd_set &write_fds, fd_set &error_fds);
106 virtual void ProcessSelectResult(fd_set &read_fds, fd_set &write_fds, fd_set &error_fds);
107};
108
114size_t ConfigSize();
115
122
123#endif /* ----- #ifndef __CONFIG_SERVER_H ----- */
124
Class to run web configurator.
Definition config_server.h:99
size_t ConfigMaxSize()
Returns the number of bytes available in configuration flash.
void SaveConfigToStorage()
Write all pending data to flash memory.
void EnableConfigMirror()
Enable the configuration mirror.
size_t ConfigSize()
Returns the number of bytes currently in use by configuration flash.
int CurrentStdioFD(int stdio_fd)
Returns the current file descriptor mapped to the stdio file descriptor.