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)]
39pub struct GenericInterfaceCounters {
40    /// Interface index
41    pub if_index: u32,
42
43    /// Interface type (from IANAifType)
44    pub if_type: u32,
45
46    /// Interface speed in bits per second
47    pub if_speed: u64,
48
49    /// Interface direction (1=full-duplex, 2=half-duplex, 3=in, 4=out)
50    pub if_direction: u32,
51
52    /// Interface status (bit 0=admin, bit 1=oper)
53    pub if_status: u32,
54
55    /// Total octets received
56    pub if_in_octets: u64,
57
58    /// Total unicast packets received
59    pub if_in_ucast_pkts: u32,
60
61    /// Total multicast packets received
62    pub if_in_multicast_pkts: u32,
63
64    /// Total broadcast packets received
65    pub if_in_broadcast_pkts: u32,
66
67    /// Total discarded inbound packets
68    pub if_in_discards: u32,
69
70    /// Total inbound errors
71    pub if_in_errors: u32,
72
73    /// Total inbound packets with unknown protocol
74    pub if_in_unknown_protos: u32,
75
76    /// Total octets transmitted
77    pub if_out_octets: u64,
78
79    /// Total unicast packets transmitted
80    pub if_out_ucast_pkts: u32,
81
82    /// Total multicast packets transmitted
83    pub if_out_multicast_pkts: u32,
84
85    /// Total broadcast packets transmitted
86    pub if_out_broadcast_pkts: u32,
87
88    /// Total discarded outbound packets
89    pub if_out_discards: u32,
90
91    /// Total outbound errors
92    pub if_out_errors: u32,
93
94    /// Promiscuous mode (1=true, 2=false)
95    pub if_promiscuous_mode: u32,
96}
97
98/// Ethernet Interface Counters - Format (0,2)
99///
100/// Ethernet-specific statistics (RFC 2358)
101///
102/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
103///
104/// ```text
105/// /* Ethernet Interface Counters - see RFC 2358 */
106/// /* opaque = counter_data; enterprise = 0; format = 2 */
107///
108/// struct ethernet_counters {
109///     unsigned int dot3StatsAlignmentErrors;
110///     unsigned int dot3StatsFCSErrors;
111///     unsigned int dot3StatsSingleCollisionFrames;
112///     unsigned int dot3StatsMultipleCollisionFrames;
113///     unsigned int dot3StatsSQETestErrors;
114///     unsigned int dot3StatsDeferredTransmissions;
115///     unsigned int dot3StatsLateCollisions;
116///     unsigned int dot3StatsExcessiveCollisions;
117///     unsigned int dot3StatsInternalMacTransmitErrors;
118///     unsigned int dot3StatsCarrierSenseErrors;
119///     unsigned int dot3StatsFrameTooLongs;
120///     unsigned int dot3StatsInternalMacReceiveErrors;
121///     unsigned int dot3StatsSymbolErrors;
122/// }
123/// ```
124#[derive(Debug, Clone, PartialEq, Eq)]
125pub struct EthernetInterfaceCounters {
126    /// Alignment errors
127    pub dot3_stats_alignment_errors: u32,
128
129    /// FCS errors
130    pub dot3_stats_fcs_errors: u32,
131
132    /// Single collision frames
133    pub dot3_stats_single_collision_frames: u32,
134
135    /// Multiple collision frames
136    pub dot3_stats_multiple_collision_frames: u32,
137
138    /// SQE test errors
139    pub dot3_stats_sqe_test_errors: u32,
140
141    /// Deferred transmissions
142    pub dot3_stats_deferred_transmissions: u32,
143
144    /// Late collisions
145    pub dot3_stats_late_collisions: u32,
146
147    /// Excessive collisions
148    pub dot3_stats_excessive_collisions: u32,
149
150    /// Internal MAC transmit errors
151    pub dot3_stats_internal_mac_transmit_errors: u32,
152
153    /// Carrier sense errors
154    pub dot3_stats_carrier_sense_errors: u32,
155
156    /// Frame too long errors
157    pub dot3_stats_frame_too_longs: u32,
158
159    /// Internal MAC receive errors
160    pub dot3_stats_internal_mac_receive_errors: u32,
161
162    /// Symbol errors
163    pub dot3_stats_symbol_errors: u32,
164}
165
166/// Token Ring Counters - Format (0,3)
167///
168/// Token Ring statistics (RFC 1748)
169///
170/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
171///
172/// ```text
173/// /* Token Ring Counters - see RFC 1748 */
174/// /* opaque = counter_data; enterprise = 0; format = 3 */
175///
176/// struct tokenring_counters {
177///     unsigned int dot5StatsLineErrors;
178///     unsigned int dot5StatsBurstErrors;
179///     unsigned int dot5StatsACErrors;
180///     unsigned int dot5StatsAbortTransErrors;
181///     unsigned int dot5StatsInternalErrors;
182///     unsigned int dot5StatsLostFrameErrors;
183///     unsigned int dot5StatsReceiveCongestions;
184///     unsigned int dot5StatsFrameCopiedErrors;
185///     unsigned int dot5StatsTokenErrors;
186///     unsigned int dot5StatsSoftErrors;
187///     unsigned int dot5StatsHardErrors;
188///     unsigned int dot5StatsSignalLoss;
189///     unsigned int dot5StatsTransmitBeacons;
190///     unsigned int dot5StatsRecoverys;
191///     unsigned int dot5StatsLobeWires;
192///     unsigned int dot5StatsRemoves;
193///     unsigned int dot5StatsSingles;
194///     unsigned int dot5StatsFreqErrors;
195/// }
196/// ```
197#[derive(Debug, Clone, PartialEq, Eq)]
198pub struct TokenRingCounters {
199    pub dot5_stats_line_errors: u32,
200    pub dot5_stats_burst_errors: u32,
201    pub dot5_stats_ac_errors: u32,
202    pub dot5_stats_abort_trans_errors: u32,
203    pub dot5_stats_internal_errors: u32,
204    pub dot5_stats_lost_frame_errors: u32,
205    pub dot5_stats_receive_congestions: u32,
206    pub dot5_stats_frame_copied_errors: u32,
207    pub dot5_stats_token_errors: u32,
208    pub dot5_stats_soft_errors: u32,
209    pub dot5_stats_hard_errors: u32,
210    pub dot5_stats_signal_loss: u32,
211    pub dot5_stats_transmit_beacons: u32,
212    pub dot5_stats_recoverys: u32,
213    pub dot5_stats_lobe_wires: u32,
214    pub dot5_stats_removes: u32,
215    pub dot5_stats_singles: u32,
216    pub dot5_stats_freq_errors: u32,
217}
218
219/// 100BaseVG Interface Counters - Format (0,4)
220///
221/// 100BaseVG statistics (RFC 2020)
222///
223/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
224///
225/// ```text
226/// /* 100 BaseVG interface counters - see RFC 2020 */
227/// /* opaque = counter_data; enterprise = 0; format = 4 */
228///
229/// struct vg_counters {
230///     unsigned int dot12InHighPriorityFrames;
231///     unsigned hyper dot12InHighPriorityOctets;
232///     unsigned int dot12InNormPriorityFrames;
233///     unsigned hyper dot12InNormPriorityOctets;
234///     unsigned int dot12InIPMErrors;
235///     unsigned int dot12InOversizeFrameErrors;
236///     unsigned int dot12InDataErrors;
237///     unsigned int dot12InNullAddressedFrames;
238///     unsigned int dot12OutHighPriorityFrames;
239///     unsigned hyper dot12OutHighPriorityOctets;
240///     unsigned int dot12TransitionIntoTrainings;
241///     unsigned hyper dot12HCInHighPriorityOctets;
242///     unsigned hyper dot12HCInNormPriorityOctets;
243///     unsigned hyper dot12HCOutHighPriorityOctets;
244/// }
245/// ```
246#[derive(Debug, Clone, PartialEq, Eq)]
247pub struct Vg100InterfaceCounters {
248    pub dot12_in_high_priority_frames: u32,
249    pub dot12_in_high_priority_octets: u64,
250    pub dot12_in_norm_priority_frames: u32,
251    pub dot12_in_norm_priority_octets: u64,
252    pub dot12_in_ipm_errors: u32,
253    pub dot12_in_oversize_frame_errors: u32,
254    pub dot12_in_data_errors: u32,
255    pub dot12_in_null_addressed_frames: u32,
256    pub dot12_out_high_priority_frames: u32,
257    pub dot12_out_high_priority_octets: u64,
258    pub dot12_transition_into_trainings: u32,
259    pub dot12_hc_in_high_priority_octets: u64,
260    pub dot12_hc_in_norm_priority_octets: u64,
261    pub dot12_hc_out_high_priority_octets: u64,
262}
263
264/// VLAN Counters - Format (0,5)
265///
266/// VLAN statistics
267///
268/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
269///
270/// ```text
271/// /* VLAN Counters */
272/// /* opaque = counter_data; enterprise = 0; format = 5 */
273///
274/// struct vlan_counters {
275///     unsigned int vlan_id;
276///     unsigned hyper octets;
277///     unsigned int ucastPkts;
278///     unsigned int multicastPkts;
279///     unsigned int broadcastPkts;
280///     unsigned int discards;
281/// }
282/// ```
283#[derive(Debug, Clone, PartialEq, Eq)]
284pub struct VlanCounters {
285    /// VLAN ID
286    pub vlan_id: u32,
287
288    /// Total octets
289    pub octets: u64,
290
291    /// Unicast packets
292    pub ucast_pkts: u32,
293
294    /// Multicast packets
295    pub multicast_pkts: u32,
296
297    /// Broadcast packets
298    pub broadcast_pkts: u32,
299
300    /// Discarded packets
301    pub discards: u32,
302}
303
304/// Processor Counters - Format (0,1001)
305/// CPU and memory utilization
306#[derive(Debug, Clone, PartialEq, Eq)]
307pub struct ProcessorCounters {
308    /// 5 second average CPU utilization (0-100%)
309    pub cpu_5s: u32,
310
311    /// 1 minute average CPU utilization (0-100%)
312    pub cpu_1m: u32,
313
314    /// 5 minute average CPU utilization (0-100%)
315    pub cpu_5m: u32,
316
317    /// Total memory in bytes
318    pub total_memory: u64,
319
320    /// Free memory in bytes
321    pub free_memory: u64,
322}
323
324/// IEEE 802.11 Counters - Format (0,6)
325///
326/// Wireless interface statistics
327///
328/// # XDR Definition ([sFlow 802.11](https://sflow.org/sflow_80211.txt))
329///
330/// ```text
331/// /* IEEE802.11 interface counters - see IEEE802dot11-MIB */
332/// /* opaque = counter_data; enterprise = 0; format = 6 */
333///
334/// struct ieee80211_counters {
335///     unsigned int dot11TransmittedFragmentCount;
336///     unsigned int dot11MulticastTransmittedFrameCount;
337///     unsigned int dot11FailedCount;
338///     unsigned int dot11RetryCount;
339///     unsigned int dot11MultipleRetryCount;
340///     unsigned int dot11FrameDuplicateCount;
341///     unsigned int dot11RTSSuccessCount;
342///     unsigned int dot11RTSFailureCount;
343///     unsigned int dot11ACKFailureCount;
344///     unsigned int dot11ReceivedFragmentCount;
345///     unsigned int dot11MulticastReceivedFrameCount;
346///     unsigned int dot11FCSErrorCount;
347///     unsigned int dot11TransmittedFrameCount;
348///     unsigned int dot11WEPUndecryptableCount;
349///     unsigned int dot11QoSDiscardedFragmentCount;
350///     unsigned int dot11AssociatedStationCount;
351///     unsigned int dot11QoSCFPollsReceivedCount;
352///     unsigned int dot11QoSCFPollsUnusedCount;
353///     unsigned int dot11QoSCFPollsUnusableCount;
354///     unsigned int dot11QoSCFPollsLostCount;
355/// }
356/// ```
357#[derive(Debug, Clone, PartialEq, Eq)]
358pub struct Ieee80211Counters {
359    pub dot11_transmitted_fragment_count: u32,
360    pub dot11_multicast_transmitted_frame_count: u32,
361    pub dot11_failed_count: u32,
362    pub dot11_retry_count: u32,
363    pub dot11_multiple_retry_count: u32,
364    pub dot11_frame_duplicate_count: u32,
365    pub dot11_rts_success_count: u32,
366    pub dot11_rts_failure_count: u32,
367    pub dot11_ack_failure_count: u32,
368    pub dot11_received_fragment_count: u32,
369    pub dot11_multicast_received_frame_count: u32,
370    pub dot11_fcs_error_count: u32,
371    pub dot11_transmitted_frame_count: u32,
372    pub dot11_wep_undecryptable_count: u32,
373    pub dot11_qos_discarded_fragment_count: u32,
374    pub dot11_associated_station_count: u32,
375    pub dot11_qos_cf_polls_received_count: u32,
376    pub dot11_qos_cf_polls_unused_count: u32,
377    pub dot11_qos_cf_polls_unusable_count: u32,
378    pub dot11_qos_cf_polls_lost_count: u32,
379}
380
381/// Radio Utilization - Format (0,1002)
382///
383/// 802.11 radio channel utilization
384///
385/// # XDR Definition ([sFlow 802.11](https://sflow.org/sflow_80211.txt))
386///
387/// ```text
388/// /* 802.11 radio utilization */
389/// /* opaque = counter_data; enterprise = 0; format = 1002 */
390///
391/// struct radio_utilization {
392///     unsigned int elapsed_time;        /* Elapsed time in ms */
393///     unsigned int on_channel_time;     /* Time on assigned channel */
394///     unsigned int on_channel_busy_time;/* Time busy on channel */
395/// }
396/// ```
397#[derive(Debug, Clone, PartialEq, Eq)]
398pub struct RadioUtilization {
399    /// Elapsed time in milliseconds
400    pub elapsed_time: u32,
401
402    /// On channel time
403    pub on_channel_time: u32,
404
405    /// On channel busy time
406    pub on_channel_busy_time: u32,
407}
408
409/// Host Description - Format (0,2000)
410///
411/// Physical or virtual host description
412///
413/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
414///
415/// ```text
416/// /* Physical or virtual host description */
417/// /* opaque = counter_data; enterprise = 0; format = 2000 */
418///
419/// struct host_descr {
420///     string hostname<64>;       /* hostname, empty if unknown */
421///     opaque uuid<16>;           /* 16 bytes binary UUID, empty if unknown */
422///     machine_type machine_type; /* the processor family */
423///     os_name os_name;           /* Operating system */
424///     string os_release<32>;     /* OS release version */
425/// }
426/// ```
427#[derive(Debug, Clone, PartialEq, Eq)]
428pub struct HostDescription {
429    /// Hostname
430    pub hostname: String,
431
432    /// UUID (16 bytes)
433    pub uuid: [u8; 16],
434
435    /// Machine type (e.g., "x86_64")
436    pub machine_type: String,
437
438    /// OS name (e.g., "Linux")
439    pub os_name: String,
440
441    /// OS release (e.g., "5.10.0")
442    pub os_release: String,
443}
444
445/// Host Adapters - Format (0,2001)
446///
447/// Set of network adapters associated with entity
448///
449/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
450///
451/// ```text
452/// /* Set of adapters associated with entity */
453/// /* opaque = counter_data; enterprise = 0; format = 2001 */
454///
455/// struct host_adapters {
456///     adapter adapters<>; /* adapter(s) associated with entity */
457/// }
458/// ```
459#[derive(Debug, Clone, PartialEq, Eq)]
460pub struct HostAdapters {
461    /// Adapters
462    pub adapters: Vec<HostAdapter>,
463}
464
465#[derive(Debug, Clone, PartialEq, Eq)]
466pub struct HostAdapter {
467    /// Interface index
468    pub if_index: u32,
469
470    /// MAC addresses
471    pub mac_addresses: Vec<crate::models::MacAddress>,
472}
473
474/// Host Parent - Format (0,2002)
475///
476/// Containment hierarchy between logical and physical entities
477///
478/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
479///
480/// ```text
481/// /* Define containment hierarchy */
482/// /* opaque = counter_data; enterprise = 0; format = 2002 */
483///
484/// struct host_parent {
485///     unsigned int container_type;  /* sFlowDataSource type */
486///     unsigned int container_index; /* sFlowDataSource index */
487/// }
488/// ```
489#[derive(Debug, Clone, PartialEq, Eq)]
490pub struct HostParent {
491    /// Container type (e.g., "docker", "lxc")
492    pub container_type: u32,
493
494    /// Container index
495    pub container_index: u32,
496}
497
498/// Host CPU - Format (0,2003)
499///
500/// Physical server CPU statistics
501///
502/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
503///
504/// ```text
505/// /* Physical Server CPU */
506/// /* opaque = counter_data; enterprise = 0; format = 2003 */
507///
508/// struct host_cpu {
509///     float load_one;          /* 1 minute load avg */
510///     float load_five;         /* 5 minute load avg */
511///     float load_fifteen;      /* 15 minute load avg */
512///     unsigned int proc_run;   /* running processes */
513///     unsigned int proc_total; /* total processes */
514///     unsigned int cpu_num;    /* number of CPUs */
515///     unsigned int cpu_speed;  /* CPU speed in MHz */
516///     unsigned int uptime;     /* seconds since last reboot */
517///     unsigned int cpu_user;   /* user time (ms) */
518///     unsigned int cpu_nice;   /* nice time (ms) */
519///     unsigned int cpu_system; /* system time (ms) */
520///     unsigned int cpu_idle;   /* idle time (ms) */
521///     unsigned int cpu_wio;    /* I/O wait time (ms) */
522///     unsigned int cpu_intr;   /* interrupt time (ms) */
523///     unsigned int cpu_sintr;  /* soft interrupt time (ms) */
524///     unsigned int interrupts; /* interrupt count */
525///     unsigned int contexts;   /* context switch count */
526/// }
527/// ```
528#[derive(Debug, Clone, PartialEq, Eq)]
529pub struct HostCpu {
530    /// Load average (1 minute) - stored as hundredths (multiply by 100)
531    pub load_one: u32,
532
533    /// Load average (5 minutes) - stored as hundredths (multiply by 100)
534    pub load_five: u32,
535
536    /// Load average (15 minutes) - stored as hundredths (multiply by 100)
537    pub load_fifteen: u32,
538
539    /// Number of running processes
540    pub proc_run: u32,
541
542    /// Total number of processes
543    pub proc_total: u32,
544
545    /// Number of CPUs
546    pub cpu_num: u32,
547
548    /// CPU speed in MHz
549    pub cpu_speed: u32,
550
551    /// CPU uptime in seconds
552    pub uptime: u32,
553
554    /// CPU time in user mode (ms)
555    pub cpu_user: u32,
556
557    /// CPU time in nice mode (ms)
558    pub cpu_nice: u32,
559
560    /// CPU time in system mode (ms)
561    pub cpu_system: u32,
562
563    /// CPU idle time (ms)
564    pub cpu_idle: u32,
565
566    /// CPU time waiting for I/O (ms)
567    pub cpu_wio: u32,
568
569    /// CPU time servicing interrupts (ms)
570    pub cpu_intr: u32,
571
572    /// CPU time servicing soft interrupts (ms)
573    pub cpu_sintr: u32,
574
575    /// Number of interrupts
576    pub interrupts: u32,
577
578    /// Number of context switches
579    pub contexts: u32,
580}
581
582/// Host Memory - Format (0,2004)
583///
584/// Physical server memory statistics
585///
586/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
587///
588/// ```text
589/// /* Physical Server Memory */
590/// /* opaque = counter_data; enterprise = 0; format = 2004 */
591///
592/// struct host_memory {
593///     unsigned hyper mem_total;   /* total bytes */
594///     unsigned hyper mem_free;    /* free bytes */
595///     unsigned hyper mem_shared;  /* shared bytes */
596///     unsigned hyper mem_buffers; /* buffers bytes */
597///     unsigned hyper mem_cached;  /* cached bytes */
598///     unsigned hyper swap_total;  /* swap total bytes */
599///     unsigned hyper swap_free;   /* swap free bytes */
600///     unsigned int page_in;       /* page in count */
601///     unsigned int page_out;      /* page out count */
602///     unsigned int swap_in;       /* swap in count */
603///     unsigned int swap_out;      /* swap out count */
604/// }
605/// ```
606#[derive(Debug, Clone, PartialEq, Eq)]
607pub struct HostMemory {
608    /// Total memory in bytes
609    pub mem_total: u64,
610
611    /// Free memory in bytes
612    pub mem_free: u64,
613
614    /// Shared memory in bytes
615    pub mem_shared: u64,
616
617    /// Memory used for buffers in bytes
618    pub mem_buffers: u64,
619
620    /// Memory used for cache in bytes
621    pub mem_cached: u64,
622
623    /// Total swap space in bytes
624    pub swap_total: u64,
625
626    /// Free swap space in bytes
627    pub swap_free: u64,
628
629    /// Page in count
630    pub page_in: u32,
631
632    /// Page out count
633    pub page_out: u32,
634
635    /// Swap in count
636    pub swap_in: u32,
637
638    /// Swap out count
639    pub swap_out: u32,
640}
641
642/// Host Disk I/O - Format (0,2005)
643///
644/// Physical server disk I/O statistics
645///
646/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
647///
648/// ```text
649/// /* Physical Server Disk I/O */
650/// /* opaque = counter_data; enterprise = 0; format = 2005 */
651///
652/// struct host_disk_io {
653///     unsigned hyper disk_total;    /* total disk size in bytes */
654///     unsigned hyper disk_free;     /* total disk free in bytes */
655///     percentage part_max_used;     /* utilization of most utilized partition */
656///     unsigned int reads;           /* reads issued */
657///     unsigned hyper bytes_read;    /* bytes read */
658///     unsigned int read_time;       /* read time (ms) */
659///     unsigned int writes;          /* writes completed */
660///     unsigned hyper bytes_written; /* bytes written */
661///     unsigned int write_time;      /* write time (ms) */
662/// }
663/// ```
664#[derive(Debug, Clone, PartialEq, Eq)]
665pub struct HostDiskIo {
666    /// Total disk capacity in bytes
667    pub disk_total: u64,
668
669    /// Free disk space in bytes
670    pub disk_free: u64,
671
672    /// Percentage of disk used (0-100)
673    pub part_max_used: u32,
674
675    /// Number of disk reads
676    pub reads: u32,
677
678    /// Bytes read from disk
679    pub bytes_read: u64,
680
681    /// Read time in milliseconds
682    pub read_time: u32,
683
684    /// Number of disk writes
685    pub writes: u32,
686
687    /// Bytes written to disk
688    pub bytes_written: u64,
689
690    /// Write time in milliseconds
691    pub write_time: u32,
692}
693
694/// Host Network I/O - Format (0,2006)
695///
696/// Physical server network I/O statistics
697///
698/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
699///
700/// ```text
701/// /* Physical Server Network I/O */
702/// /* opaque = counter_data; enterprise = 0; format = 2006 */
703///
704/// struct host_net_io {
705///     unsigned hyper bytes_in;  /* total bytes in */
706///     unsigned int pkts_in;     /* total packets in */
707///     unsigned int errs_in;     /* total errors in */
708///     unsigned int drops_in;    /* total drops in */
709///     unsigned hyper bytes_out; /* total bytes out */
710///     unsigned int packets_out; /* total packets out */
711///     unsigned int errs_out;    /* total errors out */
712///     unsigned int drops_out;   /* total drops out */
713/// }
714/// ```
715#[derive(Debug, Clone, PartialEq, Eq)]
716pub struct HostNetIo {
717    /// Bytes received
718    pub bytes_in: u64,
719
720    /// Packets received
721    pub pkts_in: u32,
722
723    /// Receive errors
724    pub errs_in: u32,
725
726    /// Receive drops
727    pub drops_in: u32,
728
729    /// Bytes transmitted
730    pub bytes_out: u64,
731
732    /// Packets transmitted
733    pub packets_out: u32,
734
735    /// Transmit errors
736    pub errs_out: u32,
737
738    /// Transmit drops
739    pub drops_out: u32,
740}
741
742/// Virtual Node - Format (0,2100)
743///
744/// Hypervisor statistics
745///
746/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
747///
748/// ```text
749/// /* Virtual Node Statistics */
750/// /* opaque = counter_data; enterprise = 0; format = 2100 */
751///
752/// struct virt_node {
753///     unsigned int mhz;           /* expected CPU frequency */
754///     unsigned int cpus;          /* number of active CPUs */
755///     unsigned hyper memory;      /* memory size in bytes */
756///     unsigned hyper memory_free; /* unassigned memory in bytes */
757///     unsigned int num_domains;   /* number of active domains */
758/// }
759/// ```
760#[derive(Debug, Clone, PartialEq, Eq)]
761pub struct VirtualNode {
762    /// Expected CPU frequency in MHz
763    pub mhz: u32,
764
765    /// Number of active CPUs
766    pub cpus: u32,
767
768    /// Memory size in bytes
769    pub memory: u64,
770
771    /// Unassigned memory in bytes
772    pub memory_free: u64,
773
774    /// Number of active domains
775    pub num_domains: u32,
776}
777
778/// Virtual CPU - Format (0,2101)
779///
780/// Virtual domain CPU statistics
781///
782/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
783///
784/// ```text
785/// /* Virtual Domain CPU statistics */
786/// /* opaque = counter_data; enterprise = 0; format = 2101 */
787///
788/// struct virt_cpu {
789///     unsigned int state;    /* virtDomainState */
790///     unsigned int cpuTime;  /* CPU time used (ms) */
791///     unsigned int nrVirtCpu;/* number of virtual CPUs */
792/// }
793/// ```
794#[derive(Debug, Clone, PartialEq, Eq)]
795pub struct VirtualCpu {
796    /// CPU state (0=running, 1=idle, 2=blocked)
797    pub state: u32,
798
799    /// CPU time in milliseconds
800    pub cpu_time: u32,
801
802    /// Number of virtual CPUs
803    pub nr_virt_cpu: u32,
804}
805
806/// Virtual Memory - Format (0,2102)
807///
808/// Virtual domain memory statistics
809///
810/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
811///
812/// ```text
813/// /* Virtual Domain Memory statistics */
814/// /* opaque = counter_data; enterprise = 0; format = 2102 */
815///
816/// struct virt_memory {
817///     unsigned hyper memory;    /* memory in bytes used by domain */
818///     unsigned hyper maxMemory; /* memory in bytes allowed */
819/// }
820/// ```
821#[derive(Debug, Clone, PartialEq, Eq)]
822pub struct VirtualMemory {
823    /// Memory in bytes
824    pub memory: u64,
825
826    /// Maximum memory in bytes
827    pub max_memory: u64,
828}
829
830/// Virtual Disk I/O - Format (0,2103)
831///
832/// Virtual domain disk statistics
833///
834/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
835///
836/// ```text
837/// /* Virtual Domain Disk statistics */
838/// /* opaque = counter_data; enterprise = 0; format = 2103 */
839///
840/// struct virt_disk_io {
841///     unsigned hyper capacity;   /* logical size in bytes */
842///     unsigned hyper allocation; /* current allocation in bytes */
843///     unsigned hyper available;  /* remaining free bytes */
844///     unsigned int rd_req;       /* number of read requests */
845///     unsigned hyper rd_bytes;   /* number of read bytes */
846///     unsigned int wr_req;       /* number of write requests */
847///     unsigned hyper wr_bytes;   /* number of written bytes */
848///     unsigned int errs;         /* read/write errors */
849/// }
850/// ```
851#[derive(Debug, Clone, PartialEq, Eq)]
852pub struct VirtualDiskIo {
853    /// Capacity in bytes
854    pub capacity: u64,
855
856    /// Allocation in bytes
857    pub allocation: u64,
858
859    /// Available in bytes
860    pub available: u64,
861
862    /// Read requests
863    pub rd_req: u32,
864
865    /// Bytes read
866    pub rd_bytes: u64,
867
868    /// Write requests
869    pub wr_req: u32,
870
871    /// Bytes written
872    pub wr_bytes: u64,
873
874    /// Errors
875    pub errs: u32,
876}
877
878/// Virtual Network I/O - Format (0,2104)
879///
880/// Virtual domain network statistics
881///
882/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
883///
884/// ```text
885/// /* Virtual Domain Network statistics */
886/// /* opaque = counter_data; enterprise = 0; format = 2104 */
887///
888/// struct virt_net_io {
889///     unsigned hyper rx_bytes;  /* total bytes received */
890///     unsigned int rx_packets;  /* total packets received */
891///     unsigned int rx_errs;     /* total receive errors */
892///     unsigned int rx_drop;     /* total receive drops */
893///     unsigned hyper tx_bytes;  /* total bytes transmitted */
894///     unsigned int tx_packets;  /* total packets transmitted */
895///     unsigned int tx_errs;     /* total transmit errors */
896///     unsigned int tx_drop;     /* total transmit drops */
897/// }
898/// ```
899#[derive(Debug, Clone, PartialEq, Eq)]
900pub struct VirtualNetIo {
901    /// Bytes received
902    pub rx_bytes: u64,
903
904    /// Packets received
905    pub rx_packets: u32,
906
907    /// Receive errors
908    pub rx_errs: u32,
909
910    /// Receive drops
911    pub rx_drop: u32,
912
913    /// Bytes transmitted
914    pub tx_bytes: u64,
915
916    /// Packets transmitted
917    pub tx_packets: u32,
918
919    /// Transmit errors
920    pub tx_errs: u32,
921
922    /// Transmit drops
923    pub tx_drop: u32,
924}
925
926/// OpenFlow Port - Format (0,1004)
927///
928/// OpenFlow port statistics
929///
930/// # XDR Definition ([sFlow OpenFlow](https://sflow.org/sflow_openflow.txt))
931///
932/// ```text
933/// /* OpenFlow port */
934/// /* opaque = counter_data; enterprise = 0; format = 1004 */
935///
936/// struct of_port {
937///     unsigned hyper datapath_id;
938///     unsigned int port_no;
939/// }
940/// ```
941#[derive(Debug, Clone, PartialEq, Eq)]
942pub struct OpenFlowPort {
943    /// Datapath ID
944    pub datapath_id: u64,
945
946    /// Port number
947    pub port_no: u32,
948}
949
950/// OpenFlow Port Name - Format (0,1005)
951///
952/// OpenFlow port name string
953///
954/// # XDR Definition ([sFlow OpenFlow](https://sflow.org/sflow_openflow.txt))
955///
956/// ```text
957/// /* Port name */
958/// /* opaque = counter_data; enterprise = 0; format = 1005 */
959///
960/// struct port_name {
961///     string name<>;
962/// }
963/// ```
964#[derive(Debug, Clone, PartialEq, Eq)]
965pub struct OpenFlowPortName {
966    /// Port name
967    pub port_name: String,
968}
969
970/// App Operations - Format (0,2202)
971///
972/// Count of operations by status code
973///
974/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
975///
976/// ```text
977/// /* Application counters */
978/// /* opaque = counter_data; enterprise = 0; format = 2202 */
979///
980/// struct app_operations {
981///     application application;
982///     unsigned int success;
983///     unsigned int other;
984///     unsigned int timeout;
985///     unsigned int internal_error;
986///     unsigned int bad_request;
987///     unsigned int forbidden;
988///     unsigned int too_large;
989///     unsigned int not_implemented;
990///     unsigned int not_found;
991///     unsigned int unavailable;
992///     unsigned int unauthorized;
993/// }
994/// ```
995#[derive(Debug, Clone, PartialEq, Eq)]
996pub struct AppOperations {
997    /// Application identifier
998    pub application: String,
999
1000    /// Successful operations
1001    pub success: u32,
1002
1003    /// Other status
1004    pub other: u32,
1005
1006    /// Timeout
1007    pub timeout: u32,
1008
1009    /// Internal error
1010    pub internal_error: u32,
1011
1012    /// Bad request
1013    pub bad_request: u32,
1014
1015    /// Forbidden
1016    pub forbidden: u32,
1017
1018    /// Too large
1019    pub too_large: u32,
1020
1021    /// Not implemented
1022    pub not_implemented: u32,
1023
1024    /// Not found
1025    pub not_found: u32,
1026
1027    /// Unavailable
1028    pub unavailable: u32,
1029
1030    /// Unauthorized
1031    pub unauthorized: u32,
1032}
1033
1034/// App Resources - Format (0,2203)
1035///
1036/// Application resource usage
1037///
1038/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
1039///
1040/// ```text
1041/// /* Application resources */
1042/// /* opaque = counter_data; enterprise = 0; format = 2203 */
1043///
1044/// struct app_resources {
1045///     unsigned int user_time;   /* user time (ms) */
1046///     unsigned int system_time; /* system time (ms) */
1047///     unsigned hyper mem_used;  /* memory used in bytes */
1048///     unsigned hyper mem_max;   /* max memory in bytes */
1049///     unsigned int fd_open;     /* open file descriptors */
1050///     unsigned int fd_max;      /* max file descriptors */
1051///     unsigned int conn_open;   /* open network connections */
1052///     unsigned int conn_max;    /* max network connections */
1053/// }
1054/// ```
1055#[derive(Debug, Clone, PartialEq, Eq)]
1056pub struct AppResources {
1057    /// User time in milliseconds
1058    pub user_time: u32,
1059
1060    /// System time in milliseconds
1061    pub system_time: u32,
1062
1063    /// Memory used in bytes
1064    pub mem_used: u64,
1065
1066    /// Maximum memory in bytes
1067    pub mem_max: u64,
1068
1069    /// Number of open file descriptors
1070    pub fd_open: u32,
1071
1072    /// Maximum number of file descriptors
1073    pub fd_max: u32,
1074
1075    /// Number of open connections
1076    pub conn_open: u32,
1077
1078    /// Maximum number of connections
1079    pub conn_max: u32,
1080}
1081
1082/// App Workers - Format (0,2206)
1083///
1084/// Application worker thread/process statistics
1085///
1086/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
1087///
1088/// ```text
1089/// /* Application workers */
1090/// /* opaque = counter_data; enterprise = 0; format = 2206 */
1091///
1092/// struct app_workers {
1093///     unsigned int workers_active; /* number of active workers */
1094///     unsigned int workers_idle;   /* number of idle workers */
1095///     unsigned int workers_max;    /* max number of workers */
1096///     unsigned int req_delayed;    /* requests delayed */
1097///     unsigned int req_dropped;    /* requests dropped */
1098/// }
1099/// ```
1100#[derive(Debug, Clone, PartialEq, Eq)]
1101pub struct AppWorkers {
1102    /// Number of active workers
1103    pub workers_active: u32,
1104
1105    /// Number of idle workers
1106    pub workers_idle: u32,
1107
1108    /// Maximum number of workers
1109    pub workers_max: u32,
1110
1111    /// Number of delayed requests
1112    pub req_delayed: u32,
1113
1114    /// Number of dropped requests
1115    pub req_dropped: u32,
1116}