Deleted Added
full compact
icmp.c (87715) icmp.c (158160)
1/*-
2 * Copyright (c) 1980, 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35
1/*-
2 * Copyright (c) 1980, 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35
36__FBSDID("$FreeBSD: head/usr.bin/systat/icmp.c 87715 2001-12-12 00:13:37Z markm $");
36__FBSDID("$FreeBSD: head/usr.bin/systat/icmp.c 158160 2006-04-30 04:26:46Z bde $");
37
38#ifdef lint
39static char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93";
40#endif
41
42/* From:
43 "Id: mbufs.c,v 1.5 1997/02/24 20:59:03 wollman Exp"
44*/

--- 16 unchanged lines hidden (view full) ---

61#include "extern.h"
62#include "mode.h"
63
64static struct icmpstat icmpstat, initstat, oldstat;
65
66/*-
67--0 1 2 3 4 5 6 7
68--0123456789012345678901234567890123456789012345678901234567890123456789012345
37
38#ifdef lint
39static char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93";
40#endif
41
42/* From:
43 "Id: mbufs.c,v 1.5 1997/02/24 20:59:03 wollman Exp"
44*/

--- 16 unchanged lines hidden (view full) ---

61#include "extern.h"
62#include "mode.h"
63
64static struct icmpstat icmpstat, initstat, oldstat;
65
66/*-
67--0 1 2 3 4 5 6 7
68--0123456789012345678901234567890123456789012345678901234567890123456789012345
6901 ICMP Input ICMP Output
7002999999999 total messages 999999999 total messages
7103999999999 with bad code 999999999 errors generated
7204999999999 with bad length 999999999 suppressed - original too short
7305999999999 with bad checksum 999999999 suppressed - original was ICMP
7406999999999 with insufficient data 999999999 responses sent
7507 999999999 suppressed - multicast echo
7608 999999999 suppressed - multicast tstamp
7709
7810 Input Histogram Output Histogram
7911999999999 echo response 999999999 echo response
8012999999999 echo request 999999999 echo request
8113999999999 destination unreachable 999999999 destination unreachable
8214999999999 redirect 999999999 redirect
8315999999999 time-to-live exceeded 999999999 time-to-line exceeded
8416999999999 parameter problem 999999999 parameter problem
8517999999999 router advertisement 999999999 router solicitation
6900 ICMP Input ICMP Output
7001999999999 total messages 999999999 total messages
7102999999999 with bad code 999999999 errors generated
7203999999999 with bad length 999999999 suppressed - original too short
7304999999999 with bad checksum 999999999 suppressed - original was ICMP
7405999999999 with insufficient data 999999999 responses sent
7506 999999999 suppressed - multicast echo
7607 999999999 suppressed - multicast tstamp
7708
7809 Input Histogram Output Histogram
7910999999999 echo response 999999999 echo response
8011999999999 echo request 999999999 echo request
8112999999999 destination unreachable 999999999 destination unreachable
8213999999999 redirect 999999999 redirect
8314999999999 time-to-live exceeded 999999999 time-to-line exceeded
8415999999999 parameter problem 999999999 parameter problem
8516999999999 router advertisement 999999999 router solicitation
8617
8618
8718
8719
88--0123456789012345678901234567890123456789012345678901234567890123456789012345
89--0 1 2 3 4 5 6 7
90*/
91
92WINDOW *
93openicmp(void)
94{
88--0123456789012345678901234567890123456789012345678901234567890123456789012345
89--0 1 2 3 4 5 6 7
90*/
91
92WINDOW *
93openicmp(void)
94{
95 return (subwin(stdscr, LINES-5-1, 0, 5, 0));
95 return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
96}
97
98void
99closeicmp(w)
100 WINDOW *w;
101{
102 if (w == NULL)
103 return;
104 wclear(w);
105 wrefresh(w);
106 delwin(w);
107}
108
109void
110labelicmp(void)
111{
112 wmove(wnd, 0, 0); wclrtoeol(wnd);
113#define L(row, str) mvwprintw(wnd, row, 10, str)
114#define R(row, str) mvwprintw(wnd, row, 45, str);
96}
97
98void
99closeicmp(w)
100 WINDOW *w;
101{
102 if (w == NULL)
103 return;
104 wclear(w);
105 wrefresh(w);
106 delwin(w);
107}
108
109void
110labelicmp(void)
111{
112 wmove(wnd, 0, 0); wclrtoeol(wnd);
113#define L(row, str) mvwprintw(wnd, row, 10, str)
114#define R(row, str) mvwprintw(wnd, row, 45, str);
115 L(1, "ICMP Input"); R(1, "ICMP Output");
116 L(2, "total messages"); R(2, "total messages");
117 L(3, "with bad code"); R(3, "errors generated");
118 L(4, "with bad length"); R(4, "suppressed - original too short");
119 L(5, "with bad checksum"); R(5, "suppressed - original was ICMP");
120 L(6, "with insufficient data"); R(6, "responses sent");
121 ; R(7, "suppressed - multicast echo");
122 ; R(8, "suppressed - multicast tstamp");
123 L(10, "Input Histogram"); R(10, "Output Histogram");
115 L(0, "ICMP Input"); R(0, "ICMP Output");
116 L(1, "total messages"); R(1, "total messages");
117 L(2, "with bad code"); R(2, "errors generated");
118 L(3, "with bad length"); R(3, "suppressed - original too short");
119 L(4, "with bad checksum"); R(4, "suppressed - original was ICMP");
120 L(5, "with insufficient data"); R(5, "responses sent");
121 R(6, "suppressed - multicast echo");
122 R(7, "suppressed - multicast tstamp");
123 L(9, "Input Histogram"); R(9, "Output Histogram");
124#define B(row, str) L(row, str); R(row, str)
124#define B(row, str) L(row, str); R(row, str)
125 B(11, "echo response");
126 B(12, "echo request");
127 B(13, "destination unreachable");
128 B(14, "redirect");
129 B(15, "time-to-live exceeded");
130 B(16, "parameter problem");
131 L(17, "router advertisement"); R(17, "router solicitation");
125 B(10, "echo response");
126 B(11, "echo request");
127 B(12, "destination unreachable");
128 B(13, "redirect");
129 B(14, "time-to-live exceeded");
130 B(15, "parameter problem");
131 L(16, "router advertisement"); R(16, "router solicitation");
132#undef L
133#undef R
134#undef B
135}
136
137static void
138domode(struct icmpstat *ret)
139{

--- 45 unchanged lines hidden (view full) ---

185 memset(&stats, 0, sizeof stats);
186 domode(&stats);
187 for (i = totalin = totalout = 0; i <= ICMP_MAXTYPE; i++) {
188 totalin += stats.icps_inhist[i];
189 totalout += stats.icps_outhist[i];
190 }
191 totalin += stats.icps_badcode + stats.icps_badlen +
192 stats.icps_checksum + stats.icps_tooshort;
132#undef L
133#undef R
134#undef B
135}
136
137static void
138domode(struct icmpstat *ret)
139{

--- 45 unchanged lines hidden (view full) ---

185 memset(&stats, 0, sizeof stats);
186 domode(&stats);
187 for (i = totalin = totalout = 0; i <= ICMP_MAXTYPE; i++) {
188 totalin += stats.icps_inhist[i];
189 totalout += stats.icps_outhist[i];
190 }
191 totalin += stats.icps_badcode + stats.icps_badlen +
192 stats.icps_checksum + stats.icps_tooshort;
193 mvwprintw(wnd, 2, 0, "%9lu", totalin);
194 mvwprintw(wnd, 2, 35, "%9lu", totalout);
193 mvwprintw(wnd, 1, 0, "%9lu", totalin);
194 mvwprintw(wnd, 1, 35, "%9lu", totalout);
195
196#define DO(stat, row, col) \
197 mvwprintw(wnd, row, col, "%9lu", stats.stat)
198
195
196#define DO(stat, row, col) \
197 mvwprintw(wnd, row, col, "%9lu", stats.stat)
198
199 DO(icps_badcode, 3, 0);
200 DO(icps_badlen, 4, 0);
201 DO(icps_checksum, 5, 0);
202 DO(icps_tooshort, 6, 0);
203 DO(icps_error, 3, 35);
204 DO(icps_oldshort, 4, 35);
205 DO(icps_oldicmp, 5, 35);
206 DO(icps_reflect, 6, 35);
207 DO(icps_bmcastecho, 7, 35);
208 DO(icps_bmcasttstamp, 8, 35);
199 DO(icps_badcode, 2, 0);
200 DO(icps_badlen, 3, 0);
201 DO(icps_checksum, 4, 0);
202 DO(icps_tooshort, 5, 0);
203 DO(icps_error, 2, 35);
204 DO(icps_oldshort, 3, 35);
205 DO(icps_oldicmp, 4, 35);
206 DO(icps_reflect, 5, 35);
207 DO(icps_bmcastecho, 6, 35);
208 DO(icps_bmcasttstamp, 7, 35);
209#define DO2(type, row) DO(icps_inhist[type], row, 0); DO(icps_outhist[type], \
210 row, 35)
209#define DO2(type, row) DO(icps_inhist[type], row, 0); DO(icps_outhist[type], \
210 row, 35)
211 DO2(ICMP_ECHOREPLY, 11);
212 DO2(ICMP_ECHO, 12);
213 DO2(ICMP_UNREACH, 13);
214 DO2(ICMP_REDIRECT, 14);
215 DO2(ICMP_TIMXCEED, 15);
216 DO2(ICMP_PARAMPROB, 16);
217 DO(icps_inhist[ICMP_ROUTERADVERT], 17, 0);
218 DO(icps_outhist[ICMP_ROUTERSOLICIT], 17, 35);
211 DO2(ICMP_ECHOREPLY, 10);
212 DO2(ICMP_ECHO, 11);
213 DO2(ICMP_UNREACH, 12);
214 DO2(ICMP_REDIRECT, 13);
215 DO2(ICMP_TIMXCEED, 14);
216 DO2(ICMP_PARAMPROB, 15);
217 DO(icps_inhist[ICMP_ROUTERADVERT], 16, 0);
218 DO(icps_outhist[ICMP_ROUTERSOLICIT], 16, 35);
219#undef DO
220#undef DO2
221}
222
223int
224initicmp(void)
225{
226 size_t len;

--- 59 unchanged lines hidden ---
219#undef DO
220#undef DO2
221}
222
223int
224initicmp(void)
225{
226 size_t len;

--- 59 unchanged lines hidden ---