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/netstat.c 100591 2002-07-24 03:02:43Z jdp $");
37
38#ifdef lint
39static const char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93";
40#endif
41
42/*
43 * netstat
44 */
--- 60 unchanged lines hidden (view full) ---
105#define NIF_LACHG 0x1 /* local address changed */
106#define NIF_FACHG 0x2 /* foreign address changed */
107 short ni_state; /* tcp state */
108 const char *ni_proto; /* protocol */
109 struct in_addr ni_laddr; /* local address */
110 long ni_lport; /* local port */
111 struct in_addr ni_faddr; /* foreign address */
112 long ni_fport; /* foreign port */
113 u_int ni_rcvcc; /* rcv buffer character count */
114 u_int ni_sndcc; /* snd buffer character count */
115};
116
117TAILQ_HEAD(netinfohead, netinfo) netcb = TAILQ_HEAD_INITIALIZER(netcb);
118
119static int aflag = 0;
120static int nflag = 0;
121static int lastrow = 1;
122
--- 322 unchanged lines hidden (view full) ---
445 p->ni_flags &= ~NIF_LACHG;
446 }
447 if (p->ni_flags & NIF_FACHG) {
448 wmove(wnd, p->ni_line, FADDR);
449 inetprint(&p->ni_faddr, p->ni_fport, p->ni_proto);
450 p->ni_flags &= ~NIF_FACHG;
451 }
452 mvwaddstr(wnd, p->ni_line, PROTO, p->ni_proto);
453 mvwprintw(wnd, p->ni_line, RCVCC, "%6u", p->ni_rcvcc);
454 mvwprintw(wnd, p->ni_line, SNDCC, "%6u", p->ni_sndcc);
455 if (streq(p->ni_proto, "tcp")) {
456 if (p->ni_state < 0 || p->ni_state >= TCP_NSTATES)
457 mvwprintw(wnd, p->ni_line, STATE, "%d",
458 p->ni_state);
459 else
460 mvwaddstr(wnd, p->ni_line, STATE,
461 tcpstates[p->ni_state]);
462 }
--- 113 unchanged lines hidden ---
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/netstat.c 100591 2002-07-24 03:02:43Z jdp $");
37
38#ifdef lint
39static const char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93";
40#endif
41
42/*
43 * netstat
44 */
--- 60 unchanged lines hidden (view full) ---
105#define NIF_LACHG 0x1 /* local address changed */
106#define NIF_FACHG 0x2 /* foreign address changed */
107 short ni_state; /* tcp state */
108 const char *ni_proto; /* protocol */
109 struct in_addr ni_laddr; /* local address */
110 long ni_lport; /* local port */
111 struct in_addr ni_faddr; /* foreign address */
112 long ni_fport; /* foreign port */
113 u_int ni_rcvcc; /* rcv buffer character count */
114 u_int ni_sndcc; /* snd buffer character count */
115};
116
117TAILQ_HEAD(netinfohead, netinfo) netcb = TAILQ_HEAD_INITIALIZER(netcb);
118
119static int aflag = 0;
120static int nflag = 0;
121static int lastrow = 1;
122
--- 322 unchanged lines hidden (view full) ---
445 p->ni_flags &= ~NIF_LACHG;
446 }
447 if (p->ni_flags & NIF_FACHG) {
448 wmove(wnd, p->ni_line, FADDR);
449 inetprint(&p->ni_faddr, p->ni_fport, p->ni_proto);
450 p->ni_flags &= ~NIF_FACHG;
451 }
452 mvwaddstr(wnd, p->ni_line, PROTO, p->ni_proto);
453 mvwprintw(wnd, p->ni_line, RCVCC, "%6u", p->ni_rcvcc);
454 mvwprintw(wnd, p->ni_line, SNDCC, "%6u", p->ni_sndcc);
455 if (streq(p->ni_proto, "tcp")) {
456 if (p->ni_state < 0 || p->ni_state >= TCP_NSTATES)
457 mvwprintw(wnd, p->ni_line, STATE, "%d",
458 p->ni_state);
459 else
460 mvwaddstr(wnd, p->ni_line, STATE,
461 tcpstates[p->ni_state]);
462 }
--- 113 unchanged lines hidden ---