Skip to content

Commit

Permalink
Add MSG_CONFIRM and MSG_DONTROUTE to RecvFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
pd0wm committed Mar 12, 2024
1 parent faa59e9 commit ee8e677
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))]
Expand Down

0 comments on commit ee8e677

Please sign in to comment.