Background technology
In the Web of embedded device webmaster field, the basic goal of Web webmaster be realize the keeper by with Web webpage alternant way, reach purpose to Equipment Control and Stateful Inspection.The basic composition of the Web network management system of embedded device comprises one group of web webpage, is used for showing network management information and accepting keeper's operation by Web browser; A Web server of realizing in equipment is used to provide webmaster devices needed information; A communication protocol is used to transmit interaction data.Its reciprocal process comprises following steps usually: net administrator's mutual by with the Web webpage, its information is sent to Web server by communication protocol, Web server obtains facility information and handles after the request, its result transfers back to Web browser by communication protocol again, represents the result and give the net administrator in the Web webpage.
The main implementation of Web network management system of embedded device has two kinds at present, and a kind of is that Web server is made of a plurality of CGI (CGI), and the Web webpage is standard html web page and script, and communication protocol is HTTP.The characteristics of this scheme are, the cgi script code of Web server, and directly the invocation facility program code is carried out the webmaster order from the net administrator, and its result returns to Web browser by the Web webpage of dynamic generation.The shortcoming of this scheme is, need develop debugging in embedded device, and cgi script code and embedded system coupling ratio are tightr, need the business of interrupt run during upgrading webmaster program, and the exploitation debugging difficulty is bigger, and the construction cycle is longer.
Another kind of existing implementation is, the Web service end provides a CGI that can transmit equipment Shell order and result, the Web webpage is with Applet (Java small routine, the Java assembly of carrying out among a kind of web of being embedded into) or ActiveX (the movable component technology of Microsoft company, also be a kind ofly can be embedded into the program assembly of carrying out among the web) be main, communication protocol also is HTTP.The characteristics of this technology are the CGI of Web server, by the webmaster order of equipment Shell execution from the net administrator, Applet in the Web webpage (perhaps ActiveX) is mutual by Web service end CGI and equipment Shell, finishes network management function and returns to Web browser.The shortcoming of this technology is, need take bigger memory space and deposit Applet or ActiveX, and this influences bigger for embedded device.It may also require Web browser that Java Virtual Machine need be installed simultaneously.
Summary of the invention
Technical problem to be solved by this invention, long at the existing embedded device Web webmaster construction cycle exactly, take the shortcoming that memory space is big, can't reduce flexibly and upgrade, provide a kind of and take that memory space is little, the construction cycle short, can reduce flexibly the embedded Web network management system of upgrading.
The present invention solve the technical problem, and the technical scheme of employing is that embedded Web network management system comprises Web browser, the Shell interface of Web server and equipment; It is characterized in that, also comprise one group of Web webpage and script;
Described Web server comprises a CGI that can transmit equipment Shell order and execution result;
Described Web webpage adopts the standard html tag to constitute, and described script is used for described CGI mutual;
Described Web browser is used to support the demonstration and the execution of standard HTML and script;
Described Web webpage and script can be equipment Shell process of commands script with net administrator's operational transition, and equipment are carried out the Shell command result resolve, and the content revealing after will resolving is in the Web webpage.
Further be that described Web browser can be downloaded Web webpage and script from Web server.
Further be that described script is embedded in the Web webpage to be carried out.
Further be that described Web webpage and script are stored in the equipment with compress mode again.
Further be that described Web webpage and script can be that unit upgrades separately with the file again.
Embedded Web webmaster exchange method may further comprise the steps:
The a.Web browser is downloaded Web webpage and script from Web server, makes an explanation then and carries out, and browses for the net administrator;
B. the net administrator browses this Web webpage by Web browser, carries out the webmaster operation;
After the script of c.Web browser Web webpage obtains net administrator's webmaster operation, the webmaster operation is converted to corresponding equipment Shell order, calls the appointment CGI of http communication component passes in the Web server in the Web browser;
The d.Web server receives after the request, call cgi script, the Shell order of request is passed to the Shell process of equipment by the Shell interface, the Shell process after carrying out this order is returned execution result, cgi script receives after the execution result, is delivered to the Web client by Web server;
The e.Web browser receives execution result, after resolving by script, execution result is presented in the Web webpage of browser and checks for the net administrator.
The invention has the beneficial effects as follows, the work of webmaster exploitation has moved on in the Web webpage fully, it is single and general that the work of equipment end becomes, Web webpage and script can directly be debugged on PC, accelerated development progress, because Web webpage and script are text, it is very little that the high compression ratio of text makes that the webmaster program takies device memory, makes the Web webmaster to reduce flexibly and to upgrade based on the functional organization of Web webpage.
Embodiment
Below in conjunction with drawings and the embodiments, describe technical scheme of the present invention in detail.
As shown in Figure 1, the present invention comprises following assembly: the Shell interface of the Web server in the embedded device, equipment, be used to transmit CGI, Web browser, one group of Web webpage and script that is used for webmaster of Shell order and result.
Wherein, Web server is realized in equipment, and the HTTP service function of standard is provided, and can read with compress mode and be kept at Web webpage and script on the Web server, and provides relevant interface that the Web webpage is upgraded separately.
Shell interface in the embedded device (being called for short Shell again) is the configuration interface of the mode word that provides out in the equipment, use when generally offering administrator configurations equipment and checking equipment state, usually the mode of operation to Shell has two kinds, the configuration mouth that the first provides by equipment (generally being referred to as Console port) is connected on the PC, and the keeper is connected to by the terminal program on the PC among the Shell of equipment and directly is configured operation; It two is to adopt Telnet or SSH mode to sign in among the equipment Shell by network remote, and equipment is operated.Operation to Shell among the present invention is another mode, the keeper is no longer undertaken alternately by top dual mode and Shell, but transmit by the Web server module in the equipment, utilize script in the Web browser to finish mutual to equipment Shell, this interactive mode is because belong to graphic user interface, intuitive and convenient more.
Carry out the CGI of Shell order, can call for Web server, the expansion that belongs to Web server, it is Web server and the mutual interface of equipment Shell, it receives the Shell order that Web server imports into, then order is delivered to the Shell process in the equipment, carry out the Shell order by the Shell process, this process just be the same by the equipment disposition mouth to equipment disposition, after the Shell fill order, can return some character informations of execution result, this CGI is with complete the catching and return to Web browser by HTTP of these character informations.
Web browser is used to provide demonstration and execution to Web webpage and script, and Web browser need be supported the relevant criterion of HTML and script, supports that script communicates by XMLHTTP assembly and Web server.
The Web webpage and the script that are used for webmaster are made of the html tag and the script of standard.Script is except the reciprocal process that will support net administrator and Web webpage among the present invention, also need to finish user's operation is translated as the corresponding Shell order of equipment, be delivered to the relevant CGI of Web server then by the XMLHTTP communications component of Web browser, after receiving the execution result that relevant CGI returns, script need be resolved the execution result that returns, by the Web webpage is revised dynamically, the form of final operating result with the Web webpage represented to the net administrator then.
Shell generally be equipment directly with the mutual interface of keeper, the text mode that employing can direct reading is represented order and execution result, this text mode helps reading, but is unfavorable for the program parsing.Because this text formatting is fixed, therefore in script, can be used as a kind of format string to it and handle, the common methods of this processing is exactly " regular expression ", and this mode is supported by the script in the Web browser at present.
In order to reach the purpose that reduces the construction cycle, the most of parts that relate among the present invention adopt existing parts to reduce the development amount, Web browser adopts standard browser (IE, FireFox, Netscape etc.), Web server adopts the standard http server, transparent transmission Shell order and a result's between Web browser end and equipment Shell (being the interactive interface of the equipment textual form that provides out) CGI is provided thereon, the data interaction agreement adopts the already provided Shell text of equipment interface, and communication protocol adopts the http protocol of standard.
Because most embedded devices are all supported the Shell interface, the present invention utilizes equipment to have the Shell interface now just, utilize the Web browser of standard, only need be on standard Web the CGI of a transparent transmission Shell of exploitation of property once, with the webmaster command translation is the Shell order, and the Shell command execution results turns back in the Web webpage and handles, this processing and represent place one's entire reliance upon standard html tag and be embedded into execution script in the Web webpage of process.Therefore adopting the groundwork emphasis of this structure webmaster exploitation is exactly the exploitation of standard Web webpage and script.For the exploitation of these standards Web webpage and script, fully can not need in equipment, develop debugging, improved development rate greatly.
On the other hand, because Web webpage and script all are the contents of text mode, and the compression ratio of text is very high, therefore takies memory space and can control to very for a short time, can significantly reduce the shared memory space of webmaster content.Because a Web webpage is generally finished a management function, is the integral body after the compiling unlike the existing Web webmaster, these Web webpages all are independent individualities, so these Web webpages also can be reduced the requirement that adapts to different embedded devices arbitrarily.
Web webpage and device program are mutually independently, therefore can standalone upgrade, do not need the equipment that stops to move in the time of the upgrading webmaster.
Below the implementation procedure of system typical case webmaster reciprocal process is described further.
The net administrator is by the Web browser maiden visit equipment Web server time, and Web server comes out according to will be correlated with html web page and associated script decompress(ion) of access path, returns to Web browser.
The Web page that shows in net administrator and the Web browser carries out interactive operation, and Web browser becomes corresponding equipment Shell order to net administrator's configuration operation " translation " by carrying out script then.
Script calls the XMLHTTP communications component that Web browser provides, and the Shell order is passed through the http communication protocol transmission to the Web server on the equipment.
Web server receives after the request, call the CGI that carries out general Shell order, CGI passes to the Shell order of request the Shell process of equipment, the Shell process returns to CGI with execution result after carrying out this order, cgi script receives after the execution result, is delivered to Web browser by Web server.
Web browser is given script with the result notification that Shell carries out, and script adopts regular expression to resolve the Shell execution result, by the Web webpage is revised dynamically, the form of final operating result with the Web webpage is represented to the net administrator then.