Struct SendOptions
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, umsh_mac::::send::SendOptions::{constant#0}>>,
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, umsh_mac::::send::SendOptions::{constant#0}>>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§
§impl SendOptions
impl SendOptions
pub fn with_mic_size(self, mic_size: MicSize) -> SendOptions
pub fn with_mic_size(self, mic_size: MicSize) -> SendOptions
Override the MIC size.
pub fn with_ack_requested(self, value: bool) -> SendOptions
pub fn with_ack_requested(self, value: bool) -> SendOptions
Set whether the send should request an ACK.
pub fn with_flood_hops(self, hops: u8) -> SendOptions
pub fn with_flood_hops(self, hops: u8) -> SendOptions
Set the flood-hop budget.
pub fn no_flood(self) -> SendOptions
pub fn no_flood(self) -> SendOptions
Disable flood forwarding.
pub fn with_trace_route(self) -> SendOptions
pub fn with_trace_route(self) -> SendOptions
Request that a trace-route option be added.
pub fn with_trace_signal(self) -> SendOptions
pub fn with_trace_signal(self) -> SendOptions
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.
pub fn try_with_source_route(
self,
route: &[RouterHint],
) -> Result<SendOptions, CapacityError>
pub fn try_with_source_route( self, route: &[RouterHint], ) -> Result<SendOptions, CapacityError>
Copy a source route into fixed-capacity storage.
pub fn with_salt(self) -> SendOptions
pub fn with_salt(self) -> SendOptions
Request a random salt in SECINFO.
pub fn with_full_source(self) -> SendOptions
pub fn with_full_source(self) -> SendOptions
Force the source address to use the full public key.
pub fn unencrypted(self) -> SendOptions
pub fn unencrypted(self) -> SendOptions
Disable encryption for this send.
pub fn with_region_code(self, code: [u8; 2]) -> SendOptions
pub fn with_region_code(self, code: [u8; 2]) -> SendOptions
Set the region-code option.
pub fn with_tx_delay_ms(self, delay_ms: u16) -> SendOptions
pub fn with_tx_delay_ms(self, delay_ms: u16) -> SendOptions
Hold the frame for delay_ms before its first transmit attempt.
Trait Implementations§
§impl Clone for SendOptions
impl Clone for SendOptions
§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 more§impl Debug for SendOptions
impl Debug for SendOptions
§impl Default for SendOptions
impl Default for SendOptions
§fn default() -> SendOptions
fn default() -> SendOptions
§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)