Project

General

Profile

Download (6.1 KB) Statistics
| Branch: | Tag: | Revision:
1 db7b006f Seth Mos
<?php
2
/* $Id$ */
3
/*
4
	status_rrd_graph.php
5
	Part of pfSense
6
	Copyright (C) 2007 Seth Mos <seth.mos@xs4all.nl>
7
	All rights reserved.
8
9
	Redistribution and use in source and binary forms, with or without
10
	modification, are permitted provided that the following conditions are met:
11
12
	1. Redistributions of source code must retain the above copyright notice,
13
	   this list of conditions and the following disclaimer.
14
15
	2. Redistributions in binary form must reproduce the above copyright
16
	   notice, this list of conditions and the following disclaimer in the
17
	   documentation and/or other materials provided with the distribution.
18
19
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
	POSSIBILITY OF SUCH DAMAGE.
29
*/
30
31
##|+PRIV
32
##|*IDENT=page-status-rrdgraphs
33
##|*NAME=Status: RRD Graphs page
34
##|*DESCR=Allow access to the 'Status: RRD Graphs' page.
35
##|*MATCH=status_rrd_graph_settings.php*
36
##|-PRIV
37
38 03d92c40 Scott Ullrich
require("guiconfig.inc");
39 db7b006f Seth Mos
40
if (!is_array($config['gateways']['settings']))
41
	$config['gateways']['settings'] = array();
42
43
$a_settings = &$config['gateways']['settings'];
44
45
$changedesc = "Gateways: ";
46 6c5334c7 Seth Mos
$input_errors = array();
47 db7b006f Seth Mos
48
if (empty($a_settings)) {
49
	$pconfig['latencylow'] = "100";
50
	$pconfig['latencyhigh'] = "500";
51
	$pconfig['losslow'] = "10";
52
	$pconfig['losshigh'] = "20";
53
} else {
54
	$pconfig['latencylow'] = $a_settings['latencylow'];
55
	$pconfig['latencyhigh'] = $a_settings['latencyhigh'];
56
	$pconfig['losslow'] = $a_settings['losslow'];
57
	$pconfig['losshigh'] = $a_settings['losshigh'];
58
}
59
60
if ($_POST) {
61
62
	unset($input_errors);
63
	$pconfig = $_POST;
64
65
	/* input validation */
66 6c5334c7 Seth Mos
	if($_POST['latencylow']) {
67
		if (! is_numeric($_POST['latencylow'])) {
68
			$input_errors[] = "The low latency watermark needs to be a numeric value.";
69
		}
70 db7b006f Seth Mos
	}
71 6c5334c7 Seth Mos
72
	if($_POST['latencyhigh']) {
73
		if (! is_numeric($_POST['latencyhigh'])) {
74
			$input_errors[] = "The high latency watermark needs to be a numeric value.";
75
		}
76
	}
77
	if($_POST['losslow']) {
78
		if (! is_numeric($_POST['losslow'])) {
79
			$input_errors[] = "The low loss watermark needs to be a numeric value.";
80
		}
81
	}
82
	if($_POST['losshigh']) {
83
		if (! is_numeric($_POST['losshigh'])) {
84
			$input_errors[] = "The high loss watermark needs to be a numeric value.";
85
		}
86
	}
87
88
	if(($_POST['latencylow']) && ($_POST['latencyhigh'])){
89
		if(($_POST['latencylow'] > $_POST['latencyhigh'])) {
90
			$input_errors[] = "The High latency watermark needs to be higher then the low latency watermark";
91
		}
92 db7b006f Seth Mos
	}
93
94 6c5334c7 Seth Mos
	if(($_POST['losslow']) && ($_POST['losshigh'])){
95
		if($_POST['losslow'] > $_POST['losshigh']) {
96
			$input_errors[] = "The High packet loss watermark needs to be higher then the low packet loss watermark";
97
		}
98
	}
99
100
101
102 db7b006f Seth Mos
        if (!$input_errors) {
103
		$a_settings['latencylow'] = $_POST['latencylow'];
104
		$a_settings['latencyhigh'] = $_POST['latencyhigh'];
105
		$a_settings['losslow'] = $_POST['losslow'];
106
		$a_settings['losshigh'] = $_POST['losshigh'];
107
		
108
109
		$config['gateways']['settings'] = $a_settings;
110
111
                $retval = 0;
112
                $retval = setup_gateways_monitor();
113
		write_config();
114
115
                $savemsg = get_std_save_message($retval);
116
	}
117
}
118
119 6c5334c7 Seth Mos
$pgtitle = array("Gateways","Settings");
120 db7b006f Seth Mos
include("head.inc");
121
122
?>
123
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
124
<?php include("fbegin.inc"); ?>
125
<?php if ($input_errors) print_input_errors($input_errors); ?>
126
<?php if ($savemsg) print_info_box($savemsg); ?>
127
<form action="system_gateways_settings.php" method="post" name="iform" id="iform">
128
<table width="100%" border="0" cellpadding="0" cellspacing="0">
129
        <tr>
130
                <td>
131
			<?php
132
				$tab_array = array();
133
				$tab_array[0] = array("Gateways", false, "system_gateways.php");
134
				$tab_array[1] = array("Routes", false, "system_routes.php");
135
				$tab_array[2] = array("Groups", false, "system_gateway_groups.php");
136
				$tab_array[3] = array("Settings", true, "system_gateways_settings.php");
137
				display_top_tabs($tab_array);
138
			?>
139
                </td>
140
        </tr>
141
        <tr>
142
                <td>
143
                        <div id="mainarea">
144
                        <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6">
145
			<tr>
146
                        	<td width="22%" valign="top" class="vncellreq">Latency boundaries</td>
147
	                        <td width="78%" class="vtable">
148
				From 
149
				    <input name="latencylow" type="text" class="formfld unknown" id="latencylow" size="2" 
150
					value="<?=htmlspecialchars($pconfig['latencylow']);?>">
151
				To
152
				    <input name="latencyhigh" type="text" class="formfld unknown" id="latencyhigh" size="2" 
153
					value="<?=htmlspecialchars($pconfig['latencyhigh']);?>">
154
				    <br> <span class="vexpl">These define the low and high water marks for latency in milliseconds.</span></td>
155
				</td>
156
			</tr>
157
			<tr>
158
                        	<td width="22%" valign="top" class="vncellreq">Packet Loss boundaries</td>
159
	                        <td width="78%" class="vtable">
160
				From 
161
				    <input name="losslow" type="text" class="formfld unknown" id="losslow" size="2" 
162
					value="<?=htmlspecialchars($pconfig['losslow']);?>">
163
				To
164
				    <input name="losshigh" type="text" class="formfld unknown" id="losshigh" size="2" 
165
					value="<?=htmlspecialchars($pconfig['losshigh']);?>">
166
				    <br> <span class="vexpl">These define the low and high water marks for packet loss in %.</span></td>
167
				</td>
168
			</tr>
169
			<tr>
170
				<td width="22%" valign="top">&nbsp;</td>
171
				<td width="78%">
172
					<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
173
				</td>
174
			</tr>
175
			</table>
176
		</div>
177
		</td>
178
	</tr>
179
</table>
180
181
</form>
182
<?php include("fend.inc"); ?>
183
</body>
184
</html>