diff --git a/src/sys/unix.rs b/src/sys/unix.rs index 805b6d55..25e8fd89 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -573,6 +573,37 @@ impl RecvFlags { pub const fn is_out_of_band(self) -> bool { self.0 & libc::MSG_OOB != 0 } + + /// Check if the confirm flag is set. + /// + /// This is used by SocketCAN to indicate a frame was sent via the + /// socket it is received on. This flag can be interpreted as a + /// 'transmission confirmation'. + /// + /// On Unix this corresponds to the `MSG_CONFIRM` flag. + #[cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))] + #[cfg_attr( + docsrs, + doc(cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))) + )] + pub const fn is_confirm(self) -> bool { + self.0 & libc::MSG_CONFIRM != 0 + } + + /// Check if the don't route flag is set. + /// + /// This is used by SocketCAN to indicate a frame was created + /// on the local host. + /// + /// On Unix this corresponds to the `MSG_DONTROUTE` flag. + #[cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))] + #[cfg_attr( + docsrs, + doc(cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))) + )] + pub const fn is_dontroute(self) -> bool { + self.0 & libc::MSG_DONTROUTE != 0 + } } #[cfg(not(target_os = "redox"))]