pub struct ControlPacket<'a> {
pub sync_pipe_indication: u8,
pub message_length: u32,
pub control_number: u8,
pub command: ControlCommand,
pub payload: Cow<'a, [u8]>,
}
Expand description
Control packets for the extcap interface. This is used for communication of control data between Wireshark and this extcap program.
Reference: https://www.wireshark.org/docs/wsdg_html_chunked/ChCaptureExtcap.html#_messages
Fields§
§sync_pipe_indication: u8
The common sync pipe indication. This protocol uses the value “T”.
message_length: u32
Length of payload
+ 2 bytes for control_number
and command
.
control_number: u8
Unique number to identify the control, as previously returned in the
{control}
declarations returned in the
--extcap-interfaces
phase. This
number also gives the order of the controls in the interface toolbar.
The control number, a unique identifier for this control.
command: ControlCommand
The command associated with this packet. See ControlCommand
for
details.
payload: Cow<'a, [u8]>
Payload specific to the command
. For example, the
payload for StatusbarMessage
is
the message string.
Implementations§
Source§impl<'a> ControlPacket<'a>
impl<'a> ControlPacket<'a>
Sourcepub fn new_with_payload<CowSlice: Into<Cow<'a, [u8]>>>(
control_number: u8,
command: ControlCommand,
payload: CowSlice,
) -> Self
pub fn new_with_payload<CowSlice: Into<Cow<'a, [u8]>>>( control_number: u8, command: ControlCommand, payload: CowSlice, ) -> Self
Creates a new control packet with a payload.
Sourcepub fn new(control_number: u8, command: ControlCommand) -> Self
pub fn new(control_number: u8, command: ControlCommand) -> Self
Creates a new control packet with an empty payload.
Sourcepub fn to_header_bytes(&self) -> [u8; 6]
pub fn to_header_bytes(&self) -> [u8; 6]
Outputs the serialzied bytes of the header to send back to wireshark.
Sourcepub fn into_owned(self) -> ControlPacket<'static>
pub fn into_owned(self) -> ControlPacket<'static>
Turns the given ControlPacket into a ControlPacket with fully owned data and ’static lifetime.
Sourcepub fn send(self, sender: &mut ExtcapControlSender) -> Result<()>
pub fn send(self, sender: &mut ExtcapControlSender) -> Result<()>
Sends this control packet to Wireshark using the given sender
.
Sourcepub async fn send_async(self, sender: &mut ExtcapControlSender) -> Result<()>
pub async fn send_async(self, sender: &mut ExtcapControlSender) -> Result<()>
Sends this control packet to Wireshark using the given sender
.
Trait Implementations§
Source§impl<'a> Clone for ControlPacket<'a>
impl<'a> Clone for ControlPacket<'a>
Source§fn clone(&self) -> ControlPacket<'a>
fn clone(&self) -> ControlPacket<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more