macro_rules! getsockopt_impl {
($name:ident, $level:expr, $flag:path, $ty:ty, $getter:ty) => { ... };
}
Expand description
Helper for implementing GetSockOpt
for a given socket option. See
::sys::socket::GetSockOpt
.
This macro aims to help implementing GetSockOpt
for different socket options that accept
different kinds of data to be use with getsockopt
.
Instead of using this macro directly consider using sockopt_impl!
,
especially if the option you are implementing represents a simple type.
ยงArguments
- Name of the type you want to implement
GetSockOpt
for. - Socket layer, or a
protocol level
: could be raw sockets (lic::SOL_SOCKET
), ip protocol (libc::IPPROTO_IP), tcp protocol (libc::IPPROTO_TCP
), and more. Please refer to your system manual for more options. Will be passed as the second argument (level
) to thegetsockopt
call. - A flag to set. Some examples:
libc::SO_REUSEADDR
,libc::TCP_NODELAY
,libc::SO_ORIGINAL_DST
and others. Will be passed as the third argument (option_name
) to thegetsockopt
call. - Type of the value that you are going to get.
- Type that implements the
Get
trait for the type from the previous item (GetBool
forbool
,GetUsize
forusize
, etc.).