pub struct Dot11 { /* private fields */ }Expand description
IEEE 802.11 MAC layer.
Implementations§
Source§impl Dot11
impl Dot11
Sourcepub fn management(subtype: Dot11ManagementSubtype) -> Self
pub fn management(subtype: Dot11ManagementSubtype) -> Self
Create a management frame with the given subtype.
Sourcepub fn control(subtype: Dot11ControlSubtype) -> Self
pub fn control(subtype: Dot11ControlSubtype) -> Self
Create a control frame with the given subtype.
Sourcepub fn probe_request() -> Self
pub fn probe_request() -> Self
Create a probe request management frame.
Sourcepub fn probe_response() -> Self
pub fn probe_response() -> Self
Create a probe response management frame.
Sourcepub fn association_request() -> Self
pub fn association_request() -> Self
Create an association request management frame.
Sourcepub fn association_response() -> Self
pub fn association_response() -> Self
Create an association response management frame.
Sourcepub fn reassociation_request() -> Self
pub fn reassociation_request() -> Self
Create a reassociation request management frame.
Sourcepub fn reassociation_response() -> Self
pub fn reassociation_response() -> Self
Create a reassociation response management frame.
Sourcepub fn authentication() -> Self
pub fn authentication() -> Self
Create an authentication management frame.
Sourcepub fn deauthentication() -> Self
pub fn deauthentication() -> Self
Create a deauthentication management frame.
Sourcepub fn disassociation() -> Self
pub fn disassociation() -> Self
Create a disassociation management frame.
Sourcepub fn action_no_ack() -> Self
pub fn action_no_ack() -> Self
Create an action-no-ack management frame with a zero category field.
Sourcepub fn block_ack_request() -> Self
pub fn block_ack_request() -> Self
Create a Block Ack Request control frame.
Sourcepub fn cf_end_cf_ack() -> Self
pub fn cf_end_cf_ack() -> Self
Create a CF-End + CF-Ack control frame.
Sourcepub fn frame_control(self, frame_control: Dot11FrameControl) -> Self
pub fn frame_control(self, frame_control: Dot11FrameControl) -> Self
Set the frame-control field.
Sourcepub fn more_fragments(self, enabled: bool) -> Self
pub fn more_fragments(self, enabled: bool) -> Self
Set or clear the More Fragments frame-control bit.
Sourcepub fn duration_id(self, duration_id: u16) -> Self
pub fn duration_id(self, duration_id: u16) -> Self
Set the duration/ID field.
Sourcepub fn sequence_control(self, sequence_control: Dot11SequenceControl) -> Self
pub fn sequence_control(self, sequence_control: Dot11SequenceControl) -> Self
Set the sequence-control field.
Sourcepub fn sequence_number(self, sequence_number: u16) -> Self
pub fn sequence_number(self, sequence_number: u16) -> Self
Set the twelve-bit sequence number in the sequence-control field.
Sourcepub fn fragment_number(self, fragment_number: u8) -> Self
pub fn fragment_number(self, fragment_number: u8) -> Self
Set the four-bit fragment number in the sequence-control field.
Sourcepub fn qos_control(self, qos_control: u16) -> Self
pub fn qos_control(self, qos_control: u16) -> Self
Set the QoS control field.
Sourcepub fn with_qos_control_fields(self, qos_control: Dot11QosControl) -> Self
pub fn with_qos_control_fields(self, qos_control: Dot11QosControl) -> Self
Set the QoS control field from typed subfields.
Sourcepub fn ht_control(self, ht_control: u32) -> Self
pub fn ht_control(self, ht_control: u32) -> Self
Set the HT Control field.
Sourcepub fn fixed_parameters(self, fixed_parameters: impl Into<Vec<u8>>) -> Self
pub fn fixed_parameters(self, fixed_parameters: impl Into<Vec<u8>>) -> Self
Set raw fixed management-field bytes to emit after the MAC header.
Sourcepub fn with_beacon_fixed_fields(
self,
fixed_fields: Dot11BeaconFixedFields,
) -> Self
pub fn with_beacon_fixed_fields( self, fixed_fields: Dot11BeaconFixedFields, ) -> Self
Set Beacon fixed fields without changing the frame subtype.
Sourcepub fn with_probe_response_fixed_fields(
self,
fixed_fields: Dot11BeaconFixedFields,
) -> Self
pub fn with_probe_response_fixed_fields( self, fixed_fields: Dot11BeaconFixedFields, ) -> Self
Set Probe Response fixed fields without changing the frame subtype.
Sourcepub fn with_association_request_fixed_fields(
self,
fixed_fields: Dot11AssociationRequestFixedFields,
) -> Self
pub fn with_association_request_fixed_fields( self, fixed_fields: Dot11AssociationRequestFixedFields, ) -> Self
Set Association Request fixed fields without changing the frame subtype.
Sourcepub fn with_association_response_fixed_fields(
self,
fixed_fields: Dot11AssociationResponseFixedFields,
) -> Self
pub fn with_association_response_fixed_fields( self, fixed_fields: Dot11AssociationResponseFixedFields, ) -> Self
Set Association Response fixed fields without changing the frame subtype.
Sourcepub fn with_reassociation_request_fixed_fields(
self,
fixed_fields: Dot11ReassociationRequestFixedFields,
) -> Self
pub fn with_reassociation_request_fixed_fields( self, fixed_fields: Dot11ReassociationRequestFixedFields, ) -> Self
Set Reassociation Request fixed fields without changing the frame subtype.
Sourcepub fn with_reassociation_response_fixed_fields(
self,
fixed_fields: Dot11AssociationResponseFixedFields,
) -> Self
pub fn with_reassociation_response_fixed_fields( self, fixed_fields: Dot11AssociationResponseFixedFields, ) -> Self
Set Reassociation Response fixed fields without changing the frame subtype.
Sourcepub fn with_authentication_fixed_fields(
self,
fixed_fields: Dot11AuthenticationFixedFields,
) -> Self
pub fn with_authentication_fixed_fields( self, fixed_fields: Dot11AuthenticationFixedFields, ) -> Self
Set Authentication fixed fields without changing the frame subtype.
Sourcepub fn with_deauthentication_fixed_fields(
self,
fixed_fields: Dot11ReasonCodeFixedFields,
) -> Self
pub fn with_deauthentication_fixed_fields( self, fixed_fields: Dot11ReasonCodeFixedFields, ) -> Self
Set Deauthentication fixed fields without changing the frame subtype.
Sourcepub fn with_disassociation_fixed_fields(
self,
fixed_fields: Dot11ReasonCodeFixedFields,
) -> Self
pub fn with_disassociation_fixed_fields( self, fixed_fields: Dot11ReasonCodeFixedFields, ) -> Self
Set Disassociation fixed fields without changing the frame subtype.
Sourcepub fn with_action_fixed_fields(
self,
fixed_fields: Dot11ActionFixedFields,
) -> Self
pub fn with_action_fixed_fields( self, fixed_fields: Dot11ActionFixedFields, ) -> Self
Set Action fixed fields without changing the frame subtype.
Sourcepub fn tag(self, tag: Dot11TaggedParameter) -> Self
pub fn tag(self, tag: Dot11TaggedParameter) -> Self
Append a raw tagged parameter.
Replace raw tagged parameters.
Sourcepub fn supported_rates(self, rates: impl Into<Vec<u8>>) -> Self
pub fn supported_rates(self, rates: impl Into<Vec<u8>>) -> Self
Append a Supported Rates tagged parameter.
Sourcepub fn ds_parameter_set(self, current_channel: u8) -> Self
pub fn ds_parameter_set(self, current_channel: u8) -> Self
Append a DS Parameter Set tagged parameter with the current channel.
Sourcepub fn with_rsn_information(self, rsn: &RsnInformation) -> Result<Self>
pub fn with_rsn_information(self, rsn: &RsnInformation) -> Result<Self>
Append an RSN tagged parameter from typed RSN information.
Sourcepub fn frame_control_value(&self) -> Dot11FrameControl
pub fn frame_control_value(&self) -> Dot11FrameControl
Current frame-control value.
Sourcepub fn frame_type(&self) -> Dot11FrameType
pub fn frame_type(&self) -> Dot11FrameType
Current typed frame type.
Sourcepub fn management_subtype(&self) -> Option<Dot11ManagementSubtype>
pub fn management_subtype(&self) -> Option<Dot11ManagementSubtype>
Current typed management subtype, when applicable.
Sourcepub fn control_subtype(&self) -> Option<Dot11ControlSubtype>
pub fn control_subtype(&self) -> Option<Dot11ControlSubtype>
Current typed control subtype, when applicable.
Sourcepub fn data_subtype(&self) -> Option<Dot11DataSubtype>
pub fn data_subtype(&self) -> Option<Dot11DataSubtype>
Current typed data subtype, when applicable.
Sourcepub fn duration_id_value(&self) -> Option<u16>
pub fn duration_id_value(&self) -> Option<u16>
Current duration/ID field value, if present.
Sourcepub fn addr1_value(&self) -> Option<MacAddr>
pub fn addr1_value(&self) -> Option<MacAddr>
Current address 1 value, if present.
Sourcepub fn addr2_value(&self) -> Option<MacAddr>
pub fn addr2_value(&self) -> Option<MacAddr>
Current address 2 value, if present.
Sourcepub fn addr3_value(&self) -> Option<MacAddr>
pub fn addr3_value(&self) -> Option<MacAddr>
Current address 3 value, if present.
Sourcepub fn addr4_value(&self) -> Option<MacAddr>
pub fn addr4_value(&self) -> Option<MacAddr>
Current address 4 value, if present.
Sourcepub fn receiver(&self) -> Option<MacAddr>
pub fn receiver(&self) -> Option<MacAddr>
Receiver address for data, management, or supported control frames.
Sourcepub fn transmitter(&self) -> Option<MacAddr>
pub fn transmitter(&self) -> Option<MacAddr>
Transmitter address for data, management, or supported two-address control frames.
Sourcepub fn destination(&self) -> Option<MacAddr>
pub fn destination(&self) -> Option<MacAddr>
Destination address for data or management frames.
Sourcepub fn bssid(&self) -> Option<MacAddr>
pub fn bssid(&self) -> Option<MacAddr>
BSSID address for data or management frames when the role is defined.
Sourcepub fn fourth_address(&self) -> Option<MacAddr>
pub fn fourth_address(&self) -> Option<MacAddr>
Fourth address for four-address data frames when present.
Sourcepub fn sequence_control_value(&self) -> Option<Dot11SequenceControl>
pub fn sequence_control_value(&self) -> Option<Dot11SequenceControl>
Current sequence-control field value, if present.
Sourcepub fn sequence_number_value(&self) -> Option<u16>
pub fn sequence_number_value(&self) -> Option<u16>
Current sequence-number subfield value, if the frame has sequence control.
Sourcepub fn fragment_number_value(&self) -> Option<u8>
pub fn fragment_number_value(&self) -> Option<u8>
Current fragment-number subfield value, if the frame has sequence control.
Sourcepub fn qos_control_value(&self) -> Option<u16>
pub fn qos_control_value(&self) -> Option<u16>
Current QoS control field value, if present.
Sourcepub fn qos_control_fields(&self) -> Option<Dot11QosControl>
pub fn qos_control_fields(&self) -> Option<Dot11QosControl>
Current typed QoS control field value, if present.
Sourcepub fn ht_control_value(&self) -> Option<u32>
pub fn ht_control_value(&self) -> Option<u32>
Current HT Control field value, if present.
Sourcepub fn fixed_parameters_value(&self) -> &[u8] ⓘ
pub fn fixed_parameters_value(&self) -> &[u8] ⓘ
Raw fixed management-field bytes.
Sourcepub fn raw_fixed_parameters(&self) -> &[u8] ⓘ
pub fn raw_fixed_parameters(&self) -> &[u8] ⓘ
Raw fixed management-field bytes, including unsupported or malformed shapes.
Sourcepub fn management_fixed_fields(&self) -> Dot11ManagementFixedFields<'_>
pub fn management_fixed_fields(&self) -> Dot11ManagementFixedFields<'_>
Typed management fixed fields, or raw bytes when the shape is unsupported.
Sourcepub fn beacon_fixed_fields(&self) -> Option<Dot11BeaconFixedFields>
pub fn beacon_fixed_fields(&self) -> Option<Dot11BeaconFixedFields>
Beacon fixed fields when this frame has the supported Beacon shape.
Sourcepub fn probe_response_fixed_fields(&self) -> Option<Dot11BeaconFixedFields>
pub fn probe_response_fixed_fields(&self) -> Option<Dot11BeaconFixedFields>
Probe Response fixed fields when this frame has the supported shape.
Sourcepub fn association_request_fixed_fields(
&self,
) -> Option<Dot11AssociationRequestFixedFields>
pub fn association_request_fixed_fields( &self, ) -> Option<Dot11AssociationRequestFixedFields>
Association Request fixed fields when this frame has the supported shape.
Sourcepub fn association_response_fixed_fields(
&self,
) -> Option<Dot11AssociationResponseFixedFields>
pub fn association_response_fixed_fields( &self, ) -> Option<Dot11AssociationResponseFixedFields>
Association Response fixed fields when this frame has the supported shape.
Sourcepub fn reassociation_request_fixed_fields(
&self,
) -> Option<Dot11ReassociationRequestFixedFields>
pub fn reassociation_request_fixed_fields( &self, ) -> Option<Dot11ReassociationRequestFixedFields>
Reassociation Request fixed fields when this frame has the supported shape.
Sourcepub fn reassociation_response_fixed_fields(
&self,
) -> Option<Dot11AssociationResponseFixedFields>
pub fn reassociation_response_fixed_fields( &self, ) -> Option<Dot11AssociationResponseFixedFields>
Reassociation Response fixed fields when this frame has the supported shape.
Sourcepub fn authentication_fixed_fields(
&self,
) -> Option<Dot11AuthenticationFixedFields>
pub fn authentication_fixed_fields( &self, ) -> Option<Dot11AuthenticationFixedFields>
Authentication fixed fields when this frame has the supported shape.
Sourcepub fn deauthentication_fixed_fields(
&self,
) -> Option<Dot11ReasonCodeFixedFields>
pub fn deauthentication_fixed_fields( &self, ) -> Option<Dot11ReasonCodeFixedFields>
Deauthentication fixed fields when this frame has the supported shape.
Sourcepub fn disassociation_fixed_fields(&self) -> Option<Dot11ReasonCodeFixedFields>
pub fn disassociation_fixed_fields(&self) -> Option<Dot11ReasonCodeFixedFields>
Disassociation fixed fields when this frame has the supported shape.
Sourcepub fn action_fixed_fields(&self) -> Option<Dot11ActionFixedFields>
pub fn action_fixed_fields(&self) -> Option<Dot11ActionFixedFields>
Action fixed fields when this frame has the supported Action shape.
Raw tagged parameters.
Sourcepub fn tagged_parameters(&self) -> &[Dot11TaggedParameter]
pub fn tagged_parameters(&self) -> &[Dot11TaggedParameter]
Raw tagged parameters.
Sourcepub fn rsn_information(&self) -> Option<Result<RsnInformation>>
pub fn rsn_information(&self) -> Option<Result<RsnInformation>>
First RSN information element carried by the raw tagged parameters.
Sourcepub fn rsn_information_elements(
&self,
) -> impl Iterator<Item = Result<RsnInformation>> + '_
pub fn rsn_information_elements( &self, ) -> impl Iterator<Item = Result<RsnInformation>> + '_
RSN information elements carried by the raw tagged parameters.
Sourcepub fn is_protected(&self) -> bool
pub fn is_protected(&self) -> bool
Return true when the Protected Frame bit is set.
Sourcepub fn has_more_fragments(&self) -> bool
pub fn has_more_fragments(&self) -> bool
Return true when the More Fragments frame-control bit is set.
Sourcepub fn is_fragmented(&self) -> bool
pub fn is_fragmented(&self) -> bool
Return true when this frame carries 802.11 fragmentation metadata.
crafter exposes this metadata for inspection but does not reassemble
fragmented 802.11 payloads.
Sourcepub fn encrypted_body_len(&self) -> Option<usize>
pub fn encrypted_body_len(&self) -> Option<usize>
Decoded encrypted body length for protected data frames.
Sourcepub fn minimum_header_len(&self) -> usize
pub fn minimum_header_len(&self) -> usize
Minimum header length implied by this frame’s type/subtype and flags.
This is the source-backed decode boundary: MAC header fields, optional address four, QoS control, HT Control when signaled by supported +HTC/Order shapes, and selected management fixed fields. It does not include tagged parameters or higher-layer payload bytes.
Sourcepub fn minimum_header_len_for(frame_control: Dot11FrameControl) -> usize
pub fn minimum_header_len_for(frame_control: Dot11FrameControl) -> usize
Minimum header length implied by a frame-control word.
Trait Implementations§
Source§impl<R> Div<R> for Dot11where
R: IntoPacket,
impl<R> Div<R> for Dot11where
R: IntoPacket,
impl Eq for Dot11
Source§impl Layer for Dot11
impl Layer for Dot11
Source§fn inspection_fields(&self) -> Vec<(&'static str, String)>
fn inspection_fields(&self) -> Vec<(&'static str, String)>
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn compile(&self, _ctx: &LayerContext<'_>, out: &mut Vec<u8>) -> Result<()>
fn compile(&self, _ctx: &LayerContext<'_>, out: &mut Vec<u8>) -> Result<()>
out.Source§fn clone_layer(&self) -> Box<dyn Layer>
fn clone_layer(&self) -> Box<dyn Layer>
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Any for typed packet access.Source§fn into_any(self: Box<Self>) -> Box<dyn Any>
fn into_any(self: Box<Self>) -> Box<dyn Any>
Any for downcasting.Source§fn encoded_len_with_context(&self, _ctx: &LayerContext<'_>) -> usize
fn encoded_len_with_context(&self, _ctx: &LayerContext<'_>) -> usize
Source§fn consumes_following(&self) -> bool
fn consumes_following(&self) -> bool
compile() emits all following layers itself. Read more