NetworkEntry

Struct NetworkEntry 

Source
pub struct NetworkEntry<'a> {
    pub hidden: bool,
    pub raw_key: bool,
    pub security: SecurityMode,
    pub ssid: &'a [u8],
    pub credential: &'a [u8],
}
Expand description

One entry of PROP_WIFI_NETWORKS: a network the device knows.

Secret-bearing. The reported form stops at the SSID, which is what Self::encode_reported writes and what Self::decode yields from a device’s answer, with credential empty.

Fields§

§hidden: bool

The network hides its SSID.

§raw_key: bool

credential is a raw pairwise master key rather than a passphrase.

§security: SecurityMode§ssid: &'a [u8]

1 to SSID_MAX_LEN octets. Never empty: an empty selection means no selection, so an entry with no name could be stored and never chosen.

§credential: &'a [u8]

Empty in the reported form, and for the modes that take none.

Implementations§

Source§

impl<'a> NetworkEntry<'a>

Source

pub const fn flags(&self) -> u8

The flags octet for this entry.

Source

pub fn validate(&self) -> Result<(), WifiError>

Whether this entry is one a device may be asked to store.

Separate from encoding so that a host can check itself before transmitting and a device can apply the same rule to what arrives, answering STATUS_INVALID_ARGUMENT to anything this rejects. A mode that is well-formed but beyond the hardware is a different answer, STATUS_UNIMPLEMENTED, and is not decided here.

Source

pub fn encode(&self, out: &mut [u8]) -> Result<usize, WifiError>

Encode the item form, credential included.

Source

pub fn encode_reported(&self, out: &mut [u8]) -> Result<usize, WifiError>

Encode the reported form: the item through its SSID. No CMD_PROP_GET and no notification ever carries a credential.

Source

pub fn decode(bytes: &'a [u8]) -> Result<Self, WifiError>

Decode one item. The credential is whatever follows the SSID, which is empty in a reported entry.

Trait Implementations§

Source§

impl<'a> Clone for NetworkEntry<'a>

Source§

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

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for NetworkEntry<'a>

Source§

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

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

impl<'a> PartialEq for NetworkEntry<'a>

Source§

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

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

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> Copy for NetworkEntry<'a>

Source§

impl<'a> Eq for NetworkEntry<'a>

Source§

impl<'a> StructuralPartialEq for NetworkEntry<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for NetworkEntry<'a>

§

impl<'a> RefUnwindSafe for NetworkEntry<'a>

§

impl<'a> Send for NetworkEntry<'a>

§

impl<'a> Sync for NetworkEntry<'a>

§

impl<'a> Unpin for NetworkEntry<'a>

§

impl<'a> UnwindSafe for NetworkEntry<'a>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.