Project

General

Profile

Download (6.13 KB) Statistics
| Branch: | Tag: | Revision:
1
<?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
	pfSense_MODULE:	routing
32
*/
33

    
34
##|+PRIV
35
##|*IDENT=page-status-rrdgraphs
36
##|*NAME=Status: RRD Graphs page
37
##|*DESCR=Allow access to the 'Status: RRD Graphs' page.
38
##|*MATCH=status_rrd_graph_settings.php*
39
##|-PRIV
40

    
41
require("guiconfig.inc");
42

    
43
if (!is_array($config['gateways']['settings']))
44
	$config['gateways']['settings'] = array();
45

    
46
$a_settings = &$config['gateways']['settings'];
47

    
48
$changedesc = "Gateways: ";
49
$input_errors = array();
50

    
51
if (empty($a_settings)) {
52
	$pconfig['latencylow'] = "100";
53
	$pconfig['latencyhigh'] = "500";
54
	$pconfig['losslow'] = "10";
55
	$pconfig['losshigh'] = "20";
56
} else {
57
	$pconfig['latencylow'] = $a_settings['latencylow'];
58
	$pconfig['latencyhigh'] = $a_settings['latencyhigh'];
59
	$pconfig['losslow'] = $a_settings['losslow'];
60
	$pconfig['losshigh'] = $a_settings['losshigh'];
61
}
62

    
63
if ($_POST) {
64

    
65
	unset($input_errors);
66
	$pconfig = $_POST;
67

    
68
	/* input validation */
69
	if($_POST['latencylow']) {
70
		if (! is_numeric($_POST['latencylow'])) {
71
			$input_errors[] = "The low latency watermark needs to be a numeric value.";
72
		}
73
	}
74

    
75
	if($_POST['latencyhigh']) {
76
		if (! is_numeric($_POST['latencyhigh'])) {
77
			$input_errors[] = "The high latency watermark needs to be a numeric value.";
78
		}
79
	}
80
	if($_POST['losslow']) {
81
		if (! is_numeric($_POST['losslow'])) {
82
			$input_errors[] = "The low loss watermark needs to be a numeric value.";
83
		}
84
	}
85
	if($_POST['losshigh']) {
86
		if (! is_numeric($_POST['losshigh'])) {
87
			$input_errors[] = "The high loss watermark needs to be a numeric value.";
88
		}
89
	}
90

    
91
	if(($_POST['latencylow']) && ($_POST['latencyhigh'])){
92
		if(($_POST['latencylow'] > $_POST['latencyhigh'])) {
93
			$input_errors[] = "The High latency watermark needs to be higher then the low latency watermark";
94
		}
95
	}
96

    
97
	if(($_POST['losslow']) && ($_POST['losshigh'])){
98
		if($_POST['losslow'] > $_POST['losshigh']) {
99
			$input_errors[] = "The High packet loss watermark needs to be higher then the low packet loss watermark";
100
		}
101
	}
102

    
103

    
104

    
105
        if (!$input_errors) {
106
		$a_settings['latencylow'] = $_POST['latencylow'];
107
		$a_settings['latencyhigh'] = $_POST['latencyhigh'];
108
		$a_settings['losslow'] = $_POST['losslow'];
109
		$a_settings['losshigh'] = $_POST['losshigh'];
110
		
111

    
112
		$config['gateways']['settings'] = $a_settings;
113

    
114
                $retval = 0;
115
                $retval = setup_gateways_monitor();
116
		write_config();
117

    
118
                $savemsg = get_std_save_message($retval);
119
	}
120
}
121

    
122
$pgtitle = array("Gateways","Settings");
123
include("head.inc");
124

    
125
?>
126
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
127
<?php include("fbegin.inc"); ?>
128
<?php if ($input_errors) print_input_errors($input_errors); ?>
129
<?php if ($savemsg) print_info_box($savemsg); ?>
130
<form action="system_gateways_settings.php" method="post" name="iform" id="iform">
131
<table width="100%" border="0" cellpadding="0" cellspacing="0">
132
        <tr>
133
                <td>
134
			<?php
135
				$tab_array = array();
136
				$tab_array[0] = array("Gateways", false, "system_gateways.php");
137
				$tab_array[1] = array("Routes", false, "system_routes.php");
138
				$tab_array[2] = array("Groups", false, "system_gateway_groups.php");
139
				$tab_array[3] = array("Settings", true, "system_gateways_settings.php");
140
				display_top_tabs($tab_array);
141
			?>
142
                </td>
143
        </tr>
144
        <tr>
145
                <td>
146
                        <div id="mainarea">
147
                        <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6">
148
			<tr>
149
                        	<td width="22%" valign="top" class="vncellreq">Latency thresholds</td>
150
	                        <td width="78%" class="vtable">
151
				From 
152
				    <input name="latencylow" type="text" class="formfld unknown" id="latencylow" size="2" 
153
					value="<?=htmlspecialchars($pconfig['latencylow']);?>">
154
				To
155
				    <input name="latencyhigh" type="text" class="formfld unknown" id="latencyhigh" size="2" 
156
					value="<?=htmlspecialchars($pconfig['latencyhigh']);?>">
157
				    <br> <span class="vexpl">These define the low and high water marks for latency in milliseconds.</span></td>
158
				</td>
159
			</tr>
160
			<tr>
161
                        	<td width="22%" valign="top" class="vncellreq">Packet Loss thresholds</td>
162
	                        <td width="78%" class="vtable">
163
				From 
164
				    <input name="losslow" type="text" class="formfld unknown" id="losslow" size="2" 
165
					value="<?=htmlspecialchars($pconfig['losslow']);?>">
166
				To
167
				    <input name="losshigh" type="text" class="formfld unknown" id="losshigh" size="2" 
168
					value="<?=htmlspecialchars($pconfig['losshigh']);?>">
169
				    <br> <span class="vexpl">These define the low and high water marks for packet loss in %.</span></td>
170
				</td>
171
			</tr>
172
			<tr>
173
				<td width="22%" valign="top">&nbsp;</td>
174
				<td width="78%">
175
					<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
176
				</td>
177
			</tr>
178
			</table>
179
		</div>
180
		</td>
181
	</tr>
182
</table>
183

    
184
</form>
185
<?php include("fend.inc"); ?>
186
</body>
187
</html>
(185-185/216)