Skip to content

Commit 8ee2700

Browse files
committed
Auto merge of #1175 - Ralith:ip-tos, r=alexcrichton
Expose unix ECN-related constants I'm not certain of the correctness of the BSD definition, but I assume that's what CI's for.
2 parents f0a6af0 + 0de81a6 commit 8ee2700

File tree

8 files changed

+32
-0
lines changed

8 files changed

+32
-0
lines changed

src/unix/bsd/apple/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,8 +1573,11 @@ pub const IP_HDRINCL: ::c_int = 2;
15731573
pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
15741574
pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
15751575
pub const IP_PKTINFO: ::c_int = 26;
1576+
pub const IP_RECVTOS: ::c_int = 27;
15761577
pub const IPV6_JOIN_GROUP: ::c_int = 12;
15771578
pub const IPV6_LEAVE_GROUP: ::c_int = 13;
1579+
pub const IPV6_RECVTCLASS: ::c_int = 35;
1580+
pub const IPV6_TCLASS: ::c_int = 36;
15781581
pub const IPV6_PKTINFO: ::c_int = 46;
15791582
pub const IPV6_RECVPKTINFO: ::c_int = 61;
15801583

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,7 @@ pub const TCP_PCAP_OUT: ::c_int = 2048;
803803
pub const TCP_PCAP_IN: ::c_int = 4096;
804804

805805
pub const IP_BINDANY: ::c_int = 24;
806+
pub const IP_RECVTOS: ::c_int = 68;
806807

807808
pub const PF_SLOW: ::c_int = AF_SLOW;
808809
pub const PF_SCLUSTER: ::c_int = AF_SCLUSTER;

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,8 @@ pub const IPV6_JOIN_GROUP: ::c_int = 12;
668668
pub const IPV6_LEAVE_GROUP: ::c_int = 13;
669669
pub const IPV6_RECVPKTINFO: ::c_int = 36;
670670
pub const IPV6_PKTINFO: ::c_int = 46;
671+
pub const IPV6_RECVTCLASS: ::c_int = 57;
672+
pub const IPV6_TCLASS: ::c_int = 61;
671673

672674
pub const TCP_NOPUSH: ::c_int = 4;
673675
pub const TCP_NOOPT: ::c_int = 8;

src/unix/bsd/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ pub const SIG_SETMASK: ::c_int = 3;
179179
pub const SIG_BLOCK: ::c_int = 0x1;
180180
pub const SIG_UNBLOCK: ::c_int = 0x2;
181181

182+
pub const IP_TOS: ::c_int = 3;
182183
pub const IP_MULTICAST_IF: ::c_int = 9;
183184
pub const IP_MULTICAST_TTL: ::c_int = 10;
184185
pub const IP_MULTICAST_LOOP: ::c_int = 11;
@@ -189,6 +190,12 @@ pub const IPV6_MULTICAST_HOPS: ::c_int = 10;
189190
pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
190191
pub const IPV6_V6ONLY: ::c_int = 27;
191192

193+
pub const IPTOS_ECN_NOTECT: u8 = 0x00;
194+
pub const IPTOS_ECN_MASK: u8 = 0x03;
195+
pub const IPTOS_ECN_ECT1: u8 = 0x01;
196+
pub const IPTOS_ECN_ECT0: u8 = 0x02;
197+
pub const IPTOS_ECN_CE: u8 = 0x03;
198+
192199
pub const ST_RDONLY: ::c_ulong = 1;
193200

194201
pub const SCM_RIGHTS: ::c_int = 0x01;

src/unix/bsd/netbsdlike/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
430430
pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
431431
pub const IPV6_RECVPKTINFO: ::c_int = 36;
432432
pub const IPV6_PKTINFO: ::c_int = 46;
433+
pub const IPV6_RECVTCLASS: ::c_int = 57;
434+
pub const IPV6_TCLASS: ::c_int = 61;
433435

434436
pub const SOL_SOCKET: ::c_int = 0xffff;
435437
pub const SO_DEBUG: ::c_int = 0x01;

src/unix/notbsd/android/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,8 @@ pub const SO_RXQ_OVFL: ::c_int = 40;
666666
pub const SO_PEEK_OFF: ::c_int = 42;
667667
pub const SO_BUSY_POLL: ::c_int = 46;
668668

669+
pub const IPTOS_ECN_NOTECT: u8 = 0x00;
670+
669671
pub const O_ACCMODE: ::c_int = 3;
670672
pub const O_APPEND: ::c_int = 1024;
671673
pub const O_CREAT: ::c_int = 64;

src/unix/notbsd/linux/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,8 @@ pub const SIOCSIFMAP: ::c_ulong = 0x00008971;
16121612
pub const IPTOS_TOS_MASK: u8 = 0x1E;
16131613
pub const IPTOS_PREC_MASK: u8 = 0xE0;
16141614

1615+
pub const IPTOS_ECN_NOT_ECT: u8 = 0x00;
1616+
16151617
pub const RTF_UP: ::c_ushort = 0x0001;
16161618
pub const RTF_GATEWAY: ::c_ushort = 0x0002;
16171619

src/unix/notbsd/mod.rs

Lines changed: 13 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;
@@ -638,6 +640,8 @@ pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21;
638640
pub const IPV6_V6ONLY: ::c_int = 26;
639641
pub const IPV6_RECVPKTINFO: ::c_int = 49;
640642
pub const IPV6_PKTINFO: ::c_int = 50;
643+
pub const IPV6_RECVTCLASS: ::c_int = 66;
644+
pub const IPV6_TCLASS: ::c_int = 67;
641645

642646
pub const TCP_NODELAY: ::c_int = 1;
643647
pub const TCP_MAXSEG: ::c_int = 2;
@@ -874,6 +878,11 @@ pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40;
874878
pub const IPTOS_PREC_PRIORITY: u8 = 0x20;
875879
pub const IPTOS_PREC_ROUTINE: u8 = 0x00;
876880

881+
pub const IPTOS_ECN_MASK: u8 = 0x03;
882+
pub const IPTOS_ECN_ECT1: u8 = 0x01;
883+
pub const IPTOS_ECN_ECT0: u8 = 0x02;
884+
pub const IPTOS_ECN_CE: u8 = 0x03;
885+
877886
pub const IPOPT_COPY: u8 = 0x80;
878887
pub const IPOPT_CLASS_MASK: u8 = 0x60;
879888
pub const IPOPT_NUMBER_MASK: u8 = 0x1f;
@@ -1087,6 +1096,10 @@ f! {
10871096
pub fn IPOPT_NUMBER(o: u8) -> u8 {
10881097
o & IPOPT_NUMBER_MASK
10891098
}
1099+
1100+
pub fn IPTOS_ECN(x: u8) -> u8 {
1101+
x & ::IPTOS_ECN_MASK
1102+
}
10901103
}
10911104

10921105
extern {

0 commit comments

Comments
 (0)