NetBurner 3.5.8
PDF Version
Toggle main menu visibility
config_server.h
1
/*NB_REVISION*/
2
3
/*NB_COPYRIGHT*/
4
8
26
27
#ifndef __CONFIG_SERVER_H
28
#define __CONFIG_SERVER_H
29
30
#include <servlets.h>
31
#include <config_obj.h>
32
33
typedef
void(diagserver)(
int
sock,
const
char
*url);
34
extern
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
57
void
StartConfigServer(
int
prio);
58
void
ConfigInit();
59
int
FindValidConfig();
// returns fd for config blob reader
60
void
AddConfigServlet(servlet *s);
61
void
ResumeSerialConfig(
int
fd_cfg =
CurrentStdioFD
(1),
bool
persist =
true
);
62
74
void
EnableConfigMirror
();
75
76
// Weak reference returns true if pass is ok, passed string with USER:PASS
77
bool
ConfigAuthenticate(
const
char
*up);
78
79
// Weak refernce to set up config servlet. Allows one to override
80
void
ConfigSetServlets();
81
82
// Configuration servlet stuff
83
void
AddConfigServlet(servlet *s);
84
85
// Exposed for expanding WebConfigServlet
86
void
ConfigIntFillInFD(fd_set &r_set, fd_set &w_set, fd_set &write_fds);
87
void
ConfigIntProcessSelectResult(fd_set &r_set, fd_set &w_set, fd_set &error_fds);
88
94
void
SaveConfigToStorage
();
95
99
class
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
112
extern
config_bool
NB_disable_web_cfg;
//"Sys.DisableWebConfig"
113
120
void
DisableWebConfig();
121
128
void
EnableWebConfig();
129
135
bool
IsWebConfigEnabled();
136
#endif
137
143
size_t
ConfigSize
();
144
150
size_t
ConfigMaxSize
();
151
152
#endif
/* ----- #ifndef __CONFIG_SERVER_H ----- */
153
config_bool
Boolean Configuration Variable.
Definition
config_obj.h:1000
ConfigMaxSize
size_t ConfigMaxSize()
Returns the number of bytes available in configuration flash.
SaveConfigToStorage
void SaveConfigToStorage()
Write all pending data to flash memory.
EnableConfigMirror
void EnableConfigMirror()
Enable the configuration mirror.
ConfigSize
size_t ConfigSize()
Returns the number of bytes currently in use by configuration flash.
CurrentStdioFD
int CurrentStdioFD(int stdio_fd)
Returns the current file descriptor mapped to the stdio file descriptor.
nbrtos
include
config_server.h
Generated by
1.18.0