void showtcp(void) { struct tcp_stats stats; memset(&stats, 0, sizeof stats); domode(&stats); #define DO(stat, row, col) \ mvwprintw(wnd, row, col, "%9lu", stats.stat) #define L(row, stat) DO(stat, row, 0) #define R(row, stat) DO(stat, row, 35) L(2, tcps_connattempt); R(2, tcps_sndtotal); L(3, tcps_accepts); R(3, tcps_sndpack); L(4, tcps_connects); R(4, tcps_sndrexmitpack); L(5, tcps_drops); R(5, tcps_sndacks); L(6, tcps_conndrops); R(6, tcps_sndprobe); L(7, tcps_timeoutdrop); R(7, tcps_sndwinup); L(8, tcps_keepdrops); R(8, tcps_sndurg); L(9, tcps_listendrop); R(9, tcps_sndctrl); R(10, tcps_mturesent); R(11, tcps_rcvtotal); L(12, tcps_segstimed); R(12, tcps_rcvpack); L(13, tcps_rttupdated); R(13, tcps_rcvduppack); L(14, tcps_delack); R(14, tcps_rcvpartduppack); L(15, tcps_rexmttimeo); R(15, tcps_rcvoopack); L(16, tcps_persisttimeo); R(16, tcps_rcvdupack); L(17, tcps_keepprobe); R(17, tcps_rcvackpack); L(18, tcps_keeptimeo); R(18, tcps_rcvwinprobe); R(19, tcps_rcvwinupd); #undef DO #undef L #undef R }
void showip6(void) { struct ip6stat stats; uint64_t totalout; domode(&stats); totalout = stats.ip6s_forward + stats.ip6s_localout; #define DO(stat, row, col) \ mvwprintw(wnd, row, col, "%9"PRIu64, stats.stat) DO(ip6s_total, 1, 0); mvwprintw(wnd, 1, 35, "%9"PRIu64, totalout); DO(ip6s_tooshort, 2, 0); DO(ip6s_localout, 2, 35); DO(ip6s_toosmall, 3, 0); DO(ip6s_odropped, 3, 35); DO(ip6s_badvers, 4, 0); DO(ip6s_ofragments, 4, 35); DO(ip6s_fragments, 5, 0); DO(ip6s_cantfrag, 5, 35); DO(ip6s_fragdropped, 6, 0); DO(ip6s_noroute, 6, 35); DO(ip6s_fragtimeout, 7, 0); DO(ip6s_rawout, 7, 35); DO(ip6s_fragoverflow, 8, 0); DO(ip6s_atomicfrags, 9, 0); DO(ip6s_reassembled, 10, 0); DO(ip6s_forward, 11, 0); DO(ip6s_nxthist[IPPROTO_DSTOPTS], 10, 35); DO(ip6s_cantforward, 12, 0); DO(ip6s_nxthist[IPPROTO_HOPOPTS], 11, 35); DO(ip6s_redirectsent, 13, 0); DO(ip6s_nxthist[IPPROTO_IPV4], 12, 35); DO(ip6s_badoptions, 14, 0); DO(ip6s_nxthist[IPPROTO_TCP], 13, 35); DO(ip6s_notmember, 15, 0); DO(ip6s_nxthist[IPPROTO_UDP], 14, 35); DO(ip6s_delivered, 16, 0); DO(ip6s_nxthist[IPPROTO_IPV6], 15, 35); DO(ip6s_badscope, 17, 0); DO(ip6s_nxthist[IPPROTO_ROUTING], 16, 35); DO(ip6s_sources_none, 18, 0); DO(ip6s_nxthist[IPPROTO_FRAGMENT], 17, 35); DO(ip6s_nxthist[IPPROTO_ICMPV6], 18, 35); DO(ip6s_nxthist[IPPROTO_NONE], 19, 35); #undef DO }
void showip(void) { struct stat stats; u_long totalout; domode(&stats); totalout = stats.i.ips_forward + stats.i.ips_localout; #define DO(stat, row, col) \ mvwprintw(wnd, row, col, "%9lu", stats.stat) DO(i.ips_total, 2, 0); mvwprintw(wnd, 2, 35, "%9lu", totalout); DO(i.ips_badsum, 3, 0); DO(i.ips_localout, 3, 35); DO(i.ips_tooshort, 4, 0); DO(i.ips_odropped, 4, 35); DO(i.ips_toosmall, 5, 0); DO(i.ips_ofragments, 5, 35); DO(i.ips_badhlen, 6, 0); DO(i.ips_cantfrag, 6, 35); DO(i.ips_badlen, 7, 0); DO(i.ips_noroute, 7, 35); DO(i.ips_badvers, 8, 0); DO(i.ips_rawout, 8, 35); DO(i.ips_toolong, 9, 0); DO(i.ips_fragments, 10, 0); DO(i.ips_fragdropped, 11, 0); DO(u.udps_ipackets, 11, 35); DO(i.ips_fragtimeout, 12, 0); DO(u.udps_hdrops, 12, 35); DO(i.ips_reassembled, 13, 0); DO(u.udps_badsum, 13, 35); DO(i.ips_forward, 14, 0); DO(u.udps_nosum, 14, 35); DO(i.ips_cantforward, 15, 0); DO(u.udps_badlen, 15, 35); DO(i.ips_redirectsent, 16, 0); DO(u.udps_noport, 16, 35); DO(i.ips_badoptions, 17, 0); DO(u.udps_noportbcast, 17, 35); DO(i.ips_notmember, 18, 0); DO(u.udps_fullsock, 18, 35); DO(i.ips_delivered, 19, 0); DO(u.udps_opackets, 19, 35); #undef DO }
void showicmp6(void) { struct icmp6stat stats; u_long totalin, totalout; int i; memset(&stats, 0, sizeof stats); domode(&stats); for (i = totalin = totalout = 0; i <= ICMP6_MAXTYPE; i++) { totalin += stats.icp6s_inhist[i]; totalout += stats.icp6s_outhist[i]; } totalin += stats.icp6s_badcode + stats.icp6s_badlen + stats.icp6s_checksum + stats.icp6s_tooshort; mvwprintw(wnd, 1, 0, "%9lu", totalin); mvwprintw(wnd, 1, 35, "%9lu", totalout); #define DO(stat, row, col) \ mvwprintw(wnd, row, col, "%9lu", stats.stat) DO(icp6s_badcode, 2, 0); DO(icp6s_badlen, 3, 0); DO(icp6s_checksum, 4, 0); DO(icp6s_tooshort, 5, 0); DO(icp6s_error, 2, 35); DO(icp6s_tooshort, 3, 35); DO(icp6s_canterror, 4, 35); DO(icp6s_reflect, 5, 35); #define DO2(type, row) DO(icp6s_inhist[type], row, 0); DO(icp6s_outhist[type], \ row, 35) DO2(ICMP6_ECHO_REPLY, 8); DO2(ICMP6_ECHO_REQUEST, 9); DO2(ICMP6_DST_UNREACH, 10); DO2(ND_REDIRECT, 11); DO2(ICMP6_TIME_EXCEEDED, 12); DO2(ICMP6_PARAM_PROB, 13); DO2(ND_NEIGHBOR_SOLICIT, 14); DO2(ND_NEIGHBOR_ADVERT, 15); DO(icp6s_inhist[ND_ROUTER_SOLICIT], 16, 0); DO(icp6s_outhist[ND_ROUTER_ADVERT], 16, 35); #undef DO #undef DO2 }
void showicmp(void) { struct icmpstat stats; u_long totalin, totalout; int i; memset(&stats, 0, sizeof stats); domode(&stats); for (i = totalin = totalout = 0; i <= ICMP_MAXTYPE; i++) { totalin += stats.icps_inhist[i]; totalout += stats.icps_outhist[i]; } totalin += stats.icps_badcode + stats.icps_badlen + stats.icps_checksum + stats.icps_tooshort; mvwprintw(wnd, 1, 0, "%9lu", totalin); mvwprintw(wnd, 1, 35, "%9lu", totalout); #define DO(stat, row, col) \ mvwprintw(wnd, row, col, "%9lu", stats.stat) DO(icps_badcode, 2, 0); DO(icps_badlen, 3, 0); DO(icps_checksum, 4, 0); DO(icps_tooshort, 5, 0); DO(icps_error, 2, 35); DO(icps_oldshort, 3, 35); DO(icps_oldicmp, 4, 35); DO(icps_reflect, 5, 35); DO(icps_bmcastecho, 6, 35); DO(icps_bmcasttstamp, 7, 35); #define DO2(type, row) DO(icps_inhist[type], row, 0); DO(icps_outhist[type], \ row, 35) DO2(ICMP_ECHOREPLY, 10); DO2(ICMP_ECHO, 11); DO2(ICMP_UNREACH, 12); DO2(ICMP_REDIRECT, 13); DO2(ICMP_TIMXCEED, 14); DO2(ICMP_PARAMPROB, 15); DO(icps_inhist[ICMP_ROUTERADVERT], 16, 0); DO(icps_outhist[ICMP_ROUTERSOLICIT], 16, 35); #undef DO #undef DO2 }