#[non_exhaustive]pub struct SocketOptions {
pub reuse_address: bool,
pub reuse_port: bool,
pub multicast_if_v4: Option<Ipv4Addr>,
pub multicast_loop_v4: Option<bool>,
}Expand description
Socket-level options applied by TransportFactory::bind.
The fields mirror the BSD / socket2 options that simple-someip
needs for its Service Discovery socket layout. A default-constructed
SocketOptions requests a plain unicast socket.
#[non_exhaustive] so additional knobs (TTL, buffer sizes) can be
introduced later without breaking downstream construction.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.reuse_address: boolEnable SO_REUSEADDR. Required on the SD port 30490 when more
than one SOME/IP endpoint runs on the same interface; on Linux,
callers binding 30490 should set BOTH this and Self::reuse_port
because Linux ties multicast-group membership to the
SO_REUSEPORT group rather than SO_REUSEADDR alone — without
REUSEPORT a second binder may fail or silently steal datagrams.
reuse_port: boolEnable SO_REUSEPORT where supported (Linux, BSD). Ignored on
platforms that do not expose it. See Self::reuse_address for
the Linux-specific reason both are required on the SD socket.
multicast_if_v4: Option<Ipv4Addr>Outbound multicast interface (IP_MULTICAST_IF). None lets the
backend choose.
multicast_loop_v4: Option<bool>Loop multicast traffic back to sockets on the same host
(IP_MULTICAST_LOOP). Tri-state:
None— the OS default applies (Linux: enabled by default). Use this when you have no opinion on loopback.Some(true)— explicitly enable. Required when running a SOME/IP server and client on the same machine for testing.Some(false)— explicitly disable.
Backends call setsockopt(IP_MULTICAST_LOOP) only for
Some(_). A previous bool-typed field caused
multicast_if_v4: Some(_), multicast_loop_v4: false to silently
turn loopback OFF on hosts where the OS default was ON, even
when the caller had no opinion on loopback.
Implementations§
Source§impl SocketOptions
impl SocketOptions
Trait Implementations§
Source§impl Clone for SocketOptions
impl Clone for SocketOptions
Source§fn clone(&self) -> SocketOptions
fn clone(&self) -> SocketOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more