Add sock_extended_err and associated constants from errqueue.h

sock_extended_err is a struct returned as a control message when the sockopt
IP_RECVERR is set, when recvmsg has the MSG_ERRQUEUE flag set.  IP_RECVERR and
MSG_ERRQUEUE are constants both already defined here.
This commit is contained in:
Matthew McPherrin 2019-12-01 19:46:05 -08:00
parent 104a3f2aba
commit 73c243700c
2 changed files with 22 additions and 0 deletions

View File

@ -2189,6 +2189,7 @@ fn test_linux(target: &str) {
cfg:
"asm/mman.h",
"linux/dccp.h",
"linux/errqueue.h",
"linux/falloc.h",
"linux/fs.h",
"linux/futex.h",

View File

@ -199,6 +199,16 @@ s! {
pub msg_hdr: ::msghdr,
pub msg_len: ::c_uint,
}
pub struct sock_extended_err {
pub ee_errno: u32,
pub ee_origin: u8,
pub ee_type: u8,
pub ee_code: u8,
pub ee_pad: u8,
pub ee_info: u32,
pub ee_data: u32
}
}
s_no_extra_traits! {
@ -1189,6 +1199,13 @@ pub const ARPHRD_IEEE802154: u16 = 804;
pub const ARPHRD_VOID: u16 = 0xFFFF;
pub const ARPHRD_NONE: u16 = 0xFFFE;
pub const SO_EE_ORIGIN_NONE: u8 = 0;
pub const SO_EE_ORIGIN_LOCAL: u8 = 1;
pub const SO_EE_ORIGIN_ICMP: u8 = 2;
pub const SO_EE_ORIGIN_ICMP6: u8 = 3;
pub const SO_EE_ORIGIN_TXSTATUS: u8 = 4;
pub const SO_EE_ORIGIN_TIMESTAMPING: u8 = SO_EE_ORIGIN_TXSTATUS;
const_fn! {
{const} fn CMSG_ALIGN(len: usize) -> usize {
len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
@ -1294,6 +1311,10 @@ f! {
pub fn IPTOS_ECN(x: u8) -> u8 {
x & ::IPTOS_ECN_MASK
}
pub fn SO_EE_OFFENDER(ee: *const ::sock_extended_err) -> *mut ::sockaddr {
ee.offset(1) as *mut ::sockaddr
}
}
extern "C" {