You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ipstat.h 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. #ifndef _IPXE_IPSTATS_H
  2. #define _IPXE_IPSTATS_H
  3. /** @file
  4. *
  5. * IP statistics
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <ipxe/tables.h>
  10. struct io_buffer;
  11. /** IP system statistics
  12. *
  13. * Definitions are taken from the RFC4293 section 5
  14. * "ipSystemStatsEntry" table.
  15. *
  16. * To minimise code size, we use "unsigned long" as the counter
  17. * variable type regardless of whether this type is 32-bit or 64-bit.
  18. * On a 32-bit build (e.g. the standard BIOS build), this means that
  19. * we omit the "high capacity" 64-bit counters (prefixed with "HC").
  20. * This reduces the code size required to maintain the counter values,
  21. * and avoids the need to support the "%lld" format in vsprintf.c
  22. * (which would require dragging in the 64-bit division library on a
  23. * standard 32-bit build). Since total available memory in a 32-bit
  24. * environment is limited to 4GB, it is unlikely that we will overflow
  25. * even the 32-bit octet counters under normal operation.
  26. *
  27. * Counters relating to packet forwarding are omitted, since iPXE
  28. * includes no functionality for acting as a router.
  29. *
  30. * Counters related to output fragmentation are omitted, since iPXE
  31. * has no support for fragmenting transmitted packets.
  32. *
  33. * The ipSystemStatsInDiscards and ipSystemStatsOutDiscards counters
  34. * are omitted, since they will always be zero.
  35. *
  36. * Separate octet counters for multicast packets are omitted to save
  37. * code size.
  38. */
  39. struct ip_statistics {
  40. /** ipSystemStatsInReceives
  41. *
  42. * The total number of input IP datagrams received, including
  43. * those received in error.
  44. */
  45. unsigned long in_receives;
  46. /** ipSystemStatsInOctets
  47. *
  48. * The total number of octets received in input IP datagrams,
  49. * including those received in error. Octets from datagrams
  50. * counted in ipSystemStatsInReceives MUST be counted here.
  51. */
  52. unsigned long in_octets;
  53. /** ipSystemStatsInHdrErrors
  54. *
  55. * The number of input IP datagrams discarded due to errors in
  56. * their IP headers, including version number mismatch, other
  57. * format errors, hop count exceeded, errors discovered in
  58. * processing their IP options, etc.
  59. */
  60. unsigned long in_hdr_errors;
  61. /** ipSystemStatsInAddrErrors
  62. *
  63. * The number of input IP datagrams discarded because the IP
  64. * address in their IP header's destination field was not a
  65. * valid address to be received at this entity. This count
  66. * includes invalid addresses (e.g., ::0). For entities that
  67. * are not IP routers and therefore do not forward datagrams,
  68. * this counter includes datagrams discarded because the
  69. * destination address was not a local address.
  70. */
  71. unsigned long in_addr_errors;
  72. /** ipSystemStatsInUnknownProtos
  73. *
  74. * The number of locally-addressed IP datagrams received
  75. * successfully but discarded because of an unknown or
  76. * unsupported protocol.
  77. */
  78. unsigned long in_unknown_protos;
  79. /** ipSystemStatsInTruncatedPkts
  80. *
  81. * The number of input IP datagrams discarded because the
  82. * datagram frame didn't carry enough data.
  83. */
  84. unsigned long in_truncated_pkts;
  85. /** ipSystemStatsReasmReqds
  86. *
  87. * The number of IP fragments received that needed to be
  88. * reassembled at this interface.
  89. */
  90. unsigned long reasm_reqds;
  91. /** ipSystemStatsReasmOks
  92. *
  93. * The number of IP datagrams successfully reassembled.
  94. */
  95. unsigned long reasm_oks;
  96. /** ipSystemStatsReasmFails
  97. *
  98. * The number of failures detected by the IP re-assembly
  99. * algorithm (for whatever reason: timed out, errors, etc.).
  100. * Note that this is not necessarily a count of discarded IP
  101. * fragments since some algorithms (notably the algorithm in
  102. * RFC 815) can lose track of the number of fragments by
  103. * combining them as they are received.
  104. */
  105. unsigned long reasm_fails;
  106. /** ipSystemStatsInDelivers
  107. *
  108. * The total number of datagrams successfully delivered to IP
  109. * user-protocols (including ICMP).
  110. */
  111. unsigned long in_delivers;
  112. /** ipSystemStatsOutRequests
  113. *
  114. * The total number of IP datagrams that local IP user-
  115. * protocols (including ICMP) supplied to IP in requests for
  116. * transmission.
  117. */
  118. unsigned long out_requests;
  119. /** ipSystemStatsOutNoRoutes
  120. *
  121. * The number of locally generated IP datagrams discarded
  122. * because no route could be found to transmit them to their
  123. * destination.
  124. */
  125. unsigned long out_no_routes;
  126. /** ipSystemStatsOutTransmits
  127. *
  128. * The total number of IP datagrams that this entity supplied
  129. * to the lower layers for transmission. This includes
  130. * datagrams generated locally and those forwarded by this
  131. * entity.
  132. */
  133. unsigned long out_transmits;
  134. /** ipSystemStatsOutOctets
  135. *
  136. * The total number of octets in IP datagrams delivered to the
  137. * lower layers for transmission. Octets from datagrams
  138. * counted in ipSystemStatsOutTransmits MUST be counted here.
  139. */
  140. unsigned long out_octets;
  141. /** ipSystemStatsInMcastPkts
  142. *
  143. * The number of IP multicast datagrams received.
  144. */
  145. unsigned long in_mcast_pkts;
  146. /** ipSystemStatsOutMcastPkts
  147. *
  148. * The number of IP multicast datagrams transmitted.
  149. */
  150. unsigned long out_mcast_pkts;
  151. /** ipSystemStatsInBcastPkts
  152. *
  153. * The number of IP broadcast datagrams received.
  154. */
  155. unsigned long in_bcast_pkts;
  156. /** ipSystemStatsOutBcastPkts
  157. *
  158. * The number of IP broadcast datagrams transmitted.
  159. */
  160. unsigned long out_bcast_pkts;
  161. };
  162. /** An IP system statistics family */
  163. struct ip_statistics_family {
  164. /** IP version */
  165. unsigned int version;
  166. /** Statistics */
  167. struct ip_statistics *stats;
  168. };
  169. /** IP system statistics family table */
  170. #define IP_STATISTICS_FAMILIES \
  171. __table ( struct ip_statistics_family, "ip_statistics_families" )
  172. /** Declare an IP system statistics family */
  173. #define __ip_statistics_family( order ) \
  174. __table_entry ( IP_STATISTICS_FAMILIES, order )
  175. #define IP_STATISTICS_IPV4 01
  176. #define IP_STATISTICS_IPV6 02
  177. #endif /* _IPXE_IPSTATS_H */