Skip to content

Commit 0e3f436

Browse files
committed
Suffix Socket::(set_)tos with v4
To indicate it an option for IPv4 sockets.
1 parent a38d197 commit 0e3f436

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/socket.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,8 +1165,8 @@ impl Socket {
11651165
///
11661166
/// [`SOCK_RAW`]: Type::RAW
11671167
/// [raw(7)]: https://man7.org/linux/man-pages/man7/raw.7.html
1168-
/// [`IP_TOS`]: Socket::set_tos
11691168
/// [`IP_TTL`]: Socket::set_ttl_v4
1169+
/// [`IP_TOS`]: Socket::set_tos_v4
11701170
#[cfg_attr(
11711171
any(target_os = "fuchsia", target_os = "illumos", target_os = "solaris"),
11721172
allow(rustdoc::broken_intra_doc_links)
@@ -1562,26 +1562,26 @@ impl Socket {
15621562
target_os = "illumos",
15631563
target_os = "haiku",
15641564
)))]
1565-
pub fn set_tos(&self, tos: u32) -> io::Result<()> {
1565+
pub fn set_tos_v4(&self, tos: u32) -> io::Result<()> {
15661566
unsafe { setsockopt(self.as_raw(), sys::IPPROTO_IP, sys::IP_TOS, tos as c_int) }
15671567
}
15681568

15691569
/// Get the value of the `IP_TOS` option for this socket.
15701570
///
1571-
/// For more information about this option, see [`set_tos`].
1571+
/// For more information about this option, see [`set_tos_v4`].
15721572
///
15731573
/// NOTE: <https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options>
15741574
/// documents that not all versions of windows support `IP_TOS`.
15751575
///
1576-
/// [`set_tos`]: Socket::set_tos
1576+
/// [`set_tos_v4`]: Socket::set_tos_v4
15771577
#[cfg(not(any(
15781578
target_os = "fuchsia",
15791579
target_os = "redox",
15801580
target_os = "solaris",
15811581
target_os = "illumos",
15821582
target_os = "haiku",
15831583
)))]
1584-
pub fn tos(&self) -> io::Result<u32> {
1584+
pub fn tos_v4(&self) -> io::Result<u32> {
15851585
unsafe {
15861586
getsockopt::<c_int>(self.as_raw(), sys::IPPROTO_IP, sys::IP_TOS).map(|tos| tos as u32)
15871587
}

tests/socket.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ test!(IPv4 ttl_v4, set_ttl_v4(40));
14101410
target_os = "illumos",
14111411
target_os = "haiku",
14121412
)))]
1413-
test!(IPv4 tos, set_tos(96));
1413+
test!(IPv4 tos_v4, set_tos_v4(96));
14141414

14151415
#[cfg(not(any(
14161416
target_os = "dragonfly",

0 commit comments

Comments
 (0)