Merge branch 'netif-doc' into 'master'
add descriptions to items in net_if header See merge request redox-os/relibc!1381
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/net_if.h.html
|
||||
#
|
||||
# There are no spec quotations relating to includes
|
||||
sys_includes = []
|
||||
include_guard = "_NET_IF_H"
|
||||
include_guard = "_RELIBC_NET_IF_H"
|
||||
language = "C"
|
||||
style = "Tag"
|
||||
no_includes = true
|
||||
|
||||
@@ -17,15 +17,21 @@ use super::errno::ENXIO;
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/net_if.h.html>.
|
||||
#[repr(C)]
|
||||
pub struct if_nameindex {
|
||||
/// Numeric index of the interface.
|
||||
if_index: c_uint,
|
||||
/// Null-terminated name of the interface.
|
||||
if_name: *const c_char,
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/net_if.h.html>.
|
||||
///
|
||||
/// Interface name length.
|
||||
pub const IF_NAMESIZE: usize = 16;
|
||||
|
||||
/// cbindgen:ignore
|
||||
const IF_STUB_INTERFACE: *const c_char = (c"stub").as_ptr();
|
||||
|
||||
/// cbindgen:ignore
|
||||
const INTERFACES: &[if_nameindex] = &[
|
||||
if_nameindex {
|
||||
if_index: 1,
|
||||
@@ -89,24 +95,43 @@ pub unsafe extern "C" fn if_nametoindex(name: *const c_char) -> c_uint {
|
||||
// Nonstandard, used alongside ifaddrs.h
|
||||
// See https://man7.org/linux/man-pages/man7/netdevice.7.html
|
||||
|
||||
/// Interface is running.
|
||||
pub const IFF_UP: c_int = 0x1;
|
||||
/// Valid broadcast address set.
|
||||
pub const IFF_BROADCAST: c_int = 0x2;
|
||||
/// Internal debugging flag.
|
||||
pub const IFF_DEBUG: c_int = 0x4;
|
||||
/// Interface is a loopback interface.
|
||||
pub const IFF_LOOPBACK: c_int = 0x8;
|
||||
/// Interface is a point-to-point link.
|
||||
pub const IFF_POINTOPOINT: c_int = 0x10;
|
||||
/// Avoid use of trailers.
|
||||
pub const IFF_NOTRAILERS: c_int = 0x20;
|
||||
/// Resources allocated.
|
||||
pub const IFF_RUNNING: c_int = 0x40;
|
||||
/// No arp protocol, L2 destination address not set.
|
||||
pub const IFF_NOARP: c_int = 0x80;
|
||||
/// Interface is in promiscuous mode.
|
||||
pub const IFF_PROMISC: c_int = 0x100;
|
||||
/// Receive all multicast packets.
|
||||
pub const IFF_ALLMULTI: c_int = 0x200;
|
||||
/// Master of a load balancing bundle.
|
||||
pub const IFF_MASTER: c_int = 0x400;
|
||||
/// Slave of a load balancing bundle.
|
||||
pub const IFF_SLAVE: c_int = 0x800;
|
||||
/// Supports multicast.
|
||||
pub const IFF_MULTICAST: c_int = 0x1000;
|
||||
/// Is able to select media type via ifmap.
|
||||
pub const IFF_PORTSEL: c_int = 0x2000;
|
||||
/// Auto media selection active.
|
||||
pub const IFF_AUTOMEDIA: c_int = 0x4000;
|
||||
/// The addresses are lost when the interface goes down.
|
||||
pub const IFF_DYNAMIC: c_int = 0x8000;
|
||||
/// Driver signals L1 up.
|
||||
pub const IFF_LOWER_UP: c_int = 0x10000;
|
||||
/// Driver signals dormant.
|
||||
pub const IFF_DORMANT: c_int = 0x20000;
|
||||
/// Echo sent packets.
|
||||
pub const IFF_ECHO: c_int = 0x40000;
|
||||
pub const IFF_VOLATILE: c_int = IFF_LOOPBACK
|
||||
| IFF_POINTOPOINT
|
||||
|
||||
Reference in New Issue
Block a user