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/// InfiniBand Counters - Format (0,9)
443///
444/// InfiniBand port statistics
445///
446/// # XDR Definition ([sFlow InfiniBand](https://sflow.org/draft_sflow_infiniband_2.txt))
447///
448/// ```text
449/// /* IB Counters */
450/// /* opaque = counter_data; enterprise = 0; format = 9 */
451///
452/// struct ib_counters {
453///    unsigned hyper PortXmitPkts; /* Total packets transmitted on all VLs */
454///    unsigned hyper PortRcvPkts;  /* Total packets (may include packets containing errors */
455///    unsigned int SymbolErrorCounter;
456///    unsigned int LinkErrorRecoveryCounter;
457///    unsigned int LinkDownedCounter;
458///    unsigned int PortRcvErrors;
459///    unsigned int PortRcvRemotePhysicalErrors;
460///    unsigned int PortRcvSwitchRelayErrors;
461///    unsigned int PortXmitDiscards;
462///    unsigned int PortXmitConstraintErrors;
463///    unsigned int PortRcvConstraintErrors;
464///    unsigned int LocalLinkIntegrityErrors;
465///    unsigned int ExcessiveBufferOverrunErrors;
466///    unsigned int VL15Dropped;
467/// }
468/// ```
469#[derive(Debug, Clone, PartialEq, Eq)]
470#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
471pub struct InfiniBandCounters {
472    /// Total packets transmitted on all virtual lanes
473    pub port_xmit_pkts: u64,
474
475    /// Total packets received (may include packets containing errors)
476    pub port_rcv_pkts: u64,
477
478    /// Symbol error counter
479    pub symbol_error_counter: u32,
480
481    /// Link error recovery counter
482    pub link_error_recovery_counter: u32,
483
484    /// Link downed counter
485    pub link_downed_counter: u32,
486
487    /// Port receive errors
488    pub port_rcv_errors: u32,
489
490    /// Port receive remote physical errors
491    pub port_rcv_remote_physical_errors: u32,
492
493    /// Port receive switch relay errors
494    pub port_rcv_switch_relay_errors: u32,
495
496    /// Port transmit discards
497    pub port_xmit_discards: u32,
498
499    /// Port transmit constraint errors
500    pub port_xmit_constraint_errors: u32,
501
502    /// Port receive constraint errors
503    pub port_rcv_constraint_errors: u32,
504
505    /// Local link integrity errors
506    pub local_link_integrity_errors: u32,
507
508    /// Excessive buffer overrun errors
509    pub excessive_buffer_overrun_errors: u32,
510
511    /// VL15 dropped packets
512    pub vl15_dropped: u32,
513}
514
515/// Optical Lane - Format (0,10)
516///
517/// Optical lane statistics for a single lane within an optical module
518///
519/// # XDR Definition ([sFlow Optics](https://sflow.org/sflow_optics.txt))
520///
521/// ```text
522/// struct lane {
523///   unsigned int index; /* 1-based index of lane within module, 0=unknown */
524///   unsigned int tx_bias_current; /* microamps */
525///   unsigned int tx_power;        /* microwatts */
526///   unsigned int tx_power_min;    /* microwatts */
527///   unsigned int tx_power_max;    /* microwatts */
528///   unsigned int tx_wavelength;   /* nanometers */
529///   unsigned int rx_power;        /* microwatts */
530///   unsigned int rx_power_min;    /* microwatts */
531///   unsigned int rx_power_max;    /* microwatts */
532///   unsigned int rx_wavelength;   /* nanometers */
533/// }
534/// ```
535#[derive(Debug, Clone, PartialEq, Eq)]
536#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
537pub struct Lane {
538    /// 1-based index of lane within module, 0=unknown
539    pub index: u32,
540
541    /// Transmit bias current in microamps
542    pub tx_bias_current: u32,
543
544    /// Transmit power in microwatts
545    pub tx_power: u32,
546
547    /// Minimum transmit power in microwatts
548    pub tx_power_min: u32,
549
550    /// Maximum transmit power in microwatts
551    pub tx_power_max: u32,
552
553    /// Transmit wavelength in nanometers
554    pub tx_wavelength: u32,
555
556    /// Receive power in microwatts
557    pub rx_power: u32,
558
559    /// Minimum receive power in microwatts
560    pub rx_power_min: u32,
561
562    /// Maximum receive power in microwatts
563    pub rx_power_max: u32,
564
565    /// Receive wavelength in nanometers
566    pub rx_wavelength: u32,
567}
568
569/// Optical SFP/QSFP Counters - Format (0,10)
570///
571/// Optical interface module statistics for pluggable optical modules (SFP, QSFP, etc.)
572///
573/// # XDR Definition ([sFlow Optics](https://sflow.org/sflow_optics.txt))
574///
575/// ```text
576/// /* Optical SFP / QSFP metrics */
577/// /* opaque = counter_data; enterprise=0; format=10 */
578/// struct sfp {
579///   unsigned int module_id;
580///   unsigned int module_num_lanes;      /* total number of lanes in module */
581///   unsigned int module_supply_voltage; /* millivolts */
582///   int module_temperature;             /* thousandths of a degree Celsius */
583///   lane<> lanes;
584/// }
585/// ```
586#[derive(Debug, Clone, PartialEq, Eq)]
587#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
588pub struct OpticalSfpQsfp {
589    /// Module identifier (ifIndex of module or lowest ifIndex of ports sharing module)
590    pub module_id: u32,
591
592    /// Total number of lanes in module
593    pub module_num_lanes: u32,
594
595    /// Module supply voltage in millivolts
596    pub module_supply_voltage: u32,
597
598    /// Module temperature in thousandths of a degree Celsius
599    pub module_temperature: i32,
600
601    /// Array of optical lane statistics
602    pub lanes: Vec<Lane>,
603}
604
605/// Processor Counters - Format (0,1001)
606///
607/// CPU and memory utilization
608///
609/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
610///
611/// ```text
612/// /* Processor Information */
613/// /* opaque = counter_data; enterprise = 0; format = 1001 */
614///
615/// struct processor {
616///     percentage 5s_cpu;          /* 5 second average CPU utilization */
617///     percentage 1m_cpu;          /* 1 minute average CPU utilization */
618///     percentage 5m_cpu;          /* 5 minute average CPU utilization */
619///     unsigned hyper total_memory; /* total memory (in bytes) */
620///     unsigned hyper free_memory;  /* free memory (in bytes) */
621/// }
622/// ```
623///
624/// **ERRATUM:** The specification is missing semicolons after `total_memory` and `free_memory`,
625/// violating RFC 4506 XDR syntax requirements. The corrected version is shown above.
626#[derive(Debug, Clone, PartialEq, Eq)]
627#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
628pub struct ProcessorCounters {
629    /// 5 second average CPU utilization (0-100%) (spec: 5s_cpu)
630    pub cpu_5s: u32,
631
632    /// 1 minute average CPU utilization (0-100%) (spec: 1m_cpu)
633    pub cpu_1m: u32,
634
635    /// 5 minute average CPU utilization (0-100%) (spec: 5m_cpu)
636    pub cpu_5m: u32,
637
638    /// Total memory in bytes
639    pub total_memory: u64,
640
641    /// Free memory in bytes
642    pub free_memory: u64,
643}
644
645/// Radio Utilization - Format (0,1002)
646///
647/// 802.11 radio channel utilization
648///
649/// # XDR Definition ([sFlow 802.11](https://sflow.org/sflow_80211.txt))
650///
651/// ```text
652/// /* 802.11 radio utilization */
653/// /* opaque = counter_data; enterprise = 0; format = 1002 */
654///
655/// struct radio_utilization {
656///     unsigned int elapsed_time;        /* Elapsed time in ms */
657///     unsigned int on_channel_time;     /* Time on assigned channel */
658///     unsigned int on_channel_busy_time;/* Time busy on channel */
659/// }
660/// ```
661#[derive(Debug, Clone, PartialEq, Eq)]
662#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
663pub struct RadioUtilization {
664    /// Elapsed time in milliseconds
665    pub elapsed_time: u32,
666
667    /// On channel time
668    pub on_channel_time: u32,
669
670    /// On channel busy time
671    pub on_channel_busy_time: u32,
672}
673
674/// OpenFlow Port - Format (0,1004)
675///
676/// OpenFlow port statistics
677///
678/// # XDR Definition ([sFlow OpenFlow](https://sflow.org/sflow_openflow.txt))
679///
680/// ```text
681/// /* OpenFlow port */
682/// /* opaque = counter_data; enterprise = 0; format = 1004 */
683///
684/// struct of_port {
685///     unsigned hyper datapath_id;
686///     unsigned int port_no;
687/// }
688/// ```
689#[derive(Debug, Clone, PartialEq, Eq)]
690#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
691pub struct OpenFlowPort {
692    /// Datapath ID
693    pub datapath_id: u64,
694
695    /// Port number
696    pub port_no: u32,
697}
698
699/// OpenFlow Port Name - Format (0,1005)
700///
701/// OpenFlow port name string
702///
703/// # XDR Definition ([sFlow OpenFlow](https://sflow.org/sflow_openflow.txt))
704///
705/// ```text
706/// /* Port name */
707/// /* opaque = counter_data; enterprise = 0; format = 1005 */
708///
709/// struct port_name {
710///     string name<>;
711/// }
712/// ```
713#[derive(Debug, Clone, PartialEq, Eq)]
714#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
715pub struct OpenFlowPortName {
716    /// Port name
717    pub port_name: String,
718}
719
720/// Machine Type enumeration
721///
722/// Processor family types as defined in sFlow v5 specification
723///
724/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
725///
726/// ```text
727/// enum machine_type {
728///    unknown = 0,
729///    other   = 1,
730///    x86     = 2,
731///    x86_64  = 3,
732///    ia64    = 4,
733///    sparc   = 5,
734///    alpha   = 6,
735///    powerpc = 7,
736///    m68k    = 8,
737///    mips    = 9,
738///    arm     = 10,
739///    hppa    = 11,
740///    s390    = 12
741/// }
742/// ```
743#[derive(Debug, Clone, Copy, PartialEq, Eq)]
744#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
745#[repr(u32)]
746pub enum MachineType {
747    Unknown = 0,
748    Other = 1,
749    X86 = 2,
750    X86_64 = 3,
751    Ia64 = 4,
752    Sparc = 5,
753    Alpha = 6,
754    Powerpc = 7,
755    M68k = 8,
756    Mips = 9,
757    Arm = 10,
758    Hppa = 11,
759    S390 = 12,
760}
761
762impl From<u32> for MachineType {
763    fn from(value: u32) -> Self {
764        match value {
765            0 => MachineType::Unknown,
766            1 => MachineType::Other,
767            2 => MachineType::X86,
768            3 => MachineType::X86_64,
769            4 => MachineType::Ia64,
770            5 => MachineType::Sparc,
771            6 => MachineType::Alpha,
772            7 => MachineType::Powerpc,
773            8 => MachineType::M68k,
774            9 => MachineType::Mips,
775            10 => MachineType::Arm,
776            11 => MachineType::Hppa,
777            12 => MachineType::S390,
778            _ => MachineType::Unknown,
779        }
780    }
781}
782
783/// Operating System Name enumeration
784///
785/// OS types as defined in sFlow v5 specification
786///
787/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
788///
789/// ```text
790/// enum os_name {
791///    unknown   = 0,
792///    other     = 1,
793///    linux     = 2,
794///    windows   = 3,
795///    darwin    = 4,
796///    hpux      = 5,
797///    aix       = 6,
798///    dragonfly = 7,
799///    freebsd   = 8,
800///    netbsd    = 9,
801///    openbsd   = 10,
802///    osf       = 11,
803///    solaris   = 12
804/// }
805/// ```
806///
807/// **Note:** The enumeration may be expanded over time. Applications receiving
808/// sFlow must be prepared to receive host_descr structures with unknown os_name values.
809#[derive(Debug, Clone, Copy, PartialEq, Eq)]
810#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
811#[repr(u32)]
812pub enum OsName {
813    Unknown = 0,
814    Other = 1,
815    Linux = 2,
816    Windows = 3,
817    Darwin = 4,
818    Hpux = 5,
819    Aix = 6,
820    Dragonfly = 7,
821    Freebsd = 8,
822    Netbsd = 9,
823    Openbsd = 10,
824    Osf = 11,
825    Solaris = 12,
826}
827
828impl From<u32> for OsName {
829    fn from(value: u32) -> Self {
830        match value {
831            0 => OsName::Unknown,
832            1 => OsName::Other,
833            2 => OsName::Linux,
834            3 => OsName::Windows,
835            4 => OsName::Darwin,
836            5 => OsName::Hpux,
837            6 => OsName::Aix,
838            7 => OsName::Dragonfly,
839            8 => OsName::Freebsd,
840            9 => OsName::Netbsd,
841            10 => OsName::Openbsd,
842            11 => OsName::Osf,
843            12 => OsName::Solaris,
844            _ => OsName::Unknown,
845        }
846    }
847}
848
849/// Host Description - Format (0,2000)
850///
851/// Physical or virtual host description
852///
853/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
854///
855/// ```text
856/// /* Physical or virtual host description */
857/// /* opaque = counter_data; enterprise = 0; format = 2000 */
858///
859/// struct host_descr {
860///    string hostname<64>;       /* hostname, empty if unknown */
861///    opaque uuid<16>;           /* 16 bytes binary UUID, empty if unknown */
862///    machine_type machine_type; /* the processor family */
863///    os_name os_name;           /* Operating system */
864///    string os_release<32>;     /* e.g. 2.6.9-42.ELsmp,xp-sp3, empty if unknown */
865/// }
866/// ```
867///
868/// **ERRATUM:** UUID field changed from `opaque uuid<16>` to `opaque uuid[16]` (fixed array).
869#[derive(Debug, Clone, PartialEq, Eq)]
870#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
871pub struct HostDescription {
872    /// Hostname
873    pub hostname: String,
874
875    /// UUID (16 bytes)
876    /// **ERRATUM:** All zeros if unknown (changed from variable-length to fixed-length array)
877    pub uuid: [u8; 16],
878
879    /// Machine type (processor family)
880    pub machine_type: MachineType,
881
882    /// Operating system name
883    pub os_name: OsName,
884
885    /// OS release (e.g., "5.10.0")
886    pub os_release: String,
887}
888
889/// Host Adapters - Format (0,2001)
890///
891/// Set of network adapters associated with entity
892///
893/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
894///
895/// ```text
896/// /* Set of adapters associated with entity */
897/// /* opaque = counter_data; enterprise = 0; format = 2001 */
898///
899/// struct host_adapters {
900///     adapter adapters<>; /* adapter(s) associated with entity */
901/// }
902/// ```
903#[derive(Debug, Clone, PartialEq, Eq)]
904#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
905pub struct HostAdapters {
906    /// Adapters
907    pub adapters: Vec<HostAdapter>,
908}
909
910#[derive(Debug, Clone, PartialEq, Eq)]
911#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
912pub struct HostAdapter {
913    /// Interface index
914    pub if_index: u32,
915
916    /// MAC addresses
917    pub mac_addresses: Vec<crate::models::MacAddress>,
918}
919
920/// Host Parent - Format (0,2002)
921///
922/// Containment hierarchy between logical and physical entities
923///
924/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
925///
926/// ```text
927/// /* Define containment hierarchy */
928/// /* opaque = counter_data; enterprise = 0; format = 2002 */
929///
930/// struct host_parent {
931///     unsigned int container_type;  /* sFlowDataSource type */
932///     unsigned int container_index; /* sFlowDataSource index */
933/// }
934/// ```
935#[derive(Debug, Clone, PartialEq, Eq)]
936#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
937pub struct HostParent {
938    /// Container type (e.g., "docker", "lxc")
939    pub container_type: u32,
940
941    /// Container index
942    pub container_index: u32,
943}
944
945/// Host CPU - Format (0,2003)
946///
947/// Physical server CPU statistics
948///
949/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
950///
951/// ```text
952/// /* Physical Server CPU */
953/// /* opaque = counter_data; enterprise = 0; format = 2003 */
954///
955/// struct host_cpu {
956///     float load_one;          /* 1 minute load avg */
957///     float load_five;         /* 5 minute load avg */
958///     float load_fifteen;      /* 15 minute load avg */
959///     unsigned int proc_run;   /* running processes */
960///     unsigned int proc_total; /* total processes */
961///     unsigned int cpu_num;    /* number of CPUs */
962///     unsigned int cpu_speed;  /* CPU speed in MHz */
963///     unsigned int uptime;     /* seconds since last reboot */
964///     unsigned int cpu_user;   /* user time (ms) */
965///     unsigned int cpu_nice;   /* nice time (ms) */
966///     unsigned int cpu_system; /* system time (ms) */
967///     unsigned int cpu_idle;   /* idle time (ms) */
968///     unsigned int cpu_wio;    /* I/O wait time (ms) */
969///     unsigned int cpu_intr;   /* interrupt time (ms) */
970///     unsigned int cpu_sintr;  /* soft interrupt time (ms) */
971///     unsigned int interrupts; /* interrupt count */
972///     unsigned int contexts;   /* context switch count */
973/// }
974/// ```
975#[derive(Debug, Clone, PartialEq, Eq)]
976#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
977pub struct HostCpu {
978    /// Load average (1 minute) - stored as hundredths (multiply by 100)
979    pub load_one: u32,
980
981    /// Load average (5 minutes) - stored as hundredths (multiply by 100)
982    pub load_five: u32,
983
984    /// Load average (15 minutes) - stored as hundredths (multiply by 100)
985    pub load_fifteen: u32,
986
987    /// Number of running processes
988    pub proc_run: u32,
989
990    /// Total number of processes
991    pub proc_total: u32,
992
993    /// Number of CPUs
994    pub cpu_num: u32,
995
996    /// CPU speed in MHz
997    pub cpu_speed: u32,
998
999    /// CPU uptime in seconds
1000    pub uptime: u32,
1001
1002    /// CPU time in user mode (ms)
1003    pub cpu_user: u32,
1004
1005    /// CPU time in nice mode (ms)
1006    pub cpu_nice: u32,
1007
1008    /// CPU time in system mode (ms)
1009    pub cpu_system: u32,
1010
1011    /// CPU idle time (ms)
1012    pub cpu_idle: u32,
1013
1014    /// CPU time waiting for I/O (ms)
1015    pub cpu_wio: u32,
1016
1017    /// CPU time servicing interrupts (ms)
1018    pub cpu_intr: u32,
1019
1020    /// CPU time servicing soft interrupts (ms)
1021    pub cpu_sintr: u32,
1022
1023    /// Number of interrupts
1024    pub interrupts: u32,
1025
1026    /// Number of context switches
1027    pub contexts: u32,
1028}
1029
1030/// Host Memory - Format (0,2004)
1031///
1032/// Physical server memory statistics
1033///
1034/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1035///
1036/// ```text
1037/// /* Physical Server Memory */
1038/// /* opaque = counter_data; enterprise = 0; format = 2004 */
1039///
1040/// struct host_memory {
1041///     unsigned hyper mem_total;   /* total bytes */
1042///     unsigned hyper mem_free;    /* free bytes */
1043///     unsigned hyper mem_shared;  /* shared bytes */
1044///     unsigned hyper mem_buffers; /* buffers bytes */
1045///     unsigned hyper mem_cached;  /* cached bytes */
1046///     unsigned hyper swap_total;  /* swap total bytes */
1047///     unsigned hyper swap_free;   /* swap free bytes */
1048///     unsigned int page_in;       /* page in count */
1049///     unsigned int page_out;      /* page out count */
1050///     unsigned int swap_in;       /* swap in count */
1051///     unsigned int swap_out;      /* swap out count */
1052/// }
1053/// ```
1054#[derive(Debug, Clone, PartialEq, Eq)]
1055#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1056pub struct HostMemory {
1057    /// Total memory in bytes
1058    pub mem_total: u64,
1059
1060    /// Free memory in bytes
1061    pub mem_free: u64,
1062
1063    /// Shared memory in bytes
1064    pub mem_shared: u64,
1065
1066    /// Memory used for buffers in bytes
1067    pub mem_buffers: u64,
1068
1069    /// Memory used for cache in bytes
1070    pub mem_cached: u64,
1071
1072    /// Total swap space in bytes
1073    pub swap_total: u64,
1074
1075    /// Free swap space in bytes
1076    pub swap_free: u64,
1077
1078    /// Page in count
1079    pub page_in: u32,
1080
1081    /// Page out count
1082    pub page_out: u32,
1083
1084    /// Swap in count
1085    pub swap_in: u32,
1086
1087    /// Swap out count
1088    pub swap_out: u32,
1089}
1090
1091/// Host Disk I/O - Format (0,2005)
1092///
1093/// Physical server disk I/O statistics
1094///
1095/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1096///
1097/// ```text
1098/// /* Physical Server Disk I/O */
1099/// /* opaque = counter_data; enterprise = 0; format = 2005 */
1100///
1101/// struct host_disk_io {
1102///     unsigned hyper disk_total;    /* total disk size in bytes */
1103///     unsigned hyper disk_free;     /* total disk free in bytes */
1104///     percentage part_max_used;     /* utilization of most utilized partition */
1105///     unsigned int reads;           /* reads issued */
1106///     unsigned hyper bytes_read;    /* bytes read */
1107///     unsigned int read_time;       /* read time (ms) */
1108///     unsigned int writes;          /* writes completed */
1109///     unsigned hyper bytes_written; /* bytes written */
1110///     unsigned int write_time;      /* write time (ms) */
1111/// }
1112/// ```
1113#[derive(Debug, Clone, PartialEq, Eq)]
1114#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1115pub struct HostDiskIo {
1116    /// Total disk capacity in bytes
1117    pub disk_total: u64,
1118
1119    /// Free disk space in bytes
1120    pub disk_free: u64,
1121
1122    /// Percentage of disk used (in hundredths of a percent, e.g., 100 = 1%)
1123    pub part_max_used: i32,
1124
1125    /// Number of disk reads
1126    pub reads: u32,
1127
1128    /// Bytes read from disk
1129    pub bytes_read: u64,
1130
1131    /// Read time in milliseconds
1132    pub read_time: u32,
1133
1134    /// Number of disk writes
1135    pub writes: u32,
1136
1137    /// Bytes written to disk
1138    pub bytes_written: u64,
1139
1140    /// Write time in milliseconds
1141    pub write_time: u32,
1142}
1143
1144/// Host Network I/O - Format (0,2006)
1145///
1146/// Physical server network I/O statistics
1147///
1148/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1149///
1150/// ```text
1151/// /* Physical Server Network I/O */
1152/// /* opaque = counter_data; enterprise = 0; format = 2006 */
1153///
1154/// struct host_net_io {
1155///     unsigned hyper bytes_in;  /* total bytes in */
1156///     unsigned int pkts_in;     /* total packets in */
1157///     unsigned int errs_in;     /* total errors in */
1158///     unsigned int drops_in;    /* total drops in */
1159///     unsigned hyper bytes_out; /* total bytes out */
1160///     unsigned int packets_out; /* total packets out */
1161///     unsigned int errs_out;    /* total errors out */
1162///     unsigned int drops_out;   /* total drops out */
1163/// }
1164/// ```
1165#[derive(Debug, Clone, PartialEq, Eq)]
1166#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1167pub struct HostNetIo {
1168    /// Bytes received
1169    pub bytes_in: u64,
1170
1171    /// Packets received
1172    pub pkts_in: u32,
1173
1174    /// Receive errors
1175    pub errs_in: u32,
1176
1177    /// Receive drops
1178    pub drops_in: u32,
1179
1180    /// Bytes transmitted
1181    pub bytes_out: u64,
1182
1183    /// Packets transmitted
1184    pub packets_out: u32,
1185
1186    /// Transmit errors
1187    pub errs_out: u32,
1188
1189    /// Transmit drops
1190    pub drops_out: u32,
1191}
1192
1193/// MIB-2 IP Group - Format (0,2007)
1194///
1195/// IP protocol statistics from MIB-II
1196///
1197/// # XDR Definition ([sFlow Host TCP/IP](https://sflow.org/sflow_host_ip.txt))
1198///
1199/// ```text
1200/// /* IP Group - see MIB-II */
1201/// /* opaque = counter_data; enterprise = 0; format = 2007 */
1202///
1203/// struct mib2_ip_group {
1204///   unsigned int ipForwarding;
1205///   unsigned int ipDefaultTTL;
1206///   unsigned int ipInReceives;
1207///   unsigned int ipInHdrErrors;
1208///   unsigned int ipInAddrErrors;
1209///   unsigned int ipForwDatagrams;
1210///   unsigned int ipInUnknownProtos;
1211///   unsigned int ipInDiscards;
1212///   unsigned int ipInDelivers;
1213///   unsigned int ipOutRequests;
1214///   unsigned int ipOutDiscards;
1215///   unsigned int ipOutNoRoutes;
1216///   unsigned int ipReasmTimeout;
1217///   unsigned int ipReasmReqds;
1218///   unsigned int ipReasmOKs;
1219///   unsigned int ipReasmFails;
1220///   unsigned int ipFragOKs;
1221///   unsigned int ipFragFails;
1222///   unsigned int ipFragCreates;
1223/// }
1224/// ```
1225#[derive(Debug, Clone, PartialEq, Eq)]
1226#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1227pub struct Mib2IpGroup {
1228    pub ip_forwarding: u32,
1229    pub ip_default_ttl: u32,
1230    pub ip_in_receives: u32,
1231    pub ip_in_hdr_errors: u32,
1232    pub ip_in_addr_errors: u32,
1233    pub ip_forw_datagrams: u32,
1234    pub ip_in_unknown_protos: u32,
1235    pub ip_in_discards: u32,
1236    pub ip_in_delivers: u32,
1237    pub ip_out_requests: u32,
1238    pub ip_out_discards: u32,
1239    pub ip_out_no_routes: u32,
1240    pub ip_reasm_timeout: u32,
1241    pub ip_reasm_reqds: u32,
1242    pub ip_reasm_oks: u32,
1243    pub ip_reasm_fails: u32,
1244    pub ip_frag_oks: u32,
1245    pub ip_frag_fails: u32,
1246    pub ip_frag_creates: u32,
1247}
1248
1249/// MIB-2 ICMP Group - Format (0,2008)
1250///
1251/// ICMP protocol statistics from MIB-II
1252///
1253/// # XDR Definition ([sFlow Host TCP/IP](https://sflow.org/sflow_host_ip.txt))
1254///
1255/// ```text
1256/// /* ICMP Group - see MIB-II */
1257/// /* opaque = counter_data; enterprise = 0; format = 2008 */
1258///
1259/// struct mib2_icmp_group {
1260///   unsigned int icmpInMsgs;
1261///   unsigned int icmpInErrors;
1262///   unsigned int icmpInDestUnreachs;
1263///   unsigned int icmpInTimeExcds;
1264///   unsigned int icmpInParamProbs;
1265///   unsigned int icmpInSrcQuenchs;
1266///   unsigned int icmpInRedirects;
1267///   unsigned int icmpInEchos;
1268///   unsigned int icmpInEchoReps;
1269///   unsigned int icmpInTimestamps;
1270///   unsigned int icmpInAddrMasks;
1271///   unsigned int icmpInAddrMaskReps;
1272///   unsigned int icmpOutMsgs;
1273///   unsigned int icmpOutErrors;
1274///   unsigned int icmpOutDestUnreachs;
1275///   unsigned int icmpOutTimeExcds;
1276///   unsigned int icmpOutParamProbs;
1277///   unsigned int icmpOutSrcQuenchs;
1278///   unsigned int icmpOutRedirects;
1279///   unsigned int icmpOutEchos;
1280///   unsigned int icmpOutEchoReps;
1281///   unsigned int icmpOutTimestamps;
1282///   unsigned int icmpOutTimestampReps;
1283///   unsigned int icmpOutAddrMasks;
1284///   unsigned int icmpOutAddrMaskReps;
1285/// }
1286/// ```
1287#[derive(Debug, Clone, PartialEq, Eq)]
1288#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1289pub struct Mib2IcmpGroup {
1290    pub icmp_in_msgs: u32,
1291    pub icmp_in_errors: u32,
1292    pub icmp_in_dest_unreachs: u32,
1293    pub icmp_in_time_excds: u32,
1294    pub icmp_in_param_probs: u32,
1295    pub icmp_in_src_quenchs: u32,
1296    pub icmp_in_redirects: u32,
1297    pub icmp_in_echos: u32,
1298    pub icmp_in_echo_reps: u32,
1299    pub icmp_in_timestamps: u32,
1300    pub icmp_in_addr_masks: u32,
1301    pub icmp_in_addr_mask_reps: u32,
1302    pub icmp_out_msgs: u32,
1303    pub icmp_out_errors: u32,
1304    pub icmp_out_dest_unreachs: u32,
1305    pub icmp_out_time_excds: u32,
1306    pub icmp_out_param_probs: u32,
1307    pub icmp_out_src_quenchs: u32,
1308    pub icmp_out_redirects: u32,
1309    pub icmp_out_echos: u32,
1310    pub icmp_out_echo_reps: u32,
1311    pub icmp_out_timestamps: u32,
1312    pub icmp_out_timestamp_reps: u32,
1313    pub icmp_out_addr_masks: u32,
1314    pub icmp_out_addr_mask_reps: u32,
1315}
1316
1317/// MIB-2 TCP Group - Format (0,2009)
1318///
1319/// TCP protocol statistics from MIB-II
1320///
1321/// # XDR Definition ([sFlow Host TCP/IP](https://sflow.org/sflow_host_ip.txt))
1322///
1323/// ```text
1324/// /* TCP Group - see MIB-II */
1325/// /* opaque = counter_data; enterprise = 0; format = 2009 */
1326///
1327/// struct mib2_tcp_group {
1328///   unsigned int tcpRtoAlgorithm;
1329///   unsigned int tcpRtoMin;
1330///   unsigned int tcpRtoMax;
1331///   unsigned int tcpMaxConn;
1332///   unsigned int tcpActiveOpens;
1333///   unsigned int tcpPassiveOpens;
1334///   unsigned int tcpAttemptFails;
1335///   unsigned int tcpEstabResets;
1336///   unsigned int tcpCurrEstab;
1337///   unsigned int tcpInSegs;
1338///   unsigned int tcpOutSegs;
1339///   unsigned int tcpRetransSegs;
1340///   unsigned int tcpInErrs;
1341///   unsigned int tcpOutRsts;
1342///   unsigned int tcpInCsumErrs;
1343/// }
1344/// ```
1345#[derive(Debug, Clone, PartialEq, Eq)]
1346#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1347pub struct Mib2TcpGroup {
1348    pub tcp_rto_algorithm: u32,
1349    pub tcp_rto_min: u32,
1350    pub tcp_rto_max: u32,
1351    pub tcp_max_conn: u32,
1352    pub tcp_active_opens: u32,
1353    pub tcp_passive_opens: u32,
1354    pub tcp_attempt_fails: u32,
1355    pub tcp_estab_resets: u32,
1356    pub tcp_curr_estab: u32,
1357    pub tcp_in_segs: u32,
1358    pub tcp_out_segs: u32,
1359    pub tcp_retrans_segs: u32,
1360    pub tcp_in_errs: u32,
1361    pub tcp_out_rsts: u32,
1362    pub tcp_in_csum_errs: u32,
1363}
1364
1365/// MIB-2 UDP Group - Format (0,2010)
1366///
1367/// UDP protocol statistics from MIB-II
1368///
1369/// # XDR Definition ([sFlow Host TCP/IP](https://sflow.org/sflow_host_ip.txt))
1370///
1371/// ```text
1372/// /* UDP Group - see MIB-II */
1373/// /* opaque = counter_data; enterprise = 0; format = 2010 */
1374///
1375/// struct mib2_udp_group {
1376///   unsigned int udpInDatagrams;
1377///   unsigned int udpNoPorts;
1378///   unsigned int udpInErrors;
1379///   unsigned int udpOutDatagrams;
1380///   unsigned int udpRcvbufErrors;
1381///   unsigned int udpSndbufErrors;
1382///   unsigned int udpInCsumErrors;
1383/// }
1384/// ```
1385#[derive(Debug, Clone, PartialEq, Eq)]
1386#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1387pub struct Mib2UdpGroup {
1388    pub udp_in_datagrams: u32,
1389    pub udp_no_ports: u32,
1390    pub udp_in_errors: u32,
1391    pub udp_out_datagrams: u32,
1392    pub udp_rcvbuf_errors: u32,
1393    pub udp_sndbuf_errors: u32,
1394    pub udp_in_csum_errors: u32,
1395}
1396
1397/// Virtual Node - Format (0,2100)
1398///
1399/// Hypervisor statistics
1400///
1401/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1402///
1403/// ```text
1404/// /* Virtual Node Statistics */
1405/// /* opaque = counter_data; enterprise = 0; format = 2100 */
1406///
1407/// struct virt_node {
1408///     unsigned int mhz;           /* expected CPU frequency */
1409///     unsigned int cpus;          /* number of active CPUs */
1410///     unsigned hyper memory;      /* memory size in bytes */
1411///     unsigned hyper memory_free; /* unassigned memory in bytes */
1412///     unsigned int num_domains;   /* number of active domains */
1413/// }
1414/// ```
1415#[derive(Debug, Clone, PartialEq, Eq)]
1416#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1417pub struct VirtualNode {
1418    /// Expected CPU frequency in MHz
1419    pub mhz: u32,
1420
1421    /// Number of active CPUs
1422    pub cpus: u32,
1423
1424    /// Memory size in bytes
1425    pub memory: u64,
1426
1427    /// Unassigned memory in bytes
1428    pub memory_free: u64,
1429
1430    /// Number of active domains
1431    pub num_domains: u32,
1432}
1433
1434/// Virtual CPU - Format (0,2101)
1435///
1436/// Virtual domain CPU statistics
1437///
1438/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1439///
1440/// ```text
1441/// /* Virtual Domain CPU statistics */
1442/// /* See libvirt, struct virDomainInfo */
1443/// /* opaque = counter_data; enterprise = 0; format = 2101 */
1444///
1445/// struct virt_cpu {
1446///     unsigned int state;    /* virtDomainState */
1447///     unsigned int cpuTime;  /* CPU time used (ms) */
1448///     unsigned int nrVirtCpu;/* number of virtual CPUs */
1449/// }
1450/// ```
1451///
1452/// **ERRATUM:** Comment reference corrected from `virtDomainInfo` to `virDomainInfo`.
1453#[derive(Debug, Clone, PartialEq, Eq)]
1454#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1455pub struct VirtualCpu {
1456    /// CPU state (0=running, 1=idle, 2=blocked)
1457    pub state: u32,
1458
1459    /// CPU time in milliseconds
1460    pub cpu_time: u32,
1461
1462    /// Number of virtual CPUs
1463    pub nr_virt_cpu: u32,
1464}
1465
1466/// Virtual Memory - Format (0,2102)
1467///
1468/// Virtual domain memory statistics
1469///
1470/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1471///
1472/// ```text
1473/// /* Virtual Domain Memory statistics */
1474/// /* See libvirt, struct virDomainInfo */
1475/// /* opaque = counter_data; enterprise = 0; format = 2102 */
1476///
1477/// struct virt_memory {
1478///     unsigned hyper memory;    /* memory in bytes used by domain */
1479///     unsigned hyper maxMemory; /* memory in bytes allowed */
1480/// }
1481/// ```
1482///
1483/// **ERRATUM:** Comment reference corrected from `virtDomainInfo` to `virDomainInfo`.
1484#[derive(Debug, Clone, PartialEq, Eq)]
1485#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1486pub struct VirtualMemory {
1487    /// Memory in bytes
1488    pub memory: u64,
1489
1490    /// Maximum memory in bytes
1491    pub max_memory: u64,
1492}
1493
1494/// Virtual Disk I/O - Format (0,2103)
1495///
1496/// Virtual domain disk statistics
1497///
1498/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1499///
1500/// ```text
1501/// /* Virtual Domain Disk statistics */
1502/// /* See libvirt, struct virDomainBlockInfo */
1503/// /* See libvirt, struct virDomainBlockStatsStruct */
1504/// /* opaque = counter_data; enterprise = 0; format = 2103 */
1505///
1506/// struct virt_disk_io {
1507///     unsigned hyper capacity;   /* logical size in bytes */
1508///     unsigned hyper allocation; /* current allocation in bytes */
1509///     unsigned hyper physical;   /* physical size in bytes of the container of the backing image */
1510///     unsigned int rd_req;       /* number of read requests */
1511///     unsigned hyper rd_bytes;   /* number of read bytes */
1512///     unsigned int wr_req;       /* number of write requests */
1513///     unsigned hyper wr_bytes;   /* number of written bytes */
1514///     unsigned int errs;         /* read/write errors */
1515/// }
1516/// ```
1517///
1518/// **ERRATUM:** Field name changed from `available` to `physical`, and comment references corrected
1519/// from `virtDomainBlockInfo`/`virtDomainBlockStatsStruct` to `virDomainBlockInfo`/`virDomainBlockStatsStruct`.
1520#[derive(Debug, Clone, PartialEq, Eq)]
1521#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1522pub struct VirtualDiskIo {
1523    /// Capacity in bytes
1524    pub capacity: u64,
1525
1526    /// Allocation in bytes
1527    pub allocation: u64,
1528
1529    /// Physical size in bytes of the container of the backing image (spec: physical)
1530    /// **ERRATUM:** Field renamed from `available` (remaining free bytes) to `physical`
1531    pub available: u64,
1532
1533    /// Read requests
1534    pub rd_req: u32,
1535
1536    /// Bytes read
1537    pub rd_bytes: u64,
1538
1539    /// Write requests
1540    pub wr_req: u32,
1541
1542    /// Bytes written
1543    pub wr_bytes: u64,
1544
1545    /// Errors
1546    pub errs: u32,
1547}
1548
1549/// Virtual Network I/O - Format (0,2104)
1550///
1551/// Virtual domain network statistics
1552///
1553/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1554///
1555/// ```text
1556/// /* Virtual Domain Network statistics */
1557/// /* See libvirt, struct virDomainInterfaceStatsStruct */
1558/// /* opaque = counter_data; enterprise = 0; format = 2104 */
1559///
1560/// struct virt_net_io {
1561///     unsigned hyper rx_bytes;  /* total bytes received */
1562///     unsigned int rx_packets;  /* total packets received */
1563///     unsigned int rx_errs;     /* total receive errors */
1564///     unsigned int rx_drop;     /* total receive drops */
1565///     unsigned hyper tx_bytes;  /* total bytes transmitted */
1566///     unsigned int tx_packets;  /* total packets transmitted */
1567///     unsigned int tx_errs;     /* total transmit errors */
1568///     unsigned int tx_drop;     /* total transmit drops */
1569/// }
1570/// ```
1571///
1572/// **ERRATUM:** Comment reference corrected from `virtDomainInterfaceStatsStruct` to `virDomainInterfaceStatsStruct`.
1573#[derive(Debug, Clone, PartialEq, Eq)]
1574#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1575pub struct VirtualNetIo {
1576    /// Bytes received
1577    pub rx_bytes: u64,
1578
1579    /// Packets received
1580    pub rx_packets: u32,
1581
1582    /// Receive errors
1583    pub rx_errs: u32,
1584
1585    /// Receive drops
1586    pub rx_drop: u32,
1587
1588    /// Bytes transmitted
1589    pub tx_bytes: u64,
1590
1591    /// Packets transmitted
1592    pub tx_packets: u32,
1593
1594    /// Transmit errors
1595    pub tx_errs: u32,
1596
1597    /// Transmit drops
1598    pub tx_drop: u32,
1599}
1600
1601/// JVM Runtime - Format (0,2105)
1602///
1603/// Java Virtual Machine runtime attributes
1604///
1605/// # XDR Definition ([sFlow JVM](https://sflow.org/sflow_jvm.txt))
1606///
1607/// ```text
1608/// /* JVM Runtime Attributes */
1609/// /* See RuntimeMXBean */
1610/// /* opaque = counter_data; enterprise = 0; format = 2105 */
1611///
1612/// struct jvm_runtime {
1613///   string vm_name<64>;      /* vm name */
1614///   string vm_vendor<32>;    /* the vendor for the JVM */
1615///   string vm_version<32>;   /* the version for the JVM */
1616/// }
1617/// ```
1618#[derive(Debug, Clone, PartialEq, Eq)]
1619#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1620pub struct JvmRuntime {
1621    /// JVM name
1622    pub vm_name: String,
1623
1624    /// JVM vendor
1625    pub vm_vendor: String,
1626
1627    /// JVM version
1628    pub vm_version: String,
1629}
1630
1631/// JVM Statistics - Format (0,2106)
1632///
1633/// Java Virtual Machine performance statistics
1634///
1635/// # XDR Definition ([sFlow JVM](https://sflow.org/sflow_jvm.txt))
1636///
1637/// ```text
1638/// /* JVM Statistics */
1639/// /* See MemoryMXBean, GarbageCollectorMXBean, ClassLoadingMXBean, */
1640/// /* CompilationMXBean, ThreadMXBean and UnixOperatingSystemMXBean */
1641/// /* opaque = counter_data; enterprise = 0; format = 2106 */
1642///
1643/// struct jvm_statistics {
1644///   unsigned hyper heap_initial;    /* initial heap memory requested */
1645///   unsigned hyper heap_used;       /* current heap memory usage  */
1646///   unsigned hyper heap_committed;  /* heap memory currently committed */
1647///   unsigned hyper heap_max;        /* max heap space */
1648///   unsigned hyper non_heap_initial; /* initial non heap memory
1649///                                       requested */
1650///   unsigned hyper non_heap_used;   /* current non heap memory usage  */
1651///   unsigned hyper non_heap_committed; /* non heap memory currently
1652///                                         committed */
1653///   unsigned hyper non_heap_max;    /* max non-heap space */
1654///   unsigned int gc_count;          /* total number of collections that
1655///                                      have occurred */
1656///   unsigned int gc_time;           /* approximate accumulated collection
1657///                                      elapsed time in milliseconds */
1658///   unsigned int classes_loaded;    /* number of classes currently loaded
1659///                                      in vm */
1660///   unsigned int classes_total;     /* total number of classes loaded
1661///                                      since vm started */
1662///   unsigned int classes_unloaded;  /* total number of classe unloaded
1663///                                      since vm started */
1664///   unsigned int compilation_time;  /* total accumulated time spent in
1665///                                      compilation (in milliseconds) */
1666///   unsigned int thread_num_live;   /* current number of live threads */
1667///   unsigned int thread_num_daemon; /* current number of live daemon
1668///                                      threads */
1669///   unsigned int thread_num_started; /* total threads started since
1670///                                       vm started */
1671///   unsigned int fd_open_count;     /* number of open file descriptors */
1672///   unsigned int fd_max_count;      /* max number of file descriptors */
1673/// }
1674/// ```
1675#[derive(Debug, Clone, PartialEq, Eq)]
1676#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1677pub struct JvmStatistics {
1678    /// Initial heap memory requested
1679    pub heap_initial: u64,
1680
1681    /// Current heap memory usage
1682    pub heap_used: u64,
1683
1684    /// Heap memory currently committed
1685    pub heap_committed: u64,
1686
1687    /// Maximum heap space
1688    pub heap_max: u64,
1689
1690    /// Initial non-heap memory requested
1691    pub non_heap_initial: u64,
1692
1693    /// Current non-heap memory usage
1694    pub non_heap_used: u64,
1695
1696    /// Non-heap memory currently committed
1697    pub non_heap_committed: u64,
1698
1699    /// Maximum non-heap space
1700    pub non_heap_max: u64,
1701
1702    /// Total number of garbage collections that have occurred
1703    pub gc_count: u32,
1704
1705    /// Approximate accumulated collection elapsed time in milliseconds
1706    pub gc_time: u32,
1707
1708    /// Number of classes currently loaded in VM
1709    pub classes_loaded: u32,
1710
1711    /// Total number of classes loaded since VM started
1712    pub classes_total: u32,
1713
1714    /// Total number of classes unloaded since VM started
1715    pub classes_unloaded: u32,
1716
1717    /// Total accumulated time spent in compilation (in milliseconds)
1718    pub compilation_time: u32,
1719
1720    /// Current number of live threads
1721    pub thread_num_live: u32,
1722
1723    /// Current number of live daemon threads
1724    pub thread_num_daemon: u32,
1725
1726    /// Total threads started since VM started
1727    pub thread_num_started: u32,
1728
1729    /// Number of open file descriptors
1730    pub fd_open_count: u32,
1731
1732    /// Maximum number of file descriptors
1733    pub fd_max_count: u32,
1734}
1735
1736/// Memcache Counters - Format (0,2200) - **DEPRECATED**
1737///
1738/// Legacy memcache statistics counters
1739///
1740/// **Note:** This format was defined in an early sFlow Memcache discussion
1741/// but was deprecated and replaced by format 2204. It is included here for
1742/// backward compatibility with legacy implementations.
1743///
1744/// # XDR Definition ([sFlow Discussion](https://groups.google.com/g/sflow/c/KDk_QrxCSJI))
1745///
1746/// ```text
1747/// /* Memcached counters */
1748/// /* See memcached protocol.txt */
1749/// /* opaque = counter_data; enterprise = 0; format = 2200 */
1750/// struct memcached_counters {
1751///   unsigned int uptime;                 /* in seconds */
1752///   unsigned int rusage_user;            /* in milliseconds */
1753///   unsigned int rusage_system;          /* in milliseconds */
1754///   unsigned int curr_connections;
1755///   unsigned int total_connections;
1756///   unsigned int connection_structures;
1757///   unsigned int cmd_get;
1758///   unsigned int cmd_set;
1759///   unsigned int cmd_flush;
1760///   unsigned int get_hits;
1761///   unsigned int get_misses;
1762///   unsigned int delete_misses;
1763///   unsigned int delete_hits;
1764///   unsigned int incr_misses;
1765///   unsigned int incr_hits;
1766///   unsigned int decr_misses;
1767///   unsigned int decr_hits;
1768///   unsigned int cas_misses;
1769///   unsigned int cas_hits;
1770///   unsigned int cas_badval;
1771///   unsigned int auth_cmds;
1772///   unsigned int auth_errors;
1773///   unsigned hyper bytes_read;
1774///   unsigned hyper bytes_written;
1775///   unsigned int limit_maxbytes;
1776///   unsigned int accepting_conns;
1777///   unsigned int listen_disabled_num;
1778///   unsigned int threads;
1779///   unsigned int conn_yields;
1780///   unsigned hyper bytes;
1781///   unsigned int curr_items;
1782///   unsigned int total_items;
1783///   unsigned int evictions;
1784/// }
1785/// ```
1786#[derive(Debug, Clone, PartialEq, Eq)]
1787#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1788pub struct MemcacheCountersDeprecated {
1789    /// Uptime in seconds
1790    pub uptime: u32,
1791
1792    /// User CPU time in milliseconds
1793    pub rusage_user: u32,
1794
1795    /// System CPU time in milliseconds
1796    pub rusage_system: u32,
1797
1798    /// Current number of connections
1799    pub curr_connections: u32,
1800
1801    /// Total number of connections
1802    pub total_connections: u32,
1803
1804    /// Number of connection structures
1805    pub connection_structures: u32,
1806
1807    /// Number of get commands
1808    pub cmd_get: u32,
1809
1810    /// Number of set commands
1811    pub cmd_set: u32,
1812
1813    /// Number of flush commands
1814    pub cmd_flush: u32,
1815
1816    /// Number of get hits
1817    pub get_hits: u32,
1818
1819    /// Number of get misses
1820    pub get_misses: u32,
1821
1822    /// Number of delete misses
1823    pub delete_misses: u32,
1824
1825    /// Number of delete hits
1826    pub delete_hits: u32,
1827
1828    /// Number of increment misses
1829    pub incr_misses: u32,
1830
1831    /// Number of increment hits
1832    pub incr_hits: u32,
1833
1834    /// Number of decrement misses
1835    pub decr_misses: u32,
1836
1837    /// Number of decrement hits
1838    pub decr_hits: u32,
1839
1840    /// Number of CAS misses
1841    pub cas_misses: u32,
1842
1843    /// Number of CAS hits
1844    pub cas_hits: u32,
1845
1846    /// Number of CAS bad value errors
1847    pub cas_badval: u32,
1848
1849    /// Number of authentication commands
1850    pub auth_cmds: u32,
1851
1852    /// Number of authentication errors
1853    pub auth_errors: u32,
1854
1855    /// Total bytes read
1856    pub bytes_read: u64,
1857
1858    /// Total bytes written
1859    pub bytes_written: u64,
1860
1861    /// Maximum bytes limit
1862    pub limit_maxbytes: u32,
1863
1864    /// Whether accepting connections (1=yes, 0=no)
1865    pub accepting_conns: u32,
1866
1867    /// Number of times listen was disabled
1868    pub listen_disabled_num: u32,
1869
1870    /// Number of threads
1871    pub threads: u32,
1872
1873    /// Number of connection yields
1874    pub conn_yields: u32,
1875
1876    /// Current bytes used
1877    pub bytes: u64,
1878
1879    /// Current number of items
1880    pub curr_items: u32,
1881
1882    /// Total number of items
1883    pub total_items: u32,
1884
1885    /// Number of evictions
1886    pub evictions: u32,
1887}
1888
1889/// HTTP Counters - Format (0,2201)
1890///
1891/// HTTP performance counters
1892///
1893/// # XDR Definition ([sFlow HTTP](https://sflow.org/sflow_http.txt))
1894///
1895/// ```text
1896/// /* HTTP counters */
1897/// /* opaque = counter_data; enterprise = 0; format = 2201 */
1898/// struct http_counters {
1899///   unsigned int method_option_count;
1900///   unsigned int method_get_count;
1901///   unsigned int method_head_count;
1902///   unsigned int method_post_count;
1903///   unsigned int method_put_count;
1904///   unsigned int method_delete_count;
1905///   unsigned int method_trace_count;
1906///   unsigned int method_connect_count;
1907///   unsigned int method_other_count;
1908///   unsigned int status_1XX_count;
1909///   unsigned int status_2XX_count;
1910///   unsigned int status_3XX_count;
1911///   unsigned int status_4XX_count;
1912///   unsigned int status_5XX_count;
1913///   unsigned int status_other_count;
1914/// }
1915/// ```
1916#[derive(Debug, Clone, PartialEq, Eq)]
1917#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1918pub struct HttpCounters {
1919    /// OPTIONS method count
1920    pub method_option_count: u32,
1921
1922    /// GET method count
1923    pub method_get_count: u32,
1924
1925    /// HEAD method count
1926    pub method_head_count: u32,
1927
1928    /// POST method count
1929    pub method_post_count: u32,
1930
1931    /// PUT method count
1932    pub method_put_count: u32,
1933
1934    /// DELETE method count
1935    pub method_delete_count: u32,
1936
1937    /// TRACE method count
1938    pub method_trace_count: u32,
1939
1940    /// CONNECT method count
1941    pub method_connect_count: u32,
1942
1943    /// Other method count
1944    pub method_other_count: u32,
1945
1946    /// 1XX status code count (spec: status_1XX_count)
1947    pub status_1xx_count: u32,
1948
1949    /// 2XX status code count (spec: status_2XX_count)
1950    pub status_2xx_count: u32,
1951
1952    /// 3XX status code count (spec: status_3XX_count)
1953    pub status_3xx_count: u32,
1954
1955    /// 4XX status code count (spec: status_4XX_count)
1956    pub status_4xx_count: u32,
1957
1958    /// 5XX status code count (spec: status_5XX_count)
1959    pub status_5xx_count: u32,
1960
1961    /// Other status code count
1962    pub status_other_count: u32,
1963}
1964
1965/// App Operations - Format (0,2202)
1966///
1967/// Count of operations by status code
1968///
1969/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
1970///
1971/// ```text
1972/// /* Application counters */
1973/// /* opaque = counter_data; enterprise = 0; format = 2202 */
1974///
1975/// struct app_operations {
1976///     application application;
1977///     unsigned int success;
1978///     unsigned int other;
1979///     unsigned int timeout;
1980///     unsigned int internal_error;
1981///     unsigned int bad_request;
1982///     unsigned int forbidden;
1983///     unsigned int too_large;
1984///     unsigned int not_implemented;
1985///     unsigned int not_found;
1986///     unsigned int unavailable;
1987///     unsigned int unauthorized;
1988/// }
1989/// ```
1990#[derive(Debug, Clone, PartialEq, Eq)]
1991#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1992pub struct AppOperations {
1993    /// Application identifier
1994    pub application: String,
1995
1996    /// Successful operations
1997    pub success: u32,
1998
1999    /// Other status
2000    pub other: u32,
2001
2002    /// Timeout
2003    pub timeout: u32,
2004
2005    /// Internal error
2006    pub internal_error: u32,
2007
2008    /// Bad request
2009    pub bad_request: u32,
2010
2011    /// Forbidden
2012    pub forbidden: u32,
2013
2014    /// Too large
2015    pub too_large: u32,
2016
2017    /// Not implemented
2018    pub not_implemented: u32,
2019
2020    /// Not found
2021    pub not_found: u32,
2022
2023    /// Unavailable
2024    pub unavailable: u32,
2025
2026    /// Unauthorized
2027    pub unauthorized: u32,
2028}
2029
2030/// App Resources - Format (0,2203)
2031///
2032/// Application resource usage
2033///
2034/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
2035///
2036/// ```text
2037/// /* Application resources */
2038/// /* opaque = counter_data; enterprise = 0; format = 2203 */
2039///
2040/// struct app_resources {
2041///     unsigned int user_time;   /* user time (ms) */
2042///     unsigned int system_time; /* system time (ms) */
2043///     unsigned hyper mem_used;  /* memory used in bytes */
2044///     unsigned hyper mem_max;   /* max memory in bytes */
2045///     unsigned int fd_open;     /* open file descriptors */
2046///     unsigned int fd_max;      /* max file descriptors */
2047///     unsigned int conn_open;   /* open network connections */
2048///     unsigned int conn_max;    /* max network connections */
2049/// }
2050/// ```
2051#[derive(Debug, Clone, PartialEq, Eq)]
2052#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2053pub struct AppResources {
2054    /// User time in milliseconds
2055    pub user_time: u32,
2056
2057    /// System time in milliseconds
2058    pub system_time: u32,
2059
2060    /// Memory used in bytes
2061    pub mem_used: u64,
2062
2063    /// Maximum memory in bytes
2064    pub mem_max: u64,
2065
2066    /// Number of open file descriptors
2067    pub fd_open: u32,
2068
2069    /// Maximum number of file descriptors
2070    pub fd_max: u32,
2071
2072    /// Number of open connections
2073    pub conn_open: u32,
2074
2075    /// Maximum number of connections
2076    pub conn_max: u32,
2077}
2078
2079/// Memcache Counters - Format (0,2204)
2080///
2081/// Memcache server performance counters
2082///
2083/// # XDR Definition ([sFlow Memcache](https://sflow.org/sflow_memcache.txt))
2084///
2085/// ```text
2086/// /* Memcache counters */
2087/// /* See Memcached protocol.txt */
2088/// /* opaque = counter_data; enterprise = 0; format = 2204 */
2089///
2090/// struct memcache_counters {
2091///   unsigned int cmd_set;
2092///   unsigned int cmd_touch;
2093///   unsigned int cmd_flush;
2094///   unsigned int get_hits;
2095///   unsigned int get_misses;
2096///   unsigned int delete_hits;
2097///   unsigned int delete_misses;
2098///   unsigned int incr_hits;
2099///   unsigned int incr_misses;
2100///   unsigned int decr_hits;
2101///   unsigned int decr_misses;
2102///   unsigned int cas_hits;
2103///   unsigned int cas_misses;
2104///   unsigned int cas_badval;
2105///   unsigned int auth_cmds;
2106///   unsigned int auth_errors;
2107///   unsigned int threads;
2108///   unsigned int conn_yields;
2109///   unsigned int listen_disabled_num;
2110///   unsigned int curr_connections;
2111///   unsigned int rejected_connections;
2112///   unsigned int total_connections;
2113///   unsigned int connection_structures;
2114///   unsigned int evictions;
2115///   unsigned int reclaimed;
2116///   unsigned int curr_items;
2117///   unsigned int total_items;
2118///   unsigned hyper bytes_read;
2119///   unsigned hyper bytes_written;
2120///   unsigned hyper bytes;
2121///   unsigned hyper limit_maxbytes;
2122/// }
2123/// ```
2124#[derive(Debug, Clone, PartialEq, Eq)]
2125#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2126pub struct MemcacheCounters {
2127    /// Number of set commands
2128    pub cmd_set: u32,
2129
2130    /// Number of touch commands
2131    pub cmd_touch: u32,
2132
2133    /// Number of flush commands
2134    pub cmd_flush: u32,
2135
2136    /// Number of get hits
2137    pub get_hits: u32,
2138
2139    /// Number of get misses
2140    pub get_misses: u32,
2141
2142    /// Number of delete hits
2143    pub delete_hits: u32,
2144
2145    /// Number of delete misses
2146    pub delete_misses: u32,
2147
2148    /// Number of increment hits
2149    pub incr_hits: u32,
2150
2151    /// Number of increment misses
2152    pub incr_misses: u32,
2153
2154    /// Number of decrement hits
2155    pub decr_hits: u32,
2156
2157    /// Number of decrement misses
2158    pub decr_misses: u32,
2159
2160    /// Number of CAS hits
2161    pub cas_hits: u32,
2162
2163    /// Number of CAS misses
2164    pub cas_misses: u32,
2165
2166    /// Number of CAS bad value errors
2167    pub cas_badval: u32,
2168
2169    /// Number of authentication commands
2170    pub auth_cmds: u32,
2171
2172    /// Number of authentication errors
2173    pub auth_errors: u32,
2174
2175    /// Number of threads
2176    pub threads: u32,
2177
2178    /// Number of connection yields
2179    pub conn_yields: u32,
2180
2181    /// Number of times listen was disabled
2182    pub listen_disabled_num: u32,
2183
2184    /// Current number of connections
2185    pub curr_connections: u32,
2186
2187    /// Number of rejected connections
2188    pub rejected_connections: u32,
2189
2190    /// Total number of connections
2191    pub total_connections: u32,
2192
2193    /// Number of connection structures
2194    pub connection_structures: u32,
2195
2196    /// Number of evictions
2197    pub evictions: u32,
2198
2199    /// Number of reclaimed items
2200    pub reclaimed: u32,
2201
2202    /// Current number of items
2203    pub curr_items: u32,
2204
2205    /// Total number of items
2206    pub total_items: u32,
2207
2208    /// Total bytes read
2209    pub bytes_read: u64,
2210
2211    /// Total bytes written
2212    pub bytes_written: u64,
2213
2214    /// Current bytes used
2215    pub bytes: u64,
2216
2217    /// Maximum bytes limit
2218    pub limit_maxbytes: u64,
2219}
2220
2221/// App Workers - Format (0,2206)
2222///
2223/// Application worker thread/process statistics
2224///
2225/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
2226///
2227/// ```text
2228/// /* Application workers */
2229/// /* opaque = counter_data; enterprise = 0; format = 2206 */
2230///
2231/// struct app_workers {
2232///     unsigned int workers_active; /* number of active workers */
2233///     unsigned int workers_idle;   /* number of idle workers */
2234///     unsigned int workers_max;    /* max number of workers */
2235///     unsigned int req_delayed;    /* requests delayed */
2236///     unsigned int req_dropped;    /* requests dropped */
2237/// }
2238/// ```
2239#[derive(Debug, Clone, PartialEq, Eq)]
2240#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2241pub struct AppWorkers {
2242    /// Number of active workers
2243    pub workers_active: u32,
2244
2245    /// Number of idle workers
2246    pub workers_idle: u32,
2247
2248    /// Maximum number of workers
2249    pub workers_max: u32,
2250
2251    /// Number of delayed requests
2252    pub req_delayed: u32,
2253
2254    /// Number of dropped requests
2255    pub req_dropped: u32,
2256}
2257
2258/// Broadcom Device Buffer Utilization - Format (4413,1)
2259///
2260/// Device level buffer utilization statistics from Broadcom switch ASICs
2261///
2262/// # XDR Definition ([sFlow Broadcom Buffers](https://sflow.org/bv-sflow.txt))
2263///
2264/// ```text
2265/// /* Device level buffer utilization */
2266/// /* buffers_used metrics represent peak since last export */
2267/// /* opaque = counter_data; enterprise = 4413; format = 1 */
2268/// struct bst_device_buffers {
2269///   percentage uc_pc;  /* unicast buffers percentage utilization */
2270///   percentage mc_pc;  /* multicast buffers percentage utilization */
2271/// }
2272/// ```
2273#[derive(Debug, Clone, PartialEq, Eq)]
2274#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2275pub struct BroadcomDeviceBuffers {
2276    /// Unicast buffers percentage utilization (in hundredths of a percent, e.g., 100 = 1%)
2277    pub uc_pc: i32,
2278
2279    /// Multicast buffers percentage utilization (in hundredths of a percent, e.g., 100 = 1%)
2280    pub mc_pc: i32,
2281}
2282
2283/// Broadcom Port Buffer Utilization - Format (4413,2)
2284///
2285/// Port level buffer utilization statistics from Broadcom switch ASICs
2286///
2287/// # XDR Definition ([sFlow Broadcom Buffers](https://sflow.org/bv-sflow.txt))
2288///
2289/// ```text
2290/// /* Port level buffer utilization */
2291/// /* buffers_used metrics represent peak buffers used since last export */
2292/// /* opaque = counter_data; enterprise = 4413; format = 2 */
2293/// struct bst_port_buffers {
2294///   percentage ingress_uc_pc;         /* ingress unicast buffers utilization */
2295///   percentage ingress_mc_pc;         /* ingress multicast buffers utilization */
2296///   percentage egress_uc_pc;          /* egress unicast buffers utilization */
2297///   percentage egress_mc_pc;          /* egress multicast buffers utilization */
2298///   percentage egress_queue_uc_pc<8>; /* per egress queue unicast buffers utilization */
2299///   percentage egress_queue_mc_pc<8>; /* per egress queue multicast buffers utilization*/
2300/// }
2301/// ```
2302#[derive(Debug, Clone, PartialEq, Eq)]
2303#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2304pub struct BroadcomPortBuffers {
2305    /// Ingress unicast buffers percentage utilization (in hundredths of a percent)
2306    pub ingress_uc_pc: i32,
2307
2308    /// Ingress multicast buffers percentage utilization (in hundredths of a percent)
2309    pub ingress_mc_pc: i32,
2310
2311    /// Egress unicast buffers percentage utilization (in hundredths of a percent)
2312    pub egress_uc_pc: i32,
2313
2314    /// Egress multicast buffers percentage utilization (in hundredths of a percent)
2315    pub egress_mc_pc: i32,
2316
2317    /// Per egress queue unicast buffers percentage utilization (up to 8 queues)
2318    pub egress_queue_uc_pc: Vec<i32>,
2319
2320    /// Per egress queue multicast buffers percentage utilization (up to 8 queues)
2321    pub egress_queue_mc_pc: Vec<i32>,
2322}
2323
2324/// Broadcom Switch ASIC Table Utilization - Format (4413,3)
2325///
2326/// Table utilization statistics from Broadcom switch ASICs
2327///
2328/// # XDR Definition ([sFlow Broadcom Tables](https://sflow.org/sflow_broadcom_tables.txt))
2329///
2330/// ```text
2331/// /* Table utilizations */
2332/// /* utilization of ASIC hardware tables */
2333/// /* opaque = counter_data; enterprise = 4413; format = 3 */
2334/// struct hw_tables {
2335///   unsigned int host_entries;
2336///   unsigned int host_entries_max;
2337///   unsigned int ipv4_entries;
2338///   unsigned int ipv4_entries_max;
2339///   unsigned int ipv6_entries;
2340///   unsigned int ipv6_entries_max;
2341///   unsigned int ipv4_ipv6_entries;
2342///   unsigned int ipv6_ipv6_entries_max;
2343///   unsigned int long_ipv6_entries;
2344///   unsigned int long_ipv6_entries_max;
2345///   unsigned int total_routes;
2346///   unsigned int total_routes_max;
2347///   unsigned int ecmp_nexthops;
2348///   unsigned int ecmp_nexthops_max;
2349///   unsigned int mac_entries;
2350///   unsigned int mac_entries_max;
2351///   unsigned int ipv4_neighbors;
2352///   unsigned int ipv6_neighbors;
2353///   unsigned int ipv4_routes;
2354///   unsigned int ipv6_routes;
2355///   unsigned int acl_ingress_entries;
2356///   unsigned int acl_ingress_entries_max;
2357///   unsigned int acl_ingress_counters;
2358///   unsigned int acl_ingress_counters_max;
2359///   unsigned int acl_ingress_meters;
2360///   unsigned int acl_ingress_meters_max;
2361///   unsigned int acl_ingress_slices;
2362///   unsigned int acl_ingress_slices_max;
2363///   unsigned int acl_egress_entries;
2364///   unsigned int acl_egress_entries_max;
2365///   unsigned int acl_egress_counters;
2366///   unsigned int acl_egress_counters_max;
2367///   unsigned int acl_egress_meters;
2368///   unsigned int acl_egress_meters_max;
2369///   unsigned int acl_egress_slices;
2370///   unsigned int acl_egress_slices_max;
2371/// }
2372/// ```
2373#[derive(Debug, Clone, PartialEq, Eq)]
2374#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2375pub struct BroadcomTables {
2376    /// Number of host table entries
2377    pub host_entries: u32,
2378
2379    /// Maximum number of host table entries
2380    pub host_entries_max: u32,
2381
2382    /// Number of IPv4 routing table entries
2383    pub ipv4_entries: u32,
2384
2385    /// Maximum number of IPv4 routing table entries
2386    pub ipv4_entries_max: u32,
2387
2388    /// Number of IPv6 routing table entries
2389    pub ipv6_entries: u32,
2390
2391    /// Maximum number of IPv6 routing table entries
2392    pub ipv6_entries_max: u32,
2393
2394    /// Number of IPv4/IPv6 routing table entries
2395    pub ipv4_ipv6_entries: u32,
2396
2397    /// Maximum number of IPv6/IPv6 routing table entries
2398    pub ipv6_ipv6_entries_max: u32,
2399
2400    /// Number of long IPv6 routing table entries
2401    pub long_ipv6_entries: u32,
2402
2403    /// Maximum number of long IPv6 routing table entries
2404    pub long_ipv6_entries_max: u32,
2405
2406    /// Total number of routes
2407    pub total_routes: u32,
2408
2409    /// Maximum total number of routes
2410    pub total_routes_max: u32,
2411
2412    /// Number of ECMP nexthops
2413    pub ecmp_nexthops: u32,
2414
2415    /// Maximum number of ECMP nexthops
2416    pub ecmp_nexthops_max: u32,
2417
2418    /// Number of MAC table entries
2419    pub mac_entries: u32,
2420
2421    /// Maximum number of MAC table entries
2422    pub mac_entries_max: u32,
2423
2424    /// Number of IPv4 neighbors
2425    pub ipv4_neighbors: u32,
2426
2427    /// Number of IPv6 neighbors
2428    pub ipv6_neighbors: u32,
2429
2430    /// Number of IPv4 routes
2431    pub ipv4_routes: u32,
2432
2433    /// Number of IPv6 routes
2434    pub ipv6_routes: u32,
2435
2436    /// Number of ingress ACL entries
2437    pub acl_ingress_entries: u32,
2438
2439    /// Maximum number of ingress ACL entries
2440    pub acl_ingress_entries_max: u32,
2441
2442    /// Number of ingress ACL counters
2443    pub acl_ingress_counters: u32,
2444
2445    /// Maximum number of ingress ACL counters
2446    pub acl_ingress_counters_max: u32,
2447
2448    /// Number of ingress ACL meters
2449    pub acl_ingress_meters: u32,
2450
2451    /// Maximum number of ingress ACL meters
2452    pub acl_ingress_meters_max: u32,
2453
2454    /// Number of ingress ACL slices
2455    pub acl_ingress_slices: u32,
2456
2457    /// Maximum number of ingress ACL slices
2458    pub acl_ingress_slices_max: u32,
2459
2460    /// Number of egress ACL entries
2461    pub acl_egress_entries: u32,
2462
2463    /// Maximum number of egress ACL entries
2464    pub acl_egress_entries_max: u32,
2465
2466    /// Number of egress ACL counters
2467    pub acl_egress_counters: u32,
2468
2469    /// Maximum number of egress ACL counters
2470    pub acl_egress_counters_max: u32,
2471
2472    /// Number of egress ACL meters
2473    pub acl_egress_meters: u32,
2474
2475    /// Maximum number of egress ACL meters
2476    pub acl_egress_meters_max: u32,
2477
2478    /// Number of egress ACL slices
2479    pub acl_egress_slices: u32,
2480
2481    /// Maximum number of egress ACL slices
2482    pub acl_egress_slices_max: u32,
2483}
2484
2485/// NVIDIA GPU Statistics - Format (5703,1)
2486///
2487/// GPU performance metrics from NVIDIA Management Library (NVML)
2488///
2489/// # XDR Definition ([sFlow NVML](https://sflow.org/sflow_nvml.txt))
2490///
2491/// ```text
2492/// /* NVIDIA GPU statistics */
2493/// /* opaque = counter_data; enterprise = 5703; format = 1 */
2494/// struct nvidia_gpu {
2495///   unsigned int device_count; /* see nvmlDeviceGetCount */
2496///   unsigned int processes;    /* see nvmlDeviceGetComputeRunningProcesses */
2497///   unsigned int gpu_time;     /* total milliseconds in which one or more
2498///                                 kernels was executing on GPU
2499///                                 sum across all devices */
2500///   unsigned int mem_time;     /* total milliseconds during which global device
2501///                                 memory was being read/written
2502///                                 sum across all devices */
2503///   unsigned hyper mem_total;  /* sum of framebuffer memory across devices
2504///                                 see nvmlDeviceGetMemoryInfo */
2505///   unsigned hyper mem_free;   /* sum of free framebuffer memory across devices
2506///                                 see nvmlDeviceGetMemoryInfo */
2507///   unsigned int ecc_errors;   /* sum of volatile ECC errors across devices
2508///                                 see nvmlDeviceGetTotalEccErrors */
2509///   unsigned int energy;       /* sum of millijoules across devices
2510///                                 see nvmlDeviceGetPowerUsage */
2511///   unsigned int temperature;  /* maximum temperature in degrees Celsius
2512///                                 across devices
2513///                                 see nvmlDeviceGetTemperature */
2514///   unsigned int fan_speed;    /* maximum fan speed in percent across devices
2515///                                 see nvmlDeviceGetFanSpeed */
2516/// }
2517/// ```
2518///
2519/// **ERRATUM:** The specification uses a comma instead of a semicolon in the format comment
2520/// (`enterprise = 5703, format=1` should be `enterprise = 5703; format = 1`), which is
2521/// inconsistent with all other sFlow specifications. The corrected version is shown above.
2522#[derive(Debug, Clone, PartialEq, Eq)]
2523#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2524pub struct NvidiaGpu {
2525    /// Number of GPU devices
2526    pub device_count: u32,
2527
2528    /// Number of running compute processes
2529    pub processes: u32,
2530
2531    /// Total GPU time in milliseconds (sum across all devices)
2532    pub gpu_time: u32,
2533
2534    /// Total memory access time in milliseconds (sum across all devices)
2535    pub mem_time: u32,
2536
2537    /// Total framebuffer memory in bytes (sum across all devices)
2538    pub mem_total: u64,
2539
2540    /// Free framebuffer memory in bytes (sum across all devices)
2541    pub mem_free: u64,
2542
2543    /// Sum of volatile ECC errors across all devices
2544    pub ecc_errors: u32,
2545
2546    /// Total energy consumption in millijoules (sum across all devices)
2547    pub energy: u32,
2548
2549    /// Maximum temperature in degrees Celsius across all devices
2550    pub temperature: u32,
2551
2552    /// Maximum fan speed in percent across all devices
2553    pub fan_speed: u32,
2554}