Struct ControlPacket

Source
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>

Source

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.

Source

pub fn new(control_number: u8, command: ControlCommand) -> Self

Creates a new control packet with an empty payload.

Source

pub fn to_header_bytes(&self) -> [u8; 6]

Outputs the serialzied bytes of the header to send back to wireshark.

Source

pub fn into_owned(self) -> ControlPacket<'static>

Turns the given ControlPacket into a ControlPacket with fully owned data and ’static lifetime.

Source

pub fn send(self, sender: &mut ExtcapControlSender) -> Result<()>

Sends this control packet to Wireshark using the given sender.

Source

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>

Source§

fn clone(&self) -> ControlPacket<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ControlPacket<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, 'nom> Parse<&'nom [u8]> for ControlPacket<'a>
where 'nom: 'a,

Source§

fn parse_be(orig_i: &'nom [u8]) -> IResult<&'nom [u8], Self>

Parse input as Big-Endian
Source§

fn parse_le(orig_i: &'nom [u8]) -> IResult<&'nom [u8], Self>

Parse input as Little-Endian
Source§

fn parse(orig_i: &'nom [u8]) -> IResult<&'nom [u8], Self>

Parse input, not knowing the endianness Read more
Source§

impl<'a> PartialEq for ControlPacket<'a>

Source§

fn eq(&self, other: &ControlPacket<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Eq for ControlPacket<'a>

Source§

impl<'a> StructuralPartialEq for ControlPacket<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for ControlPacket<'a>

§

impl<'a> RefUnwindSafe for ControlPacket<'a>

§

impl<'a> Send for ControlPacket<'a>

§

impl<'a> Sync for ControlPacket<'a>

§

impl<'a> Unpin for ControlPacket<'a>

§

impl<'a> UnwindSafe for ControlPacket<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.