sflow_parser/models/
record_counters.rs

1//! Counter record data structures
2//!
3//! These represent interface and system statistics collected periodically.
4//! Enterprise = 0 (sFlow.org standard formats)
5
6/// Generic Interface Counters - Format (0,1)
7///
8/// Standard interface statistics (RFC 2233)
9///
10/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
11///
12/// ```text
13/// /* Generic Interface Counters - see RFC 2233 */
14/// /* opaque = counter_data; enterprise = 0; format = 1 */
15///
16/// struct if_counters {
17///     unsigned int ifIndex;
18///     unsigned int ifType;
19///     unsigned hyper ifSpeed;
20///     unsigned int ifDirection;
21///     unsigned int ifStatus;
22///     unsigned hyper ifInOctets;
23///     unsigned int ifInUcastPkts;
24///     unsigned int ifInMulticastPkts;
25///     unsigned int ifInBroadcastPkts;
26///     unsigned int ifInDiscards;
27///     unsigned int ifInErrors;
28///     unsigned int ifInUnknownProtos;
29///     unsigned hyper ifOutOctets;
30///     unsigned int ifOutUcastPkts;
31///     unsigned int ifOutMulticastPkts;
32///     unsigned int ifOutBroadcastPkts;
33///     unsigned int ifOutDiscards;
34///     unsigned int ifOutErrors;
35///     unsigned int ifPromiscuousMode;
36/// }
37/// ```
38#[derive(Debug, Clone, PartialEq, Eq)]
39#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
40pub struct GenericInterfaceCounters {
41    /// Interface index
42    pub if_index: u32,
43
44    /// Interface type (from IANAifType)
45    pub if_type: u32,
46
47    /// Interface speed in bits per second
48    pub if_speed: u64,
49
50    /// Interface direction (1=full-duplex, 2=half-duplex, 3=in, 4=out)
51    pub if_direction: u32,
52
53    /// Interface status (bit 0=admin, bit 1=oper)
54    pub if_status: u32,
55
56    /// Total octets received
57    pub if_in_octets: u64,
58
59    /// Total unicast packets received
60    pub if_in_ucast_pkts: u32,
61
62    /// Total multicast packets received
63    pub if_in_multicast_pkts: u32,
64
65    /// Total broadcast packets received
66    pub if_in_broadcast_pkts: u32,
67
68    /// Total discarded inbound packets
69    pub if_in_discards: u32,
70
71    /// Total inbound errors
72    pub if_in_errors: u32,
73
74    /// Total inbound packets with unknown protocol
75    pub if_in_unknown_protos: u32,
76
77    /// Total octets transmitted
78    pub if_out_octets: u64,
79
80    /// Total unicast packets transmitted
81    pub if_out_ucast_pkts: u32,
82
83    /// Total multicast packets transmitted
84    pub if_out_multicast_pkts: u32,
85
86    /// Total broadcast packets transmitted
87    pub if_out_broadcast_pkts: u32,
88
89    /// Total discarded outbound packets
90    pub if_out_discards: u32,
91
92    /// Total outbound errors
93    pub if_out_errors: u32,
94
95    /// Promiscuous mode (1=true, 2=false)
96    pub if_promiscuous_mode: u32,
97}
98
99/// Ethernet Interface Counters - Format (0,2)
100///
101/// Ethernet-specific statistics (RFC 2358)
102///
103/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
104///
105/// ```text
106/// /* Ethernet Interface Counters - see RFC 2358 */
107/// /* opaque = counter_data; enterprise = 0; format = 2 */
108///
109/// struct ethernet_counters {
110///     unsigned int dot3StatsAlignmentErrors;
111///     unsigned int dot3StatsFCSErrors;
112///     unsigned int dot3StatsSingleCollisionFrames;
113///     unsigned int dot3StatsMultipleCollisionFrames;
114///     unsigned int dot3StatsSQETestErrors;
115///     unsigned int dot3StatsDeferredTransmissions;
116///     unsigned int dot3StatsLateCollisions;
117///     unsigned int dot3StatsExcessiveCollisions;
118///     unsigned int dot3StatsInternalMacTransmitErrors;
119///     unsigned int dot3StatsCarrierSenseErrors;
120///     unsigned int dot3StatsFrameTooLongs;
121///     unsigned int dot3StatsInternalMacReceiveErrors;
122///     unsigned int dot3StatsSymbolErrors;
123/// }
124/// ```
125#[derive(Debug, Clone, PartialEq, Eq)]
126#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
127pub struct EthernetInterfaceCounters {
128    /// Alignment errors
129    pub dot3_stats_alignment_errors: u32,
130
131    /// FCS errors
132    pub dot3_stats_fcs_errors: u32,
133
134    /// Single collision frames
135    pub dot3_stats_single_collision_frames: u32,
136
137    /// Multiple collision frames
138    pub dot3_stats_multiple_collision_frames: u32,
139
140    /// SQE test errors
141    pub dot3_stats_sqe_test_errors: u32,
142
143    /// Deferred transmissions
144    pub dot3_stats_deferred_transmissions: u32,
145
146    /// Late collisions
147    pub dot3_stats_late_collisions: u32,
148
149    /// Excessive collisions
150    pub dot3_stats_excessive_collisions: u32,
151
152    /// Internal MAC transmit errors
153    pub dot3_stats_internal_mac_transmit_errors: u32,
154
155    /// Carrier sense errors
156    pub dot3_stats_carrier_sense_errors: u32,
157
158    /// Frame too long errors
159    pub dot3_stats_frame_too_longs: u32,
160
161    /// Internal MAC receive errors
162    pub dot3_stats_internal_mac_receive_errors: u32,
163
164    /// Symbol errors
165    pub dot3_stats_symbol_errors: u32,
166}
167
168/// Token Ring Counters - Format (0,3)
169///
170/// Token Ring statistics (RFC 1748)
171///
172/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
173///
174/// ```text
175/// /* Token Ring Counters - see RFC 1748 */
176/// /* opaque = counter_data; enterprise = 0; format = 3 */
177///
178/// struct tokenring_counters {
179///     unsigned int dot5StatsLineErrors;
180///     unsigned int dot5StatsBurstErrors;
181///     unsigned int dot5StatsACErrors;
182///     unsigned int dot5StatsAbortTransErrors;
183///     unsigned int dot5StatsInternalErrors;
184///     unsigned int dot5StatsLostFrameErrors;
185///     unsigned int dot5StatsReceiveCongestions;
186///     unsigned int dot5StatsFrameCopiedErrors;
187///     unsigned int dot5StatsTokenErrors;
188///     unsigned int dot5StatsSoftErrors;
189///     unsigned int dot5StatsHardErrors;
190///     unsigned int dot5StatsSignalLoss;
191///     unsigned int dot5StatsTransmitBeacons;
192///     unsigned int dot5StatsRecoverys;
193///     unsigned int dot5StatsLobeWires;
194///     unsigned int dot5StatsRemoves;
195///     unsigned int dot5StatsSingles;
196///     unsigned int dot5StatsFreqErrors;
197/// }
198/// ```
199#[derive(Debug, Clone, PartialEq, Eq)]
200#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
201pub struct TokenRingCounters {
202    pub dot5_stats_line_errors: u32,
203    pub dot5_stats_burst_errors: u32,
204    pub dot5_stats_ac_errors: u32,
205    pub dot5_stats_abort_trans_errors: u32,
206    pub dot5_stats_internal_errors: u32,
207    pub dot5_stats_lost_frame_errors: u32,
208    pub dot5_stats_receive_congestions: u32,
209    pub dot5_stats_frame_copied_errors: u32,
210    pub dot5_stats_token_errors: u32,
211    pub dot5_stats_soft_errors: u32,
212    pub dot5_stats_hard_errors: u32,
213    pub dot5_stats_signal_loss: u32,
214    pub dot5_stats_transmit_beacons: u32,
215    pub dot5_stats_recoverys: u32,
216    pub dot5_stats_lobe_wires: u32,
217    pub dot5_stats_removes: u32,
218    pub dot5_stats_singles: u32,
219    pub dot5_stats_freq_errors: u32,
220}
221
222/// 100BaseVG Interface Counters - Format (0,4)
223///
224/// 100BaseVG statistics (RFC 2020)
225///
226/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
227///
228/// ```text
229/// /* 100 BaseVG interface counters - see RFC 2020 */
230/// /* opaque = counter_data; enterprise = 0; format = 4 */
231///
232/// struct vg_counters {
233///     unsigned int dot12InHighPriorityFrames;
234///     unsigned hyper dot12InHighPriorityOctets;
235///     unsigned int dot12InNormPriorityFrames;
236///     unsigned hyper dot12InNormPriorityOctets;
237///     unsigned int dot12InIPMErrors;
238///     unsigned int dot12InOversizeFrameErrors;
239///     unsigned int dot12InDataErrors;
240///     unsigned int dot12InNullAddressedFrames;
241///     unsigned int dot12OutHighPriorityFrames;
242///     unsigned hyper dot12OutHighPriorityOctets;
243///     unsigned int dot12TransitionIntoTrainings;
244///     unsigned hyper dot12HCInHighPriorityOctets;
245///     unsigned hyper dot12HCInNormPriorityOctets;
246///     unsigned hyper dot12HCOutHighPriorityOctets;
247/// }
248/// ```
249#[derive(Debug, Clone, PartialEq, Eq)]
250#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
251pub struct Vg100InterfaceCounters {
252    pub dot12_in_high_priority_frames: u32,
253    pub dot12_in_high_priority_octets: u64,
254    pub dot12_in_norm_priority_frames: u32,
255    pub dot12_in_norm_priority_octets: u64,
256    pub dot12_in_ipm_errors: u32,
257    pub dot12_in_oversize_frame_errors: u32,
258    pub dot12_in_data_errors: u32,
259    pub dot12_in_null_addressed_frames: u32,
260    pub dot12_out_high_priority_frames: u32,
261    pub dot12_out_high_priority_octets: u64,
262    pub dot12_transition_into_trainings: u32,
263    pub dot12_hc_in_high_priority_octets: u64,
264    pub dot12_hc_in_norm_priority_octets: u64,
265    pub dot12_hc_out_high_priority_octets: u64,
266}
267
268/// VLAN Counters - Format (0,5)
269///
270/// VLAN statistics
271///
272/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
273///
274/// ```text
275/// /* VLAN Counters */
276/// /* opaque = counter_data; enterprise = 0; format = 5 */
277///
278/// struct vlan_counters {
279///     unsigned int vlan_id;
280///     unsigned hyper octets;
281///     unsigned int ucastPkts;
282///     unsigned int multicastPkts;
283///     unsigned int broadcastPkts;
284///     unsigned int discards;
285/// }
286/// ```
287#[derive(Debug, Clone, PartialEq, Eq)]
288#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
289pub struct VlanCounters {
290    /// VLAN ID
291    pub vlan_id: u32,
292
293    /// Total octets
294    pub octets: u64,
295
296    /// Unicast packets
297    pub ucast_pkts: u32,
298
299    /// Multicast packets
300    pub multicast_pkts: u32,
301
302    /// Broadcast packets
303    pub broadcast_pkts: u32,
304
305    /// Discarded packets
306    pub discards: u32,
307}
308
309/// IEEE 802.11 Counters - Format (0,6)
310///
311/// Wireless interface statistics
312///
313/// # XDR Definition ([sFlow 802.11](https://sflow.org/sflow_80211.txt))
314///
315/// ```text
316/// /* IEEE802.11 interface counters - see IEEE802dot11-MIB */
317/// /* opaque = counter_data; enterprise = 0; format = 6 */
318///
319/// struct ieee80211_counters {
320///     unsigned int dot11TransmittedFragmentCount;
321///     unsigned int dot11MulticastTransmittedFrameCount;
322///     unsigned int dot11FailedCount;
323///     unsigned int dot11RetryCount;
324///     unsigned int dot11MultipleRetryCount;
325///     unsigned int dot11FrameDuplicateCount;
326///     unsigned int dot11RTSSuccessCount;
327///     unsigned int dot11RTSFailureCount;
328///     unsigned int dot11ACKFailureCount;
329///     unsigned int dot11ReceivedFragmentCount;
330///     unsigned int dot11MulticastReceivedFrameCount;
331///     unsigned int dot11FCSErrorCount;
332///     unsigned int dot11TransmittedFrameCount;
333///     unsigned int dot11WEPUndecryptableCount;
334///     unsigned int dot11QoSDiscardedFragmentCount;
335///     unsigned int dot11AssociatedStationCount;
336///     unsigned int dot11QoSCFPollsReceivedCount;
337///     unsigned int dot11QoSCFPollsUnusedCount;
338///     unsigned int dot11QoSCFPollsUnusableCount;
339///     unsigned int dot11QoSCFPollsLostCount;
340/// }
341/// ```
342#[derive(Debug, Clone, PartialEq, Eq)]
343#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
344pub struct Ieee80211Counters {
345    pub dot11_transmitted_fragment_count: u32,
346    pub dot11_multicast_transmitted_frame_count: u32,
347    pub dot11_failed_count: u32,
348    pub dot11_retry_count: u32,
349    pub dot11_multiple_retry_count: u32,
350    pub dot11_frame_duplicate_count: u32,
351    pub dot11_rts_success_count: u32,
352    pub dot11_rts_failure_count: u32,
353    pub dot11_ack_failure_count: u32,
354    pub dot11_received_fragment_count: u32,
355    pub dot11_multicast_received_frame_count: u32,
356    pub dot11_fcs_error_count: u32,
357    pub dot11_transmitted_frame_count: u32,
358    pub dot11_wep_undecryptable_count: u32,
359    pub dot11_qos_discarded_fragment_count: u32,
360    pub dot11_associated_station_count: u32,
361    pub dot11_qos_cf_polls_received_count: u32,
362    pub dot11_qos_cf_polls_unused_count: u32,
363    pub dot11_qos_cf_polls_unusable_count: u32,
364    pub dot11_qos_cf_polls_lost_count: u32,
365}
366
367/// LAG Port Statistics - Format (0,7)
368///
369/// Link Aggregation (LAG) port statistics based on IEEE 802.1AX
370///
371/// # XDR Definition ([sFlow LAG](https://sflow.org/sflow_lag.txt))
372///
373/// ```text
374/// /* LAG Port Statistics - see IEEE8023-LAG-MIB */
375/// /* opaque = counter_data; enterprise = 0; format = 7 */
376///
377/// struct lag_port_stats {
378///   mac dot3adAggPortActorSystemID;
379///   mac dot3adAggPortPartnerOperSystemID;
380///   unsigned int dot3adAggPortAttachedAggID;
381///   opaque dot3adAggPortState[4]; /*
382///                              Bytes are assigned in following order:
383///                              byte 0, value dot3adAggPortActorAdminState
384///                              byte 1, value dot3adAggPortActorOperState
385///                              byte 2, value dot3adAggPortPartnerAdminState
386///                              byte 3, value dot3adAggPortPartnerOperState
387///                                  */
388///   unsigned int dot3adAggPortStatsLACPDUsRx;
389///   unsigned int dot3adAggPortStatsMarkerPDUsRx;
390///   unsigned int dot3adAggPortStatsMarkerResponsePDUsRx;
391///   unsigned int dot3adAggPortStatsUnknownRx;
392///   unsigned int dot3adAggPortStatsIllegalRx;
393///   unsigned int dot3adAggPortStatsLACPDUsTx;
394///   unsigned int dot3adAggPortStatsMarkerPDUsTx;
395///   unsigned int dot3adAggPortStatsMarkerResponsePDUsTx;
396/// }
397/// ```
398#[derive(Debug, Clone, PartialEq, Eq)]
399#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
400pub struct LagPortStats {
401    /// Actor system ID (MAC address)
402    pub dot3ad_agg_port_actor_system_id: crate::models::MacAddress,
403
404    /// Partner operational system ID (MAC address)
405    pub dot3ad_agg_port_partner_oper_system_id: crate::models::MacAddress,
406
407    /// Attached aggregator ID
408    pub dot3ad_agg_port_attached_agg_id: u32,
409
410    /// Port state (4 bytes):
411    /// - byte 0: dot3adAggPortActorAdminState
412    /// - byte 1: dot3adAggPortActorOperState
413    /// - byte 2: dot3adAggPortPartnerAdminState
414    /// - byte 3: dot3adAggPortPartnerOperState
415    pub dot3ad_agg_port_state: [u8; 4],
416
417    /// LACP PDUs received
418    pub dot3ad_agg_port_stats_lacpd_us_rx: u32,
419
420    /// Marker PDUs received
421    pub dot3ad_agg_port_stats_marker_pdus_rx: u32,
422
423    /// Marker response PDUs received
424    pub dot3ad_agg_port_stats_marker_response_pdus_rx: u32,
425
426    /// Unknown PDUs received
427    pub dot3ad_agg_port_stats_unknown_rx: u32,
428
429    /// Illegal PDUs received
430    pub dot3ad_agg_port_stats_illegal_rx: u32,
431
432    /// LACP PDUs transmitted
433    pub dot3ad_agg_port_stats_lacpd_us_tx: u32,
434
435    /// Marker PDUs transmitted
436    pub dot3ad_agg_port_stats_marker_pdus_tx: u32,
437
438    /// Marker Response PDUs transmitted
439    pub dot3ad_agg_port_stats_marker_response_pdus_tx: u32,
440}
441
442/// Slow Path Counts - Format (0,8)
443///
444/// Counts of packets processed via slow path (software) rather than fast path (hardware)
445///
446/// # XDR Definition ([sFlow Discussion](https://groups.google.com/g/sflow/c/4JM1_Mmoz7w))
447///
448/// ```text
449/// /* opaque = counter_data; enterprise = 0; format = 8 */
450/// struct slow_path_counts {
451///     unsigned int unknown;
452///     unsigned int other;
453///     unsigned int cam_miss;
454///     unsigned int cam_full;
455///     unsigned int no_hw_support;
456///     unsigned int cntrl;
457/// }
458/// ```
459#[derive(Debug, Clone, PartialEq, Eq)]
460#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
461pub struct SlowPathCounts {
462    /// Unknown reason
463    pub unknown: u32,
464
465    /// Other reason
466    pub other: u32,
467
468    /// CAM (Content Addressable Memory) miss
469    pub cam_miss: u32,
470
471    /// CAM full
472    pub cam_full: u32,
473
474    /// No hardware support
475    pub no_hw_support: u32,
476
477    /// Control packets (spec: cntrl)
478    pub cntrl: u32,
479}
480
481/// InfiniBand Counters - Format (0,9)
482///
483/// InfiniBand port statistics
484///
485/// # XDR Definition ([sFlow InfiniBand](https://sflow.org/draft_sflow_infiniband_2.txt))
486///
487/// ```text
488/// /* IB Counters */
489/// /* opaque = counter_data; enterprise = 0; format = 9 */
490///
491/// struct ib_counters {
492///    unsigned hyper PortXmitPkts; /* Total packets transmitted on all VLs */
493///    unsigned hyper PortRcvPkts;  /* Total packets (may include packets containing errors */
494///    unsigned int SymbolErrorCounter;
495///    unsigned int LinkErrorRecoveryCounter;
496///    unsigned int LinkDownedCounter;
497///    unsigned int PortRcvErrors;
498///    unsigned int PortRcvRemotePhysicalErrors;
499///    unsigned int PortRcvSwitchRelayErrors;
500///    unsigned int PortXmitDiscards;
501///    unsigned int PortXmitConstraintErrors;
502///    unsigned int PortRcvConstraintErrors;
503///    unsigned int LocalLinkIntegrityErrors;
504///    unsigned int ExcessiveBufferOverrunErrors;
505///    unsigned int VL15Dropped;
506/// }
507/// ```
508#[derive(Debug, Clone, PartialEq, Eq)]
509#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
510pub struct InfiniBandCounters {
511    /// Total packets transmitted on all virtual lanes
512    pub port_xmit_pkts: u64,
513
514    /// Total packets received (may include packets containing errors)
515    pub port_rcv_pkts: u64,
516
517    /// Symbol error counter
518    pub symbol_error_counter: u32,
519
520    /// Link error recovery counter
521    pub link_error_recovery_counter: u32,
522
523    /// Link downed counter
524    pub link_downed_counter: u32,
525
526    /// Port receive errors
527    pub port_rcv_errors: u32,
528
529    /// Port receive remote physical errors
530    pub port_rcv_remote_physical_errors: u32,
531
532    /// Port receive switch relay errors
533    pub port_rcv_switch_relay_errors: u32,
534
535    /// Port transmit discards
536    pub port_xmit_discards: u32,
537
538    /// Port transmit constraint errors
539    pub port_xmit_constraint_errors: u32,
540
541    /// Port receive constraint errors
542    pub port_rcv_constraint_errors: u32,
543
544    /// Local link integrity errors
545    pub local_link_integrity_errors: u32,
546
547    /// Excessive buffer overrun errors
548    pub excessive_buffer_overrun_errors: u32,
549
550    /// VL15 dropped packets
551    pub vl15_dropped: u32,
552}
553
554/// Optical Lane
555///
556/// Optical lane statistics for a single lane within an optical module
557///
558/// # XDR Definition ([sFlow Optics](https://sflow.org/sflow_optics.txt))
559///
560/// ```text
561/// struct lane {
562///   unsigned int index; /* 1-based index of lane within module, 0=unknown */
563///   unsigned int tx_bias_current; /* microamps */
564///   unsigned int tx_power;        /* microwatts */
565///   unsigned int tx_power_min;    /* microwatts */
566///   unsigned int tx_power_max;    /* microwatts */
567///   unsigned int tx_wavelength;   /* nanometers */
568///   unsigned int rx_power;        /* microwatts */
569///   unsigned int rx_power_min;    /* microwatts */
570///   unsigned int rx_power_max;    /* microwatts */
571///   unsigned int rx_wavelength;   /* nanometers */
572/// }
573/// ```
574#[derive(Debug, Clone, PartialEq, Eq)]
575#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
576pub struct Lane {
577    /// 1-based index of lane within module, 0=unknown
578    pub index: u32,
579
580    /// Transmit bias current in microamps
581    pub tx_bias_current: u32,
582
583    /// Transmit power in microwatts
584    pub tx_power: u32,
585
586    /// Minimum transmit power in microwatts
587    pub tx_power_min: u32,
588
589    /// Maximum transmit power in microwatts
590    pub tx_power_max: u32,
591
592    /// Transmit wavelength in nanometers
593    pub tx_wavelength: u32,
594
595    /// Receive power in microwatts
596    pub rx_power: u32,
597
598    /// Minimum receive power in microwatts
599    pub rx_power_min: u32,
600
601    /// Maximum receive power in microwatts
602    pub rx_power_max: u32,
603
604    /// Receive wavelength in nanometers
605    pub rx_wavelength: u32,
606}
607
608/// Optical SFP/QSFP Counters - Format (0,10)
609///
610/// Optical interface module statistics for pluggable optical modules (SFP, QSFP, etc.)
611///
612/// # XDR Definition ([sFlow Optics](https://sflow.org/sflow_optics.txt))
613///
614/// ```text
615/// /* Optical SFP / QSFP metrics */
616/// /* opaque = counter_data; enterprise=0; format=10 */
617/// struct sfp {
618///   unsigned int module_id;
619///   unsigned int module_num_lanes;      /* total number of lanes in module */
620///   unsigned int module_supply_voltage; /* millivolts */
621///   int module_temperature;             /* thousandths of a degree Celsius */
622///   lane<> lanes;
623/// }
624/// ```
625#[derive(Debug, Clone, PartialEq, Eq)]
626#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
627pub struct OpticalSfpQsfp {
628    /// Module identifier (ifIndex of module or lowest ifIndex of ports sharing module)
629    pub module_id: u32,
630
631    /// Total number of lanes in module
632    pub module_num_lanes: u32,
633
634    /// Module supply voltage in millivolts
635    pub module_supply_voltage: u32,
636
637    /// Module temperature in thousandths of a degree Celsius
638    pub module_temperature: i32,
639
640    /// Array of optical lane statistics
641    pub lanes: Vec<Lane>,
642}
643
644/// Processor Counters - Format (0,1001)
645///
646/// CPU and memory utilization
647///
648/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
649///
650/// ```text
651/// /* Processor Information */
652/// /* opaque = counter_data; enterprise = 0; format = 1001 */
653///
654/// struct processor {
655///     percentage 5s_cpu;          /* 5 second average CPU utilization */
656///     percentage 1m_cpu;          /* 1 minute average CPU utilization */
657///     percentage 5m_cpu;          /* 5 minute average CPU utilization */
658///     unsigned hyper total_memory; /* total memory (in bytes) */
659///     unsigned hyper free_memory;  /* free memory (in bytes) */
660/// }
661/// ```
662///
663/// **ERRATUM:** The specification is missing semicolons after `total_memory` and `free_memory`,
664/// violating RFC 4506 XDR syntax requirements. The corrected version is shown above.
665#[derive(Debug, Clone, PartialEq, Eq)]
666#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
667pub struct ProcessorCounters {
668    /// 5 second average CPU utilization (0-100%) (spec: 5s_cpu)
669    pub cpu_5s: u32,
670
671    /// 1 minute average CPU utilization (0-100%) (spec: 1m_cpu)
672    pub cpu_1m: u32,
673
674    /// 5 minute average CPU utilization (0-100%) (spec: 5m_cpu)
675    pub cpu_5m: u32,
676
677    /// Total memory in bytes
678    pub total_memory: u64,
679
680    /// Free memory in bytes
681    pub free_memory: u64,
682}
683
684/// Radio Utilization - Format (0,1002)
685///
686/// 802.11 radio channel utilization
687///
688/// # XDR Definition ([sFlow 802.11](https://sflow.org/sflow_80211.txt))
689///
690/// ```text
691/// /* 802.11 radio utilization */
692/// /* opaque = counter_data; enterprise = 0; format = 1002 */
693///
694/// struct radio_utilization {
695///     unsigned int elapsed_time;        /* Elapsed time in ms */
696///     unsigned int on_channel_time;     /* Time on assigned channel */
697///     unsigned int on_channel_busy_time;/* Time busy on channel */
698/// }
699/// ```
700#[derive(Debug, Clone, PartialEq, Eq)]
701#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
702pub struct RadioUtilization {
703    /// Elapsed time in milliseconds
704    pub elapsed_time: u32,
705
706    /// On channel time
707    pub on_channel_time: u32,
708
709    /// On channel busy time
710    pub on_channel_busy_time: u32,
711}
712
713/// Queue Length - Format (0,1003)
714///
715/// Histogram of queue lengths experienced by packets when they are enqueued
716///
717/// # XDR Definition ([sFlow Discussion](http://groups.google.com/group/sflow/browse_thread/thread/773d27b17a81600c))
718///
719/// ```text
720/// /* Queue length counters
721///    Histogram of queue lengths experienced by packets when they are
722///    enqueued (ie queue length immediately before packet is enqueued)
723///    thus giving the queue lengths experienced by each packet.
724///    Queue length is measured in segments occupied by the enqueued
725///    packets.
726///    Queue length counter records for each of the queues for a
727///    port must be exported with the generic interface counters
728///    record, if_counters, for the port.*/
729///
730/// /* Queue length histogram counters
731///    opaque = counter_data; enterprise = 0; format = 1003 */
732///
733/// struct queue_length {
734///     unsigned int queueIndex; /* persistent index of queue within port */
735///     unsigned int segmentSize; /* size of queue segment in bytes */
736///     unsigned int queueSegments; /* total number of segments allocated
737///                                    (ie available) to this queue. */
738///     unsigned int queueLength0; /* queue is empty when a packet is
739///                                   enqueued. */
740///     unsigned int queueLength1; /* queue length == 1 segment when a
741///                                   packet is enqueued. */
742///     unsigned int queueLength2; /* queue length == 2 segments when a
743///                                   packet is enqueued. */
744///     unsigned int queueLength4; /* 2 segments > queue length <= 4
745///                                   segments when a packet is enqueued. */
746///     unsigned int queueLength8; /* 4 segments > queue length <= 8
747///                                   segments when packet is enqueued. */
748///     unsigned int queueLength32; /* 8 segments > queue length <= 32
749///                                    segments when packet is enqueued. */
750///     unsigned int queueLength128; /* 32 segments > queue length <= 128
751///                                     segments when packet is enqueued. */
752///     unsigned int queueLength1024; /* 128 segments > queue length <= 1024
753///                                      segments when packet is enqueued. */
754///     unsigned int queueLengthMore; /* queue length > 1024 segments when
755///                                      packet is enqueued. */
756///     unsigned int dropped; /* count of packets intended for this queue
757///                              that are dropped on enqueuing. */
758/// }
759/// ```
760#[derive(Debug, Clone, PartialEq, Eq)]
761#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
762pub struct QueueLength {
763    /// Persistent index of queue within port
764    pub queue_index: u32,
765
766    /// Size of queue segment in bytes
767    pub segment_size: u32,
768
769    /// Total number of segments allocated (available) to this queue
770    pub queue_segments: u32,
771
772    /// Queue is empty when a packet is enqueued
773    pub queue_length_0: u32,
774
775    /// Queue length == 1 segment when a packet is enqueued
776    pub queue_length_1: u32,
777
778    /// Queue length == 2 segments when a packet is enqueued
779    pub queue_length_2: u32,
780
781    /// 2 segments > queue length <= 4 segments when a packet is enqueued
782    pub queue_length_4: u32,
783
784    /// 4 segments > queue length <= 8 segments when packet is enqueued
785    pub queue_length_8: u32,
786
787    /// 8 segments > queue length <= 32 segments when packet is enqueued
788    pub queue_length_32: u32,
789
790    /// 32 segments > queue length <= 128 segments when packet is enqueued
791    pub queue_length_128: u32,
792
793    /// 128 segments > queue length <= 1024 segments when packet is enqueued
794    pub queue_length_1024: u32,
795
796    /// Queue length > 1024 segments when packet is enqueued
797    pub queue_length_more: u32,
798
799    /// Count of packets intended for this queue that are dropped on enqueuing
800    pub dropped: u32,
801}
802
803/// OpenFlow Port - Format (0,1004)
804///
805/// OpenFlow port statistics
806///
807/// # XDR Definition ([sFlow OpenFlow](https://sflow.org/sflow_openflow.txt))
808///
809/// ```text
810/// /* OpenFlow port */
811/// /* opaque = counter_data; enterprise = 0; format = 1004 */
812///
813/// struct of_port {
814///     unsigned hyper datapath_id;
815///     unsigned int port_no;
816/// }
817/// ```
818#[derive(Debug, Clone, PartialEq, Eq)]
819#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
820pub struct OpenFlowPort {
821    /// Datapath ID
822    pub datapath_id: u64,
823
824    /// Port number
825    pub port_no: u32,
826}
827
828/// OpenFlow Port Name - Format (0,1005)
829///
830/// OpenFlow port name string
831///
832/// # XDR Definition ([sFlow OpenFlow](https://sflow.org/sflow_openflow.txt))
833///
834/// ```text
835/// /* Port name */
836/// /* opaque = counter_data; enterprise = 0; format = 1005 */
837///
838/// struct port_name {
839///     string name<>;
840/// }
841/// ```
842#[derive(Debug, Clone, PartialEq, Eq)]
843#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
844pub struct OpenFlowPortName {
845    /// Port name
846    pub port_name: String,
847}
848
849/// Machine Type enumeration
850///
851/// Processor family types as defined in sFlow v5 specification
852///
853/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
854///
855/// ```text
856/// enum machine_type {
857///    unknown = 0,
858///    other   = 1,
859///    x86     = 2,
860///    x86_64  = 3,
861///    ia64    = 4,
862///    sparc   = 5,
863///    alpha   = 6,
864///    powerpc = 7,
865///    m68k    = 8,
866///    mips    = 9,
867///    arm     = 10,
868///    hppa    = 11,
869///    s390    = 12
870/// }
871/// ```
872#[derive(Debug, Clone, Copy, PartialEq, Eq)]
873#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
874#[repr(u32)]
875pub enum MachineType {
876    Unknown = 0,
877    Other = 1,
878    X86 = 2,
879    X86_64 = 3,
880    Ia64 = 4,
881    Sparc = 5,
882    Alpha = 6,
883    Powerpc = 7,
884    M68k = 8,
885    Mips = 9,
886    Arm = 10,
887    Hppa = 11,
888    S390 = 12,
889}
890
891impl From<u32> for MachineType {
892    fn from(value: u32) -> Self {
893        match value {
894            0 => MachineType::Unknown,
895            1 => MachineType::Other,
896            2 => MachineType::X86,
897            3 => MachineType::X86_64,
898            4 => MachineType::Ia64,
899            5 => MachineType::Sparc,
900            6 => MachineType::Alpha,
901            7 => MachineType::Powerpc,
902            8 => MachineType::M68k,
903            9 => MachineType::Mips,
904            10 => MachineType::Arm,
905            11 => MachineType::Hppa,
906            12 => MachineType::S390,
907            _ => MachineType::Unknown,
908        }
909    }
910}
911
912/// Operating System Name enumeration
913///
914/// OS types as defined in sFlow v5 specification
915///
916/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
917///
918/// ```text
919/// enum os_name {
920///    unknown   = 0,
921///    other     = 1,
922///    linux     = 2,
923///    windows   = 3,
924///    darwin    = 4,
925///    hpux      = 5,
926///    aix       = 6,
927///    dragonfly = 7,
928///    freebsd   = 8,
929///    netbsd    = 9,
930///    openbsd   = 10,
931///    osf       = 11,
932///    solaris   = 12
933/// }
934/// ```
935///
936/// **Note:** The enumeration may be expanded over time. Applications receiving
937/// sFlow must be prepared to receive host_descr structures with unknown os_name values.
938#[derive(Debug, Clone, Copy, PartialEq, Eq)]
939#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
940#[repr(u32)]
941pub enum OsName {
942    Unknown = 0,
943    Other = 1,
944    Linux = 2,
945    Windows = 3,
946    Darwin = 4,
947    Hpux = 5,
948    Aix = 6,
949    Dragonfly = 7,
950    Freebsd = 8,
951    Netbsd = 9,
952    Openbsd = 10,
953    Osf = 11,
954    Solaris = 12,
955}
956
957impl From<u32> for OsName {
958    fn from(value: u32) -> Self {
959        match value {
960            0 => OsName::Unknown,
961            1 => OsName::Other,
962            2 => OsName::Linux,
963            3 => OsName::Windows,
964            4 => OsName::Darwin,
965            5 => OsName::Hpux,
966            6 => OsName::Aix,
967            7 => OsName::Dragonfly,
968            8 => OsName::Freebsd,
969            9 => OsName::Netbsd,
970            10 => OsName::Openbsd,
971            11 => OsName::Osf,
972            12 => OsName::Solaris,
973            _ => OsName::Unknown,
974        }
975    }
976}
977
978/// Host Description - Format (0,2000)
979///
980/// Physical or virtual host description
981///
982/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
983///
984/// ```text
985/// /* Physical or virtual host description */
986/// /* opaque = counter_data; enterprise = 0; format = 2000 */
987///
988/// struct host_descr {
989///    string hostname<64>;       /* hostname, empty if unknown */
990///    opaque uuid<16>;           /* 16 bytes binary UUID, empty if unknown */
991///    machine_type machine_type; /* the processor family */
992///    os_name os_name;           /* Operating system */
993///    string os_release<32>;     /* e.g. 2.6.9-42.ELsmp,xp-sp3, empty if unknown */
994/// }
995/// ```
996///
997/// **ERRATUM:** UUID field changed from `opaque uuid<16>` to `opaque uuid[16]` (fixed array).
998#[derive(Debug, Clone, PartialEq, Eq)]
999#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1000pub struct HostDescription {
1001    /// Hostname
1002    pub hostname: String,
1003
1004    /// UUID (16 bytes)
1005    /// **ERRATUM:** All zeros if unknown (changed from variable-length to fixed-length array)
1006    pub uuid: [u8; 16],
1007
1008    /// Machine type (processor family)
1009    pub machine_type: MachineType,
1010
1011    /// Operating system name
1012    pub os_name: OsName,
1013
1014    /// OS release (e.g., "5.10.0")
1015    pub os_release: String,
1016}
1017
1018/// Host Adapters - Format (0,2001)
1019///
1020/// Set of network adapters associated with entity
1021///
1022/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1023///
1024/// ```text
1025/// /* Set of adapters associated with entity */
1026/// /* opaque = counter_data; enterprise = 0; format = 2001 */
1027///
1028/// struct host_adapters {
1029///     adapter adapters<>; /* adapter(s) associated with entity */
1030/// }
1031/// ```
1032#[derive(Debug, Clone, PartialEq, Eq)]
1033#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1034pub struct HostAdapters {
1035    /// Adapters
1036    pub adapters: Vec<HostAdapter>,
1037}
1038
1039#[derive(Debug, Clone, PartialEq, Eq)]
1040#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1041pub struct HostAdapter {
1042    /// Interface index
1043    pub if_index: u32,
1044
1045    /// MAC addresses
1046    pub mac_addresses: Vec<crate::models::MacAddress>,
1047}
1048
1049/// Host Parent - Format (0,2002)
1050///
1051/// Containment hierarchy between logical and physical entities
1052///
1053/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1054///
1055/// ```text
1056/// /* Define containment hierarchy */
1057/// /* opaque = counter_data; enterprise = 0; format = 2002 */
1058///
1059/// struct host_parent {
1060///     unsigned int container_type;  /* sFlowDataSource type */
1061///     unsigned int container_index; /* sFlowDataSource index */
1062/// }
1063/// ```
1064#[derive(Debug, Clone, PartialEq, Eq)]
1065#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1066pub struct HostParent {
1067    /// Container type (e.g., "docker", "lxc")
1068    pub container_type: u32,
1069
1070    /// Container index
1071    pub container_index: u32,
1072}
1073
1074/// Host CPU - Format (0,2003)
1075///
1076/// Physical server CPU statistics
1077///
1078/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1079///
1080/// ```text
1081/// /* Physical Server CPU */
1082/// /* opaque = counter_data; enterprise = 0; format = 2003 */
1083///
1084/// struct host_cpu {
1085///     float load_one;          /* 1 minute load avg */
1086///     float load_five;         /* 5 minute load avg */
1087///     float load_fifteen;      /* 15 minute load avg */
1088///     unsigned int proc_run;   /* running processes */
1089///     unsigned int proc_total; /* total processes */
1090///     unsigned int cpu_num;    /* number of CPUs */
1091///     unsigned int cpu_speed;  /* CPU speed in MHz */
1092///     unsigned int uptime;     /* seconds since last reboot */
1093///     unsigned int cpu_user;   /* user time (ms) */
1094///     unsigned int cpu_nice;   /* nice time (ms) */
1095///     unsigned int cpu_system; /* system time (ms) */
1096///     unsigned int cpu_idle;   /* idle time (ms) */
1097///     unsigned int cpu_wio;    /* I/O wait time (ms) */
1098///     unsigned int cpu_intr;   /* interrupt time (ms) */
1099///     unsigned int cpu_sintr;  /* soft interrupt time (ms) */
1100///     unsigned int interrupts; /* interrupt count */
1101///     unsigned int contexts;   /* context switch count */
1102/// }
1103/// ```
1104#[derive(Debug, Clone, PartialEq, Eq)]
1105#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1106pub struct HostCpu {
1107    /// Load average (1 minute) - stored as hundredths (multiply by 100)
1108    pub load_one: u32,
1109
1110    /// Load average (5 minutes) - stored as hundredths (multiply by 100)
1111    pub load_five: u32,
1112
1113    /// Load average (15 minutes) - stored as hundredths (multiply by 100)
1114    pub load_fifteen: u32,
1115
1116    /// Number of running processes
1117    pub proc_run: u32,
1118
1119    /// Total number of processes
1120    pub proc_total: u32,
1121
1122    /// Number of CPUs
1123    pub cpu_num: u32,
1124
1125    /// CPU speed in MHz
1126    pub cpu_speed: u32,
1127
1128    /// CPU uptime in seconds
1129    pub uptime: u32,
1130
1131    /// CPU time in user mode (ms)
1132    pub cpu_user: u32,
1133
1134    /// CPU time in nice mode (ms)
1135    pub cpu_nice: u32,
1136
1137    /// CPU time in system mode (ms)
1138    pub cpu_system: u32,
1139
1140    /// CPU idle time (ms)
1141    pub cpu_idle: u32,
1142
1143    /// CPU time waiting for I/O (ms)
1144    pub cpu_wio: u32,
1145
1146    /// CPU time servicing interrupts (ms)
1147    pub cpu_intr: u32,
1148
1149    /// CPU time servicing soft interrupts (ms)
1150    pub cpu_sintr: u32,
1151
1152    /// Number of interrupts
1153    pub interrupts: u32,
1154
1155    /// Number of context switches
1156    pub contexts: u32,
1157}
1158
1159/// Host Memory - Format (0,2004)
1160///
1161/// Physical server memory statistics
1162///
1163/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1164///
1165/// ```text
1166/// /* Physical Server Memory */
1167/// /* opaque = counter_data; enterprise = 0; format = 2004 */
1168///
1169/// struct host_memory {
1170///     unsigned hyper mem_total;   /* total bytes */
1171///     unsigned hyper mem_free;    /* free bytes */
1172///     unsigned hyper mem_shared;  /* shared bytes */
1173///     unsigned hyper mem_buffers; /* buffers bytes */
1174///     unsigned hyper mem_cached;  /* cached bytes */
1175///     unsigned hyper swap_total;  /* swap total bytes */
1176///     unsigned hyper swap_free;   /* swap free bytes */
1177///     unsigned int page_in;       /* page in count */
1178///     unsigned int page_out;      /* page out count */
1179///     unsigned int swap_in;       /* swap in count */
1180///     unsigned int swap_out;      /* swap out count */
1181/// }
1182/// ```
1183#[derive(Debug, Clone, PartialEq, Eq)]
1184#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1185pub struct HostMemory {
1186    /// Total memory in bytes
1187    pub mem_total: u64,
1188
1189    /// Free memory in bytes
1190    pub mem_free: u64,
1191
1192    /// Shared memory in bytes
1193    pub mem_shared: u64,
1194
1195    /// Memory used for buffers in bytes
1196    pub mem_buffers: u64,
1197
1198    /// Memory used for cache in bytes
1199    pub mem_cached: u64,
1200
1201    /// Total swap space in bytes
1202    pub swap_total: u64,
1203
1204    /// Free swap space in bytes
1205    pub swap_free: u64,
1206
1207    /// Page in count
1208    pub page_in: u32,
1209
1210    /// Page out count
1211    pub page_out: u32,
1212
1213    /// Swap in count
1214    pub swap_in: u32,
1215
1216    /// Swap out count
1217    pub swap_out: u32,
1218}
1219
1220/// Host Disk I/O - Format (0,2005)
1221///
1222/// Physical server disk I/O statistics
1223///
1224/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1225///
1226/// ```text
1227/// /* Physical Server Disk I/O */
1228/// /* opaque = counter_data; enterprise = 0; format = 2005 */
1229///
1230/// struct host_disk_io {
1231///     unsigned hyper disk_total;    /* total disk size in bytes */
1232///     unsigned hyper disk_free;     /* total disk free in bytes */
1233///     percentage part_max_used;     /* utilization of most utilized partition */
1234///     unsigned int reads;           /* reads issued */
1235///     unsigned hyper bytes_read;    /* bytes read */
1236///     unsigned int read_time;       /* read time (ms) */
1237///     unsigned int writes;          /* writes completed */
1238///     unsigned hyper bytes_written; /* bytes written */
1239///     unsigned int write_time;      /* write time (ms) */
1240/// }
1241/// ```
1242#[derive(Debug, Clone, PartialEq, Eq)]
1243#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1244pub struct HostDiskIo {
1245    /// Total disk capacity in bytes
1246    pub disk_total: u64,
1247
1248    /// Free disk space in bytes
1249    pub disk_free: u64,
1250
1251    /// Percentage of disk used (in hundredths of a percent, e.g., 100 = 1%)
1252    pub part_max_used: i32,
1253
1254    /// Number of disk reads
1255    pub reads: u32,
1256
1257    /// Bytes read from disk
1258    pub bytes_read: u64,
1259
1260    /// Read time in milliseconds
1261    pub read_time: u32,
1262
1263    /// Number of disk writes
1264    pub writes: u32,
1265
1266    /// Bytes written to disk
1267    pub bytes_written: u64,
1268
1269    /// Write time in milliseconds
1270    pub write_time: u32,
1271}
1272
1273/// Host Network I/O - Format (0,2006)
1274///
1275/// Physical server network I/O statistics
1276///
1277/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1278///
1279/// ```text
1280/// /* Physical Server Network I/O */
1281/// /* opaque = counter_data; enterprise = 0; format = 2006 */
1282///
1283/// struct host_net_io {
1284///     unsigned hyper bytes_in;  /* total bytes in */
1285///     unsigned int pkts_in;     /* total packets in */
1286///     unsigned int errs_in;     /* total errors in */
1287///     unsigned int drops_in;    /* total drops in */
1288///     unsigned hyper bytes_out; /* total bytes out */
1289///     unsigned int packets_out; /* total packets out */
1290///     unsigned int errs_out;    /* total errors out */
1291///     unsigned int drops_out;   /* total drops out */
1292/// }
1293/// ```
1294#[derive(Debug, Clone, PartialEq, Eq)]
1295#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1296pub struct HostNetIo {
1297    /// Bytes received
1298    pub bytes_in: u64,
1299
1300    /// Packets received
1301    pub pkts_in: u32,
1302
1303    /// Receive errors
1304    pub errs_in: u32,
1305
1306    /// Receive drops
1307    pub drops_in: u32,
1308
1309    /// Bytes transmitted
1310    pub bytes_out: u64,
1311
1312    /// Packets transmitted
1313    pub packets_out: u32,
1314
1315    /// Transmit errors
1316    pub errs_out: u32,
1317
1318    /// Transmit drops
1319    pub drops_out: u32,
1320}
1321
1322/// MIB-2 IP Group - Format (0,2007)
1323///
1324/// IP protocol statistics from MIB-II
1325///
1326/// # XDR Definition ([sFlow Host TCP/IP](https://sflow.org/sflow_host_ip.txt))
1327///
1328/// ```text
1329/// /* IP Group - see MIB-II */
1330/// /* opaque = counter_data; enterprise = 0; format = 2007 */
1331///
1332/// struct mib2_ip_group {
1333///   unsigned int ipForwarding;
1334///   unsigned int ipDefaultTTL;
1335///   unsigned int ipInReceives;
1336///   unsigned int ipInHdrErrors;
1337///   unsigned int ipInAddrErrors;
1338///   unsigned int ipForwDatagrams;
1339///   unsigned int ipInUnknownProtos;
1340///   unsigned int ipInDiscards;
1341///   unsigned int ipInDelivers;
1342///   unsigned int ipOutRequests;
1343///   unsigned int ipOutDiscards;
1344///   unsigned int ipOutNoRoutes;
1345///   unsigned int ipReasmTimeout;
1346///   unsigned int ipReasmReqds;
1347///   unsigned int ipReasmOKs;
1348///   unsigned int ipReasmFails;
1349///   unsigned int ipFragOKs;
1350///   unsigned int ipFragFails;
1351///   unsigned int ipFragCreates;
1352/// }
1353/// ```
1354#[derive(Debug, Clone, PartialEq, Eq)]
1355#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1356pub struct Mib2IpGroup {
1357    pub ip_forwarding: u32,
1358    pub ip_default_ttl: u32,
1359    pub ip_in_receives: u32,
1360    pub ip_in_hdr_errors: u32,
1361    pub ip_in_addr_errors: u32,
1362    pub ip_forw_datagrams: u32,
1363    pub ip_in_unknown_protos: u32,
1364    pub ip_in_discards: u32,
1365    pub ip_in_delivers: u32,
1366    pub ip_out_requests: u32,
1367    pub ip_out_discards: u32,
1368    pub ip_out_no_routes: u32,
1369    pub ip_reasm_timeout: u32,
1370    pub ip_reasm_reqds: u32,
1371    pub ip_reasm_oks: u32,
1372    pub ip_reasm_fails: u32,
1373    pub ip_frag_oks: u32,
1374    pub ip_frag_fails: u32,
1375    pub ip_frag_creates: u32,
1376}
1377
1378/// MIB-2 ICMP Group - Format (0,2008)
1379///
1380/// ICMP protocol statistics from MIB-II
1381///
1382/// # XDR Definition ([sFlow Host TCP/IP](https://sflow.org/sflow_host_ip.txt))
1383///
1384/// ```text
1385/// /* ICMP Group - see MIB-II */
1386/// /* opaque = counter_data; enterprise = 0; format = 2008 */
1387///
1388/// struct mib2_icmp_group {
1389///   unsigned int icmpInMsgs;
1390///   unsigned int icmpInErrors;
1391///   unsigned int icmpInDestUnreachs;
1392///   unsigned int icmpInTimeExcds;
1393///   unsigned int icmpInParamProbs;
1394///   unsigned int icmpInSrcQuenchs;
1395///   unsigned int icmpInRedirects;
1396///   unsigned int icmpInEchos;
1397///   unsigned int icmpInEchoReps;
1398///   unsigned int icmpInTimestamps;
1399///   unsigned int icmpInAddrMasks;
1400///   unsigned int icmpInAddrMaskReps;
1401///   unsigned int icmpOutMsgs;
1402///   unsigned int icmpOutErrors;
1403///   unsigned int icmpOutDestUnreachs;
1404///   unsigned int icmpOutTimeExcds;
1405///   unsigned int icmpOutParamProbs;
1406///   unsigned int icmpOutSrcQuenchs;
1407///   unsigned int icmpOutRedirects;
1408///   unsigned int icmpOutEchos;
1409///   unsigned int icmpOutEchoReps;
1410///   unsigned int icmpOutTimestamps;
1411///   unsigned int icmpOutTimestampReps;
1412///   unsigned int icmpOutAddrMasks;
1413///   unsigned int icmpOutAddrMaskReps;
1414/// }
1415/// ```
1416#[derive(Debug, Clone, PartialEq, Eq)]
1417#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1418pub struct Mib2IcmpGroup {
1419    pub icmp_in_msgs: u32,
1420    pub icmp_in_errors: u32,
1421    pub icmp_in_dest_unreachs: u32,
1422    pub icmp_in_time_excds: u32,
1423    pub icmp_in_param_probs: u32,
1424    pub icmp_in_src_quenchs: u32,
1425    pub icmp_in_redirects: u32,
1426    pub icmp_in_echos: u32,
1427    pub icmp_in_echo_reps: u32,
1428    pub icmp_in_timestamps: u32,
1429    pub icmp_in_addr_masks: u32,
1430    pub icmp_in_addr_mask_reps: u32,
1431    pub icmp_out_msgs: u32,
1432    pub icmp_out_errors: u32,
1433    pub icmp_out_dest_unreachs: u32,
1434    pub icmp_out_time_excds: u32,
1435    pub icmp_out_param_probs: u32,
1436    pub icmp_out_src_quenchs: u32,
1437    pub icmp_out_redirects: u32,
1438    pub icmp_out_echos: u32,
1439    pub icmp_out_echo_reps: u32,
1440    pub icmp_out_timestamps: u32,
1441    pub icmp_out_timestamp_reps: u32,
1442    pub icmp_out_addr_masks: u32,
1443    pub icmp_out_addr_mask_reps: u32,
1444}
1445
1446/// MIB-2 TCP Group - Format (0,2009)
1447///
1448/// TCP protocol statistics from MIB-II
1449///
1450/// # XDR Definition ([sFlow Host TCP/IP](https://sflow.org/sflow_host_ip.txt))
1451///
1452/// ```text
1453/// /* TCP Group - see MIB-II */
1454/// /* opaque = counter_data; enterprise = 0; format = 2009 */
1455///
1456/// struct mib2_tcp_group {
1457///   unsigned int tcpRtoAlgorithm;
1458///   unsigned int tcpRtoMin;
1459///   unsigned int tcpRtoMax;
1460///   unsigned int tcpMaxConn;
1461///   unsigned int tcpActiveOpens;
1462///   unsigned int tcpPassiveOpens;
1463///   unsigned int tcpAttemptFails;
1464///   unsigned int tcpEstabResets;
1465///   unsigned int tcpCurrEstab;
1466///   unsigned int tcpInSegs;
1467///   unsigned int tcpOutSegs;
1468///   unsigned int tcpRetransSegs;
1469///   unsigned int tcpInErrs;
1470///   unsigned int tcpOutRsts;
1471///   unsigned int tcpInCsumErrs;
1472/// }
1473/// ```
1474#[derive(Debug, Clone, PartialEq, Eq)]
1475#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1476pub struct Mib2TcpGroup {
1477    pub tcp_rto_algorithm: u32,
1478    pub tcp_rto_min: u32,
1479    pub tcp_rto_max: u32,
1480    pub tcp_max_conn: u32,
1481    pub tcp_active_opens: u32,
1482    pub tcp_passive_opens: u32,
1483    pub tcp_attempt_fails: u32,
1484    pub tcp_estab_resets: u32,
1485    pub tcp_curr_estab: u32,
1486    pub tcp_in_segs: u32,
1487    pub tcp_out_segs: u32,
1488    pub tcp_retrans_segs: u32,
1489    pub tcp_in_errs: u32,
1490    pub tcp_out_rsts: u32,
1491    pub tcp_in_csum_errs: u32,
1492}
1493
1494/// MIB-2 UDP Group - Format (0,2010)
1495///
1496/// UDP protocol statistics from MIB-II
1497///
1498/// # XDR Definition ([sFlow Host TCP/IP](https://sflow.org/sflow_host_ip.txt))
1499///
1500/// ```text
1501/// /* UDP Group - see MIB-II */
1502/// /* opaque = counter_data; enterprise = 0; format = 2010 */
1503///
1504/// struct mib2_udp_group {
1505///   unsigned int udpInDatagrams;
1506///   unsigned int udpNoPorts;
1507///   unsigned int udpInErrors;
1508///   unsigned int udpOutDatagrams;
1509///   unsigned int udpRcvbufErrors;
1510///   unsigned int udpSndbufErrors;
1511///   unsigned int udpInCsumErrors;
1512/// }
1513/// ```
1514#[derive(Debug, Clone, PartialEq, Eq)]
1515#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1516pub struct Mib2UdpGroup {
1517    pub udp_in_datagrams: u32,
1518    pub udp_no_ports: u32,
1519    pub udp_in_errors: u32,
1520    pub udp_out_datagrams: u32,
1521    pub udp_rcvbuf_errors: u32,
1522    pub udp_sndbuf_errors: u32,
1523    pub udp_in_csum_errors: u32,
1524}
1525
1526/// Virtual Node - Format (0,2100)
1527///
1528/// Hypervisor statistics
1529///
1530/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1531///
1532/// ```text
1533/// /* Virtual Node Statistics */
1534/// /* opaque = counter_data; enterprise = 0; format = 2100 */
1535///
1536/// struct virt_node {
1537///     unsigned int mhz;           /* expected CPU frequency */
1538///     unsigned int cpus;          /* number of active CPUs */
1539///     unsigned hyper memory;      /* memory size in bytes */
1540///     unsigned hyper memory_free; /* unassigned memory in bytes */
1541///     unsigned int num_domains;   /* number of active domains */
1542/// }
1543/// ```
1544#[derive(Debug, Clone, PartialEq, Eq)]
1545#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1546pub struct VirtualNode {
1547    /// Expected CPU frequency in MHz
1548    pub mhz: u32,
1549
1550    /// Number of active CPUs
1551    pub cpus: u32,
1552
1553    /// Memory size in bytes
1554    pub memory: u64,
1555
1556    /// Unassigned memory in bytes
1557    pub memory_free: u64,
1558
1559    /// Number of active domains
1560    pub num_domains: u32,
1561}
1562
1563/// Virtual CPU - Format (0,2101)
1564///
1565/// Virtual domain CPU statistics
1566///
1567/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1568///
1569/// ```text
1570/// /* Virtual Domain CPU statistics */
1571/// /* See libvirt, struct virDomainInfo */
1572/// /* opaque = counter_data; enterprise = 0; format = 2101 */
1573///
1574/// struct virt_cpu {
1575///     unsigned int state;    /* virtDomainState */
1576///     unsigned int cpuTime;  /* CPU time used (ms) */
1577///     unsigned int nrVirtCpu;/* number of virtual CPUs */
1578/// }
1579/// ```
1580///
1581/// **ERRATUM:** Comment reference corrected from `virtDomainInfo` to `virDomainInfo`.
1582#[derive(Debug, Clone, PartialEq, Eq)]
1583#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1584pub struct VirtualCpu {
1585    /// CPU state (0=running, 1=idle, 2=blocked)
1586    pub state: u32,
1587
1588    /// CPU time in milliseconds
1589    pub cpu_time: u32,
1590
1591    /// Number of virtual CPUs
1592    pub nr_virt_cpu: u32,
1593}
1594
1595/// Virtual Memory - Format (0,2102)
1596///
1597/// Virtual domain memory statistics
1598///
1599/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1600///
1601/// ```text
1602/// /* Virtual Domain Memory statistics */
1603/// /* See libvirt, struct virDomainInfo */
1604/// /* opaque = counter_data; enterprise = 0; format = 2102 */
1605///
1606/// struct virt_memory {
1607///     unsigned hyper memory;    /* memory in bytes used by domain */
1608///     unsigned hyper maxMemory; /* memory in bytes allowed */
1609/// }
1610/// ```
1611///
1612/// **ERRATUM:** Comment reference corrected from `virtDomainInfo` to `virDomainInfo`.
1613#[derive(Debug, Clone, PartialEq, Eq)]
1614#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1615pub struct VirtualMemory {
1616    /// Memory in bytes
1617    pub memory: u64,
1618
1619    /// Maximum memory in bytes
1620    pub max_memory: u64,
1621}
1622
1623/// Virtual Disk I/O - Format (0,2103)
1624///
1625/// Virtual domain disk statistics
1626///
1627/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1628///
1629/// ```text
1630/// /* Virtual Domain Disk statistics */
1631/// /* See libvirt, struct virDomainBlockInfo */
1632/// /* See libvirt, struct virDomainBlockStatsStruct */
1633/// /* opaque = counter_data; enterprise = 0; format = 2103 */
1634///
1635/// struct virt_disk_io {
1636///     unsigned hyper capacity;   /* logical size in bytes */
1637///     unsigned hyper allocation; /* current allocation in bytes */
1638///     unsigned hyper physical;   /* physical size in bytes of the container of the backing image */
1639///     unsigned int rd_req;       /* number of read requests */
1640///     unsigned hyper rd_bytes;   /* number of read bytes */
1641///     unsigned int wr_req;       /* number of write requests */
1642///     unsigned hyper wr_bytes;   /* number of written bytes */
1643///     unsigned int errs;         /* read/write errors */
1644/// }
1645/// ```
1646///
1647/// **ERRATUM:** Field name changed from `available` to `physical`, and comment references corrected
1648/// from `virtDomainBlockInfo`/`virtDomainBlockStatsStruct` to `virDomainBlockInfo`/`virDomainBlockStatsStruct`.
1649#[derive(Debug, Clone, PartialEq, Eq)]
1650#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1651pub struct VirtualDiskIo {
1652    /// Capacity in bytes
1653    pub capacity: u64,
1654
1655    /// Allocation in bytes
1656    pub allocation: u64,
1657
1658    /// Physical size in bytes of the container of the backing image (spec: physical)
1659    /// **ERRATUM:** Field renamed from `available` (remaining free bytes) to `physical`
1660    pub available: u64,
1661
1662    /// Read requests
1663    pub rd_req: u32,
1664
1665    /// Bytes read
1666    pub rd_bytes: u64,
1667
1668    /// Write requests
1669    pub wr_req: u32,
1670
1671    /// Bytes written
1672    pub wr_bytes: u64,
1673
1674    /// Errors
1675    pub errs: u32,
1676}
1677
1678/// Virtual Network I/O - Format (0,2104)
1679///
1680/// Virtual domain network statistics
1681///
1682/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1683///
1684/// ```text
1685/// /* Virtual Domain Network statistics */
1686/// /* See libvirt, struct virDomainInterfaceStatsStruct */
1687/// /* opaque = counter_data; enterprise = 0; format = 2104 */
1688///
1689/// struct virt_net_io {
1690///     unsigned hyper rx_bytes;  /* total bytes received */
1691///     unsigned int rx_packets;  /* total packets received */
1692///     unsigned int rx_errs;     /* total receive errors */
1693///     unsigned int rx_drop;     /* total receive drops */
1694///     unsigned hyper tx_bytes;  /* total bytes transmitted */
1695///     unsigned int tx_packets;  /* total packets transmitted */
1696///     unsigned int tx_errs;     /* total transmit errors */
1697///     unsigned int tx_drop;     /* total transmit drops */
1698/// }
1699/// ```
1700///
1701/// **ERRATUM:** Comment reference corrected from `virtDomainInterfaceStatsStruct` to `virDomainInterfaceStatsStruct`.
1702#[derive(Debug, Clone, PartialEq, Eq)]
1703#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1704pub struct VirtualNetIo {
1705    /// Bytes received
1706    pub rx_bytes: u64,
1707
1708    /// Packets received
1709    pub rx_packets: u32,
1710
1711    /// Receive errors
1712    pub rx_errs: u32,
1713
1714    /// Receive drops
1715    pub rx_drop: u32,
1716
1717    /// Bytes transmitted
1718    pub tx_bytes: u64,
1719
1720    /// Packets transmitted
1721    pub tx_packets: u32,
1722
1723    /// Transmit errors
1724    pub tx_errs: u32,
1725
1726    /// Transmit drops
1727    pub tx_drop: u32,
1728}
1729
1730/// JVM Runtime - Format (0,2105)
1731///
1732/// Java Virtual Machine runtime attributes
1733///
1734/// # XDR Definition ([sFlow JVM](https://sflow.org/sflow_jvm.txt))
1735///
1736/// ```text
1737/// /* JVM Runtime Attributes */
1738/// /* See RuntimeMXBean */
1739/// /* opaque = counter_data; enterprise = 0; format = 2105 */
1740///
1741/// struct jvm_runtime {
1742///   string vm_name<64>;      /* vm name */
1743///   string vm_vendor<32>;    /* the vendor for the JVM */
1744///   string vm_version<32>;   /* the version for the JVM */
1745/// }
1746/// ```
1747#[derive(Debug, Clone, PartialEq, Eq)]
1748#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1749pub struct JvmRuntime {
1750    /// JVM name
1751    pub vm_name: String,
1752
1753    /// JVM vendor
1754    pub vm_vendor: String,
1755
1756    /// JVM version
1757    pub vm_version: String,
1758}
1759
1760/// JVM Statistics - Format (0,2106)
1761///
1762/// Java Virtual Machine performance statistics
1763///
1764/// # XDR Definition ([sFlow JVM](https://sflow.org/sflow_jvm.txt))
1765///
1766/// ```text
1767/// /* JVM Statistics */
1768/// /* See MemoryMXBean, GarbageCollectorMXBean, ClassLoadingMXBean, */
1769/// /* CompilationMXBean, ThreadMXBean and UnixOperatingSystemMXBean */
1770/// /* opaque = counter_data; enterprise = 0; format = 2106 */
1771///
1772/// struct jvm_statistics {
1773///   unsigned hyper heap_initial;    /* initial heap memory requested */
1774///   unsigned hyper heap_used;       /* current heap memory usage  */
1775///   unsigned hyper heap_committed;  /* heap memory currently committed */
1776///   unsigned hyper heap_max;        /* max heap space */
1777///   unsigned hyper non_heap_initial; /* initial non heap memory
1778///                                       requested */
1779///   unsigned hyper non_heap_used;   /* current non heap memory usage  */
1780///   unsigned hyper non_heap_committed; /* non heap memory currently
1781///                                         committed */
1782///   unsigned hyper non_heap_max;    /* max non-heap space */
1783///   unsigned int gc_count;          /* total number of collections that
1784///                                      have occurred */
1785///   unsigned int gc_time;           /* approximate accumulated collection
1786///                                      elapsed time in milliseconds */
1787///   unsigned int classes_loaded;    /* number of classes currently loaded
1788///                                      in vm */
1789///   unsigned int classes_total;     /* total number of classes loaded
1790///                                      since vm started */
1791///   unsigned int classes_unloaded;  /* total number of classe unloaded
1792///                                      since vm started */
1793///   unsigned int compilation_time;  /* total accumulated time spent in
1794///                                      compilation (in milliseconds) */
1795///   unsigned int thread_num_live;   /* current number of live threads */
1796///   unsigned int thread_num_daemon; /* current number of live daemon
1797///                                      threads */
1798///   unsigned int thread_num_started; /* total threads started since
1799///                                       vm started */
1800///   unsigned int fd_open_count;     /* number of open file descriptors */
1801///   unsigned int fd_max_count;      /* max number of file descriptors */
1802/// }
1803/// ```
1804#[derive(Debug, Clone, PartialEq, Eq)]
1805#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1806pub struct JvmStatistics {
1807    /// Initial heap memory requested
1808    pub heap_initial: u64,
1809
1810    /// Current heap memory usage
1811    pub heap_used: u64,
1812
1813    /// Heap memory currently committed
1814    pub heap_committed: u64,
1815
1816    /// Maximum heap space
1817    pub heap_max: u64,
1818
1819    /// Initial non-heap memory requested
1820    pub non_heap_initial: u64,
1821
1822    /// Current non-heap memory usage
1823    pub non_heap_used: u64,
1824
1825    /// Non-heap memory currently committed
1826    pub non_heap_committed: u64,
1827
1828    /// Maximum non-heap space
1829    pub non_heap_max: u64,
1830
1831    /// Total number of garbage collections that have occurred
1832    pub gc_count: u32,
1833
1834    /// Approximate accumulated collection elapsed time in milliseconds
1835    pub gc_time: u32,
1836
1837    /// Number of classes currently loaded in VM
1838    pub classes_loaded: u32,
1839
1840    /// Total number of classes loaded since VM started
1841    pub classes_total: u32,
1842
1843    /// Total number of classes unloaded since VM started
1844    pub classes_unloaded: u32,
1845
1846    /// Total accumulated time spent in compilation (in milliseconds)
1847    pub compilation_time: u32,
1848
1849    /// Current number of live threads
1850    pub thread_num_live: u32,
1851
1852    /// Current number of live daemon threads
1853    pub thread_num_daemon: u32,
1854
1855    /// Total threads started since VM started
1856    pub thread_num_started: u32,
1857
1858    /// Number of open file descriptors
1859    pub fd_open_count: u32,
1860
1861    /// Maximum number of file descriptors
1862    pub fd_max_count: u32,
1863}
1864
1865/// Memcache Counters - Format (0,2200) - **DEPRECATED**
1866///
1867/// Legacy memcache statistics counters
1868///
1869/// **Note:** This format was defined in an early sFlow Memcache discussion
1870/// but was deprecated and replaced by format 2204. It is included here for
1871/// backward compatibility with legacy implementations.
1872///
1873/// # XDR Definition ([sFlow Discussion](https://groups.google.com/g/sflow/c/KDk_QrxCSJI))
1874///
1875/// ```text
1876/// /* Memcached counters */
1877/// /* See memcached protocol.txt */
1878/// /* opaque = counter_data; enterprise = 0; format = 2200 */
1879/// struct memcached_counters {
1880///   unsigned int uptime;                 /* in seconds */
1881///   unsigned int rusage_user;            /* in milliseconds */
1882///   unsigned int rusage_system;          /* in milliseconds */
1883///   unsigned int curr_connections;
1884///   unsigned int total_connections;
1885///   unsigned int connection_structures;
1886///   unsigned int cmd_get;
1887///   unsigned int cmd_set;
1888///   unsigned int cmd_flush;
1889///   unsigned int get_hits;
1890///   unsigned int get_misses;
1891///   unsigned int delete_misses;
1892///   unsigned int delete_hits;
1893///   unsigned int incr_misses;
1894///   unsigned int incr_hits;
1895///   unsigned int decr_misses;
1896///   unsigned int decr_hits;
1897///   unsigned int cas_misses;
1898///   unsigned int cas_hits;
1899///   unsigned int cas_badval;
1900///   unsigned int auth_cmds;
1901///   unsigned int auth_errors;
1902///   unsigned hyper bytes_read;
1903///   unsigned hyper bytes_written;
1904///   unsigned int limit_maxbytes;
1905///   unsigned int accepting_conns;
1906///   unsigned int listen_disabled_num;
1907///   unsigned int threads;
1908///   unsigned int conn_yields;
1909///   unsigned hyper bytes;
1910///   unsigned int curr_items;
1911///   unsigned int total_items;
1912///   unsigned int evictions;
1913/// }
1914/// ```
1915#[derive(Debug, Clone, PartialEq, Eq)]
1916#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1917pub struct MemcacheCountersDeprecated {
1918    /// Uptime in seconds
1919    pub uptime: u32,
1920
1921    /// User CPU time in milliseconds
1922    pub rusage_user: u32,
1923
1924    /// System CPU time in milliseconds
1925    pub rusage_system: u32,
1926
1927    /// Current number of connections
1928    pub curr_connections: u32,
1929
1930    /// Total number of connections
1931    pub total_connections: u32,
1932
1933    /// Number of connection structures
1934    pub connection_structures: u32,
1935
1936    /// Number of get commands
1937    pub cmd_get: u32,
1938
1939    /// Number of set commands
1940    pub cmd_set: u32,
1941
1942    /// Number of flush commands
1943    pub cmd_flush: u32,
1944
1945    /// Number of get hits
1946    pub get_hits: u32,
1947
1948    /// Number of get misses
1949    pub get_misses: u32,
1950
1951    /// Number of delete misses
1952    pub delete_misses: u32,
1953
1954    /// Number of delete hits
1955    pub delete_hits: u32,
1956
1957    /// Number of increment misses
1958    pub incr_misses: u32,
1959
1960    /// Number of increment hits
1961    pub incr_hits: u32,
1962
1963    /// Number of decrement misses
1964    pub decr_misses: u32,
1965
1966    /// Number of decrement hits
1967    pub decr_hits: u32,
1968
1969    /// Number of CAS misses
1970    pub cas_misses: u32,
1971
1972    /// Number of CAS hits
1973    pub cas_hits: u32,
1974
1975    /// Number of CAS bad value errors
1976    pub cas_badval: u32,
1977
1978    /// Number of authentication commands
1979    pub auth_cmds: u32,
1980
1981    /// Number of authentication errors
1982    pub auth_errors: u32,
1983
1984    /// Total bytes read
1985    pub bytes_read: u64,
1986
1987    /// Total bytes written
1988    pub bytes_written: u64,
1989
1990    /// Maximum bytes limit
1991    pub limit_maxbytes: u32,
1992
1993    /// Whether accepting connections (1=yes, 0=no)
1994    pub accepting_conns: u32,
1995
1996    /// Number of times listen was disabled
1997    pub listen_disabled_num: u32,
1998
1999    /// Number of threads
2000    pub threads: u32,
2001
2002    /// Number of connection yields
2003    pub conn_yields: u32,
2004
2005    /// Current bytes used
2006    pub bytes: u64,
2007
2008    /// Current number of items
2009    pub curr_items: u32,
2010
2011    /// Total number of items
2012    pub total_items: u32,
2013
2014    /// Number of evictions
2015    pub evictions: u32,
2016}
2017
2018/// HTTP Counters - Format (0,2201)
2019///
2020/// HTTP performance counters
2021///
2022/// # XDR Definition ([sFlow HTTP](https://sflow.org/sflow_http.txt))
2023///
2024/// ```text
2025/// /* HTTP counters */
2026/// /* opaque = counter_data; enterprise = 0; format = 2201 */
2027/// struct http_counters {
2028///   unsigned int method_option_count;
2029///   unsigned int method_get_count;
2030///   unsigned int method_head_count;
2031///   unsigned int method_post_count;
2032///   unsigned int method_put_count;
2033///   unsigned int method_delete_count;
2034///   unsigned int method_trace_count;
2035///   unsigned int method_connect_count;
2036///   unsigned int method_other_count;
2037///   unsigned int status_1XX_count;
2038///   unsigned int status_2XX_count;
2039///   unsigned int status_3XX_count;
2040///   unsigned int status_4XX_count;
2041///   unsigned int status_5XX_count;
2042///   unsigned int status_other_count;
2043/// }
2044/// ```
2045#[derive(Debug, Clone, PartialEq, Eq)]
2046#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2047pub struct HttpCounters {
2048    /// OPTIONS method count
2049    pub method_option_count: u32,
2050
2051    /// GET method count
2052    pub method_get_count: u32,
2053
2054    /// HEAD method count
2055    pub method_head_count: u32,
2056
2057    /// POST method count
2058    pub method_post_count: u32,
2059
2060    /// PUT method count
2061    pub method_put_count: u32,
2062
2063    /// DELETE method count
2064    pub method_delete_count: u32,
2065
2066    /// TRACE method count
2067    pub method_trace_count: u32,
2068
2069    /// CONNECT method count
2070    pub method_connect_count: u32,
2071
2072    /// Other method count
2073    pub method_other_count: u32,
2074
2075    /// 1XX status code count (spec: status_1XX_count)
2076    pub status_1xx_count: u32,
2077
2078    /// 2XX status code count (spec: status_2XX_count)
2079    pub status_2xx_count: u32,
2080
2081    /// 3XX status code count (spec: status_3XX_count)
2082    pub status_3xx_count: u32,
2083
2084    /// 4XX status code count (spec: status_4XX_count)
2085    pub status_4xx_count: u32,
2086
2087    /// 5XX status code count (spec: status_5XX_count)
2088    pub status_5xx_count: u32,
2089
2090    /// Other status code count
2091    pub status_other_count: u32,
2092}
2093
2094/// App Operations - Format (0,2202)
2095///
2096/// Count of operations by status code
2097///
2098/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
2099///
2100/// ```text
2101/// /* Application counters */
2102/// /* opaque = counter_data; enterprise = 0; format = 2202 */
2103///
2104/// struct app_operations {
2105///     application application;
2106///     unsigned int success;
2107///     unsigned int other;
2108///     unsigned int timeout;
2109///     unsigned int internal_error;
2110///     unsigned int bad_request;
2111///     unsigned int forbidden;
2112///     unsigned int too_large;
2113///     unsigned int not_implemented;
2114///     unsigned int not_found;
2115///     unsigned int unavailable;
2116///     unsigned int unauthorized;
2117/// }
2118/// ```
2119#[derive(Debug, Clone, PartialEq, Eq)]
2120#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2121pub struct AppOperations {
2122    /// Application identifier
2123    pub application: String,
2124
2125    /// Successful operations
2126    pub success: u32,
2127
2128    /// Other status
2129    pub other: u32,
2130
2131    /// Timeout
2132    pub timeout: u32,
2133
2134    /// Internal error
2135    pub internal_error: u32,
2136
2137    /// Bad request
2138    pub bad_request: u32,
2139
2140    /// Forbidden
2141    pub forbidden: u32,
2142
2143    /// Too large
2144    pub too_large: u32,
2145
2146    /// Not implemented
2147    pub not_implemented: u32,
2148
2149    /// Not found
2150    pub not_found: u32,
2151
2152    /// Unavailable
2153    pub unavailable: u32,
2154
2155    /// Unauthorized
2156    pub unauthorized: u32,
2157}
2158
2159/// App Resources - Format (0,2203)
2160///
2161/// Application resource usage
2162///
2163/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
2164///
2165/// ```text
2166/// /* Application resources */
2167/// /* opaque = counter_data; enterprise = 0; format = 2203 */
2168///
2169/// struct app_resources {
2170///     unsigned int user_time;   /* user time (ms) */
2171///     unsigned int system_time; /* system time (ms) */
2172///     unsigned hyper mem_used;  /* memory used in bytes */
2173///     unsigned hyper mem_max;   /* max memory in bytes */
2174///     unsigned int fd_open;     /* open file descriptors */
2175///     unsigned int fd_max;      /* max file descriptors */
2176///     unsigned int conn_open;   /* open network connections */
2177///     unsigned int conn_max;    /* max network connections */
2178/// }
2179/// ```
2180#[derive(Debug, Clone, PartialEq, Eq)]
2181#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2182pub struct AppResources {
2183    /// User time in milliseconds
2184    pub user_time: u32,
2185
2186    /// System time in milliseconds
2187    pub system_time: u32,
2188
2189    /// Memory used in bytes
2190    pub mem_used: u64,
2191
2192    /// Maximum memory in bytes
2193    pub mem_max: u64,
2194
2195    /// Number of open file descriptors
2196    pub fd_open: u32,
2197
2198    /// Maximum number of file descriptors
2199    pub fd_max: u32,
2200
2201    /// Number of open connections
2202    pub conn_open: u32,
2203
2204    /// Maximum number of connections
2205    pub conn_max: u32,
2206}
2207
2208/// Memcache Counters - Format (0,2204)
2209///
2210/// Memcache server performance counters
2211///
2212/// # XDR Definition ([sFlow Memcache](https://sflow.org/sflow_memcache.txt))
2213///
2214/// ```text
2215/// /* Memcache counters */
2216/// /* See Memcached protocol.txt */
2217/// /* opaque = counter_data; enterprise = 0; format = 2204 */
2218///
2219/// struct memcache_counters {
2220///   unsigned int cmd_set;
2221///   unsigned int cmd_touch;
2222///   unsigned int cmd_flush;
2223///   unsigned int get_hits;
2224///   unsigned int get_misses;
2225///   unsigned int delete_hits;
2226///   unsigned int delete_misses;
2227///   unsigned int incr_hits;
2228///   unsigned int incr_misses;
2229///   unsigned int decr_hits;
2230///   unsigned int decr_misses;
2231///   unsigned int cas_hits;
2232///   unsigned int cas_misses;
2233///   unsigned int cas_badval;
2234///   unsigned int auth_cmds;
2235///   unsigned int auth_errors;
2236///   unsigned int threads;
2237///   unsigned int conn_yields;
2238///   unsigned int listen_disabled_num;
2239///   unsigned int curr_connections;
2240///   unsigned int rejected_connections;
2241///   unsigned int total_connections;
2242///   unsigned int connection_structures;
2243///   unsigned int evictions;
2244///   unsigned int reclaimed;
2245///   unsigned int curr_items;
2246///   unsigned int total_items;
2247///   unsigned hyper bytes_read;
2248///   unsigned hyper bytes_written;
2249///   unsigned hyper bytes;
2250///   unsigned hyper limit_maxbytes;
2251/// }
2252/// ```
2253#[derive(Debug, Clone, PartialEq, Eq)]
2254#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2255pub struct MemcacheCounters {
2256    /// Number of set commands
2257    pub cmd_set: u32,
2258
2259    /// Number of touch commands
2260    pub cmd_touch: u32,
2261
2262    /// Number of flush commands
2263    pub cmd_flush: u32,
2264
2265    /// Number of get hits
2266    pub get_hits: u32,
2267
2268    /// Number of get misses
2269    pub get_misses: u32,
2270
2271    /// Number of delete hits
2272    pub delete_hits: u32,
2273
2274    /// Number of delete misses
2275    pub delete_misses: u32,
2276
2277    /// Number of increment hits
2278    pub incr_hits: u32,
2279
2280    /// Number of increment misses
2281    pub incr_misses: u32,
2282
2283    /// Number of decrement hits
2284    pub decr_hits: u32,
2285
2286    /// Number of decrement misses
2287    pub decr_misses: u32,
2288
2289    /// Number of CAS hits
2290    pub cas_hits: u32,
2291
2292    /// Number of CAS misses
2293    pub cas_misses: u32,
2294
2295    /// Number of CAS bad value errors
2296    pub cas_badval: u32,
2297
2298    /// Number of authentication commands
2299    pub auth_cmds: u32,
2300
2301    /// Number of authentication errors
2302    pub auth_errors: u32,
2303
2304    /// Number of threads
2305    pub threads: u32,
2306
2307    /// Number of connection yields
2308    pub conn_yields: u32,
2309
2310    /// Number of times listen was disabled
2311    pub listen_disabled_num: u32,
2312
2313    /// Current number of connections
2314    pub curr_connections: u32,
2315
2316    /// Number of rejected connections
2317    pub rejected_connections: u32,
2318
2319    /// Total number of connections
2320    pub total_connections: u32,
2321
2322    /// Number of connection structures
2323    pub connection_structures: u32,
2324
2325    /// Number of evictions
2326    pub evictions: u32,
2327
2328    /// Number of reclaimed items
2329    pub reclaimed: u32,
2330
2331    /// Current number of items
2332    pub curr_items: u32,
2333
2334    /// Total number of items
2335    pub total_items: u32,
2336
2337    /// Total bytes read
2338    pub bytes_read: u64,
2339
2340    /// Total bytes written
2341    pub bytes_written: u64,
2342
2343    /// Current bytes used
2344    pub bytes: u64,
2345
2346    /// Maximum bytes limit
2347    pub limit_maxbytes: u64,
2348}
2349
2350/// App Workers - Format (0,2206)
2351///
2352/// Application worker thread/process statistics
2353///
2354/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
2355///
2356/// ```text
2357/// /* Application workers */
2358/// /* opaque = counter_data; enterprise = 0; format = 2206 */
2359///
2360/// struct app_workers {
2361///     unsigned int workers_active; /* number of active workers */
2362///     unsigned int workers_idle;   /* number of idle workers */
2363///     unsigned int workers_max;    /* max number of workers */
2364///     unsigned int req_delayed;    /* requests delayed */
2365///     unsigned int req_dropped;    /* requests dropped */
2366/// }
2367/// ```
2368#[derive(Debug, Clone, PartialEq, Eq)]
2369#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2370pub struct AppWorkers {
2371    /// Number of active workers
2372    pub workers_active: u32,
2373
2374    /// Number of idle workers
2375    pub workers_idle: u32,
2376
2377    /// Maximum number of workers
2378    pub workers_max: u32,
2379
2380    /// Number of delayed requests
2381    pub req_delayed: u32,
2382
2383    /// Number of dropped requests
2384    pub req_dropped: u32,
2385}
2386
2387/// OVS DP Stats - Format (0,2207)
2388///
2389/// Open vSwitch data path statistics
2390///
2391/// # XDR Definition ([sFlow Discussion](http://blog.sflow.com/2015/01/open-vswitch-performance-monitoring.html))
2392///
2393/// ```text
2394/// /* Open vSwitch data path statistics */
2395/// /* see datapath/datapath.h */
2396/// /* opaque = counter_data; enterprise = 0; format = 2207 */
2397/// struct ovs_dp_stats {
2398///     unsigned int hits;
2399///     unsigned int misses;
2400///     unsigned int lost;
2401///     unsigned int mask_hits;
2402///     unsigned int flows;
2403///     unsigned int masks;
2404/// }
2405/// ```
2406#[derive(Debug, Clone, PartialEq, Eq)]
2407#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2408pub struct OvsDpStats {
2409    /// Number of flow table hits
2410    pub hits: u32,
2411
2412    /// Number of flow table misses
2413    pub misses: u32,
2414
2415    /// Number of lost packets
2416    pub lost: u32,
2417
2418    /// Number of mask cache hits
2419    pub mask_hits: u32,
2420
2421    /// Number of flows in the data path
2422    pub flows: u32,
2423
2424    /// Number of masks in the data path
2425    pub masks: u32,
2426}
2427
2428/// Energy Consumption - Format (0,3000)
2429///
2430/// Power consumption and energy metrics
2431///
2432/// # XDR Definition ([sFlow Discussion](https://groups.google.com/g/sflow/c/gN3nxSi2SBs))
2433///
2434/// ```text
2435/// /* Energy consumption */
2436/// /* opaque = counter_data; enterprise = 0; format = 3000 */
2437///
2438/// struct energy {
2439///     unsigned int voltage;      /* measured in mV
2440///                                   unknown = 4,294,976,295 */
2441///     unsigned int current;      /* measured in mA
2442///                                   unknown = 4,294,976,295 */
2443///     unsigned int real_power;   /* measured in mW
2444///                                   unknown = 4,294,976,295 */
2445///     int power_factor;          /* power factor
2446///                                   (expressed in 100ths of a
2447///                                   percent)
2448///                                   -10000 to 10000 for AC power
2449///                                   -2,147,483,647 for unknown AC
2450///                                   power factor
2451///                                   2,147,483,647 for DC power */
2452///     unsigned int energy;       /* energy in millijoules
2453///                                   unknown = 4,294,976,295 */
2454///     unsigned int errors;       /* count of power exceptions,
2455///                                   including:
2456///                                   over/under voltage
2457///                                   over current
2458///                                   over power
2459///                                   unknown = 4,294,976,295 */
2460/// }
2461/// ```
2462#[derive(Debug, Clone, PartialEq, Eq)]
2463#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2464pub struct Energy {
2465    /// Voltage measured in millivolts (unknown = 4,294,976,295)
2466    pub voltage: u32,
2467
2468    /// Current measured in milliamps (unknown = 4,294,976,295)
2469    pub current: u32,
2470
2471    /// Real power measured in milliwatts (unknown = 4,294,976,295)
2472    pub real_power: u32,
2473
2474    /// Power factor expressed in 100ths of a percent
2475    /// - Range: -10000 to 10000 for AC power
2476    /// - -2,147,483,647 for unknown AC power factor
2477    /// - 2,147,483,647 for DC power
2478    pub power_factor: i32,
2479
2480    /// Energy in millijoules (unknown = 4,294,976,295)
2481    pub energy: u32,
2482
2483    /// Count of power exceptions (over/under voltage, over current, over power)
2484    /// (unknown = 4,294,976,295)
2485    pub errors: u32,
2486}
2487
2488/// Temperature - Format (0,3001)
2489///
2490/// Temperature sensor readings
2491///
2492/// # XDR Definition ([sFlow Discussion](https://groups.google.com/g/sflow/c/gN3nxSi2SBs))
2493///
2494/// ```text
2495/// /* Temperature */
2496/// /* opaque = counter_data; enterprise = 0; format = 3001 */
2497///
2498/// struct temperature {
2499///     int minimum;        /* temperature reading from coolest
2500///                            thermometer
2501///                            expressed in tenths of a degree Celsius
2502///                            */
2503///     int maximum;        /* temperature reading from hottest
2504///                            thermometer
2505///                            expressed in tenths of a degree Celsius
2506///                            */
2507///     unsigned int errors; /* count of temperature exceptions */
2508/// }
2509/// ```
2510#[derive(Debug, Clone, PartialEq, Eq)]
2511#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2512pub struct Temperature {
2513    /// Temperature reading from coolest thermometer in tenths of a degree Celsius
2514    pub minimum: i32,
2515
2516    /// Temperature reading from hottest thermometer in tenths of a degree Celsius
2517    pub maximum: i32,
2518
2519    /// Count of temperature exceptions
2520    pub errors: u32,
2521}
2522
2523/// Humidity - Format (0,3002)
2524///
2525/// Relative humidity measurement
2526///
2527/// # XDR Definition ([sFlow Discussion](https://groups.google.com/g/sflow/c/gN3nxSi2SBs))
2528///
2529/// ```text
2530/// /* Humidity */
2531/// /* opaque = counter_data; enterprise = 0; format 3002 */
2532///
2533/// struct humidity {
2534///     int relative; /* relative humidity expressed as a percentage */
2535/// }
2536/// ```
2537#[derive(Debug, Clone, PartialEq, Eq)]
2538#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2539pub struct Humidity {
2540    /// Relative humidity expressed as a percentage
2541    pub relative: i32,
2542}
2543
2544/// Fans - Format (0,3003)
2545///
2546/// Cooling fan statistics
2547///
2548/// # XDR Definition ([sFlow Discussion](https://groups.google.com/g/sflow/c/gN3nxSi2SBs))
2549///
2550/// ```text
2551/// /* Cooling */
2552/// /* opaque = counter_data; enterprise = 0; format=3003 */
2553///
2554/// struct fans {
2555///     unsigned int total;  /* total fans */
2556///     unsigned int failed; /* failed fans */
2557///     unsigned int speed;  /* average fan speed expressed in percent */
2558/// }
2559/// ```
2560#[derive(Debug, Clone, PartialEq, Eq)]
2561#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2562pub struct Fans {
2563    /// Total number of fans
2564    pub total: u32,
2565
2566    /// Number of failed fans
2567    pub failed: u32,
2568
2569    /// Average fan speed expressed as a percentage
2570    pub speed: u32,
2571}
2572
2573/// Broadcom Device Buffer Utilization - Format (4413,1)
2574///
2575/// Device level buffer utilization statistics from Broadcom switch ASICs
2576///
2577/// # XDR Definition ([sFlow Broadcom Buffers](https://sflow.org/bv-sflow.txt))
2578///
2579/// ```text
2580/// /* Device level buffer utilization */
2581/// /* buffers_used metrics represent peak since last export */
2582/// /* opaque = counter_data; enterprise = 4413; format = 1 */
2583/// struct bst_device_buffers {
2584///   percentage uc_pc;  /* unicast buffers percentage utilization */
2585///   percentage mc_pc;  /* multicast buffers percentage utilization */
2586/// }
2587/// ```
2588#[derive(Debug, Clone, PartialEq, Eq)]
2589#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2590pub struct BroadcomDeviceBuffers {
2591    /// Unicast buffers percentage utilization (in hundredths of a percent, e.g., 100 = 1%)
2592    pub uc_pc: i32,
2593
2594    /// Multicast buffers percentage utilization (in hundredths of a percent, e.g., 100 = 1%)
2595    pub mc_pc: i32,
2596}
2597
2598/// Broadcom Port Buffer Utilization - Format (4413,2)
2599///
2600/// Port level buffer utilization statistics from Broadcom switch ASICs
2601///
2602/// # XDR Definition ([sFlow Broadcom Buffers](https://sflow.org/bv-sflow.txt))
2603///
2604/// ```text
2605/// /* Port level buffer utilization */
2606/// /* buffers_used metrics represent peak buffers used since last export */
2607/// /* opaque = counter_data; enterprise = 4413; format = 2 */
2608/// struct bst_port_buffers {
2609///   percentage ingress_uc_pc;         /* ingress unicast buffers utilization */
2610///   percentage ingress_mc_pc;         /* ingress multicast buffers utilization */
2611///   percentage egress_uc_pc;          /* egress unicast buffers utilization */
2612///   percentage egress_mc_pc;          /* egress multicast buffers utilization */
2613///   percentage egress_queue_uc_pc<8>; /* per egress queue unicast buffers utilization */
2614///   percentage egress_queue_mc_pc<8>; /* per egress queue multicast buffers utilization*/
2615/// }
2616/// ```
2617#[derive(Debug, Clone, PartialEq, Eq)]
2618#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2619pub struct BroadcomPortBuffers {
2620    /// Ingress unicast buffers percentage utilization (in hundredths of a percent)
2621    pub ingress_uc_pc: i32,
2622
2623    /// Ingress multicast buffers percentage utilization (in hundredths of a percent)
2624    pub ingress_mc_pc: i32,
2625
2626    /// Egress unicast buffers percentage utilization (in hundredths of a percent)
2627    pub egress_uc_pc: i32,
2628
2629    /// Egress multicast buffers percentage utilization (in hundredths of a percent)
2630    pub egress_mc_pc: i32,
2631
2632    /// Per egress queue unicast buffers percentage utilization (up to 8 queues)
2633    pub egress_queue_uc_pc: Vec<i32>,
2634
2635    /// Per egress queue multicast buffers percentage utilization (up to 8 queues)
2636    pub egress_queue_mc_pc: Vec<i32>,
2637}
2638
2639/// Broadcom Switch ASIC Table Utilization - Format (4413,3)
2640///
2641/// Table utilization statistics from Broadcom switch ASICs
2642///
2643/// # XDR Definition ([sFlow Broadcom Tables](https://sflow.org/sflow_broadcom_tables.txt))
2644///
2645/// ```text
2646/// /* Table utilizations */
2647/// /* utilization of ASIC hardware tables */
2648/// /* opaque = counter_data; enterprise = 4413; format = 3 */
2649/// struct hw_tables {
2650///   unsigned int host_entries;
2651///   unsigned int host_entries_max;
2652///   unsigned int ipv4_entries;
2653///   unsigned int ipv4_entries_max;
2654///   unsigned int ipv6_entries;
2655///   unsigned int ipv6_entries_max;
2656///   unsigned int ipv4_ipv6_entries;
2657///   unsigned int ipv6_ipv6_entries_max;
2658///   unsigned int long_ipv6_entries;
2659///   unsigned int long_ipv6_entries_max;
2660///   unsigned int total_routes;
2661///   unsigned int total_routes_max;
2662///   unsigned int ecmp_nexthops;
2663///   unsigned int ecmp_nexthops_max;
2664///   unsigned int mac_entries;
2665///   unsigned int mac_entries_max;
2666///   unsigned int ipv4_neighbors;
2667///   unsigned int ipv6_neighbors;
2668///   unsigned int ipv4_routes;
2669///   unsigned int ipv6_routes;
2670///   unsigned int acl_ingress_entries;
2671///   unsigned int acl_ingress_entries_max;
2672///   unsigned int acl_ingress_counters;
2673///   unsigned int acl_ingress_counters_max;
2674///   unsigned int acl_ingress_meters;
2675///   unsigned int acl_ingress_meters_max;
2676///   unsigned int acl_ingress_slices;
2677///   unsigned int acl_ingress_slices_max;
2678///   unsigned int acl_egress_entries;
2679///   unsigned int acl_egress_entries_max;
2680///   unsigned int acl_egress_counters;
2681///   unsigned int acl_egress_counters_max;
2682///   unsigned int acl_egress_meters;
2683///   unsigned int acl_egress_meters_max;
2684///   unsigned int acl_egress_slices;
2685///   unsigned int acl_egress_slices_max;
2686/// }
2687/// ```
2688#[derive(Debug, Clone, PartialEq, Eq)]
2689#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2690pub struct BroadcomTables {
2691    /// Number of host table entries
2692    pub host_entries: u32,
2693
2694    /// Maximum number of host table entries
2695    pub host_entries_max: u32,
2696
2697    /// Number of IPv4 routing table entries
2698    pub ipv4_entries: u32,
2699
2700    /// Maximum number of IPv4 routing table entries
2701    pub ipv4_entries_max: u32,
2702
2703    /// Number of IPv6 routing table entries
2704    pub ipv6_entries: u32,
2705
2706    /// Maximum number of IPv6 routing table entries
2707    pub ipv6_entries_max: u32,
2708
2709    /// Number of IPv4/IPv6 routing table entries
2710    pub ipv4_ipv6_entries: u32,
2711
2712    /// Maximum number of IPv6/IPv6 routing table entries
2713    pub ipv6_ipv6_entries_max: u32,
2714
2715    /// Number of long IPv6 routing table entries
2716    pub long_ipv6_entries: u32,
2717
2718    /// Maximum number of long IPv6 routing table entries
2719    pub long_ipv6_entries_max: u32,
2720
2721    /// Total number of routes
2722    pub total_routes: u32,
2723
2724    /// Maximum total number of routes
2725    pub total_routes_max: u32,
2726
2727    /// Number of ECMP nexthops
2728    pub ecmp_nexthops: u32,
2729
2730    /// Maximum number of ECMP nexthops
2731    pub ecmp_nexthops_max: u32,
2732
2733    /// Number of MAC table entries
2734    pub mac_entries: u32,
2735
2736    /// Maximum number of MAC table entries
2737    pub mac_entries_max: u32,
2738
2739    /// Number of IPv4 neighbors
2740    pub ipv4_neighbors: u32,
2741
2742    /// Number of IPv6 neighbors
2743    pub ipv6_neighbors: u32,
2744
2745    /// Number of IPv4 routes
2746    pub ipv4_routes: u32,
2747
2748    /// Number of IPv6 routes
2749    pub ipv6_routes: u32,
2750
2751    /// Number of ingress ACL entries
2752    pub acl_ingress_entries: u32,
2753
2754    /// Maximum number of ingress ACL entries
2755    pub acl_ingress_entries_max: u32,
2756
2757    /// Number of ingress ACL counters
2758    pub acl_ingress_counters: u32,
2759
2760    /// Maximum number of ingress ACL counters
2761    pub acl_ingress_counters_max: u32,
2762
2763    /// Number of ingress ACL meters
2764    pub acl_ingress_meters: u32,
2765
2766    /// Maximum number of ingress ACL meters
2767    pub acl_ingress_meters_max: u32,
2768
2769    /// Number of ingress ACL slices
2770    pub acl_ingress_slices: u32,
2771
2772    /// Maximum number of ingress ACL slices
2773    pub acl_ingress_slices_max: u32,
2774
2775    /// Number of egress ACL entries
2776    pub acl_egress_entries: u32,
2777
2778    /// Maximum number of egress ACL entries
2779    pub acl_egress_entries_max: u32,
2780
2781    /// Number of egress ACL counters
2782    pub acl_egress_counters: u32,
2783
2784    /// Maximum number of egress ACL counters
2785    pub acl_egress_counters_max: u32,
2786
2787    /// Number of egress ACL meters
2788    pub acl_egress_meters: u32,
2789
2790    /// Maximum number of egress ACL meters
2791    pub acl_egress_meters_max: u32,
2792
2793    /// Number of egress ACL slices
2794    pub acl_egress_slices: u32,
2795
2796    /// Maximum number of egress ACL slices
2797    pub acl_egress_slices_max: u32,
2798}
2799
2800/// NVIDIA GPU Statistics - Format (5703,1)
2801///
2802/// GPU performance metrics from NVIDIA Management Library (NVML)
2803///
2804/// # XDR Definition ([sFlow NVML](https://sflow.org/sflow_nvml.txt))
2805///
2806/// ```text
2807/// /* NVIDIA GPU statistics */
2808/// /* opaque = counter_data; enterprise = 5703; format = 1 */
2809/// struct nvidia_gpu {
2810///   unsigned int device_count; /* see nvmlDeviceGetCount */
2811///   unsigned int processes;    /* see nvmlDeviceGetComputeRunningProcesses */
2812///   unsigned int gpu_time;     /* total milliseconds in which one or more
2813///                                 kernels was executing on GPU
2814///                                 sum across all devices */
2815///   unsigned int mem_time;     /* total milliseconds during which global device
2816///                                 memory was being read/written
2817///                                 sum across all devices */
2818///   unsigned hyper mem_total;  /* sum of framebuffer memory across devices
2819///                                 see nvmlDeviceGetMemoryInfo */
2820///   unsigned hyper mem_free;   /* sum of free framebuffer memory across devices
2821///                                 see nvmlDeviceGetMemoryInfo */
2822///   unsigned int ecc_errors;   /* sum of volatile ECC errors across devices
2823///                                 see nvmlDeviceGetTotalEccErrors */
2824///   unsigned int energy;       /* sum of millijoules across devices
2825///                                 see nvmlDeviceGetPowerUsage */
2826///   unsigned int temperature;  /* maximum temperature in degrees Celsius
2827///                                 across devices
2828///                                 see nvmlDeviceGetTemperature */
2829///   unsigned int fan_speed;    /* maximum fan speed in percent across devices
2830///                                 see nvmlDeviceGetFanSpeed */
2831/// }
2832/// ```
2833///
2834/// **ERRATUM:** The specification uses a comma instead of a semicolon in the format comment
2835/// (`enterprise = 5703, format=1` should be `enterprise = 5703; format = 1`), which is
2836/// inconsistent with all other sFlow specifications. The corrected version is shown above.
2837#[derive(Debug, Clone, PartialEq, Eq)]
2838#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2839pub struct NvidiaGpu {
2840    /// Number of GPU devices
2841    pub device_count: u32,
2842
2843    /// Number of running compute processes
2844    pub processes: u32,
2845
2846    /// Total GPU time in milliseconds (sum across all devices)
2847    pub gpu_time: u32,
2848
2849    /// Total memory access time in milliseconds (sum across all devices)
2850    pub mem_time: u32,
2851
2852    /// Total framebuffer memory in bytes (sum across all devices)
2853    pub mem_total: u64,
2854
2855    /// Free framebuffer memory in bytes (sum across all devices)
2856    pub mem_free: u64,
2857
2858    /// Sum of volatile ECC errors across all devices
2859    pub ecc_errors: u32,
2860
2861    /// Total energy consumption in millijoules (sum across all devices)
2862    pub energy: u32,
2863
2864    /// Maximum temperature in degrees Celsius across all devices
2865    pub temperature: u32,
2866
2867    /// Maximum fan speed in percent across all devices
2868    pub fan_speed: u32,
2869}