Watt-32 tcp/ip  2.2 dev-rel.10
pcstat.h
Go to the documentation of this file.
1 
3 #ifndef _w32_PCSTAT_H
4 #define _w32_PCSTAT_H
5 
6 #ifndef ICMP_MAXTYPE
7 #define ICMP_MAXTYPE 18
8 #endif
9 
10 /*
11  * tcc <= 2.01 lacks proper bit-field support.
12  * Don't define USE_BSD_API/USE_STATISTICS with this compiler.
13  */
14 
15 #if !defined(OLD_TURBOC)
16  #include <sys/socket.h>
17  #include <net/if.h>
18  #include <net/if_dl.h>
19  #include <net/if_ether.h>
20  #include <net/route.h>
21  #include <netinet/in.h>
22  #include <netinet/in_systm.h>
23  #include <netinet/in_var.h>
24  #include <netinet/ip.h>
25  #include <netinet/ip_var.h>
26  #include <netinet/in_pcb.h>
27  #include <netinet/tcp.h>
28  #include <netinet/tcp_time.h>
29  #include <netinet/tcpip.h>
30  #include <netinet/udp.h>
31  #include <netinet/udp_var.h>
32  #include <netinet/tcp_var.h>
33  #include <netinet/icmp_var.h>
34  #include <netinet/igmp_var.h>
35  #include <netinet/icmp6.h>
36  #include <netinet6/ip6_var.h>
37 #endif
38 
39 
44 struct macstat {
45  DWORD non_ip_recv; /* # of non-IP packets received */
46  DWORD non_ip_sent; /* sent */
47  DWORD num_tx_err; /* # of transmission errors */
48  DWORD num_tx_retry; /* # of transmission retries */
49  DWORD num_tx_timeout; /* # of async transmission timeouts */
50  DWORD num_unk_type; /* # of unhandled types */
51  DWORD num_llc_frames; /* # of LLC frames received */
52  DWORD num_wrong_handle; /* # upcalls with wrong handle */
53  DWORD num_bad_sync; /* # upcalls with different lengths */
54  DWORD num_too_large; /* # upcalls with > ETH_MAX pkts */
55  DWORD num_too_small; /* # upcalls with < ETH_MIN pkts */
56  DWORD num_mac_loop; /* # of pkts looped by NDIS */
57  DWORD num_ip_recurse; /* # of IP-pkts blocked due to recursion */
58 
60  struct {
61  DWORD request_recv; /* # of ARP requests received */
62  DWORD request_sent; /* sent */
63  DWORD reply_recv; /* # of ARP replies received */
64  DWORD reply_sent; /* sent */
65  } arp;
66 
68  struct {
69  DWORD request_recv; /* # of RARP requests received */
70  DWORD request_sent; /* sent */
71  DWORD reply_recv; /* # of RARP replies received */
72  DWORD reply_sent; /* sent */
73  } rarp;
74  };
75 
80 struct pppoestat {
81  DWORD num_disc_sent;
82  DWORD num_disc_recv;
83  DWORD num_sess_sent;
84  DWORD num_sess_recv;
85  };
86 
91 struct cache_stat {
92  DWORD num_arp_search;
93  DWORD num_arp_hits;
94  DWORD num_arp_misses;
95  DWORD num_arp_overflow;
96  DWORD num_route_hits;
97  DWORD num_route_misses;
98  };
99 
100 /*
101  * IP statistics for all in/out messages, <netinet/ip_var.h>
102  *
103  * ips_total; - total packets received
104  * ips_badsum; - checksum bad
105  * ips_tooshort; - packet too short
106  * ips_toosmall; - not enough data
107  * ips_badhlen; - ip header length < data size
108  * ips_badlen; - ip length < ip header length
109  * ips_fragments; - fragments received
110  * ips_fragdropped; - frags dropped (dups, out of space)
111  * ips_fragtimeout; - fragments timed out
112  * ips_forward; - packets forwarded
113  * ips_cantforward; - packets rcvd for unreachable dest
114  * ips_redirectsent; - packets forwarded on same net
115  * ips_noproto; - unknown or unsupported protocol
116  * ips_delivered; - datagrams delivered to upper level
117  * ips_localout; - total ip packets generated here
118  * ips_odropped; - lost out packets due to nobufs, etc.
119  * ips_idropped; - lost in packets due to nobufs, etc. !! added
120  * ips_reassembled; - total packets reassembled ok
121  * ips_fragmented; - datagrams successfully fragmented
122  * ips_ofragments; - output fragments created
123  * ips_cantfrag; - don't fragment flag was set, etc.
124  * ips_badoptions; - error in option processing
125  * ips_noroute; - packets discarded due to no route
126  * ips_badvers; - ip version != 4
127  * ips_rawout; - total raw ip packets generated
128  * ips_toolong; - ip length > max ip packet size
129  *
130  *
131  * UDP statistics, <netinet/udp_var.h>
132  *
133  * udps_ipackets - total input packets
134  * udps_hdrops - packet shorter than header
135  * udps_badsum - checksum error
136  * udps_badlen - data length larger than packet
137  * udps_noport - no socket on port
138  * udps_noportbcast - as above, arrived as broadcast
139  * udps_fullsock - not delivered, input socket full
140  * udpps_pcbcachemiss - input packets missing pcb cache
141  * udpps_pcbhashmiss - input packets not for hashed pcb
142  * udps_opackets - total output packets
143  *
144  *
145  * TCP statistics for all connections, <netinet/tcp_var.h>
146  *
147  * tcps_connattempt - connections initiated (output)
148  * tcps_accepts - connections accepted (input)
149  * tcps_connects - connections established (input)
150  * tcps_drops - connections dropped (output)
151  * tcps_conndrops - embryonic connections dropped (output)
152  * tcps_closed - conn. closed (includes drops)
153  * tcps_segstimed - segs where we tried to get rtt
154  * tcps_rttupdated - times we succeeded
155  * tcps_delack - delayed acks sent
156  * tcps_timeoutdrop - conn. dropped in rxmt timeout
157  * tcps_rexmttimeo - retransmit timeouts
158  * tcps_persisttimeo - persist timeouts
159  * tcps_keeptimeo - keepalive timeouts
160  * tcps_keepprobe - keepalive probes sent
161  * tcps_keepdrops - connections dropped in keepalive
162  *
163  * tcps_sndtotal - total packets sent
164  * tcps_sndpack - data packets sent
165  * tcps_sndbyte - data bytes sent
166  * tcps_sndrexmitpack - data packets retransmitted
167  * tcps_sndrexmitbyte - data bytes retransmitted
168  * tcps_sndacks - ack-only packets sent
169  * tcps_sndprobe - window probes sent
170  * tcps_sndurg - packets sent with URG only
171  * tcps_sndwinup - window update -only packets sent
172  * tcps_sndctrl - control (SYN|FIN|RST) packets sent
173  *
174  * tcps_rcvtotal - total packets received
175  * tcps_rcvpack - packets received in sequence
176  * tcps_rcvbyte - bytes received in sequence
177  * tcps_rcvbadsum - packets received with ccksum errs
178  * tcps_rcvbadoff - packets received with bad offset
179  * tcps_rcvshort - packets received too short
180  * tcps_rcvduppack - duplicate-only packets received
181  * tcps_rcvdupbyte - duplicate-only bytes received
182  * tcps_rcvpartduppack - packets with some duplicate data
183  * tcps_rcvpartdupbyte - dup. bytes in part-dup. packets
184  * tcps_rcvoopack - out-of-order packets received
185  * tcps_rcvoobyte - out-of-order bytes received
186  * tcps_rcvpackafterwin - packets with data after window
187  * tcps_rcvbyteafterwin - bytes rcvd after window
188  * tcps_rcvafterclose - packets rcvd after "close"
189  * tcps_rcvwinprobe - rcvd window probe packets
190  * tcps_rcvdupack - rcvd duplicate acks
191  * tcps_rcvacktoomuch - rcvd acks for unsent data
192  * tcps_rcvackpack - rcvd ack packets
193  * tcps_rcvackbyte - bytes acked by rcvd acks
194  * tcps_rcvwinupd - rcvd window update packets
195  * tcps_pawsdrop - segments dropped due to PAWS (protected against wrapped segments)
196  * tcps_predack - times hdr predict ok for acks
197  * tcps_preddat - times hdr predict ok for data pkts
198  * tcps_pcbcachemiss - times missed cache for input segment
199  * tcps_cachedrtt - times cached RTT in route updated
200  * tcps_cachedrttvar - times cached rttvar updated
201  * tcps_cachedssthresh - times cached ssthresh updated
202  * tcps_usedrtt - times RTT initialized from route
203  * tcps_usedrttvar - times RTTVAR initialized from rt
204  * tcps_usedssthresh - times ssthresh initialized from rt
205  * tcps_persistdrop - timeout in persist state
206  * tcps_badsyn - bogus SYN, e.g. premature ACK
207  * tcps_mturesent - resends due to MTU discovery
208  * tcps_listendrop - listen queue overflows
209  * #ifdef TCP_FACK
210  * tcps_fack_recovery; - recovery episodes
211  * tcps_fack_sndpack; - data packets sent
212  * tcps_fack_sndbyte; - data bytes sent
213  * tcps_fack_sndrexmitpack - data packets retransmitted
214  * tcps_fack_sndrexmitbyte - data bytes retransmitted
215  * #endif
216  *
217  *
218  * ICMP statistics, in <netinet/icmp_var.h>
219  *
220  * icps_error - # of calls to icmp_error
221  * icps_oldshort - no error 'cuz old ip too short
222  * icps_oldicmp - no error 'cuz old was icmp
223  * icps_outhist[18+1] - output counters for ICMP_xx
224  * icps_badcode - icmp_code out of range
225  * icps_tooshort - packet < ICMP_MINLEN
226  * icps_checksum - bad checksum
227  * icps_badlen - calculated bound mismatch
228  * icps_reflect - number of responses
229  * icps_inhist[18+1] - input counters for ICMP_xx
230  *
231  *
232  * IGMP statistics, <netinet/igmp_var.h>
233  *
234  * igps_rcv_total - total IGMP messages received
235  * igps_rcv_tooshort - received with too few bytes
236  * igps_rcv_badsum - received with bad checksum
237  * igps_rcv_queries - received membership queries
238  * igps_rcv_badqueries - received invalid queries
239  * igps_rcv_reports - received membership reports
240  * igps_rcv_badreports - received invalid reports
241  * igps_rcv_ourreports - received reports for our groups
242  * igps_snd_reports - sent membership reports
243  */
244 
245 #if defined(USE_STATISTICS)
246  #define macstats W32_NAMESPACE (macstats)
247  #define ip4stats W32_NAMESPACE (ip4stats)
248  #define ip6stats W32_NAMESPACE (ip6stats)
249  #define udpstats W32_NAMESPACE (udpstats)
250  #define tcpstats W32_NAMESPACE (tcpstats)
251  #define icmpstats W32_NAMESPACE (icmpstats)
252  #define icmp6stats W32_NAMESPACE (icmp6stats)
253  #define igmpstats W32_NAMESPACE (igmpstats)
254  #define pppoestats W32_NAMESPACE (pppoestats)
255  #define cache_stats W32_NAMESPACE (cache_stats)
256 
257  extern struct macstat macstats;
258  extern struct ipstat ip4stats;
259  extern struct ip6stat ip6stats;
260  extern struct udpstat udpstats;
261  extern struct tcpstat tcpstats;
262  extern struct icmpstat icmpstats;
263  extern struct icmp6stat icmp6stats;
264  extern struct igmpstat igmpstats;
265  extern struct pppoestat pppoestats;
266  extern struct cache_stat cache_stats;
267 
268  extern void update_in_stat (void);
269  extern void update_out_stat (void);
270 
271  #define STAT(x) x
272 
273 #else
274  #define STAT(x) ((void)0)
275 #endif
276 
277 #endif /* !_w32_PCSTAT_H */
278 
Definition: ip_var.h:131
Definition: pcstat.h:44
void update_out_stat(void)
Definition: pcstat.c:724
void update_in_stat(void)
Definition: pcstat.c:583