Project

General

Profile

« Previous | Next » 

Revision 5f601060

Added by Phil Davis over 10 years ago

Code style usr-local-www diag

View differences:

usr/local/www/diag_sockets.php
11 11
	modification, are permitted provided that the following conditions are met:
12 12

  
13 13
	1. Redistributions of source code must retain the above copyright notice,
14
	this list of conditions and the following disclaimer.
14
	   this list of conditions and the following disclaimer.
15 15

  
16 16
	2. Redistributions in binary form must reproduce the above copyright
17
	notice, this list of conditions and the following disclaimer in the
18
	documentation and/or other materials provided with the distribution.
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19 19

  
20 20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21 21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
......
31 31
*/
32 32

  
33 33
/*
34
	pfSense_BUILDER_BINARIES:	/usr/bin/sockstat	
34
	pfSense_BUILDER_BINARIES:	/usr/bin/sockstat
35 35
*/
36 36
##|+PRIV
37 37
##|*IDENT=page-diagnostics-sockets
......
57 57
?>
58 58
<div id="mainarea">
59 59
<table class="tabcont" width="100%" summary="diag sockets">
60
<tr>
61
<td>Information about listening sockets for both <a href="#IPv4">IPv4</a> and <a href="#IPv6">IPv6</a>.</td>
62
</tr>
63
<tr>
64
<td>For explanation about the meaning of the information listed for each socket click <a href="#about">here</a>.</td>
65
</tr>
66
<tr>
67
<td><input type="button" value="<?=$showAllText?>" onclick="window.location.href='diag_sockets.php<?=$showAllOption?>'"/>To show information about both listening and connected sockets click this.</td>
68
</tr>
60
	<tr>
61
		<td>Information about listening sockets for both <a href="#IPv4">IPv4</a> and <a href="#IPv6">IPv6</a>.</td>
62
	</tr>
63
	<tr>
64
		<td>For explanation about the meaning of the information listed for each socket click <a href="#about">here</a>.</td>
65
	</tr>
66
	<tr>
67
		<td><input type="button" value="<?=$showAllText?>" onclick="window.location.href='diag_sockets.php<?=$showAllOption?>'"/>To show information about both listening and connected sockets click this.</td>
68
	</tr>
69 69
</table>
70 70

  
71 71
<?php
72
	if (isset($_GET['showAll']))
73
	{
72
	if (isset($_GET['showAll'])) {
74 73
		$internet4 = shell_exec('sockstat -4');
75 74
		$internet6 = shell_exec('sockstat -6');
76 75
	} else {
......
83 82
?>
84 83
<a name="<?=$name;?>"></a>
85 84
<table style="padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px" width="100%" border="0" cellpadding="0" cellspacing="0" summary="tab">
86
<tr><td class="listtopic" colspan="<?=$elements?>"><strong><?=$name;?></strong></td></tr>
87
<tr><td>
88
<table class="tabcont sortable" id="sortabletable" width="100%" cellspacing="0" cellpadding="6" border="0" summary="results">
89
<?php
90
		foreach (explode("\n", $table) as $i => $line) {
91
			if ($i == 0)
92
				$class = 'listhdrr';
93
			else
94
				$class = 'listlr';
95

  
96
			if (trim($line) == "")
97
				continue;
98
			print("<tr id=\"$name$i\">\n");
99
			$j = 0;
100
			foreach (explode(' ', $line) as $entry) {
101
				if ($entry == '' || $entry == "ADDRESS") continue;
102
				if ($i == 0)
103
					print("<th class=\"$class\">$entry</th>\n");
104
				else		
105
					print("<td class=\"$class\">$entry</td>\n");
106
				if ($i > 0)
107
					$class = 'listr';
108
				$j++;
109
			}
110
			print("</tr>\n");			
111
		}?>
85
	<tr>
86
		<td class="listtopic" colspan="<?=$elements?>"><strong><?=$name;?></strong></td>
87
	</tr>
88
	<tr>
89
		<td>
90
			<table class="tabcont sortable" id="sortabletable" width="100%" cellspacing="0" cellpadding="6" border="0" summary="results">
91
				<?php
92
				foreach (explode("\n", $table) as $i => $line) {
93
					if ($i == 0) {
94
						$class = 'listhdrr';
95
					} else {
96
						$class = 'listlr';
97
					}
98

  
99
					if (trim($line) == "") {
100
						continue;
101
					}
102
					print("<tr id=\"$name$i\">\n");
103
					$j = 0;
104
					foreach (explode(' ', $line) as $entry) {
105
						if ($entry == '' || $entry == "ADDRESS") {
106
							continue;
107
						}
108
						if ($i == 0) {
109
							print("<th class=\"$class\">$entry</th>\n");
110
						} else {
111
							print("<td class=\"$class\">$entry</td>\n");
112
						}
113
						if ($i > 0) {
114
							$class = 'listr';
115
						}
116
						$j++;
117
					}
118
					print("</tr>\n");
119
				}
120
				?>
121
			</table>
122
		</td>
123
	</tr>
112 124
</table>
113
</td></tr></table>
114 125
<?php
115
	} 
126
	}
116 127
?>
117 128

  
118 129
<br />
119 130
<a name="about"></a>
120 131
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="info">
121
	<tr><td colspan="2" class="listtopic" >Socket information explanation</td></tr>
122
<tr><td colspan="2" class="listhdrr">
132
	<tr>
133
		<td colspan="2" class="listtopic" >Socket information explanation</td>
134
	</tr>
135
	<tr>
136
		<td colspan="2" class="listhdrr">
123 137
This page show the output for the commands: "sockstat -4lL" and "sockstat -6lL".<br />
124 138
Or in case of showing all sockets the output for: "sockstat -4" and "sockstat -6".<br />
125 139
<br />
126
The information listed for each socket is:</td></tr>
127
	<tr><td class="listlr">USER	      </td><td class="listr">The user who owns the socket.</td></tr>
128
	<tr><td class="listlr">COMMAND	      </td><td class="listr">The command which holds the socket.</td></tr>
129
	<tr><td class="listlr">PID	      </td><td class="listr">The process ID of the command which holds the socket.</td></tr>
130
	<tr><td class="listlr">FD 	      </td><td class="listr">The file descriptor number of the socket.</td></tr>
131
	<tr><td class="listlr">PROTO	      </td><td class="listr">The transport protocol associated with the socket for Internet sockets, or the type of socket (stream or data-gram) for UNIX sockets.</td></tr>
132
	<tr><td class="listlr">ADDRESS	      </td><td class="listr">(UNIX sockets only) For bound sockets, this is the file-name of the socket.  For other sockets, it is the name, PID and file descriptor number of the peer, or ``(none)'' if the socket is neither bound nor connected.</td></tr>
133
	<tr><td class="listlr">LOCAL ADDRESS    </td><td class="listr">(Internet sockets only) The address the local end of the socket is bound to (see getsockname(2)).</td></tr>
134
	<tr><td class="listlr">FOREIGN ADDRESS  </td><td class="listr">(Internet sockets only) The address the foreign end of the socket is bound to (see getpeername(2)).</td></tr>
140
The information listed for each socket is:
141
		</td>
142
	</tr>
143
	<tr>
144
		<td class="listlr">USER	      </td>
145
		<td class="listr">The user who owns the socket.</td>
146
	</tr>
147
	<tr>
148
		<td class="listlr">COMMAND</td>
149
		<td class="listr">The command which holds the socket.</td>
150
	</tr>
151
	<tr>
152
		<td class="listlr">PID</td>
153
		<td class="listr">The process ID of the command which holds the socket.</td>
154
	</tr>
155
	<tr>
156
		<td class="listlr">FD</td>
157
		<td class="listr">The file descriptor number of the socket.</td>
158
	</tr>
159
	<tr>
160
		<td class="listlr">PROTO</td>
161
		<td class="listr">The transport protocol associated with the socket for Internet sockets, or the type of socket (stream or data-gram) for UNIX sockets.</td>
162
	</tr>
163
	<tr>
164
		<td class="listlr">ADDRESS</td>
165
		<td class="listr">(UNIX sockets only) For bound sockets, this is the file-name of the socket.  For other sockets, it is the name, PID and file descriptor number of the peer, or ``(none)'' if the socket is neither bound nor connected.</td>
166
	</tr>
167
	<tr>
168
		<td class="listlr">LOCAL ADDRESS</td>
169
		<td class="listr">(Internet sockets only) The address the local end of the socket is bound to (see getsockname(2)).</td>
170
	</tr>
171
	<tr>
172
		<td class="listlr">FOREIGN ADDRESS</td>
173
		<td class="listr">(Internet sockets only) The address the foreign end of the socket is bound to (see getpeername(2)).</td>
174
	</tr>
135 175
</table>
136 176
</div>
137 177
<?php

Also available in: Unified diff