pub struct CycleStart {
pub length: u32,
pub cycle_id: u32,
pub list_id: u32,
pub cycle_id_human: u32,
pub start_time: u32,
pub flags: Flags,
pub param_length: Option<u16>,
pub stop_time: Option<u32>,
pub hostname: Option<CString>,
}
Expand description
A start record denotes the starting point for a new cycle.
Fields§
§length: u32
§cycle_id: u32
Cycle ID, assigned by warts from a counter.
list_id: u32
List ID, referencing the list this cycle is over.
cycle_id_human: u32
Cycle ID, assigned by a human.
start_time: u32
Start time of the cycle, seconds since Unix epoch.
flags: Flags
Flags.
param_length: Option<u16>
Parameter length, included if any flags are set.
stop_time: Option<u32>
Stop time of the cycle in seconds since Unix epoch, included if flag 1 is set.
hostname: Option<CString>
Hostname at cycle start point, included if flag 2 is set.
Implementations§
Source§impl CycleStart
impl CycleStart
Sourcepub fn finalize(self) -> Self
pub fn finalize(self) -> Self
Examples found in repository?
examples/write_traceroute.rs (line 41)
12fn main() -> io::Result<()> {
13 let list_name = CString::new("default").unwrap();
14 let hostname = CString::new("ubuntu-linux-20-04-desktop").unwrap();
15
16 let list = List {
17 length: 0,
18 list_id: 1,
19 list_id_human: 0,
20 name: list_name.clone(),
21 flags: Default::default(),
22 param_length: None,
23 description: Some(list_name.clone()),
24 monitor_name: None,
25 };
26 // The `finalize()` method computes and set the flags and length fields.
27 io::stdout().write_all(&Object::List(list.finalize()).to_bytes().unwrap())?;
28
29 let cycle_start = CycleStart {
30 length: 0,
31 cycle_id: 1,
32 list_id: 1,
33 cycle_id_human: 0,
34 start_time: Utc::now().timestamp() as u32,
35 flags: Default::default(),
36 param_length: None,
37 stop_time: None,
38 hostname: Some(hostname),
39 };
40 io::stdout().write_all(
41 &Object::CycleStart(cycle_start.finalize())
42 .to_bytes()
43 .unwrap(),
44 )?;
45
46 let tp = TraceProbe {
47 flags: Default::default(),
48 param_length: None,
49 addr_id: None,
50 probe_ttl: Some(1),
51 reply_ttl: Some(254),
52 hop_flags: Some(17),
53 probe_id: Some(0),
54 rtt_usec: Some(1057),
55 icmp_type: Some(11),
56 icmp_code: Some(0),
57 probe_size: Some(44),
58 reply_size: Some(56),
59 reply_ip_id: Some(387),
60 reply_ip_tos: Some(0),
61 next_hop_mtu: None,
62 quoted_length: None,
63 quoted_ttl: None,
64 reply_tcp_flags: None,
65 quoted_tos: Some(0),
66 icmp_extensions_length: None,
67 icmp_extensions: vec![],
68 addr: Some(Address::from(Ipv4Addr::new(137, 194, 164, 254))),
69 tx: Some(Timeval::from(Utc::now().naive_utc())),
70 };
71
72 let traceroute = Traceroute {
73 length: 0,
74 flags: Flags::default(),
75 param_length: None,
76 list_id: Some(1),
77 cycle_id: Some(1),
78 src_addr_id: None,
79 dst_addr_id: None,
80 start_time: Some(Timeval::from(Utc::now().naive_utc())),
81 stop_reason: Some(TraceStopReason::Completed),
82 stop_data: Some(0),
83 trace_flags: None,
84 attempts: Some(2),
85 hop_limit: Some(0),
86 trace_type: Some(TraceType::UDPParis),
87 probe_size: Some(44),
88 src_port: Some(57352),
89 dst_port: Some(33435),
90 first_ttl: Some(1),
91 ip_tos: Some(0),
92 timeout_sec: Some(5),
93 allowed_loops: Some(1),
94 hops_probed: Some(7),
95 gap_limit: Some(5),
96 gap_limit_action: Some(TraceGapAction::LastDitch),
97 loop_action: Some(0),
98 probes_sent: Some(8),
99 interval_csec: Some(0),
100 confidence_level: Some(0),
101 src_addr: Some(Address::from(Ipv4Addr::new(137, 194, 165, 109))),
102 dst_addr: Some(Address::from(Ipv4Addr::new(8, 8, 8, 8))),
103 user_id: None,
104 ip_offset: None,
105 router_addr: None,
106 hop_count: 1,
107 hops: vec![tp.finalize()],
108 eof: 0,
109 };
110 io::stdout().write_all(
111 Object::Traceroute(traceroute.finalize())
112 .to_bytes()
113 .unwrap()
114 .as_slice(),
115 )?;
116
117 let cycle_stop = CycleStop {
118 length: 0,
119 cycle_id: 1,
120 stop_time: Utc::now().timestamp() as u32,
121 flags: Default::default(),
122 };
123 io::stdout().write_all(&Object::CycleStop(cycle_stop.finalize()).to_bytes().unwrap())?;
124
125 Ok(())
126}
Trait Implementations§
Source§impl Debug for CycleStart
impl Debug for CycleStart
Source§impl DekuRead<'_, Endian> for CycleStart
impl DekuRead<'_, Endian> for CycleStart
Source§impl DekuUpdate for CycleStart
impl DekuUpdate for CycleStart
Source§impl DekuWrite<Endian> for CycleStart
impl DekuWrite<Endian> for CycleStart
Source§impl PartialEq for CycleStart
impl PartialEq for CycleStart
impl StructuralPartialEq for CycleStart
Auto Trait Implementations§
impl Freeze for CycleStart
impl RefUnwindSafe for CycleStart
impl Send for CycleStart
impl Sync for CycleStart
impl Unpin for CycleStart
impl UnwindSafe for CycleStart
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.