iPXE
ipstat.h
Go to the documentation of this file.
00001 #ifndef _IPXE_IPSTATS_H
00002 #define _IPXE_IPSTATS_H
00003 
00004 /** @file
00005  *
00006  * IP statistics
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 #include <ipxe/tables.h>
00013 
00014 struct io_buffer;
00015 
00016 /** IP system statistics
00017  *
00018  * Definitions are taken from the RFC4293 section 5
00019  * "ipSystemStatsEntry" table.
00020  *
00021  * To minimise code size, we use "unsigned long" as the counter
00022  * variable type regardless of whether this type is 32-bit or 64-bit.
00023  * On a 32-bit build (e.g. the standard BIOS build), this means that
00024  * we omit the "high capacity" 64-bit counters (prefixed with "HC").
00025  * This reduces the code size required to maintain the counter values,
00026  * and avoids the need to support the "%lld" format in vsprintf.c
00027  * (which would require dragging in the 64-bit division library on a
00028  * standard 32-bit build).  Since total available memory in a 32-bit
00029  * environment is limited to 4GB, it is unlikely that we will overflow
00030  * even the 32-bit octet counters under normal operation.
00031  *
00032  * Counters relating to packet forwarding are omitted, since iPXE
00033  * includes no functionality for acting as a router.
00034  *
00035  * Counters related to output fragmentation are omitted, since iPXE
00036  * has no support for fragmenting transmitted packets.
00037  *
00038  * The ipSystemStatsInDiscards and ipSystemStatsOutDiscards counters
00039  * are omitted, since they will always be zero.
00040  *
00041  * Separate octet counters for multicast packets are omitted to save
00042  * code size.
00043  */
00044 struct ip_statistics {
00045         /** ipSystemStatsInReceives
00046          *
00047          * The total number of input IP datagrams received, including
00048          * those received in error.
00049          */
00050         unsigned long in_receives;
00051         /** ipSystemStatsInOctets
00052          *
00053          * The total number of octets received in input IP datagrams,
00054          * including those received in error.  Octets from datagrams
00055          * counted in ipSystemStatsInReceives MUST be counted here.
00056          */
00057         unsigned long in_octets;
00058         /** ipSystemStatsInHdrErrors
00059          *
00060          * The number of input IP datagrams discarded due to errors in
00061          * their IP headers, including version number mismatch, other
00062          * format errors, hop count exceeded, errors discovered in
00063          * processing their IP options, etc.
00064          */
00065         unsigned long in_hdr_errors;
00066         /** ipSystemStatsInAddrErrors
00067          *
00068          * The number of input IP datagrams discarded because the IP
00069          * address in their IP header's destination field was not a
00070          * valid address to be received at this entity.  This count
00071          * includes invalid addresses (e.g., ::0).  For entities that
00072          * are not IP routers and therefore do not forward datagrams,
00073          * this counter includes datagrams discarded because the
00074          * destination address was not a local address.
00075          */
00076         unsigned long in_addr_errors;
00077         /** ipSystemStatsInUnknownProtos
00078          *
00079          * The number of locally-addressed IP datagrams received
00080          * successfully but discarded because of an unknown or
00081          * unsupported protocol.
00082          */
00083         unsigned long in_unknown_protos;
00084         /** ipSystemStatsInTruncatedPkts
00085          *
00086          * The number of input IP datagrams discarded because the
00087          * datagram frame didn't carry enough data.
00088          */
00089         unsigned long in_truncated_pkts;
00090         /** ipSystemStatsReasmReqds
00091          *
00092          * The number of IP fragments received that needed to be
00093          * reassembled at this interface.
00094          */
00095         unsigned long reasm_reqds;
00096         /** ipSystemStatsReasmOks
00097          *
00098          * The number of IP datagrams successfully reassembled.
00099          */
00100         unsigned long reasm_oks;
00101         /** ipSystemStatsReasmFails
00102          *
00103          * The number of failures detected by the IP re-assembly
00104          * algorithm (for whatever reason: timed out, errors, etc.).
00105          * Note that this is not necessarily a count of discarded IP
00106          * fragments since some algorithms (notably the algorithm in
00107          * RFC 815) can lose track of the number of fragments by
00108          * combining them as they are received.
00109          */
00110         unsigned long reasm_fails;
00111         /** ipSystemStatsInDelivers
00112          *
00113          * The total number of datagrams successfully delivered to IP
00114          * user-protocols (including ICMP).
00115          */
00116         unsigned long in_delivers;
00117         /** ipSystemStatsOutRequests
00118          *
00119          * The total number of IP datagrams that local IP user-
00120          * protocols (including ICMP) supplied to IP in requests for
00121          * transmission.
00122          */
00123         unsigned long out_requests;
00124         /** ipSystemStatsOutNoRoutes
00125          *
00126          * The number of locally generated IP datagrams discarded
00127          * because no route could be found to transmit them to their
00128          * destination.
00129          */
00130         unsigned long out_no_routes;
00131         /** ipSystemStatsOutTransmits
00132          *
00133          * The total number of IP datagrams that this entity supplied
00134          * to the lower layers for transmission.  This includes
00135          * datagrams generated locally and those forwarded by this
00136          * entity.
00137          */
00138         unsigned long out_transmits;
00139         /** ipSystemStatsOutOctets
00140          *
00141          * The total number of octets in IP datagrams delivered to the
00142          * lower layers for transmission.  Octets from datagrams
00143          * counted in ipSystemStatsOutTransmits MUST be counted here.
00144          */
00145         unsigned long out_octets;
00146         /** ipSystemStatsInMcastPkts
00147          *
00148          * The number of IP multicast datagrams received.
00149          */
00150         unsigned long in_mcast_pkts;
00151         /** ipSystemStatsOutMcastPkts
00152          *
00153          * The number of IP multicast datagrams transmitted.
00154          */
00155         unsigned long out_mcast_pkts;
00156         /** ipSystemStatsInBcastPkts
00157          *
00158          * The number of IP broadcast datagrams received.
00159          */
00160         unsigned long in_bcast_pkts;
00161         /** ipSystemStatsOutBcastPkts
00162          *
00163          * The number of IP broadcast datagrams transmitted.
00164          */
00165         unsigned long out_bcast_pkts;
00166 };
00167 
00168 /** An IP system statistics family */
00169 struct ip_statistics_family {
00170         /** IP version */
00171         unsigned int version;
00172         /** Statistics */
00173         struct ip_statistics *stats;
00174 };
00175 
00176 /** IP system statistics family table */
00177 #define IP_STATISTICS_FAMILIES \
00178         __table ( struct ip_statistics_family, "ip_statistics_families" )
00179 
00180 /** Declare an IP system statistics family */
00181 #define __ip_statistics_family( order ) \
00182         __table_entry ( IP_STATISTICS_FAMILIES, order )
00183 
00184 #define IP_STATISTICS_IPV4 01
00185 #define IP_STATISTICS_IPV6 02
00186 
00187 #endif /* _IPXE_IPSTATS_H */