]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/netstat/netstat.h
Import Intel Processor Trace decoder library from
[FreeBSD/FreeBSD.git] / usr.bin / netstat / netstat.h
1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
3  *
4  * Copyright (c) 1992, 1993
5  *      Regents of the University of California.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the University nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  *
31  *      @(#)netstat.h   8.2 (Berkeley) 1/4/94
32  * $FreeBSD$
33  */
34
35 #include <sys/cdefs.h>
36
37 #define satosin(sa)     ((struct sockaddr_in *)(sa))
38 #define satosin6(sa)    ((struct sockaddr_in6 *)(sa))
39 #define sin6tosa(sin6)  ((struct sockaddr *)(sin6))
40
41 extern int      Aflag;  /* show addresses of protocol control block */
42 extern int      aflag;  /* show all sockets (including servers) */
43 extern int      bflag;  /* show i/f total bytes in/out */
44 extern int      dflag;  /* show i/f dropped packets */
45 extern int      gflag;  /* show group (multicast) routing or stats */
46 extern int      hflag;  /* show counters in human readable format */
47 extern int      iflag;  /* show interfaces */
48 extern int      Lflag;  /* show size of listen queues */
49 extern int      mflag;  /* show memory stats */
50 extern int      noutputs;       /* how much outputs before we exit */
51 extern int      numeric_addr;   /* show addresses numerically */
52 extern int      numeric_port;   /* show ports numerically */
53 extern int      rflag;  /* show routing tables (or routing stats) */
54 extern int      Rflag;  /* show flowid / RSS information */
55 extern int      sflag;  /* show protocol statistics */
56 extern int      Tflag;  /* show TCP control block info */
57 extern int      Wflag;  /* wide display */
58 extern int      xflag;  /* extended display, includes all socket buffer info */
59 extern int      zflag;  /* zero stats */
60
61 extern int      interval; /* repeat interval for i/f stats */
62
63 extern char     *interface; /* desired i/f for stats, or NULL for all i/fs */
64 extern int      unit;   /* unit number for above */
65
66 extern int      live;   /* true if we are examining a live system */
67
68 typedef int kreadfn_t(u_long, void *, size_t);
69 int     fetch_stats(const char *, u_long, void *, size_t, kreadfn_t);
70 int     fetch_stats_ro(const char *, u_long, void *, size_t, kreadfn_t);
71
72 int     kread(u_long addr, void *buf, size_t size);
73 uint64_t kread_counter(u_long addr);
74 int     kread_counters(u_long addr, void *buf, size_t size);
75 void    kset_dpcpu(u_int);
76 const char *plural(uintmax_t);
77 const char *plurales(uintmax_t);
78 const char *pluralies(uintmax_t);
79
80 struct sockaddr;
81 struct socket;
82 struct xsocket;
83 int     sotoxsocket(struct socket *, struct xsocket *);
84 void    protopr(u_long, const char *, int, int);
85 void    tcp_stats(u_long, const char *, int, int);
86 void    udp_stats(u_long, const char *, int, int);
87 #ifdef SCTP
88 void    sctp_protopr(u_long, const char *, int, int);
89 void    sctp_stats(u_long, const char *, int, int);
90 #endif
91 void    arp_stats(u_long, const char *, int, int);
92 void    ip_stats(u_long, const char *, int, int);
93 void    icmp_stats(u_long, const char *, int, int);
94 void    igmp_stats(u_long, const char *, int, int);
95 void    pim_stats(u_long, const char *, int, int);
96 void    carp_stats(u_long, const char *, int, int);
97 void    pfsync_stats(u_long, const char *, int, int);
98 #ifdef IPSEC
99 void    ipsec_stats(u_long, const char *, int, int);
100 void    esp_stats(u_long, const char *, int, int);
101 void    ah_stats(u_long, const char *, int, int);
102 void    ipcomp_stats(u_long, const char *, int, int);
103 #endif
104
105 #ifdef INET
106 struct in_addr;
107
108 char    *inetname(struct in_addr *);
109 #endif
110
111 #ifdef INET6
112 struct in6_addr;
113
114 char    *inet6name(struct in6_addr *);
115 void    ip6_stats(u_long, const char *, int, int);
116 void    ip6_ifstats(char *);
117 void    icmp6_stats(u_long, const char *, int, int);
118 void    icmp6_ifstats(char *);
119 void    pim6_stats(u_long, const char *, int, int);
120 void    rip6_stats(u_long, const char *, int, int);
121 void    mroute6pr(void);
122 void    mrt6_stats(void);
123
124 struct sockaddr_in6;
125 struct in6_addr;
126 void in6_fillscopeid(struct sockaddr_in6 *);
127 void    inet6print(const char *, struct in6_addr *, int, const char *, int);
128 #endif /*INET6*/
129
130 #ifdef IPSEC
131 void    pfkey_stats(u_long, const char *, int, int);
132 #endif
133
134 void    mbpr(void *, u_long);
135
136 void    netisr_stats(void);
137
138 void    hostpr(u_long, u_long);
139 void    impstats(u_long, u_long);
140
141 void    intpr(void (*)(char *), int);
142
143 void    pr_family(int);
144 void    rt_stats(void);
145
146 char    *routename(struct sockaddr *, int);
147 const char *netname(struct sockaddr *, struct sockaddr *);
148 void    routepr(int, int);
149
150 #ifdef NETGRAPH
151 void    netgraphprotopr(u_long, const char *, int, int);
152 #endif
153
154 void    unixpr(u_long, u_long, u_long, u_long, u_long, bool *);
155
156 void    mroutepr(void);
157 void    mrt_stats(void);
158 void    bpf_stats(char *);