Skip to content

Commit 6604264

Browse files
committed
Add docs for all sockopts that are documented by their respective OSes
1 parent 920809e commit 6604264

File tree

2 files changed

+224
-59
lines changed

2 files changed

+224
-59
lines changed

src/sys/socket/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::sys::time::TimeVal;
1414
use crate::sys::uio::IoVec;
1515

1616
mod addr;
17+
#[deny(missing_docs)]
1718
pub mod sockopt;
1819

1920
/*

src/sys/socket/sockopt.rs

+223-59
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Socket options as used by `setsockopt` and `getsockopt`.
12
use cfg_if::cfg_if;
23
use super::{GetSockOpt, SetSockOpt};
34
use crate::Result;
@@ -241,17 +242,45 @@ macro_rules! sockopt_impl {
241242
*
242243
*/
243244

244-
sockopt_impl!(ReuseAddr, Both, libc::SOL_SOCKET, libc::SO_REUSEADDR, bool);
245+
sockopt_impl!(
246+
/// Enables local address reuse
247+
ReuseAddr, Both, libc::SOL_SOCKET, libc::SO_REUSEADDR, bool
248+
);
245249
#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
246-
sockopt_impl!(ReusePort, Both, libc::SOL_SOCKET, libc::SO_REUSEPORT, bool);
247-
sockopt_impl!(TcpNoDelay, Both, libc::IPPROTO_TCP, libc::TCP_NODELAY, bool);
248-
sockopt_impl!(Linger, Both, libc::SOL_SOCKET, libc::SO_LINGER, libc::linger);
249-
sockopt_impl!(IpAddMembership, SetOnly, libc::IPPROTO_IP, libc::IP_ADD_MEMBERSHIP, super::IpMembershipRequest);
250-
sockopt_impl!(IpDropMembership, SetOnly, libc::IPPROTO_IP, libc::IP_DROP_MEMBERSHIP, super::IpMembershipRequest);
250+
sockopt_impl!(
251+
/// Permits multiple AF_INET or AF_INET6 sockets to be bound to an
252+
/// identical socket address.
253+
ReusePort, Both, libc::SOL_SOCKET, libc::SO_REUSEPORT, bool);
254+
sockopt_impl!(
255+
/// Under most circumstances, TCP sends data when it is presented; when
256+
/// outstanding data has not yet been acknowledged, it gathers small amounts
257+
/// of output to be sent in a single packet once an acknowledgement is
258+
/// received. For a small number of clients, such as window systems that
259+
/// send a stream of mouse events which receive no replies, this
260+
/// packetization may cause significant delays. The boolean option
261+
/// TCP_NODELAY defeats this algorithm.
262+
TcpNoDelay, Both, libc::IPPROTO_TCP, libc::TCP_NODELAY, bool);
263+
sockopt_impl!(
264+
/// When enabled, a close(2) or shutdown(2) will not return until all
265+
/// queued messages for the socket have been successfully sent or the
266+
/// linger timeout has been reached.
267+
Linger, Both, libc::SOL_SOCKET, libc::SO_LINGER, libc::linger);
268+
sockopt_impl!(
269+
/// Join a multicast group
270+
IpAddMembership, SetOnly, libc::IPPROTO_IP, libc::IP_ADD_MEMBERSHIP,
271+
super::IpMembershipRequest);
272+
sockopt_impl!(
273+
/// Leave a multicast group.
274+
IpDropMembership, SetOnly, libc::IPPROTO_IP, libc::IP_DROP_MEMBERSHIP,
275+
super::IpMembershipRequest);
251276
cfg_if! {
252277
if #[cfg(any(target_os = "android", target_os = "linux"))] {
253-
sockopt_impl!(Ipv6AddMembership, SetOnly, libc::IPPROTO_IPV6, libc::IPV6_ADD_MEMBERSHIP, super::Ipv6MembershipRequest);
254-
sockopt_impl!(Ipv6DropMembership, SetOnly, libc::IPPROTO_IPV6, libc::IPV6_DROP_MEMBERSHIP, super::Ipv6MembershipRequest);
278+
sockopt_impl!(
279+
/// Join an IPv6 multicast group.
280+
Ipv6AddMembership, SetOnly, libc::IPPROTO_IPV6, libc::IPV6_ADD_MEMBERSHIP, super::Ipv6MembershipRequest);
281+
sockopt_impl!(
282+
/// Leave an IPv6 multicast group.
283+
Ipv6DropMembership, SetOnly, libc::IPPROTO_IPV6, libc::IPV6_DROP_MEMBERSHIP, super::Ipv6MembershipRequest);
255284
} else if #[cfg(any(target_os = "dragonfly",
256285
target_os = "freebsd",
257286
target_os = "illumos",
@@ -260,93 +289,194 @@ cfg_if! {
260289
target_os = "netbsd",
261290
target_os = "openbsd",
262291
target_os = "solaris"))] {
263-
sockopt_impl!(Ipv6AddMembership, SetOnly, libc::IPPROTO_IPV6, libc::IPV6_JOIN_GROUP, super::Ipv6MembershipRequest);
264-
sockopt_impl!(Ipv6DropMembership, SetOnly, libc::IPPROTO_IPV6, libc::IPV6_LEAVE_GROUP, super::Ipv6MembershipRequest);
292+
sockopt_impl!(
293+
/// Join an IPv6 multicast group.
294+
Ipv6AddMembership, SetOnly, libc::IPPROTO_IPV6,
295+
libc::IPV6_JOIN_GROUP, super::Ipv6MembershipRequest);
296+
sockopt_impl!(
297+
/// Leave an IPv6 multicast group.
298+
Ipv6DropMembership, SetOnly, libc::IPPROTO_IPV6,
299+
libc::IPV6_LEAVE_GROUP, super::Ipv6MembershipRequest);
265300
}
266301
}
267-
sockopt_impl!(IpMulticastTtl, Both, libc::IPPROTO_IP, libc::IP_MULTICAST_TTL, u8);
268-
sockopt_impl!(IpMulticastLoop, Both, libc::IPPROTO_IP, libc::IP_MULTICAST_LOOP, bool);
302+
sockopt_impl!(
303+
/// Set or read the time-to-live value of outgoing multicast packets for
304+
/// this socket.
305+
IpMulticastTtl, Both, libc::IPPROTO_IP, libc::IP_MULTICAST_TTL, u8);
306+
sockopt_impl!(
307+
/// Set or read a boolean integer argument that determines whether sent
308+
/// multicast packets should be looped back to the local sockets.
309+
IpMulticastLoop, Both, libc::IPPROTO_IP, libc::IP_MULTICAST_LOOP, bool);
269310
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
270-
sockopt_impl!(IpFreebind, Both, libc::IPPROTO_IP, libc::IP_FREEBIND, bool);
271-
sockopt_impl!(ReceiveTimeout, Both, libc::SOL_SOCKET, libc::SO_RCVTIMEO, TimeVal);
272-
sockopt_impl!(SendTimeout, Both, libc::SOL_SOCKET, libc::SO_SNDTIMEO, TimeVal);
273-
sockopt_impl!(Broadcast, Both, libc::SOL_SOCKET, libc::SO_BROADCAST, bool);
274-
sockopt_impl!(OobInline, Both, libc::SOL_SOCKET, libc::SO_OOBINLINE, bool);
275-
sockopt_impl!(SocketError, GetOnly, libc::SOL_SOCKET, libc::SO_ERROR, i32);
276-
sockopt_impl!(KeepAlive, Both, libc::SOL_SOCKET, libc::SO_KEEPALIVE, bool);
311+
sockopt_impl!(
312+
/// If enabled, this boolean option allows binding to an IP address that
313+
/// is nonlocal or does not (yet) exist.
314+
IpFreebind, Both, libc::IPPROTO_IP, libc::IP_FREEBIND, bool);
315+
sockopt_impl!(
316+
/// Specify the receiving timeout until reporting an error.
317+
ReceiveTimeout, Both, libc::SOL_SOCKET, libc::SO_RCVTIMEO, TimeVal);
318+
sockopt_impl!(
319+
/// Specify the sending timeout until reporting an error.
320+
SendTimeout, Both, libc::SOL_SOCKET, libc::SO_SNDTIMEO, TimeVal);
321+
sockopt_impl!(
322+
/// Set or get the broadcast flag.
323+
Broadcast, Both, libc::SOL_SOCKET, libc::SO_BROADCAST, bool);
324+
sockopt_impl!(
325+
/// If this option is enabled, out-of-band data is directly placed into
326+
/// the receive data stream.
327+
OobInline, Both, libc::SOL_SOCKET, libc::SO_OOBINLINE, bool);
328+
sockopt_impl!(
329+
/// Get and clear the pending socket error.
330+
SocketError, GetOnly, libc::SOL_SOCKET, libc::SO_ERROR, i32);
331+
sockopt_impl!(
332+
/// Enable sending of keep-alive messages on connection-oriented sockets.
333+
KeepAlive, Both, libc::SOL_SOCKET, libc::SO_KEEPALIVE, bool);
277334
#[cfg(any(
278335
target_os = "dragonfly",
279336
target_os = "freebsd",
280337
target_os = "macos",
281338
target_os = "ios"
282339
))]
283-
// Get the credentials of the peer process of a connected unix domain socket.
284-
sockopt_impl!(LocalPeerCred, GetOnly, 0, libc::LOCAL_PEERCRED, super::XuCred);
340+
sockopt_impl!(
341+
/// Get the credentials of the peer process of a connected unix domain
342+
/// socket.
343+
LocalPeerCred, GetOnly, 0, libc::LOCAL_PEERCRED, super::XuCred);
285344
#[cfg(any(target_os = "android", target_os = "linux"))]
286-
sockopt_impl!(PeerCredentials, GetOnly, libc::SOL_SOCKET, libc::SO_PEERCRED, super::UnixCredentials);
345+
sockopt_impl!(
346+
/// Return the credentials of the foreign process connected to this socket.
347+
PeerCredentials, GetOnly, libc::SOL_SOCKET, libc::SO_PEERCRED, super::UnixCredentials);
287348
#[cfg(any(target_os = "ios",
288349
target_os = "macos"))]
289-
sockopt_impl!(TcpKeepAlive, Both, libc::IPPROTO_TCP, libc::TCP_KEEPALIVE, u32);
350+
sockopt_impl!(
351+
/// Specify the amount of time, in seconds, that the connection must be idle
352+
/// before keepalive probes (if enabled) are sent.
353+
TcpKeepAlive, Both, libc::IPPROTO_TCP, libc::TCP_KEEPALIVE, u32);
290354
#[cfg(any(target_os = "android",
291355
target_os = "dragonfly",
292356
target_os = "freebsd",
293357
target_os = "linux",
294358
target_os = "nacl"))]
295-
sockopt_impl!(TcpKeepIdle, Both, libc::IPPROTO_TCP, libc::TCP_KEEPIDLE, u32);
359+
sockopt_impl!(
360+
/// The time (in seconds) the connection needs to remain idle before TCP
361+
/// starts sending keepalive probes
362+
TcpKeepIdle, Both, libc::IPPROTO_TCP, libc::TCP_KEEPIDLE, u32);
296363
cfg_if! {
297364
if #[cfg(any(target_os = "android", target_os = "linux"))] {
298-
sockopt_impl!(TcpMaxSeg, Both, libc::IPPROTO_TCP, libc::TCP_MAXSEG, u32);
365+
sockopt_impl!(
366+
/// The maximum segment size for outgoing TCP packets.
367+
TcpMaxSeg, Both, libc::IPPROTO_TCP, libc::TCP_MAXSEG, u32);
299368
} else {
300-
sockopt_impl!(TcpMaxSeg, GetOnly, libc::IPPROTO_TCP, libc::TCP_MAXSEG, u32);
369+
sockopt_impl!(
370+
/// The maximum segment size for outgoing TCP packets.
371+
TcpMaxSeg, GetOnly, libc::IPPROTO_TCP, libc::TCP_MAXSEG, u32);
301372
}
302373
}
303374
#[cfg(not(target_os = "openbsd"))]
304-
sockopt_impl!(TcpKeepCount, Both, libc::IPPROTO_TCP, libc::TCP_KEEPCNT, u32);
375+
sockopt_impl!(
376+
/// The maximum number of keepalive probes TCP should send before
377+
/// dropping the connection.
378+
TcpKeepCount, Both, libc::IPPROTO_TCP, libc::TCP_KEEPCNT, u32);
305379
#[cfg(any(target_os = "android",
306380
target_os = "fuchsia",
307381
target_os = "linux"))]
308-
sockopt_impl!(TcpRepair, Both, libc::IPPROTO_TCP, libc::TCP_REPAIR, u32);
382+
sockopt_impl!(
383+
#[allow(missing_docs)]
384+
// Not documented by Linux!
385+
TcpRepair, Both, libc::IPPROTO_TCP, libc::TCP_REPAIR, u32);
309386
#[cfg(not(target_os = "openbsd"))]
310-
sockopt_impl!(TcpKeepInterval, Both, libc::IPPROTO_TCP, libc::TCP_KEEPINTVL, u32);
387+
sockopt_impl!(
388+
/// The time (in seconds) between individual keepalive probes.
389+
TcpKeepInterval, Both, libc::IPPROTO_TCP, libc::TCP_KEEPINTVL, u32);
311390
#[cfg(any(target_os = "fuchsia", target_os = "linux"))]
312-
sockopt_impl!(TcpUserTimeout, Both, libc::IPPROTO_TCP, libc::TCP_USER_TIMEOUT, u32);
313-
sockopt_impl!(RcvBuf, Both, libc::SOL_SOCKET, libc::SO_RCVBUF, usize);
314-
sockopt_impl!(SndBuf, Both, libc::SOL_SOCKET, libc::SO_SNDBUF, usize);
391+
sockopt_impl!(
392+
/// Specifies the maximum amount of time in milliseconds that transmitted
393+
/// data may remain unacknowledged before TCP will forcibly close the
394+
/// corresponding connection
395+
TcpUserTimeout, Both, libc::IPPROTO_TCP, libc::TCP_USER_TIMEOUT, u32);
396+
sockopt_impl!(
397+
/// Sets or gets the maximum socket receive buffer in bytes.
398+
RcvBuf, Both, libc::SOL_SOCKET, libc::SO_RCVBUF, usize);
399+
sockopt_impl!(
400+
/// Sets or gets the maximum socket send buffer in bytes.
401+
SndBuf, Both, libc::SOL_SOCKET, libc::SO_SNDBUF, usize);
315402
#[cfg(any(target_os = "android", target_os = "linux"))]
316-
sockopt_impl!(RcvBufForce, SetOnly, libc::SOL_SOCKET, libc::SO_RCVBUFFORCE, usize);
403+
sockopt_impl!(
404+
/// Using this socket option, a privileged (`CAP_NET_ADMIN`) process can
405+
/// perform the same task as `SO_RCVBUF`, but the `rmem_max limit` can be
406+
/// overridden.
407+
RcvBufForce, SetOnly, libc::SOL_SOCKET, libc::SO_RCVBUFFORCE, usize);
317408
#[cfg(any(target_os = "android", target_os = "linux"))]
318-
sockopt_impl!(SndBufForce, SetOnly, libc::SOL_SOCKET, libc::SO_SNDBUFFORCE, usize);
319-
sockopt_impl!(SockType, GetOnly, libc::SOL_SOCKET, libc::SO_TYPE, super::SockType);
320-
sockopt_impl!(AcceptConn, GetOnly, libc::SOL_SOCKET, libc::SO_ACCEPTCONN, bool);
409+
sockopt_impl!(
410+
/// Using this socket option, a privileged (`CAP_NET_ADMIN`) process can
411+
/// perform the same task as `SO_SNDBUF`, but the `wmem_max` limit can be
412+
/// overridden.
413+
SndBufForce, SetOnly, libc::SOL_SOCKET, libc::SO_SNDBUFFORCE, usize);
414+
sockopt_impl!(
415+
/// Gets the socket type as an integer.
416+
SockType, GetOnly, libc::SOL_SOCKET, libc::SO_TYPE, super::SockType);
417+
sockopt_impl!(
418+
/// Returns a value indicating whether or not this socket has been marked to
419+
/// accept connections with `listen(2)`.
420+
AcceptConn, GetOnly, libc::SOL_SOCKET, libc::SO_ACCEPTCONN, bool);
321421
#[cfg(any(target_os = "android", target_os = "linux"))]
322-
sockopt_impl!(BindToDevice, Both, libc::SOL_SOCKET, libc::SO_BINDTODEVICE, OsString<[u8; libc::IFNAMSIZ]>);
422+
sockopt_impl!(
423+
/// Bind this socket to a particular device like “eth0”.
424+
BindToDevice, Both, libc::SOL_SOCKET, libc::SO_BINDTODEVICE, OsString<[u8; libc::IFNAMSIZ]>);
323425
#[cfg(any(target_os = "android", target_os = "linux"))]
324-
sockopt_impl!(OriginalDst, GetOnly, libc::SOL_IP, libc::SO_ORIGINAL_DST, libc::sockaddr_in);
426+
sockopt_impl!(
427+
#[allow(missing_docs)]
428+
// Not documented by Linux!
429+
OriginalDst, GetOnly, libc::SOL_IP, libc::SO_ORIGINAL_DST, libc::sockaddr_in);
325430
#[cfg(any(target_os = "android", target_os = "linux"))]
326-
sockopt_impl!(Ip6tOriginalDst, GetOnly, libc::SOL_IPV6, libc::IP6T_SO_ORIGINAL_DST, libc::sockaddr_in6);
327-
sockopt_impl!(ReceiveTimestamp, Both, libc::SOL_SOCKET, libc::SO_TIMESTAMP, bool);
431+
sockopt_impl!(
432+
#[allow(missing_docs)]
433+
// Not documented by Linux!
434+
Ip6tOriginalDst, GetOnly, libc::SOL_IPV6, libc::IP6T_SO_ORIGINAL_DST, libc::sockaddr_in6);
435+
sockopt_impl!(
436+
/// Enable or disable the receiving of the `SO_TIMESTAMP` control message.
437+
ReceiveTimestamp, Both, libc::SOL_SOCKET, libc::SO_TIMESTAMP, bool);
328438
#[cfg(all(target_os = "linux"))]
329-
sockopt_impl!(ReceiveTimestampns, Both, libc::SOL_SOCKET, libc::SO_TIMESTAMPNS, bool);
439+
sockopt_impl!(
440+
/// Enable or disable the receiving of the `SO_TIMESTAMPNS` control message.
441+
ReceiveTimestampns, Both, libc::SOL_SOCKET, libc::SO_TIMESTAMPNS, bool);
330442
#[cfg(any(target_os = "android", target_os = "linux"))]
331-
sockopt_impl!(IpTransparent, Both, libc::SOL_IP, libc::IP_TRANSPARENT, bool);
443+
sockopt_impl!(
444+
/// Setting this boolean option enables transparent proxying on this socket.
445+
IpTransparent, Both, libc::SOL_IP, libc::IP_TRANSPARENT, bool);
332446
#[cfg(target_os = "openbsd")]
333-
sockopt_impl!(BindAny, Both, libc::SOL_SOCKET, libc::SO_BINDANY, bool);
447+
sockopt_impl!(
448+
BindAny, Both, libc::SOL_SOCKET, libc::SO_BINDANY, bool);
334449
#[cfg(target_os = "freebsd")]
335-
sockopt_impl!(BindAny, Both, libc::IPPROTO_IP, libc::IP_BINDANY, bool);
450+
sockopt_impl!(
451+
/// Can `bind(2)` to any address, even one not bound to any available
452+
/// network interface in the system.
453+
BindAny, Both, libc::IPPROTO_IP, libc::IP_BINDANY, bool);
336454
#[cfg(target_os = "linux")]
337-
sockopt_impl!(Mark, Both, libc::SOL_SOCKET, libc::SO_MARK, u32);
455+
sockopt_impl!(
456+
/// Set the mark for each packet sent through this socket (similar to the
457+
/// netfilter MARK target but socket-based).
458+
Mark, Both, libc::SOL_SOCKET, libc::SO_MARK, u32);
338459
#[cfg(any(target_os = "android", target_os = "linux"))]
339-
sockopt_impl!(PassCred, Both, libc::SOL_SOCKET, libc::SO_PASSCRED, bool);
460+
sockopt_impl!(
461+
/// Enable or disable the receiving of the `SCM_CREDENTIALS` control
462+
/// message.
463+
PassCred, Both, libc::SOL_SOCKET, libc::SO_PASSCRED, bool);
340464
#[cfg(any(target_os = "freebsd", target_os = "linux"))]
341-
sockopt_impl!(TcpCongestion, Both, libc::IPPROTO_TCP, libc::TCP_CONGESTION, OsString<[u8; TCP_CA_NAME_MAX]>);
465+
sockopt_impl!(
466+
/// This option allows the caller to set the TCP congestion control
467+
/// algorithm to be used, on a per-socket basis.
468+
TcpCongestion, Both, libc::IPPROTO_TCP, libc::TCP_CONGESTION, OsString<[u8; TCP_CA_NAME_MAX]>);
342469
#[cfg(any(
343470
target_os = "android",
344471
target_os = "ios",
345472
target_os = "linux",
346473
target_os = "macos",
347474
target_os = "netbsd",
348475
))]
349-
sockopt_impl!(Ipv4PacketInfo, Both, libc::IPPROTO_IP, libc::IP_PKTINFO, bool);
476+
sockopt_impl!(
477+
/// Pass an `IP_PKTINFO` ancillary message that contains a pktinfo
478+
/// structure that supplies some information about the incoming packet.
479+
Ipv4PacketInfo, Both, libc::IPPROTO_IP, libc::IP_PKTINFO, bool);
350480
#[cfg(any(
351481
target_os = "android",
352482
target_os = "freebsd",
@@ -356,39 +486,71 @@ sockopt_impl!(Ipv4PacketInfo, Both, libc::IPPROTO_IP, libc::IP_PKTINFO, bool);
356486
target_os = "netbsd",
357487
target_os = "openbsd",
358488
))]
359-
sockopt_impl!(Ipv6RecvPacketInfo, Both, libc::IPPROTO_IPV6, libc::IPV6_RECVPKTINFO, bool);
489+
sockopt_impl!(
490+
/// Set delivery of the `IPV6_PKTINFO` control message on incoming
491+
/// datagrams.
492+
Ipv6RecvPacketInfo, Both, libc::IPPROTO_IPV6, libc::IPV6_RECVPKTINFO, bool);
360493
#[cfg(any(
361494
target_os = "freebsd",
362495
target_os = "ios",
363496
target_os = "macos",
364497
target_os = "netbsd",
365498
target_os = "openbsd",
366499
))]
367-
sockopt_impl!(Ipv4RecvIf, Both, libc::IPPROTO_IP, libc::IP_RECVIF, bool);
500+
sockopt_impl!(
501+
/// The `recvmsg(2)` call returns a `struct sockaddr_dl` corresponding to
502+
/// the interface on which the packet was received.
503+
Ipv4RecvIf, Both, libc::IPPROTO_IP, libc::IP_RECVIF, bool);
368504
#[cfg(any(
369505
target_os = "freebsd",
370506
target_os = "ios",
371507
target_os = "macos",
372508
target_os = "netbsd",
373509
target_os = "openbsd",
374510
))]
375-
sockopt_impl!(Ipv4RecvDstAddr, Both, libc::IPPROTO_IP, libc::IP_RECVDSTADDR, bool);
511+
sockopt_impl!(
512+
/// The `recvmsg(2)` call will return the destination IP address for a UDP
513+
/// datagram.
514+
Ipv4RecvDstAddr, Both, libc::IPPROTO_IP, libc::IP_RECVDSTADDR, bool);
376515
#[cfg(target_os = "linux")]
377-
sockopt_impl!(UdpGsoSegment, Both, libc::SOL_UDP, libc::UDP_SEGMENT, libc::c_int);
516+
sockopt_impl!(
517+
#[allow(missing_docs)]
518+
// Not documented by Linux!
519+
UdpGsoSegment, Both, libc::SOL_UDP, libc::UDP_SEGMENT, libc::c_int);
378520
#[cfg(target_os = "linux")]
379-
sockopt_impl!(UdpGroSegment, Both, libc::IPPROTO_UDP, libc::UDP_GRO, bool);
521+
sockopt_impl!(
522+
#[allow(missing_docs)]
523+
// Not documented by Linux!
524+
UdpGroSegment, Both, libc::IPPROTO_UDP, libc::UDP_GRO, bool);
380525
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
381-
sockopt_impl!(RxqOvfl, Both, libc::SOL_SOCKET, libc::SO_RXQ_OVFL, libc::c_int);
382-
sockopt_impl!(Ipv6V6Only, Both, libc::IPPROTO_IPV6, libc::IPV6_V6ONLY, bool);
526+
sockopt_impl!(
527+
/// Indicates that an unsigned 32-bit value ancillary message (cmsg) should
528+
/// be attached to received skbs indicating the number of packets dropped by
529+
/// the socket since its creation.
530+
RxqOvfl, Both, libc::SOL_SOCKET, libc::SO_RXQ_OVFL, libc::c_int);
531+
sockopt_impl!(
532+
/// The socket is restricted to sending and receiving IPv6 packets only.
533+
Ipv6V6Only, Both, libc::IPPROTO_IPV6, libc::IPV6_V6ONLY, bool);
383534
#[cfg(any(target_os = "android", target_os = "linux"))]
384-
sockopt_impl!(Ipv4RecvErr, Both, libc::IPPROTO_IP, libc::IP_RECVERR, bool);
535+
sockopt_impl!(
536+
/// Enable extended reliable error message passing.
537+
Ipv4RecvErr, Both, libc::IPPROTO_IP, libc::IP_RECVERR, bool);
385538
#[cfg(any(target_os = "android", target_os = "linux"))]
386-
sockopt_impl!(Ipv6RecvErr, Both, libc::IPPROTO_IPV6, libc::IPV6_RECVERR, bool);
539+
sockopt_impl!(
540+
/// Control receiving of asynchronous error options.
541+
Ipv6RecvErr, Both, libc::IPPROTO_IPV6, libc::IPV6_RECVERR, bool);
387542
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))]
388-
sockopt_impl!(Ipv4Ttl, Both, libc::IPPROTO_IP, libc::IP_TTL, libc::c_int);
543+
sockopt_impl!(
544+
/// Set or retrieve the current time-to-live field that is used in every
545+
/// packet sent from this socket.
546+
Ipv4Ttl, Both, libc::IPPROTO_IP, libc::IP_TTL, libc::c_int);
389547
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))]
390-
sockopt_impl!(Ipv6Ttl, Both, libc::IPPROTO_IPV6, libc::IPV6_UNICAST_HOPS, libc::c_int);
548+
sockopt_impl!(
549+
/// Set the unicast hop limit for the socket.
550+
Ipv6Ttl, Both, libc::IPPROTO_IPV6, libc::IPV6_UNICAST_HOPS, libc::c_int);
391551

552+
#[allow(missing_docs)]
553+
// Not documented by Linux!
392554
#[cfg(any(target_os = "android", target_os = "linux"))]
393555
#[derive(Copy, Clone, Debug)]
394556
pub struct AlgSetAeadAuthSize;
@@ -411,6 +573,8 @@ impl SetSockOpt for AlgSetAeadAuthSize {
411573
}
412574
}
413575

576+
#[allow(missing_docs)]
577+
// Not documented by Linux!
414578
#[cfg(any(target_os = "android", target_os = "linux"))]
415579
#[derive(Clone, Debug)]
416580
pub struct AlgSetKey<T>(::std::marker::PhantomData<T>);

0 commit comments

Comments
 (0)