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 1f8679d
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 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 All @@ -584,6 +615,10 @@ impl std::fmt::Debug for RecvFlags {
s.field("is_out_of_band", &self.is_out_of_band());
#[cfg(not(target_os = "espidf"))]
s.field("is_truncated", &self.is_truncated());
#[cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))]
s.field("is_confirm", &self.is_confirm());
#[cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))]
s.field("is_dontroute", &self.is_dontroute());
s.finish()
}
}
Expand Down

0 comments on commit 1f8679d

Please sign in to comment.