1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
4 Copyright (C) 2006-2010 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 For use with Tomato Firmware only.
8 No part of this file may be used without permission.
12 <meta http-equiv='content-type' content='text/html;charset=utf-
8'
>
13 <meta name='robots' content='noindex,nofollow'
>
14 <title>[<%
ident(); %>] QoS: Basic Settings
</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'
>
16 <link rel='stylesheet' type='text/css' href='color.css'
>
17 <script type='text/javascript' src='tomato.js'
></script>
20 <script type='text/javascript' src='debug.js'
></script>
22 <script type='text/javascript'
>
24 // <% nvram("qos_enable,qos_ack,qos_syn,qos_fin,qos_rst,qos_icmp,qos_default,qos_obw,qos_ibw,qos_orates,qos_irates,qos_reset,ne_vegas,ne_valpha,ne_vbeta,ne_vgamma"); %>
26 classNames
= ['Highest', 'High', 'Medium', 'Low', 'Lowest', 'Class A', 'Class B', 'Class C', 'Class D', 'Class E'];
28 pctList
= [[0, 'None']];
29 for (i
= 1; i
<= 100; ++i
) pctList
.push([i
, i
+ '%']);
31 function oscale(rate
, ceil
)
33 if (rate
<= 0) return '';
34 var b
= E('_qos_obw').value
;
35 var s
= comma(MAX(Math
.floor((b
* rate
) / 100), 1));
36 if (ceil
> 0) s
+= ' - ' + MAX(Math
.round((b
* ceil
) / 100), 1);
37 return s
+ ' <small>kbit/s</small>';
42 if (ceil
< 1) return '';
43 return comma(MAX(Math
.floor((E('_qos_ibw').value
* ceil
) / 100), 1)) + ' <small>kbit/s</small>';
46 function verifyFields(focused
, quiet
)
50 if (!v_range('_qos_obw', quiet
, 10, 999999)) return 0;
51 for (i
= 0; i
< 10; ++i
) {
52 elem
.setInnerHTML('_okbps_' + i
, oscale(E('_f_orate_' + i
).value
, E('_f_oceil_' + i
).value
));
55 if (!v_range('_qos_ibw', quiet
, 10, 999999)) return 0;
56 for (i
= 0; i
< 10; ++i
) {
57 elem
.setInnerHTML('_ikbps_' + i
, iscale(E('_f_iceil_' + i
).value
));
60 f
= E('_fom').elements
;
61 b
= !E('_f_qos_enable').checked
;
62 for (i
= 0; i
< f
.length
; ++i
) {
63 if ((f
[i
].name
.substr(0, 1) != '_') && (f
[i
].type
!= 'button') && (f
[i
].name
.indexOf('enable') == -1) &&
64 (f
[i
].name
.indexOf('ne_v') == -1)) f
[i
].disabled
= b
;
67 var abg
= ['alpha', 'beta', 'gamma'];
68 b
= E('_f_ne_vegas').checked
;
69 for (i
= 0; i
< 3; ++i
) {
70 f
= E('_ne_v' + abg
[i
]);
73 if (!v_range(f
, quiet
, 0, 65535)) return 0;
85 fom
.qos_enable
.value
= E('_f_qos_enable').checked
? 1 : 0;
86 fom
.qos_ack
.value
= E('_f_qos_ack').checked
? 1 : 0;
87 fom
.qos_syn
.value
= E('_f_qos_syn').checked
? 1 : 0;
88 fom
.qos_fin
.value
= E('_f_qos_fin').checked
? 1 : 0;
89 fom
.qos_rst
.value
= E('_f_qos_rst').checked
? 1 : 0;
90 fom
.qos_icmp
.value
= E('_f_qos_icmp').checked
? 1 : 0;
91 fom
.qos_reset
.value
= E('_f_qos_reset').checked
? 1 : 0;
94 for (i
= 0; i
< 10; ++i
) {
95 a
.push(E('_f_orate_' + i
).value
+ '-' + E('_f_oceil_' + i
).value
);
97 fom
.qos_orates
.value
= a
.join(',');
100 for (i
= 0; i
< 10; ++i
) {
101 a
.push(E('_f_iceil_' + i
).value
);
103 fom
.qos_irates
.value
= a
.join(',');
105 fom
.ne_vegas
.value
= E('_f_ne_vegas').checked
? 1 : 0;
113 <form id='_fom' method='post' action='tomato.cgi'
>
114 <table id='container' cellspacing=
0>
115 <tr><td colspan=
2 id='header'
>
116 <div class='title'
>Tomato
</div>
117 <div class='version'
>Version <%
version(); %></div>
119 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
121 <div id='ident'
><%
ident(); %></div>
125 <input type='hidden' name='_nextpage' value='qos-settings.asp'
>
126 <input type='hidden' name='_service' value='qos-restart'
>
128 <input type='hidden' name='qos_enable'
>
129 <input type='hidden' name='qos_ack'
>
130 <input type='hidden' name='qos_syn'
>
131 <input type='hidden' name='qos_fin'
>
132 <input type='hidden' name='qos_rst'
>
133 <input type='hidden' name='qos_icmp'
>
134 <input type='hidden' name='qos_orates'
>
135 <input type='hidden' name='qos_irates'
>
136 <input type='hidden' name='qos_reset'
>
137 <input type='hidden' name='ne_vegas'
>
139 <div class='section-title'
>Basic Settings
</div>
140 <div class='section'
>
141 <script type='text/javascript'
>
143 for (i
= 0; i
< 10; ++i
) {
144 classList
.push([i
, classNames
[i
]]);
146 createFieldTable('', [
147 { title
: 'Enable QoS', name
: 'f_qos_enable', type
: 'checkbox', value
: nvram
.qos_enable
== '1' },
148 { title
: 'Prioritize small packets with these control flags', multi
: [
149 { suffix
: ' ACK ', name
: 'f_qos_ack', type
: 'checkbox', value
: nvram
.qos_ack
== '1' },
150 { suffix
: ' SYN ', name
: 'f_qos_syn', type
: 'checkbox', value
: nvram
.qos_syn
== '1' },
151 { suffix
: ' FIN ', name
: 'f_qos_fin', type
: 'checkbox', value
: nvram
.qos_fin
== '1' },
152 { suffix
: ' RST ', name
: 'f_qos_rst', type
: 'checkbox', value
: nvram
.qos_rst
== '1' }
154 { title
: 'Prioritize ICMP', name
: 'f_qos_icmp', type
: 'checkbox', value
: nvram
.qos_icmp
== '1' },
155 { title
: 'Reset class when changing settings', name
: 'f_qos_reset', type
: 'checkbox', value
: nvram
.qos_reset
== '1' },
156 { title
: 'Default class', name
: 'qos_default', type
: 'select', options
: classList
, value
: nvram
.qos_default
}
161 <div class='section-title'
>Outbound Rate / Limit
</div>
162 <div class='section'
>
163 <script type='text/javascript'
>
164 cc
= nvram
.qos_orates
.split(/[,-]/);
166 f
.push({ title
: 'Max Bandwidth', name
: 'qos_obw', type
: 'text', maxlen
: 6, size
: 8, suffix
: ' <small>kbit/s</small>', value
: nvram
.qos_obw
});
169 for (i
= 0; i
< 10; ++i
) {
172 f
.push({ title
: classNames
[i
], multi
: [
173 { name
: 'f_orate_' + i
, type
: 'select', options
: pctList
, value
: x
, suffix
: ' ' },
174 { name
: 'f_oceil_' + i
, type
: 'select', options
: pctList
, value
: y
},
175 { type
: 'custom', custom
: ' <span id="_okbps_' + i
+ '"></span>' } ]
178 createFieldTable('', f
);
183 <div class='section-title'
>Inbound Limit
</div>
184 <div class='section'
>
185 <script type='text/javascript'
>
186 rates
= nvram
.qos_irates
.split(',');
188 f
.push({ title
: 'Max Bandwidth', name
: 'qos_ibw', type
: 'text', maxlen
: 6, size
: 8, suffix
: ' <small>kbit/s</small>', value
: nvram
.qos_ibw
});
190 for (i
= 0; i
< 10; ++i
) {
191 f
.push({ title
: classNames
[i
], multi
: [
192 { name
: 'f_iceil_' + i
, type
: 'select', options
: pctList
, value
: rates
[i
] },
193 { custom
: ' <span id="_ikbps_' + i
+ '"></span>' } ]
196 createFieldTable('', f
);
200 <div class='section-title'
>TCP Vegas
<small>(network congestion control)
</small></div>
201 <div class='section'
>
202 <script type='text/javascript'
>
204 createFieldTable('', [
205 { title
: 'Enable TCP Vegas', name
: 'f_ne_vegas', type
: 'checkbox', value
: nvram
.ne_vegas
== '1' },
206 { title
: 'Alpha', name
: 'ne_valpha', type
: 'text', maxlen
: 6, size
: 8, value
: nvram
.ne_valpha
},
207 { title
: 'Beta', name
: 'ne_vbeta', type
: 'text', maxlen
: 6, size
: 8, value
: nvram
.ne_vbeta
},
208 { title
: 'Gamma', name
: 'ne_vgamma', type
: 'text', maxlen
: 6, size
: 8, value
: nvram
.ne_vgamma
}
216 <tr><td id='footer' colspan=
2>
217 <span id='footer-msg'
></span>
218 <input type='button' value='Save' id='save-button' onclick='save()'
>
219 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'
>
223 <script type='text/javascript'
>verifyFields(null, 1);</script>