summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-11-20 22:03:22 +0000
committerGitHub <noreply@github.com>2022-11-20 22:03:22 +0000
commit33b5f928ea8e691c89d4b7242d44bdb2c1a62167 (patch)
tree981724e0f807362a92151f183a6431747afd6e8d /src/sys
parent6e2b0a02e662a83c1748dda9825dc96da5374f6f (diff)
parentfaac24c77985a5ef8634d5f5bd6bbe50af589105 (diff)
downloadnix-33b5f928ea8e691c89d4b7242d44bdb2c1a62167.zip
Merge #1853
1853: Adds IP_TOS, IPV6_TCLASS and SO_PRIORITY sockopt wrappers for Linux r=asomers a=mzachar Added socket option wrappers for DiffServ related parameters on Linux Co-authored-by: mzachar <mzachar@users.noreply.github.com>
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/socket/sockopt.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs
index e9f26333..08b73aaa 100644
--- a/src/sys/socket/sockopt.rs
+++ b/src/sys/socket/sockopt.rs
@@ -371,6 +371,41 @@ sockopt_impl!(
libc::IP_MULTICAST_LOOP,
bool
);
+#[cfg(target_os = "linux")]
+#[cfg(feature = "net")]
+sockopt_impl!(
+ #[cfg_attr(docsrs, doc(cfg(feature = "net")))]
+ /// Set the protocol-defined priority for all packets to be
+ /// sent on this socket
+ Priority,
+ Both,
+ libc::SOL_SOCKET,
+ libc::SO_PRIORITY,
+ libc::c_int
+);
+#[cfg(target_os = "linux")]
+#[cfg(feature = "net")]
+sockopt_impl!(
+ #[cfg_attr(docsrs, doc(cfg(feature = "net")))]
+ /// Set or receive the Type-Of-Service (TOS) field that is
+ /// sent with every IP packet originating from this socket
+ IpTos,
+ Both,
+ libc::IPPROTO_IP,
+ libc::IP_TOS,
+ libc::c_int
+);
+#[cfg(target_os = "linux")]
+#[cfg(feature = "net")]
+sockopt_impl!(
+ #[cfg_attr(docsrs, doc(cfg(feature = "net")))]
+ /// Traffic class associated with outgoing packets
+ Ipv6TClass,
+ Both,
+ libc::IPPROTO_IPV6,
+ libc::IPV6_TCLASS,
+ libc::c_int
+);
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
#[cfg(feature = "net")]
sockopt_impl!(