1+ //! Socket options as used by `setsockopt` and `getsockopt`.
12use cfg_if:: cfg_if;
23use super :: { GetSockOpt , SetSockOpt } ;
34use 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 ) ;
251276cfg_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,196 @@ 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 ) ;
296363cfg_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+ /// Allows the socket to be bound to addresses which are not local to the
449+ /// machine, so it can be used to make a transparent proxy.
450+ BindAny , Both , libc:: SOL_SOCKET , libc:: SO_BINDANY , bool ) ;
334451#[ cfg( target_os = "freebsd" ) ]
335- sockopt_impl ! ( BindAny , Both , libc:: IPPROTO_IP , libc:: IP_BINDANY , bool ) ;
452+ sockopt_impl ! (
453+ /// Can `bind(2)` to any address, even one not bound to any available
454+ /// network interface in the system.
455+ BindAny , Both , libc:: IPPROTO_IP , libc:: IP_BINDANY , bool ) ;
336456#[ cfg( target_os = "linux" ) ]
337- sockopt_impl ! ( Mark , Both , libc:: SOL_SOCKET , libc:: SO_MARK , u32 ) ;
457+ sockopt_impl ! (
458+ /// Set the mark for each packet sent through this socket (similar to the
459+ /// netfilter MARK target but socket-based).
460+ Mark , Both , libc:: SOL_SOCKET , libc:: SO_MARK , u32 ) ;
338461#[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
339- sockopt_impl ! ( PassCred , Both , libc:: SOL_SOCKET , libc:: SO_PASSCRED , bool ) ;
462+ sockopt_impl ! (
463+ /// Enable or disable the receiving of the `SCM_CREDENTIALS` control
464+ /// message.
465+ PassCred , Both , libc:: SOL_SOCKET , libc:: SO_PASSCRED , bool ) ;
340466#[ 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 ] >) ;
467+ sockopt_impl ! (
468+ /// This option allows the caller to set the TCP congestion control
469+ /// algorithm to be used, on a per-socket basis.
470+ TcpCongestion , Both , libc:: IPPROTO_TCP , libc:: TCP_CONGESTION , OsString <[ u8 ; TCP_CA_NAME_MAX ] >) ;
342471#[ cfg( any(
343472 target_os = "android" ,
344473 target_os = "ios" ,
345474 target_os = "linux" ,
346475 target_os = "macos" ,
347476 target_os = "netbsd" ,
348477) ) ]
349- sockopt_impl ! ( Ipv4PacketInfo , Both , libc:: IPPROTO_IP , libc:: IP_PKTINFO , bool ) ;
478+ sockopt_impl ! (
479+ /// Pass an `IP_PKTINFO` ancillary message that contains a pktinfo
480+ /// structure that supplies some information about the incoming packet.
481+ Ipv4PacketInfo , Both , libc:: IPPROTO_IP , libc:: IP_PKTINFO , bool ) ;
350482#[ cfg( any(
351483 target_os = "android" ,
352484 target_os = "freebsd" ,
@@ -356,39 +488,71 @@ sockopt_impl!(Ipv4PacketInfo, Both, libc::IPPROTO_IP, libc::IP_PKTINFO, bool);
356488 target_os = "netbsd" ,
357489 target_os = "openbsd" ,
358490) ) ]
359- sockopt_impl ! ( Ipv6RecvPacketInfo , Both , libc:: IPPROTO_IPV6 , libc:: IPV6_RECVPKTINFO , bool ) ;
491+ sockopt_impl ! (
492+ /// Set delivery of the `IPV6_PKTINFO` control message on incoming
493+ /// datagrams.
494+ Ipv6RecvPacketInfo , Both , libc:: IPPROTO_IPV6 , libc:: IPV6_RECVPKTINFO , bool ) ;
360495#[ cfg( any(
361496 target_os = "freebsd" ,
362497 target_os = "ios" ,
363498 target_os = "macos" ,
364499 target_os = "netbsd" ,
365500 target_os = "openbsd" ,
366501) ) ]
367- sockopt_impl ! ( Ipv4RecvIf , Both , libc:: IPPROTO_IP , libc:: IP_RECVIF , bool ) ;
502+ sockopt_impl ! (
503+ /// The `recvmsg(2)` call returns a `struct sockaddr_dl` corresponding to
504+ /// the interface on which the packet was received.
505+ Ipv4RecvIf , Both , libc:: IPPROTO_IP , libc:: IP_RECVIF , bool ) ;
368506#[ cfg( any(
369507 target_os = "freebsd" ,
370508 target_os = "ios" ,
371509 target_os = "macos" ,
372510 target_os = "netbsd" ,
373511 target_os = "openbsd" ,
374512) ) ]
375- sockopt_impl ! ( Ipv4RecvDstAddr , Both , libc:: IPPROTO_IP , libc:: IP_RECVDSTADDR , bool ) ;
513+ sockopt_impl ! (
514+ /// The `recvmsg(2)` call will return the destination IP address for a UDP
515+ /// datagram.
516+ Ipv4RecvDstAddr , Both , libc:: IPPROTO_IP , libc:: IP_RECVDSTADDR , bool ) ;
376517#[ cfg( target_os = "linux" ) ]
377- sockopt_impl ! ( UdpGsoSegment , Both , libc:: SOL_UDP , libc:: UDP_SEGMENT , libc:: c_int) ;
518+ sockopt_impl ! (
519+ #[ allow( missing_docs) ]
520+ // Not documented by Linux!
521+ UdpGsoSegment , Both , libc:: SOL_UDP , libc:: UDP_SEGMENT , libc:: c_int) ;
378522#[ cfg( target_os = "linux" ) ]
379- sockopt_impl ! ( UdpGroSegment , Both , libc:: IPPROTO_UDP , libc:: UDP_GRO , bool ) ;
523+ sockopt_impl ! (
524+ #[ allow( missing_docs) ]
525+ // Not documented by Linux!
526+ UdpGroSegment , Both , libc:: IPPROTO_UDP , libc:: UDP_GRO , bool ) ;
380527#[ 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 ) ;
528+ sockopt_impl ! (
529+ /// Indicates that an unsigned 32-bit value ancillary message (cmsg) should
530+ /// be attached to received skbs indicating the number of packets dropped by
531+ /// the socket since its creation.
532+ RxqOvfl , Both , libc:: SOL_SOCKET , libc:: SO_RXQ_OVFL , libc:: c_int) ;
533+ sockopt_impl ! (
534+ /// The socket is restricted to sending and receiving IPv6 packets only.
535+ Ipv6V6Only , Both , libc:: IPPROTO_IPV6 , libc:: IPV6_V6ONLY , bool ) ;
383536#[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
384- sockopt_impl ! ( Ipv4RecvErr , Both , libc:: IPPROTO_IP , libc:: IP_RECVERR , bool ) ;
537+ sockopt_impl ! (
538+ /// Enable extended reliable error message passing.
539+ Ipv4RecvErr , Both , libc:: IPPROTO_IP , libc:: IP_RECVERR , bool ) ;
385540#[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
386- sockopt_impl ! ( Ipv6RecvErr , Both , libc:: IPPROTO_IPV6 , libc:: IPV6_RECVERR , bool ) ;
541+ sockopt_impl ! (
542+ /// Control receiving of asynchronous error options.
543+ Ipv6RecvErr , Both , libc:: IPPROTO_IPV6 , libc:: IPV6_RECVERR , bool ) ;
387544#[ 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) ;
545+ sockopt_impl ! (
546+ /// Set or retrieve the current time-to-live field that is used in every
547+ /// packet sent from this socket.
548+ Ipv4Ttl , Both , libc:: IPPROTO_IP , libc:: IP_TTL , libc:: c_int) ;
389549#[ 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) ;
550+ sockopt_impl ! (
551+ /// Set the unicast hop limit for the socket.
552+ Ipv6Ttl , Both , libc:: IPPROTO_IPV6 , libc:: IPV6_UNICAST_HOPS , libc:: c_int) ;
391553
554+ #[ allow( missing_docs) ]
555+ // Not documented by Linux!
392556#[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
393557#[ derive( Copy , Clone , Debug ) ]
394558pub struct AlgSetAeadAuthSize ;
@@ -411,6 +575,8 @@ impl SetSockOpt for AlgSetAeadAuthSize {
411575 }
412576}
413577
578+ #[ allow( missing_docs) ]
579+ // Not documented by Linux!
414580#[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
415581#[ derive( Clone , Debug ) ]
416582pub struct AlgSetKey < T > ( :: std:: marker:: PhantomData < T > ) ;
0 commit comments