Skip to main content

mxr_config_t

Struct mxr_config_t 

Source
#[repr(C)]
pub struct mxr_config_t { pub target_ip: *const c_char, pub port: u16, pub broadcast: bool, pub local_ip: *const c_char, pub interface: *const c_char, pub name: *const c_char, pub uid: *const c_char, pub uid_path: *const c_char, }
Expand description

How a client finds the network.

Zeroing the whole struct asks for the default: multicast discovery on whichever interface the host picks, which is the right answer on a machine with one network and an arbitrary one on any other.

Fields§

§target_ip: *const c_char

Where to send. Null means the multicast group, or the interface’s broadcast address when broadcast is set.

§port: u16

UDP port. Zero means the default for the selected mode.

§broadcast: bool

Use broadcast rather than multicast.

§local_ip: *const c_char

Selects the interface by address, as text. Null lets the host choose.

It decides both which interface frames leave by and which one they are accepted on. Getting it wrong on a multi-homed host fails one-sidedly: devices are still discovered, because their broadcasts arrive by any route, while every request this client sends leaves by the wrong interface and is never answered.

§interface: *const c_char

Selects the interface by name, taking precedence over local_ip.

An interface with no address of its own - a tagged VLAN - can be named only this way, and only on Linux.

§name: *const c_char

The name this client advertises to devices. Null means a default.

§uid: *const c_char

This client’s identifier, in the form mxr_uid_to_string() writes.

Null loads it from uid_path, generating and storing one on first run. It must be stable across restarts, or every peer counts each run as a new client.

mxr_uid_to_string(): crate::mxr_uid_to_string

§uid_path: *const c_char

Where the identifier is kept. Null means .mxr-uid in the user’s home directory.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.