Skip to content

Commit 94e30df

Browse files
committed
Expose unix ECN-related constants
1 parent ed8309b commit 94e30df

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/unix/bsd/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ pub const IP_MULTICAST_IF: ::c_int = 9;
183183
pub const IP_MULTICAST_TTL: ::c_int = 10;
184184
pub const IP_MULTICAST_LOOP: ::c_int = 11;
185185

186+
pub const IP_TOS: ::c_int = 1;
187+
186188
pub const IPV6_UNICAST_HOPS: ::c_int = 4;
187189
pub const IPV6_MULTICAST_IF: ::c_int = 9;
188190
pub const IPV6_MULTICAST_HOPS: ::c_int = 10;

src/unix/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,12 @@ pub const IPPROTO_UDP: ::c_int = 17;
296296
pub const IPPROTO_IP: ::c_int = 0;
297297
pub const IPPROTO_IPV6: ::c_int = 41;
298298

299+
pub const IPTOS_ECN_MASK: u8 = 0x03;
300+
pub const IPTOS_ECN_NOT_ECT: u8 = 0x00;
301+
pub const IPTOS_ECN_ECT1: u8 = 0x01;
302+
pub const IPTOS_ECN_ECT0: u8 = 0x02;
303+
pub const IPTOS_ECN_CE: u8 = 0x03;
304+
299305
pub const INADDR_LOOPBACK: in_addr_t = 2130706433;
300306
pub const INADDR_ANY: in_addr_t = 0;
301307
pub const INADDR_BROADCAST: in_addr_t = 4294967295;

src/unix/notbsd/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,9 +623,11 @@ pub const SOCK_RDM: ::c_int = 4;
623623
pub const IP_MULTICAST_IF: ::c_int = 32;
624624
pub const IP_MULTICAST_TTL: ::c_int = 33;
625625
pub const IP_MULTICAST_LOOP: ::c_int = 34;
626+
pub const IP_TOS: ::c_int = 1;
626627
pub const IP_TTL: ::c_int = 2;
627628
pub const IP_HDRINCL: ::c_int = 3;
628629
pub const IP_PKTINFO: ::c_int = 8;
630+
pub const IP_RECVTOS: ::c_int = 13;
629631
pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
630632
pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
631633
pub const IP_TRANSPARENT: ::c_int = 19;
@@ -1087,6 +1089,10 @@ f! {
10871089
pub fn IPOPT_NUMBER(o: u8) -> u8 {
10881090
o & IPOPT_NUMBER_MASK
10891091
}
1092+
1093+
pub fn IPTOS_ECN(x: u8) -> u8 {
1094+
x & super::IPTOS_ECN_MASK
1095+
}
10901096
}
10911097

10921098
extern {

0 commit comments

Comments
 (0)