authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-09-17 21:43:23-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-09-17 21:43:23-07:00
logd6b4e1918b77e2992038d385d0951c7c926703a1
tree3f2100a89895aa4ac0ed90beefdcc208e9aa5a9d
parent65a6bf1267770c4d27785cd1fbfa9fb1e5dc30c9
parent799569752793351402f636f9b0c76c43bea97806
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #25195 from blblack/netdefs

std: Add several sockopt-related constants and structs

11 files changed, 1222 insertions(+), 8 deletions(-)

lib/std/c.zig+161-2
...@@ -3991,6 +3991,17 @@ pub const W = switch (native_os) {...@@ -3991,6 +3991,17 @@ pub const W = switch (native_os) {
3991 },3991 },
3992 else => void,3992 else => void,
3993};3993};
3994pub const accept_filter_arg = switch (native_os) {
3995 // https://github.com/freebsd/freebsd-src/blob/2024887abc7d1b931e00fbb0697658e98adf048d/sys/sys/socket.h#L205
3996 // https://github.com/DragonFlyBSD/DragonFlyBSD/blob/6098912863ed4c7b3f70d7483910ce2956cf4ed3/sys/sys/socket.h#L164
3997 // https://github.com/NetBSD/src/blob/cad5c68a8524927f65e22ad651de3905382be6e0/sys/sys/socket.h#L188
3998 // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/socket.h#L504
3999 .freebsd, .dragonfly, .netbsd, .macos, .driverkit, .ios, .tvos, .watchos, .visionos => extern struct {
4000 name: [16]u8,
4001 arg: [240]u8,
4002 },
4003 else => void,
4004};
3994pub const clock_t = switch (native_os) {4005pub const clock_t = switch (native_os) {
3995 .linux => linux.clock_t,4006 .linux => linux.clock_t,
3996 .emscripten => emscripten.clock_t,4007 .emscripten => emscripten.clock_t,
...@@ -4076,6 +4087,35 @@ pub const ifreq = switch (native_os) {...@@ -4076,6 +4087,35 @@ pub const ifreq = switch (native_os) {
4076 },4087 },
4077 else => void,4088 else => void,
4078};4089};
4090pub const in_pktinfo = switch (native_os) {
4091 .linux => linux.in_pktinfo,
4092 // https://github.com/kofemann/opensolaris/blob/80192cd83bf665e708269dae856f9145f7190f74/usr/src/uts/common/netinet/in.h#L1084
4093 // https://github.com/illumos/illumos-gate/blob/608eb926e14f4ba4736b2d59e891335f1cba9e1e/usr/src/uts/common/netinet/in.h#L1132
4094 // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/netinet/in.h#L696
4095 .solaris, .illumos, .driverkit, .ios, .macos, .tvos, .watchos, .visionos => extern struct {
4096 ifindex: u32,
4097 spec_dst: u32,
4098 addr: u32,
4099 },
4100 else => void,
4101};
4102pub const in6_pktinfo = switch (native_os) {
4103 .linux => linux.in6_pktinfo,
4104 // https://github.com/freebsd/freebsd-src/blob/9bfbc6826f72eb385bf52f4cde8080bccf7e3ebd/sys/netinet6/in6.h#L547
4105 // https://github.com/DragonFlyBSD/DragonFlyBSD/blob/6098912863ed4c7b3f70d7483910ce2956cf4ed3/sys/netinet6/in6.h#L575
4106 // https://github.com/NetBSD/src/blob/80bf25a5691072d4755e84567ccbdf0729370dea/sys/netinet6/in6.h#L468
4107 // https://github.com/openbsd/src/blob/718a31b40d39fc6064de6355eb144e74633133fc/sys/netinet6/in6.h#L365
4108 // https://github.com/kofemann/opensolaris/blob/80192cd83bf665e708269dae856f9145f7190f74/usr/src/uts/common/netinet/in.h#L1093
4109 // https://github.com/illumos/illumos-gate/blob/608eb926e14f4ba4736b2d59e891335f1cba9e1e/usr/src/uts/common/netinet/in.h#L114IP1
4110 // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/netinet6/in6.h#L737
4111 // https://github.com/haiku/haiku/blob/2aab5f5f14aeb3f34c3a3d9a9064cc3c0d914bea/headers/posix/netinet6/in6.h#L63
4112 // https://github.com/SerenityOS/serenity/blob/5bd8af99be0bc4b2e14f361fd7d7590e6bcfa4d6/Kernel/API/POSIX/sys/socket.h#L122
4113 .freebsd, .dragonfly, .netbsd, .openbsd, .solaris, .illumos, .driverkit, .ios, .macos, .tvos, .watchos, .visionos, .haiku, .serenity => extern struct {
4114 addr: [16]u8,
4115 ifindex: u32,
4116 },
4117 else => void,
4118};
4079pub const itimerspec = switch (native_os) {4119pub const itimerspec = switch (native_os) {
4080 .linux => linux.itimerspec,4120 .linux => linux.itimerspec,
4081 .haiku => extern struct {4121 .haiku => extern struct {
...@@ -4084,6 +4124,37 @@ pub const itimerspec = switch (native_os) {...@@ -4084,6 +4124,37 @@ pub const itimerspec = switch (native_os) {
4084 },4124 },
4085 else => void,4125 else => void,
4086};4126};
4127pub const linger = switch (native_os) {
4128 .linux => linux.linger,
4129 // https://github.com/freebsd/freebsd-src/blob/46347b3619757e3d683a87ca03efaf2ae242335f/sys/sys/socket.h#L200
4130 .freebsd,
4131 // https://github.com/DragonFlyBSD/DragonFlyBSD/blob/6098912863ed4c7b3f70d7483910ce2956cf4ed3/sys/sys/socket.h#L158
4132 .dragonfly,
4133 // https://github.com/NetBSD/src/blob/80bf25a5691072d4755e84567ccbdf0729370dea/sys/sys/socket.h#L183
4134 .netbsd,
4135 // https://github.com/openbsd/src/blob/718a31b40d39fc6064de6355eb144e74633133fc/sys/sys/socket.h#L126
4136 .openbsd,
4137 // https://github.com/kofemann/opensolaris/blob/80192cd83bf665e708269dae856f9145f7190f74/usr/src/uts/common/sys/socket.h#L214
4138 .solaris,
4139 // https://github.com/illumos/illumos-gate/blob/608eb926e14f4ba4736b2d59e891335f1cba9e1e/usr/src/uts/common/sys/socket.h#L250
4140 .illumos,
4141 // https://github.com/haiku/haiku/blob/2aab5f5f14aeb3f34c3a3d9a9064cc3c0d914bea/headers/posix/sys/socket.h#L87
4142 .haiku,
4143 // https://github.com/SerenityOS/serenity/blob/5bd8af99be0bc4b2e14f361fd7d7590e6bcfa4d6/Kernel/API/POSIX/sys/socket.h#L122
4144 .serenity,
4145 // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/socket.h#L498
4146 .driverkit,
4147 .ios,
4148 .macos,
4149 .tvos,
4150 .watchos,
4151 .visionos,
4152 => extern struct {
4153 onoff: i32, // non-zero to linger on close
4154 linger: i32, // time to linger in seconds
4155 },
4156 else => void,
4157};
4087pub const msghdr = switch (native_os) {4158pub const msghdr = switch (native_os) {
4088 .linux => linux.msghdr,4159 .linux => linux.msghdr,
4089 .openbsd,4160 .openbsd,
...@@ -6388,7 +6459,7 @@ pub const IPPROTO = switch (native_os) {...@@ -6388,7 +6459,7 @@ pub const IPPROTO = switch (native_os) {
6388 /// dummy for IP6459 /// dummy for IP
6389 pub const IP = 0;6460 pub const IP = 0;
6390 /// IP6 hop-by-hop options6461 /// IP6 hop-by-hop options
6391 pub const HOPOPTS = IP;6462 pub const HOPOPTS = IPPROTO.IP;
6392 /// control message protocol6463 /// control message protocol
6393 pub const ICMP = 1;6464 pub const ICMP = 1;
6394 /// group mgmt protocol6465 /// group mgmt protocol
...@@ -6470,6 +6541,39 @@ pub const IPPROTO = switch (native_os) {...@@ -6470,6 +6541,39 @@ pub const IPPROTO = switch (native_os) {
6470 },6541 },
6471 else => void,6542 else => void,
6472};6543};
6544pub const IP = switch (native_os) {
6545 .linux => linux.IP,
6546 .freebsd => freebsd.IP,
6547 .dragonfly => dragonfly.IP,
6548 .netbsd => netbsd.IP,
6549 .openbsd => openbsd.IP,
6550 .solaris, .illumos => solaris.IP,
6551 .haiku => haiku.IP,
6552 .serenity => serenity.IP,
6553 else => void,
6554};
6555pub const IPV6 = switch (native_os) {
6556 .linux => linux.IPV6,
6557 .freebsd => freebsd.IPV6,
6558 .dragonfly => dragonfly.IPV6,
6559 .netbsd => netbsd.IPV6,
6560 .openbsd => openbsd.IPV6,
6561 .solaris, .illumos => solaris.IPV6,
6562 .haiku => haiku.IPV6,
6563 .serenity => serenity.IPV6,
6564 else => void,
6565};
6566pub const IPTOS = switch (native_os) {
6567 .linux => linux.IPTOS,
6568 .freebsd => freebsd.IPTOS,
6569 .dragonfly => dragonfly.IPTOS,
6570 .netbsd => netbsd.IPTOS,
6571 .openbsd => openbsd.IPTOS,
6572 .solaris, .illumos => solaris.IPTOS,
6573 .haiku => haiku.IPTOS,
6574 .serenity => serenity.IPTOS,
6575 else => void,
6576};
6473pub const SOL = switch (native_os) {6577pub const SOL = switch (native_os) {
6474 .linux => linux.SOL,6578 .linux => linux.SOL,
6475 .emscripten => emscripten.SOL,6579 .emscripten => emscripten.SOL,
...@@ -6741,6 +6845,62 @@ pub const SOMAXCONN = switch (native_os) {...@@ -6741,6 +6845,62 @@ pub const SOMAXCONN = switch (native_os) {
6741 .freebsd, .dragonfly, .netbsd, .openbsd, .driverkit, .macos, .ios, .tvos, .watchos, .visionos => 128,6845 .freebsd, .dragonfly, .netbsd, .openbsd, .driverkit, .macos, .ios, .tvos, .watchos, .visionos => 128,
6742 else => void,6846 else => void,
6743};6847};
6848pub const SCM = switch (native_os) {
6849 .linux, .emscripten => linux.SCM,
6850 // https://github.com/kofemann/opensolaris/blob/80192cd83bf665e708269dae856f9145f7190f74/usr/src/uts/common/sys/socket.h#L172
6851 // https://github.com/illumos/illumos-gate/blob/489f6310fe8952e87fc1dce8af87990fcfd90f18/usr/src/uts/common/sys/socket.h#L196
6852 .solaris, .illumos => struct {
6853 pub const RIGHTS = 0x1010;
6854 pub const UCRED = 0x1012;
6855 pub const TIMESTAMP = SO.TIMESTAMP;
6856 },
6857 // https://github.com/haiku/haiku/blob/e3d01e53a25446d5ba4999d0ff6dff29a2418657/headers/posix/sys/socket.h#L156
6858 .haiku => struct {
6859 pub const RIGHTS = 1;
6860 },
6861 // https://github.com/SerenityOS/serenity/blob/c6618f36bf0949bd76177f202659b1f3079e0792/Kernel/API/POSIX/sys/socket.h#L171
6862 .serenity => struct {
6863 pub const TIMESTAMP = 0;
6864 pub const RIGHTS = 1;
6865 },
6866 // https://github.com/freebsd/freebsd-src/blob/614e9b33bf5594d9d09b5d296afa4f3aa6971823/sys/sys/socket.h#L593
6867 .freebsd => struct {
6868 pub const RIGHTS = 1;
6869 pub const TIMESTAMP = 2;
6870 pub const CREDS = 3;
6871 pub const BINTIME = 4;
6872 pub const REALTIME = 5;
6873 pub const MONOTONIC = 6;
6874 pub const TIME_INFO = 7;
6875 pub const CREDS2 = 8;
6876 },
6877 // https://github.com/DragonFlyBSD/DragonFlyBSD/blob/6098912863ed4c7b3f70d7483910ce2956cf4ed3/sys/sys/socket.h#L520
6878 .dragonfly => struct {
6879 pub const RIGHTS = 1;
6880 pub const TIMESTAMP = 2;
6881 pub const CREDS = 3;
6882 },
6883 // https://github.com/NetBSD/src/blob/3311177ea898ab8322292ba0e48faa9b2e834cb6/sys/sys/socket.h#L578
6884 .netbsd => struct {
6885 pub const RIGHTS = 0x01;
6886 pub const TIMESTAMP = 0x08;
6887 pub const CREDS = 0x10;
6888 },
6889 // https://github.com/openbsd/src/blob/1b1dd04c9634112eb763374379af99a68ace4328/sys/sys/socket.h#L566
6890 .openbsd => struct {
6891 pub const RIGHTS = 0x01;
6892 pub const TIMESTAMP = 0x04;
6893 },
6894 // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/socket.h#L1114
6895 .driverkit, .macos, .ios, .tvos, .watchos, .visionos => struct {
6896 pub const RIGHTS = 1;
6897 pub const TIMESTAMP = 2;
6898 pub const CREDS = 3;
6899 pub const TIMESTAMP_MONOTONIC = 4;
6900 },
6901 else => void,
6902};
6903
6744pub const IFNAMESIZE = switch (native_os) {6904pub const IFNAMESIZE = switch (native_os) {
6745 .linux => linux.IFNAMESIZE,6905 .linux => linux.IFNAMESIZE,
6746 .emscripten => emscripten.IFNAMESIZE,6906 .emscripten => emscripten.IFNAMESIZE,
...@@ -11064,7 +11224,6 @@ pub const GETUSTACK = solaris.GETUSTACK;...@@ -11064,7 +11224,6 @@ pub const GETUSTACK = solaris.GETUSTACK;
11064pub const PORT_ALERT = solaris.PORT_ALERT;11224pub const PORT_ALERT = solaris.PORT_ALERT;
11065pub const PORT_SOURCE = solaris.PORT_SOURCE;11225pub const PORT_SOURCE = solaris.PORT_SOURCE;
11066pub const POSIX_FADV = solaris.POSIX_FADV;11226pub const POSIX_FADV = solaris.POSIX_FADV;
11067pub const SCM = solaris.SCM;
11068pub const SETCONTEXT = solaris.SETCONTEXT;11227pub const SETCONTEXT = solaris.SETCONTEXT;
11069pub const SETUSTACK = solaris.GETUSTACK;11228pub const SETUSTACK = solaris.GETUSTACK;
11070pub const SFD = solaris.SFD;11229pub const SFD = solaris.SFD;
lib/std/c/darwin.zig+162
...@@ -1723,3 +1723,165 @@ pub const MSG = struct {...@@ -1723,3 +1723,165 @@ pub const MSG = struct {
1723 /// Inherit upcall in sock_accept1723 /// Inherit upcall in sock_accept
1724 pub const USEUPCALL = 0x80000000;1724 pub const USEUPCALL = 0x80000000;
1725};1725};
1726
1727// https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/netinet/in.h#L454
1728pub const IP = struct {
1729 pub const OPTIONS = 1;
1730 pub const HDRINCL = 2;
1731 pub const TOS = 3;
1732 pub const TTL = 4;
1733 pub const RECVOPTS = 5;
1734 pub const RECVRETOPTS = 6;
1735 pub const RECVDSTADDR = 7;
1736 pub const RETOPTS = 8;
1737 pub const MULTICAST_IF = 9;
1738 pub const MULTICAST_TTL = 10;
1739 pub const MULTICAST_LOOP = 11;
1740 pub const ADD_MEMBERSHIP = 12;
1741 pub const DROP_MEMBERSHIP = 13;
1742 pub const MULTICAST_VIF = 14;
1743 pub const RSVP_ON = 15;
1744 pub const RSVP_OFF = 16;
1745 pub const RSVP_VIF_ON = 17;
1746 pub const RSVP_VIF_OFF = 18;
1747 pub const PORTRANGE = 19;
1748 pub const RECVIF = 20;
1749 pub const IPSEC_POLICY = 21;
1750 pub const FAITH = 22;
1751 pub const STRIPHDR = 23;
1752 pub const RECVTTL = 24;
1753 pub const BOUND_IF = 25;
1754 pub const PKTINFO = 26;
1755 pub const RECVPKTINFO = PKTINFO;
1756 pub const RECVTOS = 27;
1757 pub const DONTFRAG = 28;
1758 pub const FW_ADD = 40;
1759 pub const FW_DEL = 41;
1760 pub const FW_FLUSH = 42;
1761 pub const FW_ZERO = 43;
1762 pub const FW_GET = 44;
1763 pub const FW_RESETLOG = 45;
1764 pub const OLD_FW_ADD = 50;
1765 pub const OLD_FW_DEL = 51;
1766 pub const OLD_FW_FLUSH = 52;
1767 pub const OLD_FW_ZERO = 53;
1768 pub const OLD_FW_GET = 54;
1769 pub const OLD_FW_RESETLOG = 56;
1770 pub const DUMMYNET_CONFIGURE = 60;
1771 pub const DUMMYNET_DEL = 61;
1772 pub const DUMMYNET_FLUSH = 62;
1773 pub const DUMMYNET_GET = 64;
1774 pub const TRAFFIC_MGT_BACKGROUND = 65;
1775 pub const MULTICAST_IFINDEX = 66;
1776 pub const ADD_SOURCE_MEMBERSHIP = 70;
1777 pub const DROP_SOURCE_MEMBERSHIP = 71;
1778 pub const BLOCK_SOURCE = 72;
1779 pub const UNBLOCK_SOURCE = 73;
1780 pub const MSFILTER = 74;
1781 // Same namespace, but these are arguments rather than option names
1782 pub const DEFAULT_MULTICAST_TTL = 1;
1783 pub const DEFAULT_MULTICAST_LOOP = 1;
1784 pub const MIN_MEMBERSHIPS = 31;
1785 pub const MAX_MEMBERSHIPS = 4095;
1786 pub const MAX_GROUP_SRC_FILTER = 512;
1787 pub const MAX_SOCK_SRC_FILTER = 128;
1788 pub const MAX_SOCK_MUTE_FILTER = 128;
1789 pub const PORTRANGE_DEFAULT = 0;
1790 pub const PORTRANGE_HIGH = 1;
1791 pub const PORTRANGE_LOW = 2;
1792};
1793
1794// https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/netinet6/in6.h#L521
1795pub const IPV6 = struct {
1796 pub const UNICAST_HOPS = 4;
1797 pub const MULTICAST_IF = 9;
1798 pub const MULTICAST_HOPS = 10;
1799 pub const MULTICAST_LOOP = 11;
1800 pub const JOIN_GROUP = 12;
1801 pub const LEAVE_GROUP = 13;
1802 pub const PORTRANGE = 14;
1803 pub const @"2292PKTINFO" = 19;
1804 pub const @"2292HOPLIMIT" = 20;
1805 pub const @"2292NEXTHOP" = 21;
1806 pub const @"2292HOPOPTS" = 22;
1807 pub const @"2292DSTOPTS" = 23;
1808 pub const @"2292RTHDR" = 24;
1809 pub const @"2292PKTOPTIONS" = 25;
1810 pub const CHECKSUM = 26;
1811 pub const V6ONLY = 27;
1812 pub const BINDV6ONLY = V6ONLY;
1813 pub const IPSEC_POLICY = 28;
1814 pub const FAITH = 29;
1815 pub const FW_ADD = 30;
1816 pub const FW_DEL = 31;
1817 pub const FW_FLUSH = 32;
1818 pub const FW_ZERO = 33;
1819 pub const FW_GET = 34;
1820 pub const RECVTCLASS = 35;
1821 pub const TCLASS = 36;
1822 pub const RTHDRDSTOPTS = 57;
1823 pub const RECVPKTINFO = 61;
1824 pub const RECVHOPLIMIT = 37;
1825 pub const RECVRTHDR = 38;
1826 pub const RECVHOPOPTS = 39;
1827 pub const RECVDSTOPTS = 40;
1828 pub const RECVRTHDRDSTOPTS = 41;
1829 pub const USE_MIN_MTU = 42;
1830 pub const RECVPATHMTU = 43;
1831 pub const PATHMTU = 44;
1832 pub const REACHCONF = 45;
1833 pub const @"3542PKTINFO" = 46;
1834 pub const @"3542HOPLIMIT" = 47;
1835 pub const @"3542NEXTHOP" = 48;
1836 pub const @"3542HOPOPTS" = 49;
1837 pub const @"3542DSTOPTS" = 50;
1838 pub const @"3542RTHDR" = 51;
1839 pub const PKTINFO = @"3542PKTINFO";
1840 pub const HOPLIMIT = @"3542HOPLIMIT";
1841 pub const NEXTHOP = @"3542NEXTHOP";
1842 pub const HOPOPTS = @"3542HOPOPTS";
1843 pub const DSTOPTS = @"3542DSTOPTS";
1844 pub const RTHDR = @"3542RTHDR";
1845 pub const AUTOFLOWLABEL = 59;
1846 pub const DONTFRAG = 62;
1847 pub const PREFER_TEMPADDR = 63;
1848 pub const MSFILTER = 74;
1849 pub const BOUND_IF = 125;
1850 // Same namespace, but these are arguments rather than option names
1851 pub const RTHDR_LOOSE = 0;
1852 pub const RTHDR_STRICT = 1;
1853 pub const RTHDR_TYPE_0 = 0;
1854 pub const DEFAULT_MULTICAST_HOPS = 1;
1855 pub const DEFAULT_MULTICAST_LOOP = 1;
1856 pub const MIN_MEMBERSHIPS = 31;
1857 pub const MAX_MEMBERSHIPS = 4095;
1858 pub const MAX_GROUP_SRC_FILTER = 512;
1859 pub const MAX_SOCK_SRC_FILTER = 128;
1860 pub const PORTRANGE_DEFAULT = 0;
1861 pub const PORTRANGE_HIGH = 1;
1862 pub const PORTRANGE_LOW = 2;
1863};
1864
1865// https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/netinet/ip.h#L129
1866pub const IPTOS = struct {
1867 pub const LOWDELAY = 0x10;
1868 pub const THROUGHPUT = 0x08;
1869 pub const RELIABILITY = 0x04;
1870 pub const MINCOST = 0x02;
1871 pub const CE = 0x01;
1872 pub const ECT = 0x02;
1873 pub const DSCP_SHIFT = 2;
1874 pub const ECN_NOTECT = 0x00;
1875 pub const ECN_ECT1 = 0x01;
1876 pub const ECN_ECT0 = 0x02;
1877 pub const ECN_CE = 0x03;
1878 pub const ECN_MASK = 0x03;
1879 pub const PREC_NETCONTROL = 0xe0;
1880 pub const PREC_INTERNETCONTROL = 0xc0;
1881 pub const PREC_CRITIC_ECP = 0xa0;
1882 pub const PREC_FLASHOVERRIDE = 0x80;
1883 pub const PREC_FLASH = 0x60;
1884 pub const PREC_IMMEDIATE = 0x40;
1885 pub const PREC_PRIORITY = 0x20;
1886 pub const PREC_ROUTINE = 0x00;
1887};
lib/std/c/dragonfly.zig+158
...@@ -184,3 +184,161 @@ pub const POSIX_MADV_RANDOM = 1;...@@ -184,3 +184,161 @@ pub const POSIX_MADV_RANDOM = 1;
184pub const POSIX_MADV_DONTNEED = 4;184pub const POSIX_MADV_DONTNEED = 4;
185pub const POSIX_MADV_NORMAL = 0;185pub const POSIX_MADV_NORMAL = 0;
186pub const POSIX_MADV_WILLNEED = 3;186pub const POSIX_MADV_WILLNEED = 3;
187
188// https://github.com/DragonFlyBSD/DragonFlyBSD/blob/6098912863ed4c7b3f70d7483910ce2956cf4ed3/sys/netinet/ip.h#L94
189pub const IP = struct {
190 pub const OPTIONS = 1;
191 pub const HDRINCL = 2;
192 pub const TOS = 3;
193 pub const TTL = 4;
194 pub const RECVOPTS = 5;
195 pub const RECVRETOPTS = 6;
196 pub const RECVDSTADDR = 7;
197 pub const SENDSRCADDR = RECVDSTADDR;
198 pub const RETOPTS = 8;
199 pub const MULTICAST_IF = 9;
200 pub const MULTICAST_TTL = 10;
201 pub const MULTICAST_LOOP = 11;
202 pub const ADD_MEMBERSHIP = 12;
203 pub const DROP_MEMBERSHIP = 13;
204 pub const MULTICAST_VIF = 14;
205 pub const RSVP_ON = 15;
206 pub const RSVP_OFF = 16;
207 pub const RSVP_VIF_ON = 17;
208 pub const RSVP_VIF_OFF = 18;
209 pub const PORTRANGE = 19;
210 pub const RECVIF = 20;
211 pub const FW_TBL_CREATE = 40;
212 pub const FW_TBL_DESTROY = 41;
213 pub const FW_TBL_ADD = 42;
214 pub const FW_TBL_DEL = 43;
215 pub const FW_TBL_FLUSH = 44;
216 pub const FW_TBL_GET = 45;
217 pub const FW_TBL_ZERO = 46;
218 pub const FW_TBL_EXPIRE = 47;
219 pub const FW_X = 49;
220 pub const FW_ADD = 50;
221 pub const FW_DEL = 51;
222 pub const FW_FLUSH = 52;
223 pub const FW_ZERO = 53;
224 pub const FW_GET = 54;
225 pub const FW_RESETLOG = 55;
226 pub const DUMMYNET_CONFIGURE = 60;
227 pub const DUMMYNET_DEL = 61;
228 pub const DUMMYNET_FLUSH = 62;
229 pub const DUMMYNET_GET = 64;
230 pub const RECVTTL = 65;
231 pub const MINTTL = 66;
232 pub const RECVTOS = 68;
233 // Same namespace, but these are arguments rather than option names
234 pub const DEFAULT_MULTICAST_TTL = 1;
235 pub const DEFAULT_MULTICAST_LOOP = 1;
236 pub const MAX_MEMBERSHIPS = 20;
237 pub const PORTRANGE_DEFAULT = 0;
238 pub const PORTRANGE_HIGH = 1;
239 pub const PORTRANGE_LOW = 2;
240};
241
242// https://github.com/DragonFlyBSD/DragonFlyBSD/blob/6098912863ed4c7b3f70d7483910ce2956cf4ed3/sys/netinet6/in6.h#L448
243pub const IPV6 = struct {
244 pub const UNICAST_HOPS = 4;
245 pub const MULTICAST_IF = 9;
246 pub const MULTICAST_HOPS = 10;
247 pub const MULTICAST_LOOP = 11;
248 pub const JOIN_GROUP = 12;
249 pub const LEAVE_GROUP = 13;
250 pub const PORTRANGE = 14;
251 pub const @"2292PKTINFO" = 19;
252 pub const @"2292HOPLIMIT" = 20;
253 pub const @"2292NEXTHOP" = 21;
254 pub const @"2292HOPOPTS" = 22;
255 pub const @"2292DSTOPTS" = 23;
256 pub const @"2292RTHDR" = 24;
257 pub const @"2292PKTOPTIONS" = 25;
258 pub const CHECKSUM = 26;
259 pub const V6ONLY = 27;
260 pub const BINDV6ONLY = V6ONLY;
261 pub const FW_ADD = 30;
262 pub const FW_DEL = 31;
263 pub const FW_FLUSH = 32;
264 pub const FW_ZERO = 33;
265 pub const FW_GET = 34;
266 pub const RTHDRDSTOPTS = 35;
267 pub const RECVPKTINFO = 36;
268 pub const RECVHOPLIMIT = 37;
269 pub const RECVRTHDR = 38;
270 pub const RECVHOPOPTS = 39;
271 pub const RECVDSTOPTS = 40;
272 pub const RECVRTHDRDSTOPTS = 41;
273 pub const USE_MIN_MTU = 42;
274 pub const RECVPATHMTU = 43;
275 pub const PATHMTU = 44;
276 pub const REACHCONF = 45;
277 pub const PKTINFO = 46;
278 pub const HOPLIMIT = 47;
279 pub const NEXTHOP = 48;
280 pub const HOPOPTS = 49;
281 pub const DSTOPTS = 50;
282 pub const RTHDR = 51;
283 pub const PKTOPTIONS = 52;
284 pub const RECVTCLASS = 57;
285 pub const AUTOFLOWLABEL = 59;
286 pub const TCLASS = 61;
287 pub const DONTFRAG = 62;
288 pub const PREFER_TEMPADDR = 63;
289 pub const MSFILTER = 74;
290 // Same namespace, but these are arguments rather than option names
291 pub const RTHDR_LOOSE = 0;
292 pub const RTHDR_STRICT = 1;
293 pub const RTHDR_TYPE_0 = 0;
294 pub const DEFAULT_MULTICAST_HOPS = 1;
295 pub const DEFAULT_MULTICAST_LOOP = 1;
296 pub const PORTRANGE_DEFAULT = 0;
297 pub const PORTRANGE_HIGH = 1;
298 pub const PORTRANGE_LOW = 2;
299};
300
301// https://github.com/DragonFlyBSD/DragonFlyBSD/blob/6098912863ed4c7b3f70d7483910ce2956cf4ed3/sys/netinet/ip.h#L94
302pub const IPTOS = struct {
303 pub const LOWDELAY = 0x10;
304 pub const THROUGHPUT = 0x08;
305 pub const RELIABILITY = 0x04;
306 pub const MINCOST = 0x02;
307 pub const CE = 0x01;
308 pub const ECT = 0x02;
309 pub const PREC_ROUTINE = DSCP_CS0;
310 pub const PREC_PRIORITY = DSCP_CS1;
311 pub const PREC_IMMEDIATE = DSCP_CS2;
312 pub const PREC_FLASH = DSCP_CS3;
313 pub const PREC_FLASHOVERRIDE = DSCP_CS4;
314 pub const PREC_CRITIC_ECP = DSCP_CS5;
315 pub const PREC_INTERNETCONTROL = DSCP_CS6;
316 pub const PREC_NETCONTROL = DSCP_CS7;
317 pub const DSCP_CS0 = 0x00;
318 pub const DSCP_CS1 = 0x20;
319 pub const DSCP_AF11 = 0x28;
320 pub const DSCP_AF12 = 0x30;
321 pub const DSCP_AF13 = 0x38;
322 pub const DSCP_CS2 = 0x40;
323 pub const DSCP_AF21 = 0x48;
324 pub const DSCP_AF22 = 0x50;
325 pub const DSCP_AF23 = 0x58;
326 pub const DSCP_CS3 = 0x60;
327 pub const DSCP_AF31 = 0x68;
328 pub const DSCP_AF32 = 0x70;
329 pub const DSCP_AF33 = 0x78;
330 pub const DSCP_CS4 = 0x80;
331 pub const DSCP_AF41 = 0x88;
332 pub const DSCP_AF42 = 0x90;
333 pub const DSCP_AF43 = 0x98;
334 pub const DSCP_CS5 = 0xa0;
335 pub const DSCP_VA = 0xb0;
336 pub const DSCP_EF = 0xb8;
337 pub const DSCP_CS6 = 0xc0;
338 pub const DSCP_CS7 = 0xe0;
339 pub const ECN_NOTECT = 0x00;
340 pub const ECN_ECT1 = 0x01;
341 pub const ECN_ECT0 = 0x02;
342 pub const ECN_CE = 0x03;
343 pub const ECN_MASK = 0x03;
344};
lib/std/c/freebsd.zig+192
...@@ -394,3 +394,195 @@ pub const E = enum(u16) {...@@ -394,3 +394,195 @@ pub const E = enum(u16) {
394 INTEGRITY = 97, // Integrity check failed394 INTEGRITY = 97, // Integrity check failed
395 _,395 _,
396};396};
397
398// https://github.com/freebsd/freebsd-src/blob/9bfbc6826f72eb385bf52f4cde8080bccf7e3ebd/sys/netinet/in.h#L436
399pub const IP = struct {
400 pub const OPTIONS = 1;
401 pub const HDRINCL = 2;
402 pub const TOS = 3;
403 pub const TTL = 4;
404 pub const RECVOPTS = 5;
405 pub const RECVRETOPTS = 6;
406 pub const RECVDSTADDR = 7;
407 pub const SENDSRCADDR = RECVDSTADDR;
408 pub const RETOPTS = 8;
409 pub const MULTICAST_IF = 9;
410 pub const MULTICAST_TTL = 10;
411 pub const MULTICAST_LOOP = 11;
412 pub const ADD_MEMBERSHIP = 12;
413 pub const DROP_MEMBERSHIP = 13;
414 pub const MULTICAST_VIF = 14;
415 pub const RSVP_ON = 15;
416 pub const RSVP_OFF = 16;
417 pub const RSVP_VIF_ON = 17;
418 pub const RSVP_VIF_OFF = 18;
419 pub const PORTRANGE = 19;
420 pub const RECVIF = 20;
421 pub const IPSEC_POLICY = 21;
422 pub const ONESBCAST = 23;
423 pub const BINDANY = 24;
424 pub const ORIGDSTADDR = 27;
425 pub const RECVORIGDSTADDR = ORIGDSTADDR;
426 pub const FW_TABLE_ADD = 40;
427 pub const FW_TABLE_DEL = 41;
428 pub const FW_TABLE_FLUSH = 42;
429 pub const FW_TABLE_GETSIZE = 43;
430 pub const FW_TABLE_LIST = 44;
431 pub const FW3 = 48;
432 pub const DUMMYNET3 = 49;
433 pub const FW_ADD = 50;
434 pub const FW_DEL = 51;
435 pub const FW_FLUSH = 52;
436 pub const FW_ZERO = 53;
437 pub const FW_GET = 54;
438 pub const FW_RESETLOG = 55;
439 pub const FW_NAT_CFG = 56;
440 pub const FW_NAT_DEL = 57;
441 pub const FW_NAT_GET_CONFIG = 58;
442 pub const FW_NAT_GET_LOG = 59;
443 pub const DUMMYNET_CONFIGURE = 60;
444 pub const DUMMYNET_DEL = 61;
445 pub const DUMMYNET_FLUSH = 62;
446 pub const DUMMYNET_GET = 64;
447 pub const RECVTTL = 65;
448 pub const MINTTL = 66;
449 pub const DONTFRAG = 67;
450 pub const RECVTOS = 68;
451 pub const ADD_SOURCE_MEMBERSHIP = 70;
452 pub const DROP_SOURCE_MEMBERSHIP = 71;
453 pub const BLOCK_SOURCE = 72;
454 pub const UNBLOCK_SOURCE = 73;
455 pub const MSFILTER = 74;
456 pub const VLAN_PCP = 75;
457 pub const FLOWID = 90;
458 pub const FLOWTYPE = 91;
459 pub const RSSBUCKETID = 92;
460 pub const RECVFLOWID = 93;
461 pub const RECVRSSBUCKETID = 94;
462 // Same namespace, but these are arguments rather than option names
463 pub const DEFAULT_MULTICAST_TTL = 1;
464 pub const DEFAULT_MULTICAST_LOOP = 1;
465 pub const MAX_MEMBERSHIPS = 4095;
466 pub const MAX_GROUP_SRC_FILTER = 512;
467 pub const MAX_SOCK_SRC_FILTER = 128;
468 pub const MAX_SOCK_MUTE_FILTER = 128;
469 pub const PORTRANGE_DEFAULT = 0;
470 pub const PORTRANGE_HIGH = 1;
471 pub const PORTRANGE_LOW = 2;
472};
473
474// https://github.com/freebsd/freebsd-src/blob/9bfbc6826f72eb385bf52f4cde8080bccf7e3ebd/sys/netinet6/in6.h#L402
475pub const IPV6 = struct {
476 pub const UNICAST_HOPS = 4;
477 pub const MULTICAST_IF = 9;
478 pub const MULTICAST_HOPS = 10;
479 pub const MULTICAST_LOOP = 11;
480 pub const JOIN_GROUP = 12;
481 pub const LEAVE_GROUP = 13;
482 pub const PORTRANGE = 14;
483 pub const @"2292PKTINFO" = 19;
484 pub const @"2292HOPLIMIT" = 20;
485 pub const @"2292NEXTHOP" = 21;
486 pub const @"2292HOPOPTS" = 22;
487 pub const @"2292DSTOPTS" = 23;
488 pub const @"2292RTHDR" = 24;
489 pub const @"2292PKTOPTIONS" = 25;
490 pub const CHECKSUM = 26;
491 pub const V6ONLY = 27;
492 pub const BINDV6ONLY = V6ONLY;
493 pub const IPSEC_POLICY = 28;
494 pub const FW_ADD = 30;
495 pub const FW_DEL = 31;
496 pub const FW_FLUSH = 32;
497 pub const FW_ZERO = 33;
498 pub const FW_GET = 34;
499 pub const RTHDRDSTOPTS = 35;
500 pub const RECVPKTINFO = 36;
501 pub const RECVHOPLIMIT = 37;
502 pub const RECVRTHDR = 38;
503 pub const RECVHOPOPTS = 39;
504 pub const RECVDSTOPTS = 40;
505 pub const RECVRTHDRDSTOPTS = 41;
506 pub const USE_MIN_MTU = 42;
507 pub const RECVPATHMTU = 43;
508 pub const PATHMTU = 44;
509 pub const REACHCONF = 45;
510 pub const PKTINFO = 46;
511 pub const HOPLIMIT = 47;
512 pub const NEXTHOP = 48;
513 pub const HOPOPTS = 49;
514 pub const DSTOPTS = 50;
515 pub const RTHDR = 51;
516 pub const PKTOPTIONS = 52;
517 pub const RECVTCLASS = 57;
518 pub const AUTOFLOWLABEL = 59;
519 pub const TCLASS = 61;
520 pub const DONTFRAG = 62;
521 pub const PREFER_TEMPADDR = 63;
522 pub const BINDANY = 64;
523 pub const FLOWID = 67;
524 pub const FLOWTYPE = 68;
525 pub const RSSBUCKETID = 69;
526 pub const RECVFLOWID = 70;
527 pub const RECVRSSBUCKETID = 71;
528 pub const ORIGDSTADDR = 72;
529 pub const RECVORIGDSTADDR = ORIGDSTADDR;
530 pub const MSFILTER = 74;
531 pub const VLAN_PCP = 75;
532 // Same namespace, but these are arguments rather than option names
533 pub const RTHDR_LOOSE = 0;
534 pub const RTHDR_STRICT = 1;
535 pub const RTHDR_TYPE_0 = 0;
536 pub const DEFAULT_MULTICAST_HOPS = 1;
537 pub const DEFAULT_MULTICAST_LOOP = 1;
538 pub const MAX_MEMBERSHIPS = 4095;
539 pub const MAX_GROUP_SRC_FILTER = 512;
540 pub const MAX_SOCK_SRC_FILTER = 128;
541 pub const PORTRANGE_DEFAULT = 0;
542 pub const PORTRANGE_HIGH = 1;
543 pub const PORTRANGE_LOW = 2;
544};
545
546// https://github.com/freebsd/freebsd-src/blob/9bfbc6826f72eb385bf52f4cde8080bccf7e3ebd/sys/netinet/ip.h#L77
547pub const IPTOS = struct {
548 pub const LOWDELAY = 0x10;
549 pub const THROUGHPUT = 0x08;
550 pub const RELIABILITY = 0x04;
551 pub const MINCOST = DSCP_CS0;
552 pub const PREC_ROUTINE = DSCP_CS0;
553 pub const PREC_PRIORITY = DSCP_CS1;
554 pub const PREC_IMMEDIATE = DSCP_CS2;
555 pub const PREC_FLASH = DSCP_CS3;
556 pub const PREC_FLASHOVERRIDE = DSCP_CS4;
557 pub const PREC_CRITIC_ECP = DSCP_CS5;
558 pub const PREC_INTERNETCONTROL = DSCP_CS6;
559 pub const PREC_NETCONTROL = DSCP_CS7;
560 pub const DSCP_OFFSET = 2;
561 pub const DSCP_CS0 = 0x00;
562 pub const DSCP_CS1 = 0x20;
563 pub const DSCP_AF11 = 0x28;
564 pub const DSCP_AF12 = 0x30;
565 pub const DSCP_AF13 = 0x38;
566 pub const DSCP_CS2 = 0x40;
567 pub const DSCP_AF21 = 0x48;
568 pub const DSCP_AF22 = 0x50;
569 pub const DSCP_AF23 = 0x58;
570 pub const DSCP_CS3 = 0x60;
571 pub const DSCP_AF31 = 0x68;
572 pub const DSCP_AF32 = 0x70;
573 pub const DSCP_AF33 = 0x78;
574 pub const DSCP_CS4 = 0x80;
575 pub const DSCP_AF41 = 0x88;
576 pub const DSCP_AF42 = 0x90;
577 pub const DSCP_AF43 = 0x98;
578 pub const DSCP_CS5 = 0xa0;
579 pub const DSCP_VA = 0xb0;
580 pub const DSCP_EF = 0xb8;
581 pub const DSCP_CS6 = 0xc0;
582 pub const DSCP_CS7 = 0xe0;
583 pub const ECN_NOTECT = 0x00;
584 pub const ECN_ECT1 = 0x01;
585 pub const ECN_ECT0 = 0x02;
586 pub const ECN_CE = 0x03;
587 pub const ECN_MASK = 0x03;
588};
lib/std/c/haiku.zig+47
...@@ -553,3 +553,50 @@ pub const DirEnt = extern struct {...@@ -553,3 +553,50 @@ pub const DirEnt = extern struct {
553 return @ptrCast(&dirent.name);553 return @ptrCast(&dirent.name);
554 }554 }
555};555};
556
557// https://github.com/haiku/haiku/blob/2aab5f5f14aeb3f34c3a3d9a9064cc3c0d914bea/headers/posix/netinet/in.h#L122
558pub const IP = struct {
559 pub const OPTIONS = 1;
560 pub const HDRINCL = 2;
561 pub const TOS = 3;
562 pub const TTL = 4;
563 pub const RECVOPTS = 5;
564 pub const RECVRETOPTS = 6;
565 pub const RECVDSTADDR = 7;
566 pub const RETOPTS = 8;
567 pub const MULTICAST_IF = 9;
568 pub const MULTICAST_TTL = 10;
569 pub const MULTICAST_LOOP = 11;
570 pub const ADD_MEMBERSHIP = 12;
571 pub const DROP_MEMBERSHIP = 13;
572 pub const BLOCK_SOURCE = 14;
573 pub const UNBLOCK_SOURCE = 15;
574 pub const ADD_SOURCE_MEMBERSHIP = 16;
575 pub const DROP_SOURCE_MEMBERSHIP = 17;
576 pub const DONTFRAG = 38;
577};
578
579// https://github.com/haiku/haiku/blob/2aab5f5f14aeb3f34c3a3d9a9064cc3c0d914bea/headers/posix/netinet/in.h#L150
580pub const IPV6 = struct {
581 pub const MULTICAST_IF = 24;
582 pub const MULTICAST_HOPS = 25;
583 pub const MULTICAST_LOOP = 26;
584 pub const UNICAST_HOPS = 27;
585 pub const JOIN_GROUP = 28;
586 pub const LEAVE_GROUP = 29;
587 pub const V6ONLY = 30;
588 pub const PKTINFO = 31;
589 pub const RECVPKTINFO = 32;
590 pub const HOPLIMIT = 33;
591 pub const RECVHOPLIMIT = 34;
592 pub const HOPOPTS = 35;
593 pub const DSTOPTS = 36;
594 pub const RTHDR = 37;
595};
596
597// https://github.com/haiku/haiku/blob/2aab5f5f14aeb3f34c3a3d9a9064cc3c0d914bea/headers/posix/netinet/ip.h#L36
598pub const IPTOS = struct {
599 pub const RELIABILITY = 0x04;
600 pub const THROUGHPUT = 0x08;
601 pub const LOWDELAY = 0x10;
602};
lib/std/c/netbsd.zig+152
...@@ -203,3 +203,155 @@ pub const E = enum(u16) {...@@ -203,3 +203,155 @@ pub const E = enum(u16) {
203203
204 _,204 _,
205};205};
206
207// https://github.com/NetBSD/src/blob/80bf25a5691072d4755e84567ccbdf0729370dea/sys/netinet/in.h#L276
208pub const IP = struct {
209 pub const OPTIONS = 1;
210 pub const HDRINCL = 2;
211 pub const TOS = 3;
212 pub const TTL = 4;
213 pub const RECVOPTS = 5;
214 pub const RECVRETOPTS = 6;
215 pub const RECVDSTADDR = 7;
216 pub const RETOPTS = 8;
217 pub const MULTICAST_IF = 9;
218 pub const MULTICAST_TTL = 10;
219 pub const MULTICAST_LOOP = 11;
220 pub const ADD_MEMBERSHIP = 12;
221 pub const DROP_MEMBERSHIP = 13;
222 pub const PORTALGO = 18;
223 pub const PORTRANGE = 19;
224 pub const RECVIF = 20;
225 pub const ERRORMTU = 21;
226 pub const IPSEC_POLICY = 22;
227 pub const RECVTTL = 23;
228 pub const MINTTL = 24;
229 pub const PKTINFO = 25;
230 pub const RECVPKTINFO = 26;
231 pub const BINDANY = 27;
232 pub const SENDSRCADDR = RECVDSTADDR;
233 pub const DEFAULT_MULTICAST_TTL = 1;
234 pub const DEFAULT_MULTICAST_LOOP = 1;
235 pub const MAX_MEMBERSHIPS = 20;
236 pub const PORTRANGE_DEFAULT = 0;
237 pub const PORTRANGE_HIGH = 1;
238 pub const PORTRANGE_LOW = 2;
239};
240
241// https://github.com/NetBSD/src/blob/80bf25a5691072d4755e84567ccbdf0729370dea/sys/netinet6/in6.h#L370
242pub const IPV6 = struct {
243 pub const UNICAST_HOPS = 4;
244 pub const MULTICAST_IF = 9;
245 pub const MULTICAST_HOPS = 10;
246 pub const MULTICAST_LOOP = 11;
247 pub const JOIN_GROUP = 12;
248 pub const LEAVE_GROUP = 13;
249 pub const PORTRANGE = 14;
250 pub const PORTALGO = 17;
251 pub const @"2292PKTINFO" = 19;
252 pub const @"2292HOPLIMIT" = 20;
253 pub const @"2292NEXTHOP" = 21;
254 pub const @"2292HOPOPTS" = 22;
255 pub const @"2292DSTOPTS" = 23;
256 pub const @"2292RTHDR" = 24;
257 pub const @"2292PKTOPTIONS" = 25;
258 pub const CHECKSUM = 26;
259 pub const V6ONLY = 27;
260 pub const IPSEC_POLICY = 28;
261 pub const FAITH = 29;
262 pub const RTHDRDSTOPTS = 35;
263 pub const RECVPKTINFO = 36;
264 pub const RECVHOPLIMIT = 37;
265 pub const RECVRTHDR = 38;
266 pub const RECVHOPOPTS = 39;
267 pub const RECVDSTOPTS = 40;
268 pub const RECVRTHDRDSTOPTS = 41;
269 pub const USE_MIN_MTU = 42;
270 pub const RECVPATHMTU = 43;
271 pub const PATHMTU = 44;
272 pub const PKTINFO = 46;
273 pub const HOPLIMIT = 47;
274 pub const NEXTHOP = 48;
275 pub const HOPOPTS = 49;
276 pub const DSTOPTS = 50;
277 pub const RTHDR = 51;
278 pub const RECVTCLASS = 57;
279 pub const OTCLASS = 58;
280 pub const TCLASS = 61;
281 pub const DONTFRAG = 62;
282 pub const PREFER_TEMPADDR = 63;
283 pub const BINDANY = 64;
284 pub const RTHDR_LOOSE = 0;
285 pub const RTHDR_STRICT = 1;
286 pub const RTHDR_TYPE_0 = 0;
287 pub const DEFAULT_MULTICAST_HOPS = 1;
288 pub const DEFAULT_MULTICAST_LOOP = 1;
289 pub const PORTRANGE_DEFAULT = 0;
290 pub const PORTRANGE_HIGH = 1;
291 pub const PORTRANGE_LOW = 2;
292};
293
294// https://github.com/NetBSD/src/blob/80bf25a5691072d4755e84567ccbdf0729370dea/sys/netinet/ip.h#L140
295pub const IPTOS = struct {
296 pub const DSCP_CS0 = 0x00;
297 pub const DSCP_CS1 = 0x20;
298 pub const DSCP_AF11 = 0x28;
299 pub const DSCP_AF12 = 0x30;
300 pub const DSCP_AF13 = 0x38;
301 pub const DSCP_CS2 = 0x40;
302 pub const DSCP_AF21 = 0x48;
303 pub const DSCP_AF22 = 0x50;
304 pub const DSCP_AF23 = 0x58;
305 pub const DSCP_CS3 = 0x60;
306 pub const DSCP_AF31 = 0x68;
307 pub const DSCP_AF32 = 0x70;
308 pub const DSCP_AF33 = 0x78;
309 pub const DSCP_CS4 = 0x80;
310 pub const DSCP_AF41 = 0x88;
311 pub const DSCP_AF42 = 0x90;
312 pub const DSCP_AF43 = 0x98;
313 pub const DSCP_CS5 = 0xa0;
314 pub const DSCP_EF = 0xb8;
315 pub const DSCP_CS6 = 0xc0;
316 pub const DSCP_CS7 = 0xe0;
317 pub const CLASS_CS0 = 0x00;
318 pub const CLASS_CS1 = 0x20;
319 pub const CLASS_CS2 = 0x40;
320 pub const CLASS_CS3 = 0x60;
321 pub const CLASS_CS4 = 0x80;
322 pub const CLASS_CS5 = 0xa0;
323 pub const CLASS_CS6 = 0xc0;
324 pub const CLASS_CS7 = 0xe0;
325 pub const CLASS_DEFAULT = CLASS_CS0;
326 pub const CLASS_MASK = 0xe0;
327 pub fn CLASS(t: anytype) @TypeOf(t) {
328 return t & CLASS_MASK;
329 }
330 pub const DSCP_MASK = 0xfc;
331 pub fn DSCP(t: anytype) @TypeOf(t) {
332 return t & DSCP_MASK;
333 }
334 pub const ECN_NOTECT = 0x00;
335 pub const ECN_ECT1 = 0x01;
336 pub const ECN_ECT0 = 0x02;
337 pub const ECN_CE = 0x03;
338 pub const ECN_MASK = 0x03;
339 pub fn ECN(t: anytype) @TypeOf(t) {
340 return t & ECN_MASK;
341 }
342 pub const ECN_NOT_ECT = 0x00;
343 pub const LOWDELAY = 0x10;
344 pub const THROUGHPUT = 0x08;
345 pub const RELIABILITY = 0x04;
346 pub const MINCOST = 0x02;
347 pub const CE = 0x01;
348 pub const ECT = 0x02;
349 pub const PREC_NETCONTROL = 0xe0;
350 pub const PREC_INTERNETCONTROL = 0xc0;
351 pub const PREC_CRITIC_ECP = 0xa0;
352 pub const PREC_FLASHOVERRIDE = 0x80;
353 pub const PREC_FLASH = 0x60;
354 pub const PREC_IMMEDIATE = 0x40;
355 pub const PREC_PRIORITY = 0x20;
356 pub const PREC_ROUTINE = 0x00;
357};
lib/std/c/openbsd.zig+136
...@@ -354,3 +354,139 @@ pub const PTHREAD_STACK_MIN = switch (builtin.cpu.arch) {...@@ -354,3 +354,139 @@ pub const PTHREAD_STACK_MIN = switch (builtin.cpu.arch) {
354 .mips64 => 1 << 14,354 .mips64 => 1 << 14,
355 else => 1 << 12,355 else => 1 << 12,
356};356};
357
358// https://github.com/openbsd/src/blob/718a31b40d39fc6064de6355eb144e74633133fc/sys/netinet/in.h#L283
359pub const IP = struct {
360 pub const OPTIONS = 1;
361 pub const HDRINCL = 2;
362 pub const TOS = 3;
363 pub const TTL = 4;
364 pub const RECVOPTS = 5;
365 pub const RECVRETOPTS = 6;
366 pub const RECVDSTADDR = 7;
367 pub const RETOPTS = 8;
368 pub const MULTICAST_IF = 9;
369 pub const MULTICAST_TTL = 10;
370 pub const MULTICAST_LOOP = 11;
371 pub const ADD_MEMBERSHIP = 12;
372 pub const DROP_MEMBERSHIP = 13;
373 pub const PORTRANGE = 19;
374 pub const AUTH_LEVEL = 20;
375 pub const ESP_TRANS_LEVEL = 21;
376 pub const ESP_NETWORK_LEVEL = 22;
377 pub const IPSEC_LOCAL_ID = 23;
378 pub const IPSEC_REMOTE_ID = 24;
379 pub const IPSEC_LOCAL_CRED = 25;
380 pub const IPSEC_REMOTE_CRED = 26;
381 pub const IPSEC_LOCAL_AUTH = 27;
382 pub const IPSEC_REMOTE_AUTH = 28;
383 pub const IPCOMP_LEVEL = 29;
384 pub const RECVIF = 30;
385 pub const RECVTTL = 31;
386 pub const MINTTL = 32;
387 pub const RECVDSTPORT = 33;
388 pub const PIPEX = 34;
389 pub const RECVRTABLE = 35;
390 pub const IPSECFLOWINFO = 36;
391 pub const IPDEFTTL = 37;
392 pub const SENDSRCADDR = RECVDSTADDR;
393 pub const RTABLE = 0x1021;
394 pub const DEFAULT_MULTICAST_TTL = 1;
395 pub const DEFAULT_MULTICAST_LOOP = 1;
396 pub const MIN_MEMBERSHIPS = 15;
397 pub const MAX_MEMBERSHIPS = 4095;
398 pub const PORTRANGE_DEFAULT = 0;
399 pub const PORTRANGE_HIGH = 1;
400 pub const PORTRANGE_LOW = 2;
401};
402
403// https://github.com/openbsd/src/blob/718a31b40d39fc6064de6355eb144e74633133fc/sys/netinet6/in6.h#L284
404pub const IPV6 = struct {
405 pub const UNICAST_HOPS = 4;
406 pub const MULTICAST_IF = 9;
407 pub const MULTICAST_HOPS = 10;
408 pub const MULTICAST_LOOP = 11;
409 pub const JOIN_GROUP = 12;
410 pub const LEAVE_GROUP = 13;
411 pub const PORTRANGE = 14;
412 pub const CHECKSUM = 26;
413 pub const V6ONLY = 27;
414 pub const RTHDRDSTOPTS = 35;
415 pub const RECVPKTINFO = 36;
416 pub const RECVHOPLIMIT = 37;
417 pub const RECVRTHDR = 38;
418 pub const RECVHOPOPTS = 39;
419 pub const RECVDSTOPTS = 40;
420 pub const USE_MIN_MTU = 42;
421 pub const RECVPATHMTU = 43;
422 pub const PATHMTU = 44;
423 pub const PKTINFO = 46;
424 pub const HOPLIMIT = 47;
425 pub const NEXTHOP = 48;
426 pub const HOPOPTS = 49;
427 pub const DSTOPTS = 50;
428 pub const RTHDR = 51;
429 pub const AUTH_LEVEL = 53;
430 pub const ESP_TRANS_LEVEL = 54;
431 pub const ESP_NETWORK_LEVEL = 55;
432 pub const RECVTCLASS = 57;
433 pub const AUTOFLOWLABEL = 59;
434 pub const IPCOMP_LEVEL = 60;
435 pub const TCLASS = 61;
436 pub const DONTFRAG = 62;
437 pub const PIPEX = 63;
438 pub const RECVDSTPORT = 64;
439 pub const MINHOPCOUNT = 65;
440 pub const RTABLE = 0x1021;
441 pub const RTHDR_LOOSE = 0;
442 pub const RTHDR_TYPE_0 = 0;
443 pub const DEFAULT_MULTICAST_HOPS = 1;
444 pub const DEFAULT_MULTICAST_LOOP = 1;
445 pub const PORTRANGE_DEFAULT = 0;
446 pub const PORTRANGE_HIGH = 1;
447 pub const PORTRANGE_LOW = 2;
448};
449
450// https://github.com/openbsd/src/blob/718a31b40d39fc6064de6355eb144e74633133fc/sys/netinet/ip.h#L73
451pub const IPTOS = struct {
452 pub const LOWDELAY = 0x10;
453 pub const THROUGHPUT = 0x08;
454 pub const RELIABILITY = 0x04;
455 pub const CE = 0x01;
456 pub const ECT = 0x02;
457 pub const PREC_NETCONTROL = 0xe0;
458 pub const PREC_INTERNETCONTROL = 0xc0;
459 pub const PREC_CRITIC_ECP = 0xa0;
460 pub const PREC_FLASHOVERRIDE = 0x80;
461 pub const PREC_FLASH = 0x60;
462 pub const PREC_IMMEDIATE = 0x40;
463 pub const PREC_PRIORITY = 0x20;
464 pub const PREC_ROUTINE = 0x00;
465 pub const DSCP_CS0 = 0x00;
466 pub const DSCP_LE = 0x04;
467 pub const DSCP_CS1 = 0x20;
468 pub const DSCP_AF11 = 0x28;
469 pub const DSCP_AF12 = 0x30;
470 pub const DSCP_AF13 = 0x38;
471 pub const DSCP_CS2 = 0x40;
472 pub const DSCP_AF21 = 0x48;
473 pub const DSCP_AF22 = 0x50;
474 pub const DSCP_AF23 = 0x58;
475 pub const DSCP_CS3 = 0x60;
476 pub const DSCP_AF31 = 0x68;
477 pub const DSCP_AF32 = 0x70;
478 pub const DSCP_AF33 = 0x78;
479 pub const DSCP_CS4 = 0x80;
480 pub const DSCP_AF41 = 0x88;
481 pub const DSCP_AF42 = 0x90;
482 pub const DSCP_AF43 = 0x98;
483 pub const DSCP_CS5 = 0xa0;
484 pub const DSCP_EF = 0xb8;
485 pub const DSCP_CS6 = 0xc0;
486 pub const DSCP_CS7 = 0xe0;
487 pub const ECN_NOTECT = 0x00;
488 pub const ECN_ECT1 = 0x01;
489 pub const ECN_ECT0 = 0x02;
490 pub const ECN_CE = 0x03;
491 pub const ECN_MASK = 0x03;
492};
lib/std/c/serenity.zig+40
...@@ -71,3 +71,43 @@ pub extern "c" fn serenity_open(path: [*]const u8, path_length: usize, options:...@@ -71,3 +71,43 @@ pub extern "c" fn serenity_open(path: [*]const u8, path_length: usize, options:
7171
72pub extern "c" fn getkeymap(name_buffer: [*]u8, name_buffer_size: usize, map: [*]u32, shift_map: [*]u32, alt_map: [*]u32, altgr_map: [*]u32, shift_altgr_map: [*]u32) c_int;72pub extern "c" fn getkeymap(name_buffer: [*]u8, name_buffer_size: usize, map: [*]u32, shift_map: [*]u32, alt_map: [*]u32, altgr_map: [*]u32, shift_altgr_map: [*]u32) c_int;
73pub extern "c" fn setkeymap(name: [*]const u8, map: [*]const u32, shift_map: [*]const u32, alt_map: [*]const u32, altgr_map: [*]const u32, shift_altgr_map: [*]const u32) c_int;73pub extern "c" fn setkeymap(name: [*]const u8, map: [*]const u32, shift_map: [*]const u32, alt_map: [*]const u32, altgr_map: [*]const u32, shift_altgr_map: [*]const u32) c_int;
74
75// https://github.com/SerenityOS/serenity/blob/5bd8af99be0bc4b2e14f361fd7d7590e6bcfa4d6/Kernel/API/POSIX/netinet/in.h#L29
76pub const IP = struct {
77 pub const TOS = 1;
78 pub const TTL = 2;
79 pub const MULTICAST_LOOP = 3;
80 pub const ADD_MEMBERSHIP = 4;
81 pub const DROP_MEMBERSHIP = 5;
82 pub const MULTICAST_IF = 6;
83 pub const MULTICAST_TTL = 7;
84 pub const BLOCK_SOURCE = 8;
85 pub const ADD_SOURCE_MEMBERSHIP = 7;
86 pub const DROP_SOURCE_MEMBERSHIP = 8;
87 pub const UNBLOCK_SOURCE = 9;
88 pub const OPTIONS = 10;
89};
90
91// https://github.com/SerenityOS/serenity/blob/5bd8af99be0bc4b2e14f361fd7d7590e6bcfa4d6/Kernel/API/POSIX/netinet/in.h#L81
92pub const IPV6 = struct {
93 pub const UNICAST_HOPS = 1;
94 pub const MULTICAST_HOPS = 2;
95 pub const MULTICAST_LOOP = 3;
96 pub const MULTICAST_IF = 4;
97 pub const ADD_MEMBERSHIP = 5;
98 pub const DROP_MEMBERSHIP = 6;
99 pub const V6ONLY = 9;
100 pub const JOIN_GROUP = 5;
101 pub const LEAVE_GROUP = 6;
102 pub const RECVPKTINFO = 10;
103 pub const PKTINFO = 11;
104 pub const RECVHOPLIMIT = 12;
105 pub const HOPLIMIT = 13;
106};
107
108// https://github.com/SerenityOS/serenity/blob/5bd8af99be0bc4b2e14f361fd7d7590e6bcfa4d6/Kernel/API/POSIX/netinet/in.h#L40
109pub const IPTOS = struct {
110 pub const LOWDELAY = 16;
111 pub const THROUGHPUT = 8;
112 pub const RELIABILITY = 4;
113};
lib/std/c/solaris.zig+115-6
...@@ -31,12 +31,6 @@ pub const poolid_t = id_t;...@@ -31,12 +31,6 @@ pub const poolid_t = id_t;
31pub const zoneid_t = id_t;31pub const zoneid_t = id_t;
32pub const ctid_t = id_t;32pub const ctid_t = id_t;
3333
34pub const SCM = struct {
35 pub const UCRED = 0x1012;
36 pub const RIGHTS = 0x1010;
37 pub const TIMESTAMP = SO.TIMESTAMP;
38};
39
40pub const fpregset_t = extern union {34pub const fpregset_t = extern union {
41 regs: [130]u32,35 regs: [130]u32,
42 chip_state: extern struct {36 chip_state: extern struct {
...@@ -369,3 +363,118 @@ pub fn IOW(io_type: u8, nr: u8, comptime IOT: type) i32 {...@@ -369,3 +363,118 @@ pub fn IOW(io_type: u8, nr: u8, comptime IOT: type) i32 {
369pub fn IOWR(io_type: u8, nr: u8, comptime IOT: type) i32 {363pub fn IOWR(io_type: u8, nr: u8, comptime IOT: type) i32 {
370 return ioImpl(.read_write, io_type, nr, IOT);364 return ioImpl(.read_write, io_type, nr, IOT);
371}365}
366
367// https://github.com/illumos/illumos-gate/blob/608eb926e14f4ba4736b2d59e891335f1cba9e1e/usr/src/uts/common/netinet/in.h#L1141
368// (old OpenSolaris is very similar, it's just missing a few more-modern ones, and probably modern Solaris has those)
369pub const IP = struct {
370 pub const OPTIONS = 1;
371 pub const HDRINCL = 2;
372 pub const TOS = 3;
373 pub const TTL = 4;
374 pub const RECVOPTS = 0x5;
375 pub const RECVRETOPTS = 0x6;
376 pub const RECVDSTADDR = 0x7;
377 pub const RETOPTS = 0x8;
378 pub const RECVIF = 0x9;
379 pub const RECVSLLA = 0xa;
380 pub const RECVTTL = 0xb;
381 pub const RECVTOS = 0xc;
382 pub const MULTICAST_IF = 0x10;
383 pub const MULTICAST_TTL = 0x11;
384 pub const MULTICAST_LOOP = 0x12;
385 pub const ADD_MEMBERSHIP = 0x13;
386 pub const DROP_MEMBERSHIP = 0x14;
387 pub const BLOCK_SOURCE = 0x15;
388 pub const UNBLOCK_SOURCE = 0x16;
389 pub const ADD_SOURCE_MEMBERSHIP = 0x17;
390 pub const DROP_SOURCE_MEMBERSHIP = 0x18;
391 pub const NEXTHOP = 0x19;
392 pub const PKTINFO = 0x1a;
393 pub const RECVPKTINFO = 0x1a;
394 pub const DONTFRAG = 0x1b;
395 pub const MINTTL = 0x1c;
396 pub const SEC_OPT = 0x22;
397 pub const BOUND_IF = 0x41;
398 pub const UNSPEC_SRC = 0x42;
399 pub const BROADCAST_TTL = 0x43;
400 pub const DHCPINIT_IF = 0x45;
401 pub const REUSEADDR = 0x104;
402 pub const DONTROUTE = 0x105;
403 pub const BROADCAST = 0x106;
404 // Same namespace, but these are arguments rather than option names
405 pub const DEFAULT_MULTICAST_TTL = 1;
406 pub const DEFAULT_MULTICAST_LOOP = 1;
407};
408
409// https://github.com/illumos/illumos-gate/blob/608eb926e14f4ba4736b2d59e891335f1cba9e1e/usr/src/uts/common/netinet/in.h#L1192
410// (old OpenSolaris is very similar, it's just missing a few more-modern ones, and probably modern Solaris has those)
411pub const IPV6 = struct {
412 pub const UNICAST_HOPS = 0x5;
413 pub const MULTICAST_IF = 0x6;
414 pub const MULTICAST_HOPS = 0x7;
415 pub const MULTICAST_LOOP = 0x8;
416 pub const JOIN_GROUP = 0x9;
417 pub const LEAVE_GROUP = 0xa;
418 pub const ADD_MEMBERSHIP = 0x9;
419 pub const DROP_MEMBERSHIP = 0xa;
420 pub const PKTINFO = 0xb;
421 pub const HOPLIMIT = 0xc;
422 pub const NEXTHOP = 0xd;
423 pub const HOPOPTS = 0xe;
424 pub const DSTOPTS = 0xf;
425 pub const RTHDR = 0x10;
426 pub const RTHDRDSTOPTS = 0x11;
427 pub const RECVPKTINFO = 0x12;
428 pub const RECVHOPLIMIT = 0x13;
429 pub const RECVHOPOPTS = 0x14;
430 pub const OLD_RECVDSTOPTS = 0x15;
431 pub const RECVRTHDR = 0x16;
432 pub const RECVRTHDRDSTOPTS = 0x17;
433 pub const CHECKSUM = 0x18;
434 pub const RECVTCLASS = 0x19;
435 pub const USE_MIN_MTU = 0x20;
436 pub const DONTFRAG = 0x21;
437 pub const SEC_OPT = 0x22;
438 pub const SRC_PREFERENCES = 0x23;
439 pub const RECVPATHMTU = 0x24;
440 pub const PATHMTU = 0x25;
441 pub const TCLASS = 0x26;
442 pub const V6ONLY = 0x27;
443 pub const RECVDSTOPTS = 0x28;
444 pub const MINHOPCOUNT = 0x2f;
445 pub const BOUND_IF = 0x41;
446 pub const UNSPEC_SRC = 0x42;
447 // Same namespace, but these are arguments rather than option names
448 pub const RTHDR_TYPE_0 = 0;
449 pub const PREFER_SRC_HOME = 0x01;
450 pub const PREFER_SRC_COA = 0x02;
451 pub const PREFER_SRC_PUBLIC = 0x04;
452 pub const PREFER_SRC_TMP = 0x08;
453 pub const PREFER_SRC_NONCGA = 0x10;
454 pub const PREFER_SRC_CGA = 0x20;
455 pub const PREFER_SRC_MIPMASK = PREFER_SRC_HOME | PREFER_SRC_COA;
456 pub const PREFER_SRC_MIPDEFAULT = PREFER_SRC_HOME;
457 pub const PREFER_SRC_TMPMASK = PREFER_SRC_PUBLIC | PREFER_SRC_TMP;
458 pub const PREFER_SRC_TMPDEFAULT = PREFER_SRC_PUBLIC;
459 pub const PREFER_SRC_CGAMASK = PREFER_SRC_NONCGA | PREFER_SRC_CGA;
460 pub const PREFER_SRC_CGADEFAULT = PREFER_SRC_NONCGA;
461 pub const PREFER_SRC_MASK = PREFER_SRC_MIPMASK | PREFER_SRC_TMPMASK | PREFER_SRC_CGAMASK;
462 pub const PREFER_SRC_DEFAULT = PREFER_SRC_MIPDEFAULT | PREFER_SRC_TMPDEFAULT | PREFER_SRC_CGADEFAULT;
463};
464
465// https://github.com/illumos/illumos-gate/blob/608eb926e14f4ba4736b2d59e891335f1cba9e1e/usr/src/uts/common/netinet/ip.h#L64
466pub const IPTOS = struct {
467 pub const LOWDELAY = 0x10;
468 pub const THROUGHPUT = 0x08;
469 pub const RELIABILITY = 0x04;
470 pub const ECT = 0x02;
471 pub const CE = 0x01;
472 pub const PREC_NETCONTROL = 0xe0;
473 pub const PREC_INTERNETCONTROL = 0xc0;
474 pub const PREC_CRITIC_ECP = 0xa0;
475 pub const PREC_FLASHOVERRIDE = 0x80;
476 pub const PREC_FLASH = 0x60;
477 pub const PREC_IMMEDIATE = 0x40;
478 pub const PREC_PRIORITY = 0x20;
479 pub const PREC_ROUTINE = 0x00;
480};
lib/std/os/linux.zig+52
...@@ -4338,6 +4338,12 @@ pub const SO = if (is_mips) struct {...@@ -4338,6 +4338,12 @@ pub const SO = if (is_mips) struct {
4338};4338};
43394339
4340pub const SCM = struct {4340pub const SCM = struct {
4341 // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/socket.h?id=f777d1112ee597d7f7dd3ca232220873a34ad0c8#n178
4342 pub const RIGHTS = 1;
4343 pub const CREDENTIALS = 2;
4344 pub const SECURITY = 3;
4345 pub const PIDFD = 4;
4346
4341 pub const WIFI_STATUS = SO.WIFI_STATUS;4347 pub const WIFI_STATUS = SO.WIFI_STATUS;
4342 pub const TIMESTAMPING_OPT_STATS = 54;4348 pub const TIMESTAMPING_OPT_STATS = 54;
4343 pub const TIMESTAMPING_PKTINFO = 58;4349 pub const TIMESTAMPING_PKTINFO = 58;
...@@ -4521,6 +4527,52 @@ pub const IPV6 = struct {...@@ -4521,6 +4527,52 @@ pub const IPV6 = struct {
4521 pub const FREEBIND = 78;4527 pub const FREEBIND = 78;
4522};4528};
45234529
4530// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/ip.h?id=64e844505bc08cde3f346f193cbbbab0096fef54#n24
4531pub const IPTOS = struct {
4532 pub const TOS_MASK = 0x1e;
4533 pub fn TOS(t: anytype) @TypeOf(t) {
4534 return t & TOS_MASK;
4535 }
4536
4537 pub const MINCOST = 0x02;
4538 pub const RELIABILITY = 0x04;
4539 pub const THROUGHPUT = 0x08;
4540 pub const LOWDELAY = 0x10;
4541
4542 pub const PREC_MASK = 0xe0;
4543 pub fn PREC(t: anytype) @TypeOf(t) {
4544 return t & PREC_MASK;
4545 }
4546
4547 pub const PREC_ROUTINE = 0x00;
4548 pub const PREC_PRIORITY = 0x20;
4549 pub const PREC_IMMEDIATE = 0x40;
4550 pub const PREC_FLASH = 0x60;
4551 pub const PREC_FLASHOVERRIDE = 0x80;
4552 pub const PREC_CRITIC_ECP = 0xa0;
4553 pub const PREC_INTERNETCONTROL = 0xc0;
4554 pub const PREC_NETCONTROL = 0xe0;
4555};
4556
4557// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/socket.h?id=b1e904999542ad6764eafa54545f1c55776006d1#n43
4558pub const linger = extern struct {
4559 onoff: i32, // non-zero to linger on close
4560 linger: i32, // time to linger in seconds
4561};
4562
4563// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/in.h?id=64e844505bc08cde3f346f193cbbbab0096fef54#n250
4564pub const in_pktinfo = extern struct {
4565 ifindex: i32,
4566 spec_dst: u32,
4567 addr: u32,
4568};
4569
4570// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/ipv6.h?id=f24987ef6959a7efaf79bffd265522c3df18d431#n22
4571pub const in6_pktinfo = extern struct {
4572 addr: [16]u8,
4573 ifindex: i32,
4574};
4575
4524/// IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble4576/// IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
4525/// and FCS/CRC (frame check sequence).4577/// and FCS/CRC (frame check sequence).
4526pub const ETH = struct {4578pub const ETH = struct {
lib/std/posix.zig+7
...@@ -75,7 +75,10 @@ pub const HOST_NAME_MAX = system.HOST_NAME_MAX;...@@ -75,7 +75,10 @@ pub const HOST_NAME_MAX = system.HOST_NAME_MAX;
75pub const HW = system.HW;75pub const HW = system.HW;
76pub const IFNAMESIZE = system.IFNAMESIZE;76pub const IFNAMESIZE = system.IFNAMESIZE;
77pub const IOV_MAX = system.IOV_MAX;77pub const IOV_MAX = system.IOV_MAX;
78pub const IP = system.IP;
79pub const IPV6 = system.IPV6;
78pub const IPPROTO = system.IPPROTO;80pub const IPPROTO = system.IPPROTO;
81pub const IPTOS = system.IPTOS;
79pub const KERN = system.KERN;82pub const KERN = system.KERN;
80pub const Kevent = system.Kevent;83pub const Kevent = system.Kevent;
81pub const MADV = system.MADV;84pub const MADV = system.MADV;
...@@ -101,6 +104,7 @@ pub const RR = system.RR;...@@ -101,6 +104,7 @@ pub const RR = system.RR;
101pub const S = system.S;104pub const S = system.S;
102pub const SA = system.SA;105pub const SA = system.SA;
103pub const SC = system.SC;106pub const SC = system.SC;
107pub const SCM = system.SCM;
104pub const SEEK = system.SEEK;108pub const SEEK = system.SEEK;
105pub const SHUT = system.SHUT;109pub const SHUT = system.SHUT;
106pub const SIG = system.SIG;110pub const SIG = system.SIG;
...@@ -133,7 +137,10 @@ pub const fd_t = system.fd_t;...@@ -133,7 +137,10 @@ pub const fd_t = system.fd_t;
133pub const file_obj = system.file_obj;137pub const file_obj = system.file_obj;
134pub const gid_t = system.gid_t;138pub const gid_t = system.gid_t;
135pub const ifreq = system.ifreq;139pub const ifreq = system.ifreq;
140pub const in_pktinfo = system.in_pktinfo;
141pub const in6_pktinfo = system.in6_pktinfo;
136pub const ino_t = system.ino_t;142pub const ino_t = system.ino_t;
143pub const linger = system.linger;
137pub const mcontext_t = system.mcontext_t;144pub const mcontext_t = system.mcontext_t;
138pub const mode_t = system.mode_t;145pub const mode_t = system.mode_t;
139pub const msghdr = system.msghdr;146pub const msghdr = system.msghdr;