added files
[bcm963xx.git] / userapps / broadcom / cfm / html / qoscls.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <!--
3         (c) 2005 U.S. Robotics Corporation
4 -->
5 <html>
6 <head>
7         <title>Quality of Service</title>
8
9         <link href="usr_main.css" rel="stylesheet" type="text/css">
10         <link href="usr_menus.css" rel="stylesheet" type="text/css"><script src="usr_menus.js" type="text/javascript"></script><script src="usr_menus_build.js" type="text/javascript"></script>
11         <script src="usr_common.js" type="text/javascript"></script>
12         <script src="portName.js" type="text/javascript"></script>
13
14    <meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>
15
16    <script type="text/javascript" src="util.js"></script>
17    <script type="text/javascript">
18 <!-- hide
19
20 setPageTitle("<%ejGetWlJS(wlInterface)%>");
21
22 function btnApply() {
23    var loc = 'qoscls.cmd?action=add';
24
25    with ( document.forms[0] ) {
26       if ( txtclsname.value == '' )
27       {
28          alert('Please enter a Quality of Service class name.');
29          return;
30       }
31
32       if (!isValidName(txtclsname.value))
33       {
34          alert('Please enter valid Quality of Service class name. Special characters are not permitted.');
35          return;
36       }
37
38 // priority.selected index == 0 is valid value.
39
40 // Some conditions are specified by default.
41
42       if (optTraffic[0].checked)
43       {
44                 if (srcaddr.value != "" && !isValidIpAddress(srcaddr.value))
45                 {
46                         alert('Source address "' + srcaddr.value + '" is an invalid IP address.');
47                         return;
48                 }
49
50                 if (srcmask.value != "" && !isValidSubnetMask(srcmask.value))
51                 {
52                         alert('Source subnet mask "' + srcmask.value + '" is an invalid subnet mask.');
53                         return;
54                 }
55
56                 if ( srcaddr.value == "" && srcmask.value != "" ) {
57                         alert('Cannot have source subnet mask without source IP address.');
58                         return;
59                 }
60
61                 if (srcport.value != "" && !isValidPort(srcport.value))
62                 {
63                         alert('Source port "' + srcport.value + '" is an invalid port number or port range.');
64                         return;
65                 }
66
67                 if (dstaddr.value != "" && !isValidIpAddress(dstaddr.value))
68                 {
69                         alert('Destination address "' + dstaddr.value + '" is invalid IP address.');
70                         return;
71                 }
72
73                 if (dstmask.value != "" && !isValidSubnetMask(dstmask.value))
74                 {
75                         alert('Destination subnet mask "' + dstmask.value + '" is an invalid subnet mask.');
76                         return;
77                 }
78
79                 if ( dstaddr.value == "" && dstmask.value != "" ) {
80                         alert('Cannot have destination subnet mask without destination IP address.');
81                         return;
82                         }
83
84                 if (dstport.value != "" && !isValidPort(dstport.value))
85                 {
86                         alert('Destination port "' + dstport.value + '" is invalid port number or port range.');
87                         return;
88                 }
89
90                 if ( (srcport.value != "" || dstport.value != "") &&
91                         (protocol.selectedIndex > 2) )
92                 {
93                         alert("The ports must be entered if the TCP or UDP protocol is selected.");
94                         return;
95                 }
96       }
97
98       // class name
99       loc += '&clsName=' + encodeUrl(txtclsname.value);
100
101       // priority
102       var idx = priority.selectedIndex;
103       val = priority.options[idx].value;
104       loc += '&priority=' + val;
105
106       // IP precedence bits
107       idx = precedence.selectedIndex;
108       val = precedence.options[idx].value;
109       loc += '&precedence=' + val;
110
111       // IP type of service bits
112       idx = tos.selectedIndex;
113       val = tos.options[idx].value;
114       loc += '&tos=' + val;
115
116       if (optTraffic[0].checked)
117       {
118          // physical lan port ifc name
119          idx = lanIfcName.selectedIndex;
120          val = lanIfcName.options[idx].value;
121          loc += '&lanIfcName=' + val;
122
123          // protocol
124          idx = protocol.selectedIndex;
125          val = protocol.options[idx].value;
126          loc += '&protocol=' + val;
127
128          // VLAN 802.1p priority
129          loc += '&vlan8021p=-1';
130       } 
131       else 
132       {
133          // physical lan port ifc name
134          loc += '&lanIfcName=';
135
136          // protocol
137          loc += '&protocol=-1';
138
139          // VLAN 802.1p priority
140          idx = vlan8021p.selectedIndex;
141          val = vlan8021p.options[idx].value;
142          loc += '&vlan8021p=' + val;
143       }
144
145       // source address
146       if ( srcaddr.value != "" )
147          loc += '&srcAddr=' + srcaddr.value;
148
149       // source subnet mask
150       if ( srcmask.value != "" )
151          loc += '&srcMask=' + srcmask.value;
152
153       // source port
154       if ( srcport.value != "" )
155          loc += '&srcPort=' + srcport.value;
156
157       // destination address
158       if ( dstaddr.value != "" )
159          loc += '&dstAddr=' + dstaddr.value;
160
161       // destination subnet mask
162       if ( dstaddr.value != "" )
163          loc += '&dstMask=' + dstmask.value;
164
165       // destination port
166       if ( dstport.value != "" )
167          loc += '&dstPort=' + dstport.value;
168
169            // WAN 802.1p priority
170       idx = wanVlan8021p.selectedIndex;
171       val = wanVlan8021p.options[idx].value;
172       loc += '&wanVlan8021p=' + val;       
173    }
174
175    var code = 'location = "' + loc + '"';
176    eval(code);
177 }
178
179 function manageTrafficOptions()
180 {
181         with ( document.forms[0] )
182         {
183                 setVisibility("idIPtraffic", optTraffic[0].checked);
184                 setVisibility("id8021p", optTraffic[1].checked);
185            if (optTraffic[1].checked)
186            {
187               srcaddr.value = "";
188               srcmask.value = "";
189               srcport.value = "";
190               dstaddr.value = "";
191               dstmask.value = "";
192               dstport.value = "";
193               vlan8021p.selectedIndex = 0;
194               lanIfcName.selectedIndex = 0;
195            }
196         }
197 }
198 // done hiding -->
199    </script>
200 </head>
201 <body onload="initMenu(); manageTrafficOptions();">
202
203 <script type="text/javascript">
204         writeHeader("Add Network Traffic Class");
205 </script>
206
207 <form>
208         <p>This page creates a traffic class rule to classify the upstream traffic,
209                 assign queuing priority, and optionally overwrite the IP header TOS byte. A rule
210                 consists of a class name and at least one condition below. All of the specified
211                 conditions in this classification rule must be satisfied for the rule to take
212                 effect. Press <b>Apply</b> to save and activate the rule.</p>
213         <p><label for="txtclsname">Traffic class name:</label>
214                 <input type='text' size="20" name="txtclsname" id="txtclsname"></p>
215
216         <h4>Class Priority, IP Precedence, and Type of Service</h4>
217         <p>If a non-zero value is selected for <b>IP Precedence</b> or
218         a value other than "Normal" for <b>IP Type of Service</b>,
219         the corresponding TOS byte in the IP header of the upstream packet will be
220         overwritten by the selected value.</p>
221    <table border="0">
222       <tr>
223          <td><label>ATM transmit priority:</label></td>
224          <td><select name='priority' id='priority'>
225                <option value="1">Low</option>
226                <option value="2">Medium</option>
227                <option value="3">High</option>
228             </select></td>
229       </tr>
230       <tr>
231          <td><label>IP precedence:</label></td>
232          <td><select name='precedence' id='precedence'>
233                <option value="-1" selected>(None)</option>
234                <option value="0">0</option>
235                <option value="1">1</option>
236                <option value="2">2</option>
237                <option value="3">3</option>
238                <option value="4">4</option>
239                <option value="5">5</option>
240                <option value="6">6</option>
241                <option value="7">7</option>
242             </select></td>
243       </tr>
244       <tr>
245          <td><label>IP type of service:</label></td>
246          <td><select name='tos' id='tos'>
247                <option value="-1" selected>(None)</option>
248                <option value="0">Normal service</option>
249                <option value="2">Minimize cost</option>
250                <option value="4">Maximize reliability</option>
251                <option value="8">Maximize throughput</option>
252                <option value="16">Minimize delay</option>
253             </select></td>
254       </tr>
255       <tr>
256              <td><label>802.1p (if 802.1q is enabled on WAN):</label></td>
257              <td><select name="wanVlan8021p" id="wanVlan8021p">
258                            <option value="-1" selected>(None)</option>
259                            <option value="0">0</option>
260                            <option value="1">1</option>
261                            <option value="2">2</option>
262                            <option value="3">3</option>
263                            <option value="4">4</option>
264                            <option value="5">5</option>
265                            <option value="6">6</option>
266                            <option value="7">7</option>
267                     </select></td>
268         </tr>
269         </table>
270
271         <h4>Class Traffic Conditions</h4>
272         <p>Please select a method for controlling the data traffic priority.</p>
273
274         <p>
275                 <input type="radio" name="optTraffic" id="optIP" value="trafficIP" onclick="manageTrafficOptions();" checked /> <label for="optIP">IP traffic</label><br/>
276                 <input type="radio" name="optTraffic" id="opt8021p" value="traffic8021p" onclick="manageTrafficOptions();" /> <label for="opt8021p">802.1p priority</label>
277         </p>
278
279    <table id="idIPtraffic" border="0">
280       <tr> 
281          <td><label>Physical LAN port:</label></td>
282          <td><select name="lanIfcName" id="lanIfcName">
283              <option value="" selected>(None)</option>
284 <script type="text/javascript">
285 <!-- hide
286 {
287    var i = 0;
288    var interfaceInfo = '';
289    var dispName = '';
290    var brdId = '<%ejGetJS(boardID)%>';
291    
292    interfaceInfo = '<%ejGetOther(bridgeInterfaceInfo, all)%>';
293    var interfaces = interfaceInfo.split('|');
294    interfaces.sort();
295    for ( i = 0; i < interfaces.length; i++ ) {
296       dispName = getUNameByLName(brdId + '|' + interfaces[i]);
297       if (dispName.indexOf('nas_') != -1)
298          continue;      // skip nas_ ifc
299       if (interfaces[i] != '') {
300          document.writeln("  <option value='" + interfaces[i] + "'>" + dispName + "</option>");
301       }
302    }
303 }
304 // done hiding -->
305 </script>
306             </select>
307          </td>
308       </tr>
309       <tr>
310          <td><label>Protocol:</label></td>
311          <td><select name='protocol' id='protocol'>
312                <option value="0">TCP/UDP</option>
313                <option value="1">TCP</option>
314                <option value="2">UDP</option>
315                <option value="3">ICMP</option>
316             </select></td>
317       </tr>
318
319       <tr><th align="left" colspan="2">Source</td></tr>
320       <tr>
321          <td><label for="srcaddr">IP address:</label></td>
322          <td><input type='text' size="20" name="srcaddr" id="srcaddr"></td>
323       </tr>
324       <tr>
325          <td><label for="srcport">UDP/TCP port(s):</label></td>
326          <td><input type='text' size="20" name="srcport" id="srcport"> <label class="clsNote" for="srcport">(port or port:port)</label></td>
327       </tr>
328       <tr>
329          <td><label for="srcmask">Subnet mask:</label></td>
330          <td><input type='text' size="20" name="srcmask" id="srcmask"></td>
331       </tr>
332
333       <tr><th align="left" colspan="2">Destination</th></tr>
334       <tr>
335          <td><label for="dstaddr">IP address:</label></td>
336          <td><input type='text' size="20" name="dstaddr" id="dstaddr"></td>
337       </tr>
338       <tr>
339          <td><label for="dstport">UDP/TCP port(s):</label></td>
340          <td><input type='text' size="20" name="dstport" id="dstport"> <label class="clsNote" for="dstport">(port or port:port)</label></td>
341       </tr>
342       <tr>
343          <td><label for="dstmask">Subnet mask:</label></td>
344          <td><input type='text' size="20" name="dstmask" id="dstmask"></td>
345       </tr>
346    </table>
347
348         <p id="id8021p"><label>802.1p priority:</label>
349                 <select name='vlan8021p' id='vlan8021p'>
350                         <option value="0">0</option>
351                         <option value="1">1</option>
352                         <option value="2">2</option>
353                         <option value="3">3</option>
354                         <option value="4">4</option>
355                         <option value="5">5</option>
356                         <option value="6">6</option>
357                         <option value="7">7</option>
358                 </select>
359         </p>
360
361         <p><input type='button' onClick='btnApply()' value='Apply'></p>
362 </form>
363
364 <script type="text/javascript">
365         writeFooter();
366 </script>
367
368 </body>
369 </html>