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