pub trait SocketOptions: AsRawFd {
    // Provided methods
    fn set_filters<F>(&self, filters: &[F]) -> Result<()>
       where F: Into<CanFilter> + Copy { ... }
    fn set_filter_drop_all(&self) -> Result<()> { ... }
    fn set_filter_accept_all(&self) -> Result<()> { ... }
    fn set_error_filter(&self, mask: u32) -> Result<()> { ... }
    fn set_error_filter_drop_all(&self) -> Result<()> { ... }
    fn set_error_filter_accept_all(&self) -> Result<()> { ... }
    fn set_error_mask(&self, mask: u32) -> Result<()> { ... }
    fn set_loopback(&self, enabled: bool) -> Result<()> { ... }
    fn set_recv_own_msgs(&self, enabled: bool) -> Result<()> { ... }
    fn set_join_filters(&self, enabled: bool) -> Result<()> { ... }
}
Expand description

Traits for setting CAN socket options

Provided Methods§

source

fn set_filters<F>(&self, filters: &[F]) -> Result<()>where F: Into<CanFilter> + Copy,

Sets CAN ID filters on the socket.

CAN packages received by SocketCAN are matched against these filters, only matching packets are returned by the interface.

See CanFilter for details on how filtering works. By default, all single filter matching all incoming frames is installed.

source

fn set_filter_drop_all(&self) -> Result<()>

Disable reception of CAN frames.

Sets a completely empty filter; disabling all CAN frame reception.

source

fn set_filter_accept_all(&self) -> Result<()>

Accept all frames, disabling any kind of filtering.

Replace the current filter with one containing a single rule that acceps all CAN frames.

source

fn set_error_filter(&self, mask: u32) -> Result<()>

Sets the error mask on the socket.

By default (ERR_MASK_NONE) no error conditions are reported as special error frames by the socket. Enabling error conditions by setting ERR_MASK_ALL or another non-empty error mask causes the socket to receive notification about the specified conditions.

source

fn set_error_filter_drop_all(&self) -> Result<()>

Sets the error mask on the socket to reject all errors.

source

fn set_error_filter_accept_all(&self) -> Result<()>

Sets the error mask on the socket to accept all errors.

source

fn set_error_mask(&self, mask: u32) -> Result<()>

Sets the error mask on the socket.

By default (ERR_MASK_NONE) no error conditions are reported as special error frames by the socket. Enabling error conditions by setting ERR_MASK_ALL or another non-empty error mask causes the socket to receive notification about the specified conditions.

source

fn set_loopback(&self, enabled: bool) -> Result<()>

Enable or disable loopback.

By default, loopback is enabled, causing other applications that open the same CAN bus to see frames emitted by different applications on the same system.

source

fn set_recv_own_msgs(&self, enabled: bool) -> Result<()>

Enable or disable receiving of own frames.

When loopback is enabled, this settings controls if CAN frames sent are received back immediately by sender. Default is off.

source

fn set_join_filters(&self, enabled: bool) -> Result<()>

Enable or disable join filters.

By default a frame is accepted if it matches any of the filters set with set_filters. If join filters is enabled, a frame has to match all filters to be accepted.

Object Safety§

This trait is not object safe.

Implementors§