2008-01-02 23:26:11 +00:00
|
|
|
/*-
|
2017-11-20 19:49:47 +00:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*
|
1994-05-27 12:33:43 +00:00
|
|
|
* Copyright (c) 1992, 1993
|
|
|
|
* Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2017-02-28 23:42:47 +00:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1994-05-27 12:33:43 +00:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* @(#)netstat.h 8.2 (Berkeley) 1/4/94
|
1999-10-21 09:06:11 +00:00
|
|
|
* $FreeBSD$
|
1994-05-27 12:33:43 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
2015-09-01 08:42:04 +00:00
|
|
|
#define satosin(sa) ((struct sockaddr_in *)(sa))
|
|
|
|
#define satosin6(sa) ((struct sockaddr_in6 *)(sa))
|
|
|
|
#define sin6tosa(sin6) ((struct sockaddr *)(sin6))
|
|
|
|
|
2001-03-15 20:46:04 +00:00
|
|
|
extern int Aflag; /* show addresses of protocol control block */
|
|
|
|
extern int aflag; /* show all sockets (including servers) */
|
|
|
|
extern int bflag; /* show i/f total bytes in/out */
|
|
|
|
extern int dflag; /* show i/f dropped packets */
|
|
|
|
extern int gflag; /* show group (multicast) routing or stats */
|
2005-08-18 21:04:12 +00:00
|
|
|
extern int hflag; /* show counters in human readable format */
|
2001-03-15 20:46:04 +00:00
|
|
|
extern int iflag; /* show interfaces */
|
|
|
|
extern int Lflag; /* show size of listen queues */
|
|
|
|
extern int mflag; /* show memory stats */
|
2010-01-11 03:00:17 +00:00
|
|
|
extern int noutputs; /* how much outputs before we exit */
|
2001-06-15 00:25:44 +00:00
|
|
|
extern int numeric_addr; /* show addresses numerically */
|
|
|
|
extern int numeric_port; /* show ports numerically */
|
2018-03-22 09:40:08 +00:00
|
|
|
extern int Pflag; /* show TCP log ID */
|
2001-03-15 20:46:04 +00:00
|
|
|
extern int rflag; /* show routing tables (or routing stats) */
|
2014-05-19 17:11:43 +00:00
|
|
|
extern int Rflag; /* show flowid / RSS information */
|
2001-03-15 20:46:04 +00:00
|
|
|
extern int sflag; /* show protocol statistics */
|
2010-11-17 18:55:12 +00:00
|
|
|
extern int Tflag; /* show TCP control block info */
|
2001-03-15 20:46:04 +00:00
|
|
|
extern int Wflag; /* wide display */
|
2008-09-01 15:04:38 +00:00
|
|
|
extern int xflag; /* extended display, includes all socket buffer info */
|
2001-06-23 17:17:59 +00:00
|
|
|
extern int zflag; /* zero stats */
|
1994-05-27 12:33:43 +00:00
|
|
|
|
2001-03-15 20:46:04 +00:00
|
|
|
extern int interval; /* repeat interval for i/f stats */
|
1994-05-27 12:33:43 +00:00
|
|
|
|
2001-03-15 20:46:04 +00:00
|
|
|
extern char *interface; /* desired i/f for stats, or NULL for all i/fs */
|
|
|
|
extern int unit; /* unit number for above */
|
1994-05-27 12:33:43 +00:00
|
|
|
|
2007-07-16 17:15:55 +00:00
|
|
|
extern int live; /* true if we are examining a live system */
|
1994-05-27 12:33:43 +00:00
|
|
|
|
2016-03-15 00:19:30 +00:00
|
|
|
typedef int kreadfn_t(u_long, void *, size_t);
|
|
|
|
int fetch_stats(const char *, u_long, void *, size_t, kreadfn_t);
|
|
|
|
int fetch_stats_ro(const char *, u_long, void *, size_t, kreadfn_t);
|
|
|
|
|
2007-07-16 17:15:55 +00:00
|
|
|
int kread(u_long addr, void *buf, size_t size);
|
2014-03-05 01:17:47 +00:00
|
|
|
uint64_t kread_counter(u_long addr);
|
2013-07-09 09:43:03 +00:00
|
|
|
int kread_counters(u_long addr, void *buf, size_t size);
|
2015-09-02 18:51:36 +00:00
|
|
|
void kset_dpcpu(u_int);
|
2006-07-28 16:09:19 +00:00
|
|
|
const char *plural(uintmax_t);
|
|
|
|
const char *plurales(uintmax_t);
|
|
|
|
const char *pluralies(uintmax_t);
|
2003-12-29 04:34:36 +00:00
|
|
|
|
2010-02-22 15:57:36 +00:00
|
|
|
struct sockaddr;
|
|
|
|
struct socket;
|
|
|
|
struct xsocket;
|
2007-07-16 17:15:55 +00:00
|
|
|
int sotoxsocket(struct socket *, struct xsocket *);
|
|
|
|
void protopr(u_long, const char *, int, int);
|
|
|
|
void tcp_stats(u_long, const char *, int, int);
|
|
|
|
void udp_stats(u_long, const char *, int, int);
|
2007-06-09 13:44:09 +00:00
|
|
|
#ifdef SCTP
|
2007-07-16 17:15:55 +00:00
|
|
|
void sctp_protopr(u_long, const char *, int, int);
|
|
|
|
void sctp_stats(u_long, const char *, int, int);
|
2007-06-09 13:44:09 +00:00
|
|
|
#endif
|
2009-09-03 21:10:57 +00:00
|
|
|
void arp_stats(u_long, const char *, int, int);
|
2007-07-16 17:15:55 +00:00
|
|
|
void ip_stats(u_long, const char *, int, int);
|
|
|
|
void icmp_stats(u_long, const char *, int, int);
|
|
|
|
void igmp_stats(u_long, const char *, int, int);
|
|
|
|
void pim_stats(u_long, const char *, int, int);
|
2008-01-02 23:26:11 +00:00
|
|
|
void carp_stats(u_long, const char *, int, int);
|
|
|
|
void pfsync_stats(u_long, const char *, int, int);
|
1999-12-07 17:39:16 +00:00
|
|
|
#ifdef IPSEC
|
2007-07-16 17:15:55 +00:00
|
|
|
void ipsec_stats(u_long, const char *, int, int);
|
2008-01-02 23:26:11 +00:00
|
|
|
void esp_stats(u_long, const char *, int, int);
|
|
|
|
void ah_stats(u_long, const char *, int, int);
|
|
|
|
void ipcomp_stats(u_long, const char *, int, int);
|
2005-12-28 20:36:55 +00:00
|
|
|
#endif
|
1999-12-07 17:39:16 +00:00
|
|
|
|
2017-01-05 09:23:54 +00:00
|
|
|
#ifdef INET
|
|
|
|
struct in_addr;
|
|
|
|
|
|
|
|
char *inetname(struct in_addr *);
|
|
|
|
#endif
|
|
|
|
|
1999-12-07 17:39:16 +00:00
|
|
|
#ifdef INET6
|
2017-01-05 09:23:54 +00:00
|
|
|
struct in6_addr;
|
|
|
|
|
|
|
|
char *inet6name(struct in6_addr *);
|
2007-07-16 17:15:55 +00:00
|
|
|
void ip6_stats(u_long, const char *, int, int);
|
2003-12-29 04:34:36 +00:00
|
|
|
void ip6_ifstats(char *);
|
2007-07-16 17:15:55 +00:00
|
|
|
void icmp6_stats(u_long, const char *, int, int);
|
2003-12-29 04:34:36 +00:00
|
|
|
void icmp6_ifstats(char *);
|
2007-07-16 17:15:55 +00:00
|
|
|
void pim6_stats(u_long, const char *, int, int);
|
|
|
|
void rip6_stats(u_long, const char *, int, int);
|
2013-12-20 00:17:26 +00:00
|
|
|
void mroute6pr(void);
|
|
|
|
void mrt6_stats(void);
|
2000-07-04 16:26:46 +00:00
|
|
|
|
|
|
|
struct sockaddr_in6;
|
|
|
|
struct in6_addr;
|
2011-01-20 15:22:01 +00:00
|
|
|
void in6_fillscopeid(struct sockaddr_in6 *);
|
2015-02-21 23:47:20 +00:00
|
|
|
void inet6print(const char *, struct in6_addr *, int, const char *, int);
|
1999-12-07 17:39:16 +00:00
|
|
|
#endif /*INET6*/
|
|
|
|
|
2000-07-05 02:02:54 +00:00
|
|
|
#ifdef IPSEC
|
2007-07-16 17:15:55 +00:00
|
|
|
void pfkey_stats(u_long, const char *, int, int);
|
2000-07-05 02:02:54 +00:00
|
|
|
#endif
|
|
|
|
|
2005-11-13 14:06:01 +00:00
|
|
|
void mbpr(void *, u_long);
|
1994-05-27 12:33:43 +00:00
|
|
|
|
2015-09-02 18:51:36 +00:00
|
|
|
void netisr_stats(void);
|
2010-02-22 15:57:36 +00:00
|
|
|
|
2003-12-29 04:34:36 +00:00
|
|
|
void hostpr(u_long, u_long);
|
|
|
|
void impstats(u_long, u_long);
|
|
|
|
|
2015-09-01 08:42:04 +00:00
|
|
|
void intpr(void (*)(char *), int);
|
2003-12-29 04:34:36 +00:00
|
|
|
|
|
|
|
void pr_family(int);
|
2013-12-20 00:17:26 +00:00
|
|
|
void rt_stats(void);
|
2003-12-29 04:34:36 +00:00
|
|
|
|
2015-09-01 08:42:04 +00:00
|
|
|
char *routename(struct sockaddr *, int);
|
|
|
|
const char *netname(struct sockaddr *, struct sockaddr *);
|
2013-12-20 00:17:26 +00:00
|
|
|
void routepr(int, int);
|
2003-12-29 04:34:36 +00:00
|
|
|
|
2008-09-21 22:02:26 +00:00
|
|
|
#ifdef NETGRAPH
|
2007-07-16 17:15:55 +00:00
|
|
|
void netgraphprotopr(u_long, const char *, int, int);
|
2008-09-21 22:02:26 +00:00
|
|
|
#endif
|
2003-12-29 04:34:36 +00:00
|
|
|
|
2015-02-21 23:47:20 +00:00
|
|
|
void unixpr(u_long, u_long, u_long, u_long, u_long, bool *);
|
2003-12-29 04:34:36 +00:00
|
|
|
|
2013-12-20 00:17:26 +00:00
|
|
|
void mroutepr(void);
|
|
|
|
void mrt_stats(void);
|
2005-09-07 17:35:16 +00:00
|
|
|
void bpf_stats(char *);
|