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_
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
[] =
33 "Content-type: text/html\n\n";
35 static const char* STAT_PAGE_BASE
[] = {
38 "<style type=\"text/css\">\n"
41 " padding: 1em 0.5em 0.5em;\n"
43 " letter-spacing:0.1em;\n"
44 " font-family: serif; \n"
48 " font-weight:bold;\n"
50 " letter-spacing:0.1em;\n"
53 " margin:0.5em auto 0.2em auto;\n"
57 " border-collapse:collapse;\n"
60 " font-weight:bold;\n"
62 " border: 1px solid #333;\n"
63 " padding: 0.5em 0.5em 0.2em;\n"
67 " border: 1px solid #333;\n"
68 " padding: 0.2em 0.5em;\n"
71 " background: #FFF;\n"
74 ".proctabl tr.uneven{\n"
75 " background: #dde;\n"
80 " border: 1px solid #334;\n"
82 " font: 90% Arial, sans-serif;\n"
83 " text-align:center;\n"
88 " padding: 2em 2em 0.5em;\n"
91 " margin: 2em 0 0.5em;\n"
94 " letter-spacing:0.1em;\n"
95 " font-family: Verdana,Arial,sans-serif;\n"
100 static const size_t LEN_STAT_PAGE_BASE
= 3;
102 static const char STAT_PAGE_FMT1
[] =
104 "<div id=\"bodyCon\">\n"
105 "<h1>udpxy status:</h1>\n"
106 "<div id=\"pgCont\">\n"
107 "<table cellspacing=\"0\">\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"
121 "<form action=\"/restart/\" method=\"get\">\n"
122 "<input type=\"submit\" value=\"Restart\">\n"
125 "%s" /* Active clients table goes here */
126 "%s" /* Usage guide table */
128 "<div id=\"footer\">udpxy v. %s (Build %d) %s - [%s]<br>%s</div>\n" /* footer */
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"
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"
154 "%s" /* Active clients (nothing in restart page) */
155 "%s" /* Usage guide table */
157 "<div id=\"footer\">udpxy v. %s (Build %d) %s - [%s]<br>%s</div>\n" /* footer */
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",
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)"
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"
196 #endif /* STATPG_H_0110081157_ */