Stealth Mode script
[tomato.git] / release / src / router / udpxy / statpg.h
blobe70269d82603500036d880d7a8a9325f56fca7ba
1 /* @(#) HTML-page templates/generation for udpxy status page
3 * Copyright 2008-2011 Pavel V. Cherenkov (pcherenkov@gmail.com)
5 * This file is part of udpxy.
7 * udpxy is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * udpxy is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with udpxy. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef STATPG_H_0110081157_
22 #define STATPG_H_0110081157_
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 /* NB: strings are exposed in the header to be included
29 * by unit tests, yet made static to confine to a single unit */
31 static const char HTML_PAGE_HEADER[] =
32 "HTTP/1.0 200 OK\n"
33 "Content-type: text/html\n\n";
35 static const char* STAT_PAGE_BASE[] = {
36 "<html>\n"
37 "<head>\n"
38 "<style type=\"text/css\">\n"
39 "h1 {\n"
40 " margin: 0;\n"
41 " padding: 1em 0.5em 0.5em;\n"
42 " font-size: 120%;\n"
43 " letter-spacing:0.1em;\n"
44 " font-family: serif; \n"
45 "}\n"
46 "h3{\n"
47 " margin: 1em 0 0;\n"
48 " font-weight:bold;\n"
49 " font-size: 110%;\n"
50 " letter-spacing:0.1em;\n"
51 "}\n"
52 "table {\n"
53 " margin:0.5em auto 0.2em auto;\n"
54 " padding:0;\n"
55 " background:#fff;\n"
56 " font-size: 100%;\n"
57 " border-collapse:collapse;\n"
58 "}\n"
59 "th {\n"
60 " font-weight:bold;\n"
61 " font-size: 110%;\n"
62 " border: 1px solid #333;\n"
63 " padding: 0.5em 0.5em 0.2em;\n"
64 "}\n",
66 "td {\n"
67 " border: 1px solid #333;\n"
68 " padding: 0.2em 0.5em;\n"
69 "}\n"
70 ".proctabl th {\n"
71 " background: #FFF;\n"
72 " color:#000;\n"
73 "}\n"
74 ".proctabl tr.uneven{\n"
75 " background: #dde;\n"
76 "}\n"
77 "#bodyCon{\n"
78 " margin:0;\n"
79 " padding:0;\n"
80 " border: 1px solid #334;\n"
81 " width: 750px;\n"
82 " font: 90% Arial, sans-serif;\n"
83 " text-align:center;\n"
84 "}\n",
86 "#pgCont {\n"
87 " margin: 1em;\n"
88 " padding: 2em 2em 0.5em;\n"
89 "}\n"
90 "#footer {\n"
91 " margin: 2em 0 0.5em;\n"
92 " font-size: 80%;\n"
93 " color:#555;\n"
94 " letter-spacing:0.1em;\n"
95 " font-family: Verdana,Arial,sans-serif;\n"
96 "}\n"
97 "</style>\n"
98 "</head>\n"
100 static const size_t LEN_STAT_PAGE_BASE = 3;
102 static const char STAT_PAGE_FMT1[] =
103 "<body>\n"
104 "<div id=\"bodyCon\">\n"
105 "<h1>udpxy status:</h1>\n"
106 "<div id=\"pgCont\">\n"
107 "<table cellspacing=\"0\">\n"
108 "<tr>\n"
109 " <th>Server Process ID</th>\n"
110 " <th>Accepting clients on</th>\n"
111 " <th>Multicast address</th>\n"
112 " <th>Active clients</th>\n"
113 "</tr>\n"
114 "<tr>\n"
115 " <td>%d</td>\n"
116 " <td>%s:%d</td>\n"
117 " <td>%s</td>\n"
118 " <td>%d</td>\n"
119 "</tr>\n"
120 "</table>\n"
121 "<form action=\"/restart/\" method=\"get\">\n"
122 "<input type=\"submit\" value=\"Restart\">\n"
123 "</form>\n"
124 "\n"
125 "%s" /* Active clients table goes here */
126 "%s" /* Usage guide table */
127 "</div>\n"
128 "<div id=\"footer\">udpxy v. %s (Build %d) %s - [%s]<br>%s</div>\n" /* footer */
129 "</div>\n"
130 "</body>\n"
131 "</html>\n";
134 static const char RST_PAGE_FMT1[] =
135 "<body onload=\"body_onload();\">\n"
136 "<div id=\"bodyCon\">\n"
137 "<h1>udpxy is RESTARTING - This page will refresh automatically</h1>\n"
138 "<div id=\"pgCont\">\n"
139 "<table cellspacing=\"0\">\n"
140 "<tr>\n"
141 " <th>Server Process ID</th>\n"
142 " <th>Accepting clients on</th>\n"
143 " <th>Multicast address</th>\n"
144 " <th>Active clients</th>\n"
145 "</tr>\n"
146 "<tr>\n"
147 " <td>%d</td>\n"
148 " <td>%s:%d</td>\n"
149 " <td>%s</td>\n"
150 " <td>%d</td>\n"
151 "</tr>\n"
152 "</table>\n"
153 "\n"
154 "%s" /* Active clients (nothing in restart page) */
155 "%s" /* Usage guide table */
156 "</div>\n"
157 "<div id=\"footer\">udpxy v. %s (Build %d) %s - [%s]<br>%s</div>\n" /* footer */
158 "</div>\n"
159 "</body>\n"
160 "</html>\n";
162 static const char* ACLIENT_TABLE[] = {
163 "<h3>Active clients:</h3>\n"
164 "<table cellspacing=\"0\" class=\"proctabl\">\n"
165 "<tr><th>Process ID</th><th>Source</th><th>Destination</th><th>Throughput</th></tr>\n",
166 "</table>\n" };
169 static const char* ACLIENT_REC_FMT[] = {
170 "<tr><td>%d</td><td>%s:%d</td><td>%s:%d</td><td>%s</td></tr>\n",
171 "<tr class=\"uneven\"><td>%d</td><td>%s:%d</td><td>%s:%d</td><td>%s</td></tr>\n" };
174 static const char REDIRECT_SCRIPT_FMT[] =
175 "<script type=\"text/JavaScript\" language=\"Javascript\">"
176 "function body_onload(){"
177 " var t=setTimeout(\"window.location = '/status'\",%u)"
179 "</script>";
181 static const char REQUEST_GUIDE[] =
182 "<h3>Available HTTP requests:</h3>\n"
183 "<table cellspacing=\"0\">\n"
184 "<tr><th>Request template</th><th>Function</th></tr>\n"
185 "<tr><td><small>http://<i>address:port</i>/udp/<i>mcast_addr:mport/</i></small></td>\n"
186 "<td>Relay multicast traffic from mcast_addr:mport</td></tr>"
187 "<tr><td><small>http://<i>address:port</i>/status/</small></td><td>Display udpxy status</td></tr>\n"
188 "<tr><td><small>http://<i>address:port</i>/restart/</small></td><td>Restart udpxy</td></tr>\n"
189 "</table>\n";
192 #ifdef __cplusplus
194 #endif
196 #endif /* STATPG_H_0110081157_ */
198 /* __EOF__ */