summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-12-14 00:35:54 +0000
committerGitHub <noreply@github.com>2022-12-14 00:35:54 +0000
commitb7cb456af7a37e75e03e927c900bd852482cd04c (patch)
treeaa2df5a2546fb43e078cecea3e5fd6ee550cee3d /src/sys
parent53531b4330aa18af88e8c35d32992bd4d8a69907 (diff)
parent4871c1ae1f19353b57303e4b2ff164337a3dc1fd (diff)
downloadnix-b7cb456af7a37e75e03e927c900bd852482cd04c.zip
Merge #1912
1912: Added CANbus socket family protocol constants. r=asomers a=fpagliughi Added CANbus socket family protocol values for `CanRaw` and `CanBcm` Co-authored-by: fpagliughi <fpagliughi@mindspring.com>
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/socket/mod.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs
index a67a5ab3..bcc28ae6 100644
--- a/src/sys/socket/mod.rs
+++ b/src/sys/socket/mod.rs
@@ -218,8 +218,21 @@ pub enum SockProtocol {
#[cfg(any(target_os = "android", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
EthAll = libc::ETH_P_ALL.to_be(),
+ /// The Controller Area Network raw socket protocol
+ /// ([ref](https://docs.kernel.org/networking/can.html#how-to-use-socketcan))
+ #[cfg(target_os = "linux")]
+ #[cfg_attr(docsrs, doc(cfg(all())))]
+ CanRaw = libc::CAN_RAW,
}
+impl SockProtocol {
+ /// The Controller Area Network broadcast manager protocol
+ /// ([ref](https://docs.kernel.org/networking/can.html#how-to-use-socketcan))
+ #[cfg(target_os = "linux")]
+ #[cfg_attr(docsrs, doc(cfg(all())))]
+ #[allow(non_upper_case_globals)]
+ pub const CanBcm: SockProtocol = SockProtocol::NetlinkUserSock; // Matches libc::CAN_BCM
+}
#[cfg(any(target_os = "linux"))]
libc_bitflags! {
/// Configuration flags for `SO_TIMESTAMPING` interface