sflow_parser/models/record_flows.rs
1//! Flow record data structures
2//!
3//! These represent the actual packet data captured in flow samples.
4//! Enterprise = 0 (sFlow.org standard formats)
5
6use std::net::{Ipv4Addr, Ipv6Addr};
7
8/// Header protocol types for sampled headers
9#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
11pub enum HeaderProtocol {
12 EthernetIso88023 = 1,
13 Iso88024TokenBus = 2,
14 Iso88025TokenRing = 3,
15 Fddi = 4,
16 FrameRelay = 5,
17 X25 = 6,
18 Ppp = 7,
19 Smds = 8,
20 Aal5 = 9,
21 Aal5Ip = 10,
22 Ipv4 = 11,
23 Ipv6 = 12,
24 Mpls = 13,
25 Pos = 14,
26 Ieee80211Mac = 15,
27 Ieee80211Ampdu = 16,
28 Ieee80211Amsdu = 17,
29}
30
31impl HeaderProtocol {
32 /// Convert from u32 value to HeaderProtocol enum
33 pub fn from_u32(value: u32) -> Option<Self> {
34 match value {
35 1 => Some(HeaderProtocol::EthernetIso88023),
36 2 => Some(HeaderProtocol::Iso88024TokenBus),
37 3 => Some(HeaderProtocol::Iso88025TokenRing),
38 4 => Some(HeaderProtocol::Fddi),
39 5 => Some(HeaderProtocol::FrameRelay),
40 6 => Some(HeaderProtocol::X25),
41 7 => Some(HeaderProtocol::Ppp),
42 8 => Some(HeaderProtocol::Smds),
43 9 => Some(HeaderProtocol::Aal5),
44 10 => Some(HeaderProtocol::Aal5Ip),
45 11 => Some(HeaderProtocol::Ipv4),
46 12 => Some(HeaderProtocol::Ipv6),
47 13 => Some(HeaderProtocol::Mpls),
48 14 => Some(HeaderProtocol::Pos),
49 15 => Some(HeaderProtocol::Ieee80211Mac),
50 16 => Some(HeaderProtocol::Ieee80211Ampdu),
51 17 => Some(HeaderProtocol::Ieee80211Amsdu),
52 _ => None,
53 }
54 }
55}
56
57impl std::fmt::Display for HeaderProtocol {
58 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
59 match self {
60 HeaderProtocol::EthernetIso88023 => write!(f, "Ethernet (ISO 802.3)"),
61 HeaderProtocol::Iso88024TokenBus => write!(f, "ISO 802.4 Token Bus"),
62 HeaderProtocol::Iso88025TokenRing => write!(f, "ISO 802.5 Token Ring"),
63 HeaderProtocol::Fddi => write!(f, "FDDI"),
64 HeaderProtocol::FrameRelay => write!(f, "Frame Relay"),
65 HeaderProtocol::X25 => write!(f, "X.25"),
66 HeaderProtocol::Ppp => write!(f, "PPP"),
67 HeaderProtocol::Smds => write!(f, "SMDS"),
68 HeaderProtocol::Aal5 => write!(f, "AAL5"),
69 HeaderProtocol::Aal5Ip => write!(f, "AAL5 IP"),
70 HeaderProtocol::Ipv4 => write!(f, "IPv4"),
71 HeaderProtocol::Ipv6 => write!(f, "IPv6"),
72 HeaderProtocol::Mpls => write!(f, "MPLS"),
73 HeaderProtocol::Pos => write!(f, "POS"),
74 HeaderProtocol::Ieee80211Mac => write!(f, "IEEE 802.11 MAC"),
75 HeaderProtocol::Ieee80211Ampdu => write!(f, "IEEE 802.11 A-MPDU"),
76 HeaderProtocol::Ieee80211Amsdu => write!(f, "IEEE 802.11 A-MSDU"),
77 }
78 }
79}
80
81/// Sampled Header - Format (0,1)
82///
83/// Raw packet header captured from the wire
84///
85/// # XDR Definition (sFlow v5)
86///
87/// ```text
88/// /* Raw Packet Header */
89/// /* opaque = flow_data; enterprise = 0; format = 1 */
90///
91/// struct sampled_header {
92/// header_protocol protocol; /* Format of sampled header */
93/// unsigned int frame_length; /* Original length of packet before sampling */
94/// unsigned int stripped; /* Number of octets removed from packet */
95/// opaque header<>; /* Header bytes */
96/// }
97/// ```
98#[derive(Debug, Clone, PartialEq, Eq)]
99#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
100pub struct SampledHeader {
101 /// Protocol of the sampled packet
102 pub protocol: HeaderProtocol,
103
104 /// Original length of the packet (before sampling)
105 pub frame_length: u32,
106
107 /// Number of bytes stripped from the packet before sampling
108 pub stripped: u32,
109
110 /// Raw header bytes
111 pub header: Vec<u8>,
112}
113
114/// Sampled Ethernet Frame - Format (0,2)
115///
116/// Ethernet frame header information
117///
118/// # XDR Definition (sFlow v5)
119///
120/// ```text
121/// /* Ethernet Frame Data */
122/// /* opaque = flow_data; enterprise = 0; format = 2 */
123///
124/// struct sampled_ethernet {
125/// unsigned int length; /* The length of the MAC packet received on the
126/// network, excluding lower layer encapsulations
127/// and framing bits but including FCS octets */
128/// mac src_mac; /* Source MAC address */
129/// mac dst_mac; /* Destination MAC address */
130/// unsigned int type; /* Ethernet packet type */
131/// }
132/// ```
133#[derive(Debug, Clone, PartialEq, Eq)]
134#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
135pub struct SampledEthernet {
136 /// Length of MAC packet in bytes
137 pub length: u32,
138
139 /// Source MAC address
140 pub src_mac: crate::models::MacAddress,
141
142 /// Destination MAC address
143 pub dst_mac: crate::models::MacAddress,
144
145 /// Ethernet type (spec: type)
146 pub eth_type: u32,
147}
148
149/// Sampled IPv4 - Format (0,3)
150///
151/// IPv4 packet header information
152///
153/// # XDR Definition (sFlow v5)
154///
155/// ```text
156/// /* Packet IP version 4 data */
157/// /* opaque = flow_data; enterprise = 0; format = 3 */
158///
159/// struct sampled_ipv4 {
160/// unsigned int length; /* Length of IP packet excluding lower layer encapsulations */
161/// unsigned int protocol; /* IP Protocol type (e.g., TCP = 6, UDP = 17) */
162/// ip_v4 src_ip; /* Source IP Address */
163/// ip_v4 dst_ip; /* Destination IP Address */
164/// unsigned int src_port; /* TCP/UDP source port number or equivalent */
165/// unsigned int dst_port; /* TCP/UDP destination port number or equivalent */
166/// unsigned int tcp_flags; /* TCP flags */
167/// unsigned int tos; /* IP type of service */
168/// }
169/// ```
170#[derive(Debug, Clone, PartialEq, Eq)]
171#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
172pub struct SampledIpv4 {
173 /// Length of IP packet in bytes
174 pub length: u32,
175
176 /// IP Protocol (TCP=6, UDP=17, etc.)
177 pub protocol: u32,
178
179 /// Source IP address
180 pub src_ip: Ipv4Addr,
181
182 /// Destination IP address
183 pub dst_ip: Ipv4Addr,
184
185 /// Source port (for TCP/UDP)
186 pub src_port: u32,
187
188 /// Destination port (for TCP/UDP)
189 pub dst_port: u32,
190
191 /// TCP flags
192 pub tcp_flags: u32,
193
194 /// Type of Service
195 pub tos: u32,
196}
197
198/// Sampled IPv6 - Format (0,4)
199///
200/// IPv6 packet header information
201///
202/// # XDR Definition (sFlow v5)
203///
204/// ```text
205/// /* Packet IP Version 6 Data */
206/// /* opaque = flow_data; enterprise = 0; format = 4 */
207///
208/// struct sampled_ipv6 {
209/// unsigned int length; /* Length of IP packet excluding lower layer encapsulations */
210/// unsigned int protocol; /* IP next header (e.g., TCP = 6, UDP = 17) */
211/// ip_v6 src_ip; /* Source IP Address */
212/// ip_v6 dst_ip; /* Destination IP Address */
213/// unsigned int src_port; /* TCP/UDP source port number or equivalent */
214/// unsigned int dst_port; /* TCP/UDP destination port number or equivalent */
215/// unsigned int tcp_flags; /* TCP flags */
216/// unsigned int priority; /* IP priority */
217/// }
218/// ```
219#[derive(Debug, Clone, PartialEq, Eq)]
220#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
221pub struct SampledIpv6 {
222 /// Length of IP packet in bytes
223 pub length: u32,
224
225 /// IP Protocol (TCP=6, UDP=17, etc.)
226 pub protocol: u32,
227
228 /// Source IP address
229 pub src_ip: Ipv6Addr,
230
231 /// Destination IP address
232 pub dst_ip: Ipv6Addr,
233
234 /// Source port (for TCP/UDP)
235 pub src_port: u32,
236
237 /// Destination port (for TCP/UDP)
238 pub dst_port: u32,
239
240 /// TCP flags
241 pub tcp_flags: u32,
242
243 /// Priority (traffic class)
244 pub priority: u32,
245}
246
247/// Extended Switch Data - Format (0,1001)
248///
249/// Layer 2 switching information
250///
251/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
252///
253/// ```text
254/// /* Extended Switch Data */
255/// /* opaque = flow_data; enterprise = 0; format = 1001 */
256///
257/// struct extended_switch {
258/// unsigned int src_vlan; /* The 802.1Q VLAN id of incoming frame,
259/// 0xffffffff if unknown */
260/// unsigned int src_priority; /* The 802.1p priority of incoming frame,
261/// 0xffffffff if unknown */
262/// unsigned int dst_vlan; /* The 802.1Q VLAN id of outgoing frame,
263/// 0xffffffff if unknown */
264/// unsigned int dst_priority; /* The 802.1p priority of outgoing frame,
265/// 0xffffffff if unknown */
266/// }
267/// ```
268///
269/// **ERRATUM:** The specification was updated to clarify that 0xffffffff indicates unknown values.
270#[derive(Debug, Clone, PartialEq, Eq)]
271#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
272pub struct ExtendedSwitch {
273 /// Source VLAN ID
274 /// **ERRATUM:** 0xffffffff if unknown
275 pub src_vlan: u32,
276
277 /// Source priority (802.1p)
278 /// **ERRATUM:** 0xffffffff if unknown
279 pub src_priority: u32,
280
281 /// Destination VLAN ID
282 /// **ERRATUM:** 0xffffffff if unknown
283 pub dst_vlan: u32,
284
285 /// Destination priority (802.1p)
286 /// **ERRATUM:** 0xffffffff if unknown
287 pub dst_priority: u32,
288}
289
290/// Extended Router Data - Format (0,1002)
291///
292/// Layer 3 routing information
293///
294/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
295///
296/// ```text
297/// /* Extended Router Data */
298/// /* opaque = flow_data; enterprise = 0; format = 1002 */
299///
300/// struct extended_router {
301/// next_hop nexthop; /* IP address of immediate next hop router */
302/// unsigned int src_mask_len; /* Source address prefix mask (number of bits) */
303/// unsigned int dst_mask_len; /* Destination address prefix mask (number of bits) */
304/// }
305/// ```
306///
307/// **ERRATUM:** The specification was clarified to specify "immediate" next hop router.
308#[derive(Debug, Clone, PartialEq, Eq)]
309#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
310pub struct ExtendedRouter {
311 /// IP address of immediate next hop router (spec: nexthop)
312 /// **ERRATUM:** Clarified as "immediate" next hop router
313 pub next_hop: crate::models::core::Address,
314
315 /// Source subnet mask bits
316 pub src_mask_len: u32,
317
318 /// Destination subnet mask bits
319 pub dst_mask_len: u32,
320}
321
322/// AS Path Type
323#[derive(Debug, Clone, Copy, PartialEq, Eq)]
324#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
325#[repr(u32)]
326pub enum AsPathType {
327 AsSet = 1,
328 AsSequence = 2,
329}
330
331impl From<u32> for AsPathType {
332 fn from(value: u32) -> Self {
333 match value {
334 1 => AsPathType::AsSet,
335 2 => AsPathType::AsSequence,
336 _ => AsPathType::AsSet,
337 }
338 }
339}
340
341/// AS Path Segment
342#[derive(Debug, Clone, PartialEq, Eq)]
343#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
344pub struct AsPathSegment {
345 pub path_type: AsPathType,
346 pub path_length: u32,
347 pub path: Vec<u32>,
348}
349
350/// Extended Gateway Data - Format (0,1003)
351///
352/// BGP routing information
353///
354/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
355///
356/// ```text
357/// /* Extended Gateway Data */
358/// /* opaque = flow_data; enterprise = 0; format = 1003 */
359///
360/// struct extended_gateway {
361/// next_hop nexthop; /* Address of the border router */
362/// unsigned int as; /* Autonomous system number of router */
363/// unsigned int src_as; /* Autonomous system number of source */
364/// unsigned int src_peer_as; /* Autonomous system number of source peer */
365/// as_path_type dst_as_path<>; /* AS path to the destination */
366/// unsigned int communities<>; /* Communities associated with this route */
367/// unsigned int localpref; /* LocalPref associated with this route */
368/// }
369/// ```
370#[derive(Debug, Clone, PartialEq, Eq)]
371#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
372pub struct ExtendedGateway {
373 /// IP address of the border router (spec: nexthop)
374 pub next_hop: crate::models::core::Address,
375
376 /// Autonomous system number (spec: as)
377 pub as_number: u32,
378
379 /// Source AS
380 pub src_as: u32,
381
382 /// Source peer AS
383 pub src_peer_as: u32,
384
385 /// Autonomous system path to the destination
386 pub dst_as_path: Vec<AsPathSegment>,
387
388 /// Communities associated with this route
389 pub communities: Vec<u32>,
390
391 /// Local preference (spec: localpref)
392 pub local_pref: u32,
393}
394
395/// Extended User Data - Format (0,1004)
396///
397/// Application-level user information
398///
399/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
400///
401/// ```text
402/// /* Extended User Data */
403/// /* opaque = flow_data; enterprise = 0; format = 1004 */
404///
405/// struct extended_user {
406/// charset src_charset; /* Character set for src_user */
407/// opaque src_user<>; /* User ID associated with packet source */
408/// charset dst_charset; /* Character set for dst_user */
409/// opaque dst_user<>; /* User ID associated with packet destination */
410/// }
411/// ```
412#[derive(Debug, Clone, PartialEq, Eq)]
413#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
414pub struct ExtendedUser {
415 /// Source character set (MIBEnum)
416 pub src_charset: u32,
417
418 /// Source user ID
419 pub src_user: String,
420
421 /// Destination character set (MIBEnum)
422 pub dst_charset: u32,
423
424 /// Destination user ID
425 pub dst_user: String,
426}
427
428/// URL Direction
429#[derive(Debug, Clone, Copy, PartialEq, Eq)]
430#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
431#[repr(u32)]
432pub enum UrlDirection {
433 Source = 1,
434 Destination = 2,
435}
436
437impl From<u32> for UrlDirection {
438 fn from(value: u32) -> Self {
439 match value {
440 1 => UrlDirection::Source,
441 2 => UrlDirection::Destination,
442 _ => UrlDirection::Source,
443 }
444 }
445}
446
447/// Extended URL Data - Format (0,1005) - **DEPRECATED**
448///
449/// HTTP request information
450///
451/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
452///
453/// ```text
454/// /* Extended URL Data */
455/// /* opaque = flow_data; enterprise = 0; format = 1005 */
456///
457/// struct extended_url {
458/// url_direction direction; /* Direction of connection */
459/// string url<>; /* The HTTP request-line (see RFC 2616) */
460/// string host<>; /* The host field from the HTTP header */
461/// }
462/// ```
463#[derive(Debug, Clone, PartialEq, Eq)]
464#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
465pub struct ExtendedUrl {
466 /// Direction (source or destination)
467 pub direction: UrlDirection,
468
469 /// URL string (HTTP request-line)
470 pub url: String,
471
472 /// Host header from HTTP request
473 pub host: String,
474}
475
476/// Extended MPLS Data - Format (0,1006)
477///
478/// MPLS label stack information
479///
480/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
481///
482/// ```text
483/// /* Extended MPLS Data */
484/// /* opaque = flow_data; enterprise = 0; format = 1006 */
485///
486/// struct extended_mpls {
487/// next_hop nexthop; /* Address of the next hop */
488/// label_stack in_stack; /* Label stack of received packet */
489/// label_stack out_stack;/* Label stack for transmitted packet */
490/// }
491/// ```
492#[derive(Debug, Clone, PartialEq, Eq)]
493#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
494pub struct ExtendedMpls {
495 /// Next hop address (spec: nexthop)
496 pub next_hop: crate::models::core::Address,
497
498 /// Input label stack
499 pub in_stack: Vec<u32>,
500
501 /// Output label stack
502 pub out_stack: Vec<u32>,
503}
504
505/// Extended NAT Data - Format (0,1007)
506///
507/// Network Address Translation information
508///
509/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
510///
511/// ```text
512/// /* Extended NAT Data */
513/// /* opaque = flow_data; enterprise = 0; format = 1007 */
514///
515/// struct extended_nat {
516/// address src_address; /* Source address */
517/// address dst_address; /* Destination address */
518/// }
519/// ```
520#[derive(Debug, Clone, PartialEq, Eq)]
521#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
522pub struct ExtendedNat {
523 /// Source address type
524 pub src_address: crate::models::core::Address,
525
526 /// Destination address type
527 pub dst_address: crate::models::core::Address,
528}
529
530/// Extended MPLS Tunnel - Format (0,1008)
531///
532/// MPLS tunnel information
533///
534/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
535///
536/// ```text
537/// /* Extended MPLS Tunnel */
538/// /* opaque = flow_data; enterprise = 0; format = 1008 */
539///
540/// struct extended_mpls_tunnel {
541/// string tunnel_lsp_name<>; /* Tunnel name */
542/// unsigned int tunnel_id; /* Tunnel ID */
543/// unsigned int tunnel_cos; /* Tunnel COS value */
544/// }
545/// ```
546#[derive(Debug, Clone, PartialEq, Eq)]
547#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
548pub struct ExtendedMplsTunnel {
549 /// Tunnel LSP name
550 pub tunnel_lsp_name: String,
551
552 /// Tunnel ID
553 pub tunnel_id: u32,
554
555 /// Tunnel COS value
556 pub tunnel_cos: u32,
557}
558
559/// Extended MPLS VC - Format (0,1009)
560///
561/// MPLS Virtual Circuit information
562///
563/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
564///
565/// ```text
566/// /* Extended MPLS VC */
567/// /* opaque = flow_data; enterprise = 0; format = 1009 */
568///
569/// struct extended_mpls_vc {
570/// string vc_instance_name<>; /* VC instance name */
571/// unsigned int vll_vc_id; /* VLL/VC instance ID */
572/// unsigned int vc_label_cos; /* VC Label COS value */
573/// }
574/// ```
575#[derive(Debug, Clone, PartialEq, Eq)]
576#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
577pub struct ExtendedMplsVc {
578 /// VC instance name
579 pub vc_instance_name: String,
580
581 /// VC ID
582 pub vll_vc_id: u32,
583
584 /// VC label
585 pub vc_label: u32,
586
587 /// VC COS
588 pub vc_cos: u32,
589}
590
591/// Extended MPLS FEC - Format (0,1010)
592///
593/// MPLS Forwarding Equivalence Class information
594///
595/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
596///
597/// ```text
598/// /* Extended MPLS FEC */
599/// /* opaque = flow_data; enterprise = 0; format = 1010 */
600///
601/// struct extended_mpls_FTN {
602/// string mplsFTNDescr<>; /* FEC description */
603/// unsigned int mplsFTNMask; /* FEC mask */
604/// }
605/// ```
606#[derive(Debug, Clone, PartialEq, Eq)]
607#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
608pub struct ExtendedMplsFec {
609 /// FEC address prefix
610 pub fec_addr_prefix: crate::models::core::Address,
611
612 /// FEC prefix length
613 pub fec_prefix_len: u32,
614}
615
616/// Extended MPLS LVP FEC - Format (0,1011)
617///
618/// MPLS LDP FEC information
619///
620/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
621///
622/// ```text
623/// /* Extended MPLS LVP FEC */
624/// /* opaque = flow_data; enterprise = 0; format = 1011 */
625///
626/// struct extended_mpls_LDP_FEC {
627/// unsigned int mplsFecAddrPrefixLength; /* FEC address prefix length */
628/// }
629/// ```
630#[derive(Debug, Clone, PartialEq, Eq)]
631#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
632pub struct ExtendedMplsLvpFec {
633 /// FEC address prefix length
634 pub mpls_fec_addr_prefix_length: u32,
635}
636
637/// Extended VLAN Tunnel - Format (0,1012)
638///
639/// VLAN tunnel information for nested VLAN tags
640///
641/// # XDR Definition ([sFlow v5](https://sflow.org/sflow_version_5.txt))
642///
643/// ```text
644/// /* Extended VLAN tunnel information */
645/// /* opaque = flow_data; enterprise = 0; format = 1012 */
646///
647/// struct extended_vlantunnel {
648/// unsigned int stack<>; /* List of stripped 802.1Q TPID/TCI layers */
649/// }
650/// ```
651#[derive(Debug, Clone, PartialEq, Eq)]
652#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
653pub struct ExtendedVlanTunnel {
654 /// List of stripped 802.1Q TPID/TCI layers
655 pub stack: Vec<u32>,
656}
657
658/// Extended 802.11 Payload - Format (0,1013)
659///
660/// Unencrypted 802.11 payload data
661///
662/// # XDR Definition ([sFlow 802.11](https://sflow.org/sflow_80211.txt))
663///
664/// ```text
665/// /* Extended 80211 Payload */
666/// /* opaque = flow_data; enterprise = 0; format = 1013 */
667///
668/// struct extended_80211_payload {
669/// cipher_suite ciphersuite; /* encryption scheme used for this packet */
670/// opaque data<>; /* unencrypted bytes from the payload */
671/// }
672/// ```
673#[derive(Debug, Clone, PartialEq, Eq)]
674#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
675pub struct Extended80211Payload {
676 /// Cipher suite (OUI + Suite Type) (spec: ciphersuite)
677 pub cipher_suite: u32,
678
679 /// Unencrypted payload data
680 pub data: Vec<u8>,
681}
682
683/// Extended 802.11 RX - Format (0,1014)
684///
685/// 802.11 receive information
686///
687/// # XDR Definition ([sFlow 802.11](https://sflow.org/sflow_80211.txt))
688///
689/// ```text
690/// /* Extended 802.11 RX */
691/// /* opaque = flow_data; enterprise = 0; format = 1014 */
692///
693/// struct extended_80211_rx {
694/// string ssid<32>; /* SSID string */
695/// mac bssid; /* BSSID */
696/// ieee80211_version version; /* version */
697/// unsigned int channel; /* channel number */
698/// unsigned hyper speed; /* speed */
699/// unsigned int rsni; /* received signal to noise ratio */
700/// unsigned int rcpi; /* received channel power */
701/// duration_us packet_duration; /* time packet occupied RF medium */
702/// }
703/// ```
704///
705/// **ERRATUM:** The specification is missing a semicolon after `packet_duration`,
706/// violating RFC 4506 XDR syntax requirements. The corrected version is shown above.
707#[derive(Debug, Clone, PartialEq, Eq)]
708#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
709pub struct Extended80211Rx {
710 /// SSID string (max 32 bytes)
711 pub ssid: String,
712
713 /// BSSID (MAC address)
714 pub bssid: crate::models::MacAddress,
715
716 /// IEEE 802.11 version (a=1, b=2, g=3, n=4)
717 pub version: u32,
718
719 /// Channel number
720 pub channel: u32,
721
722 /// Speed in bits per second
723 pub speed: u64,
724
725 /// Received signal to noise ratio (RSNI)
726 pub rsni: u32,
727
728 /// Received channel power indicator (RCPI)
729 pub rcpi: u32,
730
731 /// Packet duration in microseconds
732 pub packet_duration: u32,
733}
734
735/// Extended 802.11 TX - Format (0,1015)
736///
737/// 802.11 transmit information
738///
739/// # XDR Definition ([sFlow 802.11](https://sflow.org/sflow_80211.txt))
740///
741/// ```text
742/// /* Extended 802.11 TX */
743/// /* opaque = flow_data; enterprise = 0; format = 1015 */
744///
745/// struct extended_80211_tx {
746/// string ssid<32>; /* SSID string */
747/// mac bssid; /* BSSID */
748/// ieee80211_version version; /* version */
749/// unsigned int transmissions; /* number of transmissions */
750/// duration_us packet_duration; /* time packet occupied RF medium */
751/// duration_us retrans_duration;/* time failed attempts occupied RF */
752/// unsigned int channel; /* channel number */
753/// unsigned hyper speed; /* speed */
754/// unsigned int power; /* transmit power in mW */
755/// }
756/// ```
757#[derive(Debug, Clone, PartialEq, Eq)]
758#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
759pub struct Extended80211Tx {
760 /// SSID string (max 32 bytes)
761 pub ssid: String,
762
763 /// BSSID (MAC address)
764 pub bssid: crate::models::MacAddress,
765
766 /// IEEE 802.11 version (a=1, b=2, g=3, n=4)
767 pub version: u32,
768
769 /// Number of transmissions (0=unknown, 1=success on first attempt, n>1 = n-1 retransmissions)
770 pub transmissions: u32,
771
772 /// Packet duration in microseconds (successful transmission)
773 pub packet_duration: u32,
774
775 /// Retransmission duration in microseconds (failed attempts)
776 pub retrans_duration: u32,
777
778 /// Channel number
779 pub channel: u32,
780
781 /// Speed in bits per second
782 pub speed: u64,
783
784 /// Transmit power in milliwatts
785 pub power: u32,
786}
787
788/// PDU (Protocol Data Unit) in 802.11 aggregation
789///
790/// # XDR Definition ([sFlow 802.11](https://sflow.org/sflow_80211.txt))
791///
792/// ```text
793/// struct pdu {
794/// flow_record flow_records<>;
795/// }
796/// ```
797#[derive(Debug, Clone, PartialEq, Eq)]
798#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
799pub struct Pdu {
800 /// Flow records for this PDU
801 pub flow_records: Vec<crate::models::FlowRecord>,
802}
803
804/// Extended 802.11 Aggregation - Format (0,1016)
805///
806/// 802.11 frame aggregation information
807///
808/// # XDR Definition ([sFlow 802.11](https://sflow.org/sflow_80211.txt))
809///
810/// ```text
811/// /* Extended 802.11 Aggregation Data */
812/// /* opaque = flow_data; enterprise = 0; format = 1016 */
813///
814/// struct extended_80211_aggregation {
815/// pdu pdus<>; /* Array of PDUs in the aggregation */
816/// }
817/// ```
818#[derive(Debug, Clone, PartialEq, Eq)]
819#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
820pub struct Extended80211Aggregation {
821 /// Array of PDUs in the aggregation
822 pub pdus: Vec<Pdu>,
823}
824
825/// Extended OpenFlow v1 - Format (0,1017) - **DEPRECATED**
826///
827/// OpenFlow 1.0 forwarding information
828///
829/// **Note:** This format was defined in an early draft of the sFlow OpenFlow specification
830/// but was deprecated and removed from the final specification. It is included here for
831/// backward compatibility with legacy implementations.
832///
833/// # XDR Definition ([sFlow OpenFlow Draft](https://sflow.org/draft-sflow-openflow.txt))
834///
835/// ```text
836/// /* Extended OpenFlow 1.0 Data */
837/// /* opaque = flow_data; enterprise = 0; format = 1017 */
838///
839/// struct extended_openflow_v1 {
840/// unsigned hyper flow_cookie; /* Flow cookie set by controller */
841/// wildcards flow_match; /* Bit array of wildcarded fields */
842/// actions flow_actions; /* Bit array of actions applied */
843/// }
844/// ```
845#[derive(Debug, Clone, PartialEq, Eq)]
846#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
847pub struct ExtendedOpenFlowV1 {
848 /// Flow cookie set by the OpenFlow controller
849 pub flow_cookie: u64,
850
851 /// Bit array describing the fields in the packet header that are used to form the flow key
852 /// See OpenFlow 1.0 ofp_match for the definition of wildcards
853 pub flow_match: u32,
854
855 /// Bit array describing fields that may have been altered by the flow action
856 /// The ofp_action_type enum is used to determine the bit positions
857 pub flow_actions: u32,
858}
859
860/// Extended Fiber Channel Routing Entry - Format (0,1018)
861///
862/// Fiber Channel routing information
863///
864/// # XDR Definition (RFC 4625)
865///
866/// ```text
867/// /* Extended Fiber Channel Routing Entry */
868/// /* opaque = flow_data; enterprise = 0; format = 1018 */
869/// /* See RFC 4625 */
870/// typedef unsigned int fc_address; /* 24 bit fiber channel address,
871/// most significant byte = 0 */
872/// struct extended_fc {
873/// unsigned int src_mask_len; /* Source FC address mask,
874/// see t11FcRouteSrcMask
875/// (expressed in number of bits) */
876/// unsigned int dst_mask_len; /* Destination FC address mask,
877/// see t11FcRouteDestMask
878/// (expressed in number of bits) */
879/// fc_address next_hop; /* Next hop FC switch
880/// see t11FcRouteDomainId */
881/// unsigned int metric; /* most significant byte,
882/// most significant bit = t11FcRouteType
883/// least significant 7 bits = t11FcRouteProto,
884/// least significant 3 bytes = t11FcRouteMetric
885/// */
886/// }
887/// ```
888#[derive(Debug, Clone, PartialEq, Eq)]
889#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
890pub struct ExtendedFc {
891 /// Source FC address mask (number of bits)
892 pub src_mask_len: u32,
893
894 /// Destination FC address mask (number of bits)
895 pub dst_mask_len: u32,
896
897 /// Next hop FC switch (24-bit fiber channel address)
898 pub next_hop: u32,
899
900 /// Metric containing route type, protocol, and metric value
901 /// - Most significant byte, most significant bit: t11FcRouteType
902 /// - Most significant byte, least significant 7 bits: t11FcRouteProto
903 /// - Least significant 3 bytes: t11FcRouteMetric
904 pub metric: u32,
905}
906
907/// Extended Queue Length - Format (0,1019)
908///
909/// Queue length experienced by the sampled packet
910///
911/// # XDR Definition ([sFlow Discussion](http://groups.google.com/group/sflow/browse_thread/thread/773d27b17a81600c))
912///
913/// ```text
914/// /* Extended queue length data
915/// Used to indicate the queue length experienced by the sampled packet.
916/// If the extended_queue_length record is exported, queue_length counter
917/// records must also be exported with the if_counter record.*/
918///
919/// /* opaque = flow_data; enterprise = 0; format = 1019 */
920///
921/// struct extended_queue_length
922/// {
923/// unsigned int queueIndex; /* persistent index within port of queue
924/// used to enqueue sampled packet.
925/// The ifIndex of the port can be inferred
926/// from the data source. */
927/// unsigned int queueLength; /* length of queue, in segments,
928/// experienced by the packet (ie queue length
929/// immediately before the sampled packet is
930/// enqueued). */
931/// }
932/// ```
933#[derive(Debug, Clone, PartialEq, Eq)]
934#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
935pub struct ExtendedQueueLength {
936 /// Persistent index within port of queue used to enqueue sampled packet
937 pub queue_index: u32,
938
939 /// Length of queue, in segments, experienced by the packet
940 /// (queue length immediately before the sampled packet is enqueued)
941 pub queue_length: u32,
942}
943
944/// Extended NAT Port Data - Format (0,1020)
945///
946/// Layer 4 port translation information for NAT
947///
948/// # XDR Definition ([sFlow Port NAT](https://sflow.org/sflow_pnat.txt))
949///
950/// ```text
951/// /* Extended NAT L4 Port Data
952/// Packet header reports ports as seen at the sFlowDataSource.
953/// The extended_nat_port structure reports on translated source and/or
954/// destination layer 4 (TCP/UDP) ports for this packet. If port was not
955/// translated it should be equal to that reported for the header. */
956/// /* opaque = flow_data; enterprise = 0; format = 1020 */
957///
958/// struct extended_nat_port {
959/// unsigned int src_port; /* Source port */
960/// unsigned int dst_port; /* Destination port */
961/// }
962/// ```
963#[derive(Debug, Clone, PartialEq, Eq)]
964#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
965pub struct ExtendedNatPort {
966 /// Translated source port
967 pub src_port: u32,
968
969 /// Translated destination port
970 pub dst_port: u32,
971}
972
973/// Extended L2 Tunnel Egress - Format (0,1021)
974///
975/// Layer 2 tunnel egress information - reports outer Ethernet headers
976/// that will be added on egress when encapsulating packets
977///
978/// # XDR Definition ([sFlow Tunnels](https://sflow.org/sflow_tunnels.txt))
979///
980/// ```text
981/// /* opaque = flow_data; enterprise = 0; format = 1021 */
982/// struct extended_L2_tunnel_egress {
983/// sampled_ethernet header;
984/// }
985/// ```
986#[derive(Debug, Clone, PartialEq, Eq)]
987#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
988pub struct ExtendedL2TunnelEgress {
989 /// Outer Ethernet header that will be added on egress
990 pub header: SampledEthernet,
991}
992
993/// Extended L2 Tunnel Ingress - Format (0,1022)
994///
995/// Layer 2 tunnel ingress information - reports outer Ethernet headers
996/// that were present on ingress and removed during decapsulation
997///
998/// # XDR Definition ([sFlow Tunnels](https://sflow.org/sflow_tunnels.txt))
999///
1000/// ```text
1001/// /* opaque = flow_data; enterprise = 0; format = 1022 */
1002/// struct extended_L2_tunnel_ingress {
1003/// sampled_ethernet header;
1004/// }
1005/// ```
1006#[derive(Debug, Clone, PartialEq, Eq)]
1007#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1008pub struct ExtendedL2TunnelIngress {
1009 /// Outer Ethernet header that was present on ingress
1010 pub header: SampledEthernet,
1011}
1012
1013/// Extended IPv4 Tunnel Egress - Format (0,1023)
1014///
1015/// IPv4 tunnel egress information - reports outer IPv4 headers
1016/// that will be added on egress when encapsulating packets
1017///
1018/// # XDR Definition ([sFlow Tunnels](https://sflow.org/sflow_tunnels.txt))
1019///
1020/// ```text
1021/// /* opaque = flow_data; enterprise = 0; format = 1023 */
1022/// struct extended_ipv4_tunnel_egress {
1023/// sampled_ipv4 header;
1024/// }
1025/// ```
1026#[derive(Debug, Clone, PartialEq, Eq)]
1027#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1028pub struct ExtendedIpv4TunnelEgress {
1029 /// Outer IPv4 header that will be added on egress
1030 pub header: SampledIpv4,
1031}
1032
1033/// Extended IPv4 Tunnel Ingress - Format (0,1024)
1034///
1035/// IPv4 tunnel ingress information - reports outer IPv4 headers
1036/// that were present on ingress and removed during decapsulation
1037///
1038/// # XDR Definition ([sFlow Tunnels](https://sflow.org/sflow_tunnels.txt))
1039///
1040/// ```text
1041/// /* opaque = flow_data; enterprise = 0; format = 1024 */
1042/// struct extended_ipv4_tunnel_ingress {
1043/// sampled_ipv4 header;
1044/// }
1045/// ```
1046#[derive(Debug, Clone, PartialEq, Eq)]
1047#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1048pub struct ExtendedIpv4TunnelIngress {
1049 /// Outer IPv4 header that was present on ingress
1050 pub header: SampledIpv4,
1051}
1052
1053/// Extended IPv6 Tunnel Egress - Format (0,1025)
1054///
1055/// IPv6 tunnel egress information - reports outer IPv6 headers
1056/// that will be added on egress when encapsulating packets
1057///
1058/// # XDR Definition ([sFlow Tunnels](https://sflow.org/sflow_tunnels.txt))
1059///
1060/// ```text
1061/// /* opaque = flow_data; enterprise = 0; format = 1025 */
1062/// struct extended_ipv6_tunnel_egress {
1063/// sampled_ipv6 header;
1064/// }
1065/// ```
1066#[derive(Debug, Clone, PartialEq, Eq)]
1067#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1068pub struct ExtendedIpv6TunnelEgress {
1069 /// Outer IPv6 header that will be added on egress
1070 pub header: SampledIpv6,
1071}
1072
1073/// Extended IPv6 Tunnel Ingress - Format (0,1026)
1074///
1075/// IPv6 tunnel ingress information - reports outer IPv6 headers
1076/// that were present on ingress and removed during decapsulation
1077///
1078/// # XDR Definition ([sFlow Tunnels](https://sflow.org/sflow_tunnels.txt))
1079///
1080/// ```text
1081/// /* opaque = flow_data; enterprise = 0; format = 1026 */
1082/// struct extended_ipv6_tunnel_ingress {
1083/// sampled_ipv6 header;
1084/// }
1085/// ```
1086#[derive(Debug, Clone, PartialEq, Eq)]
1087#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1088pub struct ExtendedIpv6TunnelIngress {
1089 /// Outer IPv6 header that was present on ingress
1090 pub header: SampledIpv6,
1091}
1092
1093/// Extended Decapsulate Egress - Format (0,1027)
1094///
1095/// Indicates the end of a tunnel and points to the start of the inner header
1096/// Used when a packet is sampled before decapsulation on ingress
1097///
1098/// # XDR Definition ([sFlow Tunnels](https://sflow.org/sflow_tunnels.txt))
1099///
1100/// ```text
1101/// /* opaque = flow_data; enterprise = 0; format = 1027 */
1102/// struct extended_decapsulate_egress {
1103/// unsigned int inner_header_offset;
1104/// }
1105/// ```
1106#[derive(Debug, Clone, PartialEq, Eq)]
1107#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1108pub struct ExtendedDecapsulateEgress {
1109 /// Offset in bytes to the inner header within the sampled packet header
1110 pub inner_header_offset: u32,
1111}
1112
1113/// Extended Decapsulate Ingress - Format (0,1028)
1114///
1115/// Indicates the start of a tunnel
1116/// Used when a packet is sampled after encapsulation on egress
1117///
1118/// # XDR Definition ([sFlow Tunnels](https://sflow.org/sflow_tunnels.txt))
1119///
1120/// ```text
1121/// /* opaque = flow_data; enterprise = 0; format = 1028 */
1122/// struct extended_decapsulate_ingress {
1123/// unsigned int inner_header_offset;
1124/// }
1125/// ```
1126#[derive(Debug, Clone, PartialEq, Eq)]
1127#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1128pub struct ExtendedDecapsulateIngress {
1129 /// Offset in bytes to the inner header within the sampled packet header
1130 pub inner_header_offset: u32,
1131}
1132
1133/// Extended VNI Egress - Format (0,1029)
1134///
1135/// Virtual Network Identifier for egress traffic
1136/// The VNI may be explicitly included in the tunneling protocol or implicit
1137///
1138/// # XDR Definition ([sFlow Tunnels](https://sflow.org/sflow_tunnels.txt))
1139///
1140/// ```text
1141/// /* opaque_flow_data; enterprise = 0; format = 1029 */
1142/// struct extended_vni_egress {
1143/// unsigned int vni;
1144/// }
1145/// ```
1146#[derive(Debug, Clone, PartialEq, Eq)]
1147#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1148pub struct ExtendedVniEgress {
1149 /// Virtual Network Identifier
1150 pub vni: u32,
1151}
1152
1153/// Extended VNI Ingress - Format (0,1030)
1154///
1155/// Virtual Network Identifier for ingress traffic
1156/// The VNI may be explicitly included in the tunneling protocol or implicit
1157/// in the encapsulation (e.g., VXLAN uses UDP port 4789).
1158///
1159/// # XDR Definition ([sFlow Tunnel](https://sflow.org/sflow_tunnels.txt))
1160///
1161/// ```text
1162/// /* VNI ingress */
1163/// /* opaque = flow_data; enterprise = 0; format = 1030 */
1164///
1165/// struct extended_vni_ingress {
1166/// unsigned int vni; /* VNI associated with ingress packet */
1167/// }
1168/// ```
1169#[derive(Debug, Clone, PartialEq, Eq)]
1170#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1171pub struct ExtendedVniIngress {
1172 /// Virtual Network Identifier
1173 pub vni: u32,
1174}
1175
1176/// Extended InfiniBand LRH - Format (0,1031)
1177///
1178/// InfiniBand Local Routing Header information
1179///
1180/// # XDR Definition ([sFlow InfiniBand](https://sflow.org/draft_sflow_infiniband_2.txt))
1181///
1182/// ```text
1183/// /* Extended IB LRH Data
1184/// - Local Routing Header definition from InfiniBand Architecture
1185/// Specification */
1186///
1187/// /* opaque = flow_data; enterprise = 0; format = 1031 */
1188///
1189/// struct extended_ib_lrh {
1190/// unsigned int src_vl; /* source virtual lane */
1191/// unsigned int src_sl; /* source service level */
1192/// unsigned int src_dlid; /* source destination-local-ID */
1193/// unsigned int src_slid; /* source source-local-ID */
1194/// unsigned int src_lnh; /* source link next header */
1195/// unsigned int dst_vl; /* Destination virtual lane */
1196/// unsigned int dst_sl; /* Destination service level */
1197/// unsigned int dst_dlid; /* Destination destination-local-ID */
1198/// unsigned int dst_slid; /* Destination source-local-ID */
1199/// unsigned int dst_lnh; /* Destination link next header */
1200/// }
1201/// ```
1202///
1203/// **ERRATUM:** The specification uses non-standard data type `ib_lrh_data` instead of `flow_data`.
1204/// The corrected version is shown above.
1205#[derive(Debug, Clone, PartialEq, Eq)]
1206#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1207pub struct ExtendedInfiniBandLrh {
1208 /// Source virtual lane
1209 pub src_vl: u32,
1210 /// Source service level
1211 pub src_sl: u32,
1212 /// Source destination-local-ID
1213 pub src_dlid: u32,
1214 /// Source source-local-ID
1215 pub src_slid: u32,
1216 /// Source link next header
1217 pub src_lnh: u32,
1218 /// Destination virtual lane
1219 pub dst_vl: u32,
1220 /// Destination service level
1221 pub dst_sl: u32,
1222 /// Destination destination-local-ID
1223 pub dst_dlid: u32,
1224 /// Destination source-local-ID
1225 pub dst_slid: u32,
1226 /// Destination link next header
1227 pub dst_lnh: u32,
1228}
1229
1230/// Extended InfiniBand GRH - Format (0,1032)
1231///
1232/// InfiniBand Global Routing Header information
1233///
1234/// # XDR Definition ([sFlow InfiniBand](https://sflow.org/draft_sflow_infiniband_2.txt))
1235///
1236/// ```text
1237/// /* GID type 16 bytes long */
1238/// typedef opaque gid[16];
1239///
1240/// /* Extended IB GRH Data
1241/// - Global Routing Header definition from InfiniBand Architecture
1242/// Specification */
1243///
1244/// /* opaque = flow_data; enterprise = 0; format = 1032 */
1245///
1246/// struct extended_ib_grh {
1247/// unsigned int flow_label; /* flow label */
1248/// unsigned int tc; /* Traffic Class */
1249/// gid s_gid; /* source GID */
1250/// gid d_gid; /* destination GID */
1251/// unsigned int next_header; /* next header type */
1252/// unsigned int length; /* payload length */
1253/// }
1254/// ```
1255///
1256/// **ERRATUM:** The specification is missing semicolons after `next_header` and `length`,
1257/// violating RFC 4506 XDR syntax requirements. Additionally, the specification uses
1258/// non-standard data type `ib_grh_data` instead of `flow_data`. The corrected version is shown above.
1259#[derive(Debug, Clone, PartialEq, Eq)]
1260#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1261pub struct ExtendedInfiniBandGrh {
1262 /// Flow label
1263 pub flow_label: u32,
1264 /// Traffic class
1265 pub tc: u32,
1266 /// Source GID (16 bytes)
1267 pub s_gid: [u8; 16],
1268 /// Destination GID (16 bytes)
1269 pub d_gid: [u8; 16],
1270 /// Next header type
1271 pub next_header: u32,
1272 /// Payload length
1273 pub length: u32,
1274}
1275
1276/// Extended InfiniBand BTH - Format (0,1033)
1277///
1278/// InfiniBand Base Transport Header information
1279///
1280/// # XDR Definition ([sFlow InfiniBand](https://sflow.org/draft_sflow_infiniband_2.txt))
1281///
1282/// ```text
1283/// /* Extended IB BTH Data
1284/// - Base Transport Header definition from InfiniBand Architecture
1285/// Specification */
1286///
1287/// /* opaque = flow_data; enterprise = 0; format = 1033 */
1288///
1289/// struct extended_ib_bth {
1290/// unsigned int pkey; /* Partition key */
1291/// unsigned int dst_qp; /* Destination Queue Pair */
1292/// unsigned int opcode; /* IBA packet type */
1293/// }
1294/// ```
1295///
1296/// **ERRATUM:** The specification uses non-standard data type `ib_bth_data` instead of `flow_data`.
1297/// The corrected version is shown above.
1298#[derive(Debug, Clone, PartialEq, Eq)]
1299#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1300pub struct ExtendedInfiniBandBth {
1301 /// Partition key
1302 pub pkey: u32,
1303 /// Destination Queue Pair
1304 pub dst_qp: u32,
1305 /// IBA packet type (opcode)
1306 pub opcode: u32,
1307}
1308
1309/// Extended VLAN In - Format (0,1034)
1310///
1311/// Ingress 802.1Q VLAN tag information
1312///
1313/// # XDR Definition ([sFlow Discussion](https://sflow.org/discussion/sflow-discussion/0199.html))
1314///
1315/// ```text
1316/// /* opaque = flow_data; enterprise = 0; format = 1034 */
1317/// extended_vlanin {
1318/// unsigned int stack<>; /* List of ingress 802.1Q TPID/TCI layers. Each
1319/// TPID,TCI pair is represented as a single 32 bit
1320/// integer. Layers listed from outermost to
1321/// innermost. */
1322/// }
1323/// ```
1324#[derive(Debug, Clone, PartialEq, Eq)]
1325#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1326pub struct ExtendedVlanIn {
1327 /// List of ingress 802.1Q TPID/TCI layers
1328 /// Each TPID,TCI pair is represented as a single 32-bit integer
1329 /// Layers listed from outermost to innermost
1330 pub stack: Vec<u32>,
1331}
1332
1333/// Extended VLAN Out - Format (0,1035)
1334///
1335/// Egress 802.1Q VLAN tag information
1336///
1337/// # XDR Definition ([sFlow Discussion](https://sflow.org/discussion/sflow-discussion/0199.html))
1338///
1339/// ```text
1340/// /* opaque = flow_data; enterprise = 0; format = 1035 */
1341/// extended_vlanout {
1342/// unsigned int stack<>; /* List of egress 802.1Q TPID/TCI layers. Each
1343/// TPID,TCI pair is represented as a single 32 bit
1344/// integer. Layers listed from outermost to
1345/// innermost. */
1346/// }
1347/// ```
1348#[derive(Debug, Clone, PartialEq, Eq)]
1349#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1350pub struct ExtendedVlanOut {
1351 /// List of egress 802.1Q TPID/TCI layers
1352 /// Each TPID,TCI pair is represented as a single 32-bit integer
1353 /// Layers listed from outermost to innermost
1354 pub stack: Vec<u32>,
1355}
1356
1357/// Extended Egress Queue - Format (0,1036)
1358///
1359/// Selected egress queue for the sampled packet
1360///
1361/// # XDR Definition ([sFlow Drops](https://sflow.org/sflow_drops.txt))
1362///
1363/// ```text
1364/// /* Selected egress queue */
1365/// /* Output port number must be provided in enclosing structure */
1366/// /* opaque = flow_data; enterprise = 0; format = 1036 */
1367/// struct extended_egress_queue {
1368/// unsigned int queue; /* eqress queue number selected for sampled packet */
1369/// }
1370/// ```
1371#[derive(Debug, Clone, PartialEq, Eq)]
1372#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1373pub struct ExtendedEgressQueue {
1374 /// Egress queue number selected for sampled packet
1375 pub queue: u32,
1376}
1377
1378/// Extended ACL - Format (0,1037)
1379///
1380/// ACL information about the rule that matched this packet
1381///
1382/// # XDR Definition ([sFlow Drops](https://sflow.org/sflow_drops.txt))
1383///
1384/// ```text
1385/// /* ACL information */
1386/// /* Information about ACL rule that matched this packet
1387/// /* opaque = flow_data; enterprise = 0; format = 1037 */
1388/// struct extended_acl {
1389/// unsigned int number; /* access list number */
1390/// string name<>; /* access list name */
1391/// unsigned int direction; /* unknown = 0, ingress = 1, egress = 2 */
1392/// }
1393/// ```
1394#[derive(Debug, Clone, PartialEq, Eq)]
1395#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1396pub struct ExtendedAcl {
1397 /// Access list number
1398 pub number: u32,
1399
1400 /// Access list name
1401 pub name: String,
1402
1403 /// Direction: unknown = 0, ingress = 1, egress = 2
1404 pub direction: u32,
1405}
1406
1407/// Extended Function - Format (0,1038)
1408///
1409/// Name of the function in software network stack that discarded the packet
1410///
1411/// # XDR Definition ([sFlow Drops](https://sflow.org/sflow_drops.txt))
1412///
1413/// ```text
1414/// /* Software function */
1415/// /* Name of the function in software network stack that discarded the packet */
1416/// /* opaque = flow_data; enterprise = 0; format = 1038 */
1417/// struct extended_function {
1418/// string symbol<>;
1419/// }
1420/// ```
1421#[derive(Debug, Clone, PartialEq, Eq)]
1422#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1423pub struct ExtendedFunction {
1424 /// Function symbol name
1425 pub symbol: String,
1426}
1427
1428/// Extended Transit - Format (0,1039)
1429///
1430/// Delay for sampled packet traversing switch
1431///
1432/// # XDR Definition ([sFlow Transit](https://sflow.org/sflow_transit.txt))
1433///
1434/// ```text
1435/// /* Delay for sampled packet traversing switch */
1436/// /* opaque = flow_data; enterprise = 0; format = 1039 */
1437/// struct extended_transit {
1438/// unsigned int delay; /* transit delay in nanoseconds
1439/// 0xffffffff indicates value >= 0xffffffff */
1440/// }
1441/// ```
1442#[derive(Debug, Clone, PartialEq, Eq)]
1443#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1444pub struct ExtendedTransit {
1445 /// Transit delay in nanoseconds (0xffffffff indicates value >= 0xffffffff)
1446 pub delay: u32,
1447}
1448
1449/// Extended Queue - Format (0,1040)
1450///
1451/// Queue depth for sampled packet traversing switch
1452///
1453/// # XDR Definition ([sFlow Transit](https://sflow.org/sflow_transit.txt))
1454///
1455/// ```text
1456/// /* Queue depth for sampled packet traversing switch */
1457/// /* extended_egress_queue structure must be included */
1458/// /* opaque = flow_data; enterprise = 0; format = 1040 */
1459/// struct extended_queue {
1460/// unsigned int depth; /* queue depth in bytes */
1461/// }
1462/// ```
1463#[derive(Debug, Clone, PartialEq, Eq)]
1464#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1465pub struct ExtendedQueue {
1466 /// Queue depth in bytes
1467 pub depth: u32,
1468}
1469
1470/// Extended HW Trap - Format (0,1041)
1471///
1472/// Devlink Trap Name information from Linux kernel
1473///
1474/// # XDR Definition ([host-sflow](https://github.com/sflow/host-sflow/blob/v2.0.50-3/src/sflow/sflow.h))
1475///
1476/// ```text
1477/// /* Devlink Trap Name */
1478/// /* opaque = flow_data; enterprise = 0; format = 1041 */
1479/// /* https://www.kernel.org/doc/html/latest/networking/devlink/devlink-trap.html */
1480/// /* XDR spec: */
1481/// /* struct extended_hw_trap { */
1482/// /* string group<>; */ /* NET_DM_ATTR_HW_TRAP_GROUP_NAME */
1483/// /* string trap<>; */ /* NET_DM_ATTR_HW_TRAP_NAME */
1484/// /* } */
1485/// ```
1486#[derive(Debug, Clone, PartialEq, Eq)]
1487#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1488pub struct ExtendedHwTrap {
1489 /// Hardware trap group name (NET_DM_ATTR_HW_TRAP_GROUP_NAME)
1490 pub group: String,
1491
1492 /// Hardware trap name (NET_DM_ATTR_HW_TRAP_NAME)
1493 pub trap: String,
1494}
1495
1496/// Extended Linux Drop Reason - Format (0,1042)
1497///
1498/// Linux drop_monitor reason information
1499///
1500/// # XDR Definition ([host-sflow](https://github.com/sflow/host-sflow/blob/v2.0.50-3/src/sflow/sflow.h))
1501///
1502/// ```text
1503/// /* Linux drop_monitor reason */
1504/// /* opaque = flow_data; enterprise = 0; format = 1042 */
1505/// /* https://github.com/torvalds/linux/blob/master/include/net/dropreason.h */
1506/// /* XDR spec: */
1507/// /* struct extended_linux_drop_reason { */
1508/// /* string reason<>; */ /* NET_DM_ATTR_REASON */
1509/// /* } */
1510/// ```
1511#[derive(Debug, Clone, PartialEq, Eq)]
1512#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1513pub struct ExtendedLinuxDropReason {
1514 /// Drop reason string (NET_DM_ATTR_REASON)
1515 pub reason: String,
1516}
1517
1518/// Transaction status values
1519///
1520/// # XDR Definition ([sFlow Discussion](https://sflow.org/discussion/sflow-discussion/0282.html))
1521///
1522/// ```text
1523/// enum status_value {
1524/// succeeded = 0,
1525/// generic_failure = 1,
1526/// outofmemory = 2,
1527/// timeout = 3,
1528/// notpermitted = 4
1529/// }
1530/// ```
1531#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1532#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1533#[repr(u32)]
1534pub enum TransactionStatus {
1535 Succeeded = 0,
1536 GenericFailure = 1,
1537 OutOfMemory = 2,
1538 Timeout = 3,
1539 NotPermitted = 4,
1540}
1541
1542impl From<u32> for TransactionStatus {
1543 fn from(value: u32) -> Self {
1544 match value {
1545 0 => TransactionStatus::Succeeded,
1546 1 => TransactionStatus::GenericFailure,
1547 2 => TransactionStatus::OutOfMemory,
1548 3 => TransactionStatus::Timeout,
1549 4 => TransactionStatus::NotPermitted,
1550 _ => TransactionStatus::GenericFailure,
1551 }
1552 }
1553}
1554
1555/// Service direction for transactions
1556///
1557/// # XDR Definition ([sFlow Discussion](https://sflow.org/discussion/sflow-discussion/0282.html))
1558///
1559/// ```text
1560/// enum service_direction {
1561/// client = 1,
1562/// server = 2
1563/// }
1564/// ```
1565#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1566#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1567#[repr(u32)]
1568pub enum ServiceDirection {
1569 Client = 1,
1570 Server = 2,
1571}
1572
1573impl From<u32> for ServiceDirection {
1574 fn from(value: u32) -> Self {
1575 match value {
1576 1 => ServiceDirection::Client,
1577 2 => ServiceDirection::Server,
1578 _ => ServiceDirection::Client,
1579 }
1580 }
1581}
1582
1583/// Transaction - Format (0,2000)
1584///
1585/// Generic application transaction record sampled upon completion
1586///
1587/// # XDR Definition ([sFlow Discussion](https://sflow.org/discussion/sflow-discussion/0282.html))
1588///
1589/// ```text
1590/// /* Generic Application Transaction record */
1591/// /* Every Application Transaction sample must start with a generic transaction record */
1592/// /* opaque = flow_data; enterprise = 0; format = 2000 */
1593/// struct transaction {
1594/// service_direction direction; /* was this transaction observed by the server or the client */
1595/// unsigned int wait; /* time in microseconds that transaction was queued
1596/// before processing started */
1597/// unsigned int duration; /* time in microseconds from start of processing to completion */
1598/// status_value status; /* status of transaction */
1599/// unsigned hyper bytes_received; /* bytes received */
1600/// unsigned hyper bytes_send; /* bytes sent */
1601/// }
1602/// ```
1603#[derive(Debug, Clone, PartialEq, Eq)]
1604#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1605pub struct Transaction {
1606 /// Was this transaction observed by the server or the client
1607 pub direction: ServiceDirection,
1608
1609 /// Time in microseconds that transaction was queued before processing started
1610 pub wait: u32,
1611
1612 /// Time in microseconds from start of processing to completion
1613 pub duration: u32,
1614
1615 /// Status of transaction
1616 pub status: TransactionStatus,
1617
1618 /// Bytes received
1619 pub bytes_received: u64,
1620
1621 /// Bytes sent (spec: bytes_send)
1622 pub bytes_sent: u64,
1623}
1624
1625/// Extended NFS Storage Transaction - Format (0,2001)
1626///
1627/// NFS operation transaction details
1628///
1629/// # XDR Definition ([sFlow Discussion](https://sflow.org/discussion/sflow-discussion/0282.html))
1630///
1631/// ```text
1632/// /* Extended NFS transaction */
1633/// /* see RFC 3530 */
1634/// /* opaque = flow_data; enterprise = 0; format = 2001 */
1635/// struct extended_nfs_storage_transaction {
1636/// opaque<> path; /* canonical path to file or directory
1637/// associated with operation file handle
1638/// UTF8 encoded string */
1639/// unsigned int operation; /* NFS operation */
1640/// unsigned int status; /* NFS operation status - nfsstat4 */
1641/// }
1642/// ```
1643#[derive(Debug, Clone, PartialEq, Eq)]
1644#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1645pub struct ExtendedNfsStorageTransaction {
1646 /// Canonical path to file or directory (UTF8 encoded)
1647 pub path: Vec<u8>,
1648
1649 /// NFS operation
1650 pub operation: u32,
1651
1652 /// NFS operation status (nfsstat4)
1653 pub status: u32,
1654}
1655
1656/// Extended SCSI Storage Transaction - Format (0,2002)
1657///
1658/// SCSI operation transaction details
1659///
1660/// # XDR Definition ([sFlow Discussion](https://sflow.org/discussion/sflow-discussion/0282.html))
1661///
1662/// ```text
1663/// /* Extended SCSI transaction */
1664/// /* opaque = flow_data; enterprise = 0; format = 2002 */
1665/// struct extended_scsi_storage_transaction {
1666/// unsigned int lun; /* LUN */
1667/// unsigned int operation; /* use maxint to encode unknown operation */
1668/// unsigned int status; /* SCSI status code reporting result of operation */
1669/// }
1670/// ```
1671#[derive(Debug, Clone, PartialEq, Eq)]
1672#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1673pub struct ExtendedScsiStorageTransaction {
1674 /// Logical Unit Number
1675 pub lun: u32,
1676
1677 /// SCSI operation (use maxint to encode unknown operation)
1678 pub operation: u32,
1679
1680 /// SCSI status code reporting result of operation
1681 pub status: u32,
1682}
1683
1684/// Extended HTTP Transaction - Format (0,2003)
1685///
1686/// HTTP transaction details
1687///
1688/// # XDR Definition ([sFlow Discussion](https://sflow.org/discussion/sflow-discussion/0282.html))
1689///
1690/// ```text
1691/// /* Extended Web transaction */
1692/// /* opaque = flow_data; enterprise = 0; format = 2003 */
1693/// struct extended_http_transaction {
1694/// string<> url; /* The HTTP request-line (see RFC 2616) */
1695/// string<> host; /* The host field from the HTTP header */
1696/// string<> referer; /* The referer field from the HTTP header */
1697/// string<> useragent; /* The user agent from the HTTP header */
1698/// string<> user; /* The authenticated user */
1699/// unigned int status; /* Status code returned with response */
1700/// }
1701/// ```
1702#[derive(Debug, Clone, PartialEq, Eq)]
1703#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1704pub struct ExtendedHttpTransaction {
1705 /// The HTTP request-line (see RFC 2616)
1706 pub url: String,
1707
1708 /// The host field from the HTTP header
1709 pub host: String,
1710
1711 /// The referer field from the HTTP header
1712 pub referer: String,
1713
1714 /// The user agent from the HTTP header (spec: useragent)
1715 pub user_agent: String,
1716
1717 /// The authenticated user
1718 pub user: String,
1719
1720 /// Status code returned with response
1721 pub status: u32,
1722}
1723
1724/// Extended Socket IPv4 - Format (0,2100)
1725///
1726/// IPv4 socket information for application transactions
1727///
1728/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1729///
1730/// ```text
1731/// /* IPv4 Socket */
1732/// /* opaque = flow_data; enterprise = 0; format = 2100 */
1733///
1734/// struct extended_socket_ipv4 {
1735/// unsigned int protocol; /* IP Protocol type (e.g., TCP = 6, UDP = 17) */
1736/// ip_v4 local_ip; /* local IP address */
1737/// ip_v4 remote_ip; /* remote IP address */
1738/// unsigned int local_port; /* TCP/UDP local port number or equivalent */
1739/// unsigned int remote_port; /* TCP/UDP remote port number or equivalent */
1740/// }
1741/// ```
1742#[derive(Debug, Clone, PartialEq, Eq)]
1743#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1744pub struct ExtendedSocketIpv4 {
1745 /// IP Protocol type (e.g., TCP = 6, UDP = 17)
1746 pub protocol: u32,
1747
1748 /// Local IP address
1749 pub local_ip: std::net::Ipv4Addr,
1750
1751 /// Remote IP address
1752 pub remote_ip: std::net::Ipv4Addr,
1753
1754 /// TCP/UDP local port number
1755 pub local_port: u32,
1756
1757 /// TCP/UDP remote port number
1758 pub remote_port: u32,
1759}
1760
1761/// Extended Socket IPv6 - Format (0,2101)
1762///
1763/// IPv6 socket information for application transactions
1764///
1765/// # XDR Definition ([sFlow Host](https://sflow.org/sflow_host.txt))
1766///
1767/// ```text
1768/// /* IPv6 Socket */
1769/// /* opaque = flow_data; enterprise = 0; format = 2101 */
1770///
1771/// struct extended_socket_ipv6 {
1772/// unsigned int protocol; /* IP Protocol type (e.g., TCP = 6, UDP = 17) */
1773/// ip_v6 local_ip; /* local IP address */
1774/// ip_v6 remote_ip; /* remote IP address */
1775/// unsigned int local_port; /* TCP/UDP local port number or equivalent */
1776/// unsigned int remote_port; /* TCP/UDP remote port number or equivalent */
1777/// }
1778/// ```
1779#[derive(Debug, Clone, PartialEq, Eq)]
1780#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1781pub struct ExtendedSocketIpv6 {
1782 /// IP Protocol type (e.g., TCP = 6, UDP = 17)
1783 pub protocol: u32,
1784
1785 /// Local IP address
1786 pub local_ip: std::net::Ipv6Addr,
1787
1788 /// Remote IP address
1789 pub remote_ip: std::net::Ipv6Addr,
1790
1791 /// TCP/UDP local port number
1792 pub local_port: u32,
1793
1794 /// TCP/UDP remote port number
1795 pub remote_port: u32,
1796}
1797
1798/// Extended Proxy Socket IPv4 - Format (0,2102)
1799///
1800/// IPv4 socket information for proxy connections
1801///
1802/// # XDR Definition ([sFlow HTTP](https://sflow.org/sflow_http.txt))
1803///
1804/// ```text
1805/// /* Proxy socket IPv4 */
1806/// /* opaque = flow_data; enterprise=0; format=2102 */
1807/// struct extended_proxy_socket_ipv4 {
1808/// extended_socket_ipv4 socket;
1809/// }
1810/// ```
1811#[derive(Debug, Clone, PartialEq, Eq)]
1812#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1813pub struct ExtendedProxySocketIpv4 {
1814 /// Socket information
1815 pub socket: ExtendedSocketIpv4,
1816}
1817
1818/// Extended Proxy Socket IPv6 - Format (0,2103)
1819///
1820/// IPv6 socket information for proxy connections
1821///
1822/// # XDR Definition ([sFlow HTTP](https://sflow.org/sflow_http.txt))
1823///
1824/// ```text
1825/// /* Proxy socket IPv6 */
1826/// /* opaque = flow_data; enterprise=0; format=2103 */
1827/// struct extended_proxy_socket_ipv6 {
1828/// extended_socket_ipv6 socket;
1829/// }
1830/// ```
1831#[derive(Debug, Clone, PartialEq, Eq)]
1832#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1833pub struct ExtendedProxySocketIpv6 {
1834 /// Socket information
1835 pub socket: ExtendedSocketIpv6,
1836}
1837
1838/// Application operation context
1839///
1840/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
1841///
1842/// ```text
1843/// struct context {
1844/// application application;
1845/// operation operation;
1846/// attributes attributes;
1847/// }
1848/// ```
1849#[derive(Debug, Clone, PartialEq, Eq)]
1850#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1851pub struct AppContext {
1852 /// Application name (e.g., "payment", "mail.smtp", "db.oracle")
1853 pub application: String,
1854
1855 /// Operation name (e.g., "get.customer.name", "upload.photo")
1856 pub operation: String,
1857
1858 /// Operation attributes as name=value pairs (e.g., "cc=visa&loc=mobile")
1859 pub attributes: String,
1860}
1861
1862/// Application operation status
1863///
1864/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
1865#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1866#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1867#[repr(u32)]
1868pub enum AppStatus {
1869 Success = 0,
1870 Other = 1,
1871 Timeout = 2,
1872 InternalError = 3,
1873 BadRequest = 4,
1874 Forbidden = 5,
1875 TooLarge = 6,
1876 NotImplemented = 7,
1877 NotFound = 8,
1878 Unavailable = 9,
1879 Unauthorized = 10,
1880}
1881
1882impl From<u32> for AppStatus {
1883 fn from(value: u32) -> Self {
1884 match value {
1885 0 => AppStatus::Success,
1886 1 => AppStatus::Other,
1887 2 => AppStatus::Timeout,
1888 3 => AppStatus::InternalError,
1889 4 => AppStatus::BadRequest,
1890 5 => AppStatus::Forbidden,
1891 6 => AppStatus::TooLarge,
1892 7 => AppStatus::NotImplemented,
1893 8 => AppStatus::NotFound,
1894 9 => AppStatus::Unavailable,
1895 10 => AppStatus::Unauthorized,
1896 _ => AppStatus::Other,
1897 }
1898 }
1899}
1900
1901/// Memcache Protocol
1902///
1903/// # XDR Definition ([sFlow Memcache](https://sflow.org/sflow_memcache.txt))
1904///
1905/// ```text
1906/// enum memcache_protocol {
1907/// OTHER = 0;
1908/// ASCII = 1;
1909/// BINARY = 2;
1910/// }
1911/// ```
1912#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1913#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1914#[repr(u32)]
1915pub enum MemcacheProtocol {
1916 Other = 0,
1917 Ascii = 1,
1918 Binary = 2,
1919}
1920
1921impl MemcacheProtocol {
1922 /// Convert from u32 value to MemcacheProtocol enum
1923 pub fn from_u32(value: u32) -> Self {
1924 match value {
1925 1 => MemcacheProtocol::Ascii,
1926 2 => MemcacheProtocol::Binary,
1927 _ => MemcacheProtocol::Other,
1928 }
1929 }
1930}
1931
1932/// Memcache Command
1933///
1934/// # XDR Definition ([sFlow Memcache](https://sflow.org/sflow_memcache.txt))
1935///
1936/// ```text
1937/// enum memcache_cmd {
1938/// OTHER = 0;
1939/// SET = 1;
1940/// ADD = 2;
1941/// REPLACE = 3;
1942/// APPEND = 4;
1943/// PREPEND = 5;
1944/// CAS = 6;
1945/// GET = 7;
1946/// GETS = 8;
1947/// INCR = 9;
1948/// DECR = 10;
1949/// DELETE = 11;
1950/// STATS = 12;
1951/// FLUSH = 13;
1952/// VERSION = 14;
1953/// QUIT = 15;
1954/// TOUCH = 16;
1955/// }
1956/// ```
1957#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1958#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1959#[repr(u32)]
1960pub enum MemcacheCommand {
1961 Other = 0,
1962 Set = 1,
1963 Add = 2,
1964 Replace = 3,
1965 Append = 4,
1966 Prepend = 5,
1967 Cas = 6,
1968 Get = 7,
1969 Gets = 8,
1970 Incr = 9,
1971 Decr = 10,
1972 Delete = 11,
1973 Stats = 12,
1974 Flush = 13,
1975 Version = 14,
1976 Quit = 15,
1977 Touch = 16,
1978}
1979
1980impl MemcacheCommand {
1981 /// Convert from u32 value to MemcacheCommand enum
1982 pub fn from_u32(value: u32) -> Self {
1983 match value {
1984 1 => MemcacheCommand::Set,
1985 2 => MemcacheCommand::Add,
1986 3 => MemcacheCommand::Replace,
1987 4 => MemcacheCommand::Append,
1988 5 => MemcacheCommand::Prepend,
1989 6 => MemcacheCommand::Cas,
1990 7 => MemcacheCommand::Get,
1991 8 => MemcacheCommand::Gets,
1992 9 => MemcacheCommand::Incr,
1993 10 => MemcacheCommand::Decr,
1994 11 => MemcacheCommand::Delete,
1995 12 => MemcacheCommand::Stats,
1996 13 => MemcacheCommand::Flush,
1997 14 => MemcacheCommand::Version,
1998 15 => MemcacheCommand::Quit,
1999 16 => MemcacheCommand::Touch,
2000 _ => MemcacheCommand::Other,
2001 }
2002 }
2003}
2004
2005/// Memcache Status
2006///
2007/// # XDR Definition ([sFlow Memcache](https://sflow.org/sflow_memcache.txt))
2008///
2009/// ```text
2010/// enum memcache_status {
2011/// UNKNOWN = 0;
2012/// OK = 1;
2013/// ERROR = 2;
2014/// CLIENT_ERROR = 3;
2015/// SERVER_ERROR = 4;
2016/// STORED = 5;
2017/// NOT_STORED = 6;
2018/// EXISTS = 7;
2019/// NOT_FOUND = 8;
2020/// DELETED = 9;
2021/// }
2022/// ```
2023#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2024#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2025#[repr(u32)]
2026pub enum MemcacheStatus {
2027 Unknown = 0,
2028 Ok = 1,
2029 Error = 2,
2030 ClientError = 3,
2031 ServerError = 4,
2032 Stored = 5,
2033 NotStored = 6,
2034 Exists = 7,
2035 NotFound = 8,
2036 Deleted = 9,
2037}
2038
2039impl MemcacheStatus {
2040 /// Convert from u32 value to MemcacheStatus enum
2041 pub fn from_u32(value: u32) -> Self {
2042 match value {
2043 1 => MemcacheStatus::Ok,
2044 2 => MemcacheStatus::Error,
2045 3 => MemcacheStatus::ClientError,
2046 4 => MemcacheStatus::ServerError,
2047 5 => MemcacheStatus::Stored,
2048 6 => MemcacheStatus::NotStored,
2049 7 => MemcacheStatus::Exists,
2050 8 => MemcacheStatus::NotFound,
2051 9 => MemcacheStatus::Deleted,
2052 _ => MemcacheStatus::Unknown,
2053 }
2054 }
2055}
2056
2057/// Memcache Operation - Format (0,2200)
2058///
2059/// Sampled memcache operation
2060///
2061/// # XDR Definition ([sFlow Memcache](https://sflow.org/sflow_memcache.txt))
2062///
2063/// ```text
2064/// /* Memcache operation */
2065/// /* opaque = flow_data; enterprise = 0; format = 2200 */
2066///
2067/// struct memcache_operation {
2068/// memcache_protocol protocol; /* protocol */
2069/// memcache_cmd cmd; /* command */
2070/// string<255> key; /* key used to store/retrieve data */
2071/// unsigned int nkeys; /* number of keys
2072/// (including sampled key) */
2073/// unsigned int value_bytes; /* size of the value (in bytes) */
2074/// unsigned int uS; /* duration of the operation
2075/// (in microseconds) */
2076/// memcache_status status; /* status of command */
2077/// }
2078/// ```
2079#[derive(Debug, Clone, PartialEq, Eq)]
2080#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2081pub struct MemcacheOperation {
2082 /// Protocol (ASCII or Binary)
2083 pub protocol: MemcacheProtocol,
2084
2085 /// Command type
2086 pub cmd: MemcacheCommand,
2087
2088 /// Key used to store/retrieve data
2089 pub key: String,
2090
2091 /// Number of keys (including sampled key)
2092 pub nkeys: u32,
2093
2094 /// Size of the value in bytes
2095 pub value_bytes: u32,
2096
2097 /// Duration of the operation in microseconds
2098 pub duration_us: u32,
2099
2100 /// Status of the command
2101 pub status: MemcacheStatus,
2102}
2103
2104/// HTTP method enumeration
2105///
2106/// # XDR Definition ([sFlow HTTP](https://sflow.org/sflow_http.txt))
2107///
2108/// ```text
2109/// /* The http_method enumeration may be expanded over time.
2110/// Applications receiving sFlow must be prepared to receive
2111/// http_request structures with unknown http_method values */
2112///
2113/// enum http_method {
2114/// OTHER = 0;
2115/// OPTIONS = 1;
2116/// GET = 2;
2117/// HEAD = 3;
2118/// POST = 4;
2119/// PUT = 5;
2120/// DELETE = 6;
2121/// TRACE = 7;
2122/// CONNECT = 8;
2123/// }
2124/// ```
2125#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2126#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2127#[repr(u32)]
2128pub enum HttpMethod {
2129 Other = 0,
2130 Options = 1,
2131 Get = 2,
2132 Head = 3,
2133 Post = 4,
2134 Put = 5,
2135 Delete = 6,
2136 Trace = 7,
2137 Connect = 8,
2138}
2139
2140impl From<u32> for HttpMethod {
2141 fn from(value: u32) -> Self {
2142 match value {
2143 1 => HttpMethod::Options,
2144 2 => HttpMethod::Get,
2145 3 => HttpMethod::Head,
2146 4 => HttpMethod::Post,
2147 5 => HttpMethod::Put,
2148 6 => HttpMethod::Delete,
2149 7 => HttpMethod::Trace,
2150 8 => HttpMethod::Connect,
2151 _ => HttpMethod::Other,
2152 }
2153 }
2154}
2155
2156impl std::fmt::Display for HttpMethod {
2157 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2158 match self {
2159 HttpMethod::Other => write!(f, "OTHER"),
2160 HttpMethod::Options => write!(f, "OPTIONS"),
2161 HttpMethod::Get => write!(f, "GET"),
2162 HttpMethod::Head => write!(f, "HEAD"),
2163 HttpMethod::Post => write!(f, "POST"),
2164 HttpMethod::Put => write!(f, "PUT"),
2165 HttpMethod::Delete => write!(f, "DELETE"),
2166 HttpMethod::Trace => write!(f, "TRACE"),
2167 HttpMethod::Connect => write!(f, "CONNECT"),
2168 }
2169 }
2170}
2171
2172/// HTTP Request - Format (0,2201) - **DEPRECATED**
2173///
2174/// Legacy HTTP request information
2175///
2176/// **Note:** This format was defined in an early sFlow HTTP discussion
2177/// but was deprecated and replaced by format 2206. It is included here for
2178/// backward compatibility with legacy implementations.
2179///
2180/// # XDR Definition ([sFlow Discussion](https://groups.google.com/g/sflow/c/iKzLK61ZTR0))
2181///
2182/// ```text
2183/// /* HTTP request */
2184/// /* opaque = flow_data; enterprise = 0; format = 2201 */
2185/// struct http_request {
2186/// http_method method; /* method */
2187/// string<255> uri; /* URI exactly as it came from the client */
2188/// string<32> host; /* Host value from request header */
2189/// string<255> referer; /* Referer value from request header */
2190/// string<64> useragent; /* User-Agent value from request header */
2191/// string<64> xff; /* X-Forwarded-For value from request header */
2192/// string<32> authuser; /* RFC 1413 identity of user*/
2193/// string<32> mime_type; /* Mime-Type */
2194/// unsigned hyper req_bytes; /* Content-Length of request */
2195/// unsigned hyper resp_bytes; /* Content-Length of response */
2196/// unsigned int uS; /* duration of the operation (microseconds) */
2197/// int status; /* HTTP status code */
2198/// }
2199/// ```
2200#[derive(Debug, Clone, PartialEq, Eq)]
2201#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2202pub struct HttpRequestDeprecated {
2203 /// HTTP method
2204 pub method: HttpMethod,
2205
2206 /// URI exactly as it came from the client
2207 pub uri: String,
2208
2209 /// Host value from request header
2210 pub host: String,
2211
2212 /// Referer value from request header
2213 pub referer: String,
2214
2215 /// User-Agent value from request header
2216 pub useragent: String,
2217
2218 /// X-Forwarded-For value from request header
2219 pub xff: String,
2220
2221 /// RFC 1413 identity of user
2222 pub authuser: String,
2223
2224 /// Mime-Type
2225 pub mime_type: String,
2226
2227 /// Content-Length of request
2228 pub req_bytes: u64,
2229
2230 /// Content-Length of response
2231 pub resp_bytes: u64,
2232
2233 /// Duration of the operation in microseconds
2234 pub duration_us: u32,
2235
2236 /// HTTP status code
2237 pub status: i32,
2238}
2239
2240/// Application Operation - Format (0,2202)
2241///
2242/// Sampled application operation information
2243///
2244/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
2245///
2246/// ```text
2247/// /* Sampled Application Operation */
2248/// /* opaque = flow_data; enterprise = 0; format = 2202 */
2249///
2250/// struct app_operation {
2251/// context context; /* attributes describing the operation */
2252/// utf8string<64> status_descr; /* additional text describing status */
2253/// unsigned hyper req_bytes; /* size of request body (exclude headers) */
2254/// unsigned hyper resp_bytes; /* size of response body (exclude headers) */
2255/// unsigned int uS; /* duration of the operation (microseconds) */
2256/// status status; /* status code */
2257/// }
2258/// ```
2259#[derive(Debug, Clone, PartialEq, Eq)]
2260#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2261pub struct AppOperation {
2262 /// Operation context
2263 pub context: AppContext,
2264
2265 /// Additional status description
2266 pub status_descr: String,
2267
2268 /// Size of request body in bytes (excluding headers)
2269 pub req_bytes: u64,
2270
2271 /// Size of response body in bytes (excluding headers)
2272 pub resp_bytes: u64,
2273
2274 /// Duration of the operation in microseconds
2275 pub duration_us: u32,
2276
2277 /// Operation status code
2278 pub status: AppStatus,
2279}
2280
2281/// Application Parent Context - Format (0,2203)
2282///
2283/// Parent context for sampled client operations
2284///
2285/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
2286///
2287/// ```text
2288/// /* Optional parent context information for sampled client operation */
2289/// /* opaque = flow_data; enterprise = 0; format = 2203 */
2290///
2291/// struct app_parent_context {
2292/// context context;
2293/// }
2294/// ```
2295#[derive(Debug, Clone, PartialEq, Eq)]
2296#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2297pub struct AppParentContext {
2298 /// Parent operation context
2299 pub context: AppContext,
2300}
2301
2302/// Application Initiator - Format (0,2204)
2303///
2304/// Actor initiating the request (e.g., customer sending a payment)
2305///
2306/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
2307///
2308/// ```text
2309/// /* Actor initiating the request */
2310/// /* e.g. customer sending a payment */
2311/// /* opaque = flow_data; enterprise = 0; format = 2204 */
2312///
2313/// struct app_initiator {
2314/// actor actor;
2315/// }
2316/// ```
2317///
2318/// **ERRATUM:** The specification is missing the `struct` keyword before the structure name,
2319/// which is inconsistent with XDR syntax conventions. The corrected version is shown above.
2320#[derive(Debug, Clone, PartialEq, Eq)]
2321#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2322pub struct AppInitiator {
2323 /// Business level identifier (e.g., customer id, vendor id)
2324 pub actor: String,
2325}
2326
2327/// Application Target - Format (0,2205)
2328///
2329/// Actor targeted by the request (e.g., recipient of payment)
2330///
2331/// # XDR Definition ([sFlow Application](https://sflow.org/sflow_application.txt))
2332///
2333/// ```text
2334/// /* Actor targetted by the request */
2335/// /* e.g. recipient of payment */
2336/// /* opaque = flow_data; enterprise = 0; format = 2205 */
2337///
2338/// struct app_target {
2339/// actor actor;
2340/// }
2341/// ```
2342///
2343/// **ERRATUM:** The specification is missing the `struct` keyword before the structure name,
2344/// which is inconsistent with XDR syntax conventions. The corrected version is shown above.
2345#[derive(Debug, Clone, PartialEq, Eq)]
2346#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2347pub struct AppTarget {
2348 /// Business level identifier (e.g., customer id, vendor id)
2349 pub actor: String,
2350}
2351
2352/// HTTP Request - Format (0,2206)
2353///
2354/// HTTP request information
2355///
2356/// # XDR Definition ([sFlow HTTP](https://sflow.org/sflow_http.txt))
2357///
2358/// ```text
2359/// /* HTTP protocol version number */
2360/// /* Encoded as major_number * 1000 + minor_number */
2361/// /* e.g. HTTP1.1 is encoded as 1001 */
2362/// typedef unsigned int version;
2363///
2364/// /* HTTP request */
2365/// /* opaque = flow_data; enterprise = 0; format = 2206 */
2366/// struct http_request {
2367/// http_method method; /* method */
2368/// version protocol; /* HTTP protocol version */
2369/// string<255> uri; /* URI exactly as it came from the client */
2370/// string<64> host; /* Host value from request header */
2371/// string<255> referer; /* Referer value from request header */
2372/// string<128> useragent; /* User-Agent value from request header */
2373/// string<64> xff; /* X-Forwarded-For value
2374/// from request header */
2375/// string<32> authuser; /* RFC 1413 identity of user*/
2376/// string<64> mime-type; /* Mime-Type of response */
2377/// unsigned hyper req_bytes; /* Content-Length of request */
2378/// unsigned hyper resp_bytes; /* Content-Length of response */
2379/// unsigned int uS; /* duration of the operation
2380/// (in microseconds) */
2381/// int status; /* HTTP status code */
2382/// }
2383/// ```
2384#[derive(Debug, Clone, PartialEq, Eq)]
2385#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2386pub struct HttpRequest {
2387 /// HTTP method
2388 pub method: HttpMethod,
2389
2390 /// HTTP protocol version (major * 1000 + minor, e.g., HTTP/1.1 = 1001)
2391 pub protocol: u32,
2392
2393 /// URI exactly as it came from the client
2394 pub uri: String,
2395
2396 /// Host value from request header
2397 pub host: String,
2398
2399 /// Referer value from request header
2400 pub referer: String,
2401
2402 /// User-Agent value from request header
2403 pub useragent: String,
2404
2405 /// X-Forwarded-For value from request header
2406 pub xff: String,
2407
2408 /// RFC 1413 identity of user
2409 pub authuser: String,
2410
2411 /// MIME type of response
2412 pub mime_type: String,
2413
2414 /// Content-Length of request
2415 pub req_bytes: u64,
2416
2417 /// Content-Length of response
2418 pub resp_bytes: u64,
2419
2420 /// Duration of the operation in microseconds
2421 pub duration_us: u32,
2422
2423 /// HTTP status code
2424 pub status: i32,
2425}
2426
2427/// Extended Proxy Request - Format (0,2207)
2428///
2429/// Rewritten URI for proxy requests
2430///
2431/// # XDR Definition ([sFlow HTTP](https://sflow.org/sflow_http.txt))
2432///
2433/// ```text
2434/// /* Rewritten URI */
2435/// /* Only include if host or uri are modified */
2436/// /* opaque = flow_data; enterprise = 0; format = 2207 */
2437/// struct extended_proxy_request {
2438/// string<255> uri; /* URI in request to downstream server */
2439/// string<64> host; /* Host in request to downstream server */
2440/// }
2441/// ```
2442#[derive(Debug, Clone, PartialEq, Eq)]
2443#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2444pub struct ExtendedProxyRequest {
2445 /// URI in request to downstream server
2446 pub uri: String,
2447
2448 /// Host in request to downstream server
2449 pub host: String,
2450}
2451
2452/// Extended Nav Timing - Format (0,2208)
2453///
2454/// Navigation timing information from web browsers
2455///
2456/// # XDR Definition ([sFlow Discussion](https://groups.google.com/g/sflow/c/FKzkvig32Tk))
2457///
2458/// ```text
2459/// /* Navigation Timing */
2460/// /* reference http://www.w3.org/TR/navigation-timing/ */
2461/// /* To allow times to fit into 32 bits, normalize so that smallest time
2462/// value is 1, times are expressed in milliseconds and 0 is used to indicate
2463/// that event is not fired, or not complete */
2464/// /* opaque = flow_data; enterprise = 0; format = 2208 */
2465///
2466/// struct extended_nav_timing {
2467/// unsigned int type; /* PerformanceNavigation */
2468/// unsigned int redirectCount;
2469/// unsigned int navigationStart; /* PerformanceTiming */
2470/// unsigned int unloadEventStart;
2471/// unsigned int unloadEventEnd;
2472/// unsigned int redirectStart;
2473/// unsigned int redirectEnd;
2474/// unsigned int fetchStart;
2475/// unsigned int domainLookupStart;
2476/// unsigned int domainLookupEnd;
2477/// unsigned int connectStart;
2478/// unsigned int connectEnd;
2479/// unsigned int secureConnectionStart;
2480/// unsigned int requestStart;
2481/// unsigned int responseStart;
2482/// unsigned int responseEnd;
2483/// unsigned int domLoading;
2484/// unsigned int domInteractive;
2485/// unsigned int domContentLoadedEventStart;
2486/// unsigned int domContentLoadedEventEnd;
2487/// unsigned int domComplete;
2488/// unsigned int loadEventStart;
2489/// unsigned int loadEventEnd;
2490/// }
2491/// ```
2492#[derive(Debug, Clone, PartialEq, Eq)]
2493#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2494pub struct ExtendedNavTiming {
2495 /// Navigation type (PerformanceNavigation)
2496 pub nav_type: u32,
2497 /// Redirect count
2498 pub redirect_count: u32,
2499 /// Navigation start time (PerformanceTiming)
2500 pub navigation_start: u32,
2501 /// Unload event start time
2502 pub unload_event_start: u32,
2503 /// Unload event end time
2504 pub unload_event_end: u32,
2505 /// Redirect start time
2506 pub redirect_start: u32,
2507 /// Redirect end time
2508 pub redirect_end: u32,
2509 /// Fetch start time
2510 pub fetch_start: u32,
2511 /// Domain lookup start time
2512 pub domain_lookup_start: u32,
2513 /// Domain lookup end time
2514 pub domain_lookup_end: u32,
2515 /// Connect start time
2516 pub connect_start: u32,
2517 /// Connect end time
2518 pub connect_end: u32,
2519 /// Secure connection start time
2520 pub secure_connection_start: u32,
2521 /// Request start time
2522 pub request_start: u32,
2523 /// Response start time
2524 pub response_start: u32,
2525 /// Response end time
2526 pub response_end: u32,
2527 /// DOM loading time
2528 pub dom_loading: u32,
2529 /// DOM interactive time
2530 pub dom_interactive: u32,
2531 /// DOM content loaded event start time
2532 pub dom_content_loaded_event_start: u32,
2533 /// DOM content loaded event end time
2534 pub dom_content_loaded_event_end: u32,
2535 /// DOM complete time
2536 pub dom_complete: u32,
2537 /// Load event start time
2538 pub load_event_start: u32,
2539 /// Load event end time
2540 pub load_event_end: u32,
2541}
2542
2543/// Packet direction for TCP info
2544#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2545#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2546pub enum PacketDirection {
2547 Unknown = 0,
2548 Received = 1,
2549 Sent = 2,
2550}
2551
2552impl PacketDirection {
2553 /// Convert from u32 value to PacketDirection enum
2554 pub fn from_u32(value: u32) -> Self {
2555 match value {
2556 1 => PacketDirection::Received,
2557 2 => PacketDirection::Sent,
2558 _ => PacketDirection::Unknown,
2559 }
2560 }
2561}
2562
2563/// Extended TCP Info - Format (0,2209)
2564///
2565/// TCP connection state information based on Linux struct tcp_info
2566///
2567/// # XDR Definition ([sFlow Discussion](https://groups.google.com/g/sflow/c/JCG9iwacLZA))
2568///
2569/// ```text
2570/// /* TCP connection state */
2571/// /* Based on Linux struct tcp_info */
2572/// /* opaque = flow_data; enterprise=0; format=2209 */
2573/// struct extended_tcp_info {
2574/// packet_direction dir; /* Sampled packet direction */
2575/// unsigned int snd_mss; /* Cached effective mss, not including SACKS */
2576/// unsigned int rcv_mss; /* Max. recv. segment size */
2577/// unsigned int unacked; /* Packets which are "in flight" */
2578/// unsigned int lost; /* Lost packets */
2579/// unsigned int retrans; /* Retransmitted packets */
2580/// unsigned int pmtu; /* Last pmtu seen by socket */
2581/// unsigned int rtt; /* smoothed RTT (microseconds) */
2582/// unsigned int rttvar; /* RTT variance (microseconds) */
2583/// unsigned int snd_cwnd; /* Sending congestion window */
2584/// unsigned int reordering; /* Reordering */
2585/// unsigned int min_rtt; /* Minimum RTT (microseconds) */
2586/// }
2587/// ```
2588#[derive(Debug, Clone, PartialEq, Eq)]
2589#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2590pub struct ExtendedTcpInfo {
2591 /// Sampled packet direction
2592 pub dir: PacketDirection,
2593 /// Cached effective MSS, not including SACKS
2594 pub snd_mss: u32,
2595 /// Maximum receive segment size
2596 pub rcv_mss: u32,
2597 /// Packets which are "in flight"
2598 pub unacked: u32,
2599 /// Lost packets
2600 pub lost: u32,
2601 /// Retransmitted packets
2602 pub retrans: u32,
2603 /// Last PMTU seen by socket
2604 pub pmtu: u32,
2605 /// Smoothed RTT (microseconds)
2606 pub rtt: u32,
2607 /// RTT variance (microseconds)
2608 pub rttvar: u32,
2609 /// Sending congestion window
2610 pub snd_cwnd: u32,
2611 /// Reordering
2612 pub reordering: u32,
2613 /// Minimum RTT (microseconds)
2614 pub min_rtt: u32,
2615}
2616
2617/// Extended Entities - Format (0,2210)
2618///
2619/// Traffic source/sink entity reference
2620///
2621/// # XDR Definition ([sFlow Discussion](https://blog.sflow.com/2018/10/systemd-traffic-marking.html))
2622///
2623/// ```text
2624/// /* Traffic source/sink entity reference */
2625/// /* opaque = flow_data; enterprise = 0; format = 2210 */
2626/// /* Set Data source to all zeroes if unknown */
2627/// struct extended_entities {
2628/// sflow_data_source_expanded src_ds; /* Data Source associated with
2629/// packet source */
2630/// sflow_data_source_expanded dst_ds; /* Data Source associated with
2631/// packet destination */
2632/// }
2633/// ```
2634#[derive(Debug, Clone, PartialEq, Eq)]
2635#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2636pub struct ExtendedEntities {
2637 /// Data source associated with packet source
2638 pub src_ds: crate::models::core::DataSourceExpanded,
2639 /// Data source associated with packet destination
2640 pub dst_ds: crate::models::core::DataSourceExpanded,
2641}
2642
2643/// Extended BST Egress Queue - Format (4413,1)
2644///
2645/// Selected egress queue for sampled packet from Broadcom switch ASIC
2646///
2647/// # XDR Definition ([sFlow Broadcom Buffers](https://sflow.org/bv-sflow.txt))
2648///
2649/// ```text
2650/// /* Selected egress queue */
2651/// /* opaque = flow_data; enterprise = 4413; format = 1 */
2652/// struct extended_bst_egress_queue {
2653/// unsigned int queue; /* eqress queue number selected for sampled packet */
2654/// }
2655/// ```
2656#[derive(Debug, Clone, PartialEq, Eq)]
2657#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2658pub struct ExtendedBstEgressQueue {
2659 /// Egress queue number selected for sampled packet
2660 pub queue: u32,
2661}