SendOptions

Struct SendOptions 

Source
pub struct SendOptions {
    pub mic_size: MicSize,
    pub encrypted: bool,
    pub ack_requested: bool,
    pub full_source: bool,
    pub flood_hops: Option<u8>,
    pub trace_route: bool,
    pub source_route: Option<Vec<RouterHint, MAX_SOURCE_ROUTE_HOPS>>,
    pub region_code: Option<[u8; 2]>,
    pub salt: bool,
}
Expand description

High-level transmission options passed to Mac send helpers.

SendOptions expresses what the application wants from a send — the coordinator translates these into packet-builder calls and enforces any OperatingPolicy constraints before building the frame.

The default configuration (SendOptions::default()) is a reasonable starting point: 16-byte MIC, encryption enabled, no ACK, 3-byte source hint, 5 flood hops, no trace route, no salt.

SendOptions exposes a fluent builder API so applications can override only what they care about:

let opts = SendOptions::default()
    .with_ack_requested(true)
    .with_mic_size(MicSize::Mic8)
    .no_flood()
    .with_trace_route();

§Field notes

  • mic_size — trading MIC length against frame overhead. 16-byte MIC is strongly preferred for unicast; 4-byte may be acceptable for low-bandwidth broadcast beacons.
  • flood_hopsNone disables flood forwarding (point-to-point or source-routed only). Some(n) sets the initial FHOPS_REM budget; repeaters decrement it and drop at zero.
  • full_source — include the full 32-byte public key instead of the 3-byte hint, allowing the receiver to authenticate without a prior key exchange. Useful for first contact or identity announcements; costs 29 extra bytes per frame.
  • salt — append a random 2-byte salt to SECINFO, adding nonce diversity and preventing correlation of frames sharing the same counter value across sessions.
  • source_route — provide an explicit list of RouterHint values to route the frame along a known path rather than relying on flood forwarding. Setting a source route also constrains the flood-hop budget to the route length when flood_hops is unset.

Fields§

§mic_size: MicSize

Requested MIC size.

§encrypted: bool

Whether the payload should be encrypted when supported.

§ack_requested: bool

Whether a transport ACK should be requested.

§full_source: bool

Whether to encode the full source public key.

§flood_hops: Option<u8>

Optional flood-hop budget.

§trace_route: bool

Whether to include a trace-route option.

§source_route: Option<Vec<RouterHint, MAX_SOURCE_ROUTE_HOPS>>

Optional explicit source route.

§region_code: Option<[u8; 2]>

Optional region-code option.

§salt: bool

Whether to include a random salt in SECINFO.

Implementations§

Source§

impl SendOptions

Source

pub fn with_mic_size(self, mic_size: MicSize) -> Self

Override the MIC size.

Source

pub fn with_ack_requested(self, value: bool) -> Self

Set whether the send should request an ACK.

Source

pub fn with_flood_hops(self, hops: u8) -> Self

Set the flood-hop budget.

Source

pub fn no_flood(self) -> Self

Disable flood forwarding.

Source

pub fn with_trace_route(self) -> Self

Request that a trace-route option be added.

Source

pub fn try_with_source_route( self, route: &[RouterHint], ) -> Result<Self, CapacityError>

Copy a source route into fixed-capacity storage.

Source

pub fn with_salt(self) -> Self

Request a random salt in SECINFO.

Source

pub fn with_full_source(self) -> Self

Force the source address to use the full public key.

Source

pub fn unencrypted(self) -> Self

Disable encryption for this send.

Source

pub fn with_region_code(self, code: [u8; 2]) -> Self

Set the region-code option.

Trait Implementations§

Source§

impl Clone for SendOptions

Source§

fn clone(&self) -> SendOptions

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 Debug for SendOptions

Source§

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

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

impl Default for SendOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for SendOptions

Source§

fn eq(&self, other: &SendOptions) -> 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 Eq for SendOptions

Source§

impl StructuralPartialEq for SendOptions

Auto Trait Implementations§

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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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.