NetBurner 3.5.6
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#include <config_obj.h>
32
33typedef void(diagserver)(int sock, const char *url);
34extern diagserver *pDiagServer;
35
36/*
37 * Macro used for styling the local discover page
38 * .styleDiv - Style for the DIVs around the table and button, responsible for element placement
39 * .discDiv - Style for DIV around the table, responsible for border and spacing from top of page
40 * .discTab - Style for table
41 * .devTh - Style for text separating devices in table
42 * .devTd - Style for all the table TD elements
43 * .tabTh - Style for column headers in table
44 * .btnCnf - Style for button INPUT element
45 */
46#define DiscoverStyle \
47 "<style>" \
48 ".styleDiv{width:70%; min-width:480px; max-width:900px; font-family:sans-serif; margin-left:auto; margin-right:auto;}" \
49 ".discDiv{border-width:1px; border-style:solid; border-color:#595454; border-radius:5px; margin-top:30px;}" \
50 ".discTab{width:100%; color:#595454; border-spacing:0px;}" \
51 ".devTh{font-weight:bold; border-bottom:2px solid #ddd; padding:8px; border-top:1px solid #595454; color:#333;}" \
52 ".devTd{border-top:1px solid #ddd; padding:8px; color:#333;}" \
53 ".tabTh{padding:8px; background-color:#595454; color:#fff; text-align:left;}" \
54 ".btnCnf{width:125px; height:40px; background-color:#595454; color:#fff; border-radius:5px; margin-top:10px;}" \
55 "</style>"
56
57void StartConfigServer(int prio);
58void ConfigInit();
59int FindValidConfig(); // returns fd for config blob reader
60void AddConfigServlet(servlet *s);
61void ResumeSerialConfig(int fd_cfg = CurrentStdioFD(1), bool persist = true);
62
75
76// Weak reference returns true if pass is ok, passed string with USER:PASS
77bool ConfigAuthenticate(const char *up);
78
79// Weak refernce to set up config servlet. Allows one to override
80void ConfigSetServlets();
81
82// Configuration servlet stuff
83void AddConfigServlet(servlet *s);
84
85// Exposed for expanding WebConfigServlet
86void ConfigIntFillInFD(fd_set &r_set, fd_set &w_set, fd_set &write_fds);
87void ConfigIntProcessSelectResult(fd_set &r_set, fd_set &w_set, fd_set &error_fds);
88
95
99class WebConfigServlet : public servlet
100{
101 int m_cfg_listen;
102 int m_port;
103
104 public:
105 WebConfigServlet(int port = 20034);
106 virtual int AddToSelectSet(fd_set &read_fds, fd_set &write_fds, fd_set &error_fds);
107 virtual void ProcessSelectResult(fd_set &read_fds, fd_set &write_fds, fd_set &error_fds);
108};
109
110#ifdef NNDK_WEB_CONFIG_TOGGLE
111
112extern config_bool NB_disable_web_cfg; //"Sys.DisableWebConfig"
113
120void DisableWebConfig();
121
128void EnableWebConfig();
129
135bool IsWebConfigEnabled();
136#endif
137
143size_t ConfigSize();
144
151
152#endif /* ----- #ifndef __CONFIG_SERVER_H ----- */
153
Class to run web configurator.
Definition config_server.h:100
Boolean Configuration Variable.
Definition config_obj.h:997
Configuration object header file.
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.