Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/netstat/main.c
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | void (*pr_cblocks)(u_long, const char *, int, int); | ||||
/* control blocks printing routine */ | /* control blocks printing routine */ | ||||
void (*pr_stats)(u_long, const char *, int, int); | void (*pr_stats)(u_long, const char *, int, int); | ||||
/* statistics printing routine */ | /* statistics printing routine */ | ||||
void (*pr_istats)(char *); /* per/if statistics printing routine */ | void (*pr_istats)(char *); /* per/if statistics printing routine */ | ||||
const char *pr_name; /* well-known name */ | const char *pr_name; /* well-known name */ | ||||
int pr_usesysctl; /* non-zero if we use sysctl, not kvm */ | int pr_usesysctl; /* non-zero if we use sysctl, not kvm */ | ||||
int pr_protocol; | int pr_protocol; | ||||
} protox[] = { | } protox[] = { | ||||
{ N_TCBINFO, N_TCPSTAT, 1, protopr, | { -1 , N_TCPSTAT, 1, protopr, | ||||
tcp_stats, NULL, "tcp", 1, IPPROTO_TCP }, | tcp_stats, NULL, "tcp", 1, IPPROTO_TCP }, | ||||
{ N_UDBINFO, N_UDPSTAT, 1, protopr, | { -1 , N_UDPSTAT, 1, protopr, | ||||
udp_stats, NULL, "udp", 1, IPPROTO_UDP }, | udp_stats, NULL, "udp", 1, IPPROTO_UDP }, | ||||
#ifdef SCTP | #ifdef SCTP | ||||
{ -1, N_SCTPSTAT, 1, sctp_protopr, | { -1, N_SCTPSTAT, 1, sctp_protopr, | ||||
sctp_stats, NULL, "sctp", 1, IPPROTO_SCTP }, | sctp_stats, NULL, "sctp", 1, IPPROTO_SCTP }, | ||||
#endif | #endif | ||||
#ifdef SDP | #ifdef SDP | ||||
{ -1, -1, 1, protopr, | { -1, -1, 1, protopr, | ||||
NULL, NULL, "sdp", 1, IPPROTO_TCP }, | NULL, NULL, "sdp", 1, IPPROTO_TCP }, | ||||
#endif | #endif | ||||
{ N_DIVCBINFO, -1, 1, protopr, | { -1 , -1, 1, protopr, | ||||
divert_stats, NULL, "divert", 1, 0 }, | divert_stats, NULL, "divert", 1, 0 }, | ||||
{ N_RIPCBINFO, N_IPSTAT, 1, protopr, | { -1 , N_IPSTAT, 1, protopr, | ||||
ip_stats, NULL, "ip", 1, IPPROTO_RAW }, | ip_stats, NULL, "ip", 1, IPPROTO_RAW }, | ||||
{ N_RIPCBINFO, N_ICMPSTAT, 1, protopr, | { -1 , N_ICMPSTAT, 1, protopr, | ||||
icmp_stats, NULL, "icmp", 1, IPPROTO_ICMP }, | icmp_stats, NULL, "icmp", 1, IPPROTO_ICMP }, | ||||
{ N_RIPCBINFO, N_IGMPSTAT, 1, protopr, | { -1 , N_IGMPSTAT, 1, protopr, | ||||
igmp_stats, NULL, "igmp", 1, IPPROTO_IGMP }, | igmp_stats, NULL, "igmp", 1, IPPROTO_IGMP }, | ||||
#ifdef IPSEC | #ifdef IPSEC | ||||
{ -1, N_IPSEC4STAT, 1, NULL, /* keep as compat */ | { -1, N_IPSEC4STAT, 1, NULL, /* keep as compat */ | ||||
ipsec_stats, NULL, "ipsec", 1, 0}, | ipsec_stats, NULL, "ipsec", 1, 0}, | ||||
{ -1, N_AHSTAT, 1, NULL, | { -1, N_AHSTAT, 1, NULL, | ||||
ah_stats, NULL, "ah", 1, 0}, | ah_stats, NULL, "ah", 1, 0}, | ||||
{ -1, N_ESPSTAT, 1, NULL, | { -1, N_ESPSTAT, 1, NULL, | ||||
esp_stats, NULL, "esp", 1, 0}, | esp_stats, NULL, "esp", 1, 0}, | ||||
{ -1, N_IPCOMPSTAT, 1, NULL, | { -1, N_IPCOMPSTAT, 1, NULL, | ||||
ipcomp_stats, NULL, "ipcomp", 1, 0}, | ipcomp_stats, NULL, "ipcomp", 1, 0}, | ||||
#endif | #endif | ||||
{ N_RIPCBINFO, N_PIMSTAT, 1, protopr, | { -1 , N_PIMSTAT, 1, protopr, | ||||
pim_stats, NULL, "pim", 1, IPPROTO_PIM }, | pim_stats, NULL, "pim", 1, IPPROTO_PIM }, | ||||
{ -1, N_CARPSTATS, 1, NULL, | { -1, N_CARPSTATS, 1, NULL, | ||||
carp_stats, NULL, "carp", 1, 0 }, | carp_stats, NULL, "carp", 1, 0 }, | ||||
#ifdef PF | #ifdef PF | ||||
{ -1, N_PFSYNCSTATS, 1, NULL, | { -1, N_PFSYNCSTATS, 1, NULL, | ||||
pfsync_stats, NULL, "pfsync", 1, 0 }, | pfsync_stats, NULL, "pfsync", 1, 0 }, | ||||
#endif | #endif | ||||
{ -1, N_ARPSTAT, 1, NULL, | { -1, N_ARPSTAT, 1, NULL, | ||||
arp_stats, NULL, "arp", 1, 0 }, | arp_stats, NULL, "arp", 1, 0 }, | ||||
{ -1, -1, 0, NULL, | { -1, -1, 0, NULL, | ||||
NULL, NULL, NULL, 0, 0 } | NULL, NULL, NULL, 0, 0 } | ||||
}; | }; | ||||
#ifdef INET6 | #ifdef INET6 | ||||
static struct protox ip6protox[] = { | static struct protox ip6protox[] = { | ||||
{ N_TCBINFO, N_TCPSTAT, 1, protopr, | { -1 , N_TCPSTAT, 1, protopr, | ||||
tcp_stats, NULL, "tcp", 1, IPPROTO_TCP }, | tcp_stats, NULL, "tcp", 1, IPPROTO_TCP }, | ||||
{ N_UDBINFO, N_UDPSTAT, 1, protopr, | { -1 , N_UDPSTAT, 1, protopr, | ||||
udp_stats, NULL, "udp", 1, IPPROTO_UDP }, | udp_stats, NULL, "udp", 1, IPPROTO_UDP }, | ||||
{ N_RIPCBINFO, N_IP6STAT, 1, protopr, | { -1 , N_IP6STAT, 1, protopr, | ||||
ip6_stats, ip6_ifstats, "ip6", 1, IPPROTO_RAW }, | ip6_stats, ip6_ifstats, "ip6", 1, IPPROTO_RAW }, | ||||
{ N_RIPCBINFO, N_ICMP6STAT, 1, protopr, | { -1 , N_ICMP6STAT, 1, protopr, | ||||
icmp6_stats, icmp6_ifstats, "icmp6", 1, IPPROTO_ICMPV6 }, | icmp6_stats, icmp6_ifstats, "icmp6", 1, IPPROTO_ICMPV6 }, | ||||
#ifdef SDP | #ifdef SDP | ||||
{ -1, -1, 1, protopr, | { -1, -1, 1, protopr, | ||||
NULL, NULL, "sdp", 1, IPPROTO_TCP }, | NULL, NULL, "sdp", 1, IPPROTO_TCP }, | ||||
#endif | #endif | ||||
#ifdef IPSEC | #ifdef IPSEC | ||||
{ -1, N_IPSEC6STAT, 1, NULL, | { -1, N_IPSEC6STAT, 1, NULL, | ||||
ipsec_stats, NULL, "ipsec6", 1, 0 }, | ipsec_stats, NULL, "ipsec6", 1, 0 }, | ||||
▲ Show 20 Lines • Show All 762 Lines • Show Last 20 Lines |