Module linux_io::fd::sockopt

source ·
Expand description

A safer abstraction for setsockopt and getsockopt.

These system calls are very open-ended, supporting a variety of different operations with different argument and result types. Passing the wrong kind of value to the wrong command can cause memory corruption.

To make these a little safer to use, this module provides option constants that also include information about the argument and result types, so that the super::File::setsockopt and super::File::getsockopt methods can then provide a type-safe interface as long as these constants are defined correctly.

This module defines constants for the main sockets API options. Protocol-specific options might also be available in other modules, or potentially in other crates.

Structs§

Constants§

  • The sockopt “level” for general socket options that are not protocol-specific.
  • Indicates whether or not this socket has been marked to accept connections e.g. using super::File::listen.
  • Returns the protocol/address family for this socket.
  • Send only to directly-connected hosts, ignoring any configured gateway.
  • Send period keepalive messages on connection-oriented sockets.

Traits§

  • Implemented by options that can be used with getsockopt.
  • Implemented by options that can be used with setsockopt.

Functions§

  • Constructs a new “simple” socket option whose safe-facing argument type is the same as its internal type and whose level and option name are fixed.
  • Constructs a new “simple” socket option that is read-only.