Skip to content

Commit 100d9f2

Browse files
committed
Add LINK_STATE_* definitions to NetBSD and OpenBSD.
1 parent 06a5ca2 commit 100d9f2

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,15 @@ pub const LOCAL_CONNWAIT: c_int = 0x0002; // connects block until accepted
13931393
pub const LOCAL_PEEREID: c_int = 0x0003; // get peer identification
13941394
pub const LOCAL_CREDS: c_int = 0x0004; // pass credentials to receiver
13951395

1396-
// https://github.com/NetBSD/src/blob/trunk/sys/net/if.h#L373
1396+
// https://github.com/NetBSD/src/blob/trunk/sys/net/if.h#L207
1397+
/// link invalid/unknown
1398+
pub const LINK_STATE_UNKNOWN: c_int = 0;
1399+
/// link is down
1400+
pub const LINK_STATE_DOWN: c_int = 1;
1401+
/// link is up
1402+
pub const LINK_STATE_UP: c_int = 2;
1403+
1404+
// https://github.com/NetBSD/src/blob/trunk/sys/net/if.h#L445
13971405
pub const IFF_UP: c_int = 0x0001; // interface is up
13981406
pub const IFF_BROADCAST: c_int = 0x0002; // broadcast address valid
13991407
pub const IFF_DEBUG: c_int = 0x0004; // turn on debugging

src/unix/bsd/netbsdlike/openbsd/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,6 +1629,22 @@ const SI_PAD: size_t = (SI_MAXSZ / size_of::<c_int>()) - 3;
16291629
pub const MAP_STACK: c_int = 0x4000;
16301630
pub const MAP_CONCEAL: c_int = 0x8000;
16311631

1632+
// https://github.com/openbsd/src/blob/HEAD/sys/net/if.h#L135
1633+
/// link unknown
1634+
pub const LINK_STATE_UNKNOWN: c_int = 0;
1635+
/// link invalid
1636+
pub const LINK_STATE_INVALID: c_int = 1;
1637+
/// link is down
1638+
pub const LINK_STATE_DOWN: c_int = 2;
1639+
/// keepalive reports down
1640+
pub const LINK_STATE_KALIVE_DOWN: c_int = 3;
1641+
/// link is up
1642+
pub const LINK_STATE_UP: c_int = 4;
1643+
/// link is up and half duplex
1644+
pub const LINK_STATE_HALF_DUPLEX: c_int = 5;
1645+
/// link is up and full duplex
1646+
pub const LINK_STATE_FULL_DUPLEX: c_int = 6;
1647+
16321648
// https://github.com/openbsd/src/blob/HEAD/sys/net/if.h#L187
16331649
pub const IFF_UP: c_int = 0x1; // interface is up
16341650
pub const IFF_BROADCAST: c_int = 0x2; // broadcast address valid

0 commit comments

Comments
 (0)