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 trace_signal: bool,
pub source_route: Option<Vec<RouterHint, MAX_SOURCE_ROUTE_HOPS>>,
pub region_code: Option<[u8; 2]>,
pub salt: bool,
pub tx_delay_ms: Option<u16>,
}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_hops—Nonedisables flood forwarding (point-to-point or source-routed only).Some(n)caps the initialFHOPS_REMbudget; repeaters decrement it and drop at zero. For unicast and blind unicast this is a ceiling rather than a fixed value: a route already learned for the peer narrows the budget to what that route costs plusESTABLISHED_ROUTE_EXTRA_HOPS, so an established path does not re-flood the whole mesh. Clear the peer’s cached route (MacHandle::clear_peer_route) to get the full budget back.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. Routed hops cost no flood budget, so an attached source route narrowsflood_hopsto the slack that backstops the route’s far end rather than to the route’s length.
Fields§
§mic_size: MicSizeRequested MIC size.
encrypted: boolWhether the payload should be encrypted when supported.
ack_requested: boolWhether a transport ACK should be requested.
full_source: boolWhether to encode the full source public key.
flood_hops: Option<u8>Optional flood-hop budget.
trace_route: boolWhether to include a trace-route option.
trace_signal: boolWhether to include a trace-signal option.
source_route: Option<Vec<RouterHint, MAX_SOURCE_ROUTE_HOPS>>Optional explicit source route.
region_code: Option<[u8; 2]>Optional region-code option.
salt: boolWhether to include a random salt in SECINFO.
tx_delay_ms: Option<u16>Optional delay before the first transmit attempt, in milliseconds.
The frame is sealed and queued immediately but held until the delay elapses. Used to desynchronize sends that many nodes may make at once — replies to a broadcast Identity Request, say — so they do not all hit the channel together. ACK deadlines start at the first actual transmit, not at queue time.
Implementations§
Source§impl SendOptions
impl SendOptions
Sourcepub fn with_mic_size(self, mic_size: MicSize) -> Self
pub fn with_mic_size(self, mic_size: MicSize) -> Self
Override the MIC size.
Sourcepub fn with_ack_requested(self, value: bool) -> Self
pub fn with_ack_requested(self, value: bool) -> Self
Set whether the send should request an ACK.
Sourcepub fn with_flood_hops(self, hops: u8) -> Self
pub fn with_flood_hops(self, hops: u8) -> Self
Set the flood-hop budget.
Sourcepub fn with_trace_route(self) -> Self
pub fn with_trace_route(self) -> Self
Request that a trace-route option be added.
Sourcepub fn with_trace_signal(self) -> Self
pub fn with_trace_signal(self) -> Self
Request that a trace-signal option be added. Each repeater prepends
the signal quality it received the frame at, one entry per trace-route
hint, so this is only useful together with
with_trace_route.
Sourcepub fn try_with_source_route(
self,
route: &[RouterHint],
) -> Result<Self, CapacityError>
pub fn try_with_source_route( self, route: &[RouterHint], ) -> Result<Self, CapacityError>
Copy a source route into fixed-capacity storage.
Sourcepub fn with_full_source(self) -> Self
pub fn with_full_source(self) -> Self
Force the source address to use the full public key.
Sourcepub fn unencrypted(self) -> Self
pub fn unencrypted(self) -> Self
Disable encryption for this send.
Sourcepub fn with_region_code(self, code: [u8; 2]) -> Self
pub fn with_region_code(self, code: [u8; 2]) -> Self
Set the region-code option.
Sourcepub fn with_tx_delay_ms(self, delay_ms: u16) -> Self
pub fn with_tx_delay_ms(self, delay_ms: u16) -> Self
Hold the frame for delay_ms before its first transmit attempt.
Trait Implementations§
Source§impl Clone for SendOptions
impl Clone for SendOptions
Source§fn clone(&self) -> SendOptions
fn clone(&self) -> SendOptions
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SendOptions
impl Debug for SendOptions
Source§impl Default for SendOptions
impl Default for SendOptions
Source§impl PartialEq for SendOptions
impl PartialEq for SendOptions
impl Eq for SendOptions
impl StructuralPartialEq for SendOptions
Auto Trait Implementations§
impl Freeze for SendOptions
impl RefUnwindSafe for SendOptions
impl Send for SendOptions
impl Sync for SendOptions
impl Unpin for SendOptions
impl UnwindSafe for SendOptions
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)