Source
pub const IPPROTO = switch (native_os) {
.linux, .emscripten => linux.IPPROTO,
.windows => ws2_32.IPPROTO,
.macos, .ios, .tvos, .watchos, .visionos => struct {
pub const ICMP = 1;
pub const ICMPV6 = 58;
pub const TCP = 6;
pub const UDP = 17;
pub const IP = 0;
pub const IPV6 = 41;
},
.freebsd => struct {
/// dummy for IP
pub const IP = 0;
/// control message protocol
pub const ICMP = 1;
/// tcp
pub const TCP = 6;
/// user datagram protocol
pub const UDP = 17;
/// IP6 header
pub const IPV6 = 41;
/// raw IP packet
pub const RAW = 255;
/// IP6 hop-by-hop options
pub const HOPOPTS = 0;
/// group mgmt protocol
pub const IGMP = 2;
/// gateway^2 (deprecated)
pub const GGP = 3;
/// IPv4 encapsulation
pub const IPV4 = 4;
/// for compatibility
pub const IPIP = IPV4;
/// Stream protocol II
pub const ST = 7;
/// exterior gateway protocol
pub const EGP = 8;
/// private interior gateway
pub const PIGP = 9;
/// BBN RCC Monitoring
pub const RCCMON = 10;
/// network voice protocol
pub const NVPII = 11;
/// pup
pub const PUP = 12;
/// Argus
pub const ARGUS = 13;
/// EMCON
pub const EMCON = 14;
/// Cross Net Debugger
pub const XNET = 15;
/// Chaos
pub const CHAOS = 16;
/// Multiplexing
pub const MUX = 18;
/// DCN Measurement Subsystems
pub const MEAS = 19;
/// Host Monitoring
pub const HMP = 20;
/// Packet Radio Measurement
pub const PRM = 21;
/// xns idp
pub const IDP = 22;
/// Trunk-1
pub const TRUNK1 = 23;
/// Trunk-2
pub const TRUNK2 = 24;
/// Leaf-1
pub const LEAF1 = 25;
/// Leaf-2
pub const LEAF2 = 26;
/// Reliable Data
pub const RDP = 27;
/// Reliable Transaction
pub const IRTP = 28;
/// tp-4 w/ class negotiation
pub const TP = 29;
/// Bulk Data Transfer
pub const BLT = 30;
/// Network Services
pub const NSP = 31;
/// Merit Internodal
pub const INP = 32;
/// Datagram Congestion Control Protocol
pub const DCCP = 33;
/// Third Party Connect
pub const @"3PC" = 34;
/// InterDomain Policy Routing
pub const IDPR = 35;
/// XTP
pub const XTP = 36;
/// Datagram Delivery
pub const DDP = 37;
/// Control Message Transport
pub const CMTP = 38;
/// TP++ Transport
pub const TPXX = 39;
/// IL transport protocol
pub const IL = 40;
/// Source Demand Routing
pub const SDRP = 42;
/// IP6 routing header
pub const ROUTING = 43;
/// IP6 fragmentation header
pub const FRAGMENT = 44;
/// InterDomain Routing
pub const IDRP = 45;
/// resource reservation
pub const RSVP = 46;
/// General Routing Encap.
pub const GRE = 47;
/// Mobile Host Routing
pub const MHRP = 48;
/// BHA
pub const BHA = 49;
/// IP6 Encap Sec. Payload
pub const ESP = 50;
/// IP6 Auth Header
pub const AH = 51;
/// Integ. Net Layer Security
pub const INLSP = 52;
/// IP with encryption
pub const SWIPE = 53;
/// Next Hop Resolution
pub const NHRP = 54;
/// IP Mobility
pub const MOBILE = 55;
/// Transport Layer Security
pub const TLSP = 56;
/// SKIP
pub const SKIP = 57;
/// ICMP6
pub const ICMPV6 = 58;
/// IP6 no next header
pub const NONE = 59;
/// IP6 destination option
pub const DSTOPTS = 60;
/// any host internal protocol
pub const AHIP = 61;
/// CFTP
pub const CFTP = 62;
/// "hello" routing protocol
pub const HELLO = 63;
/// SATNET/Backroom EXPAK
pub const SATEXPAK = 64;
/// Kryptolan
pub const KRYPTOLAN = 65;
/// Remote Virtual Disk
pub const RVD = 66;
/// Pluribus Packet Core
pub const IPPC = 67;
/// Any distributed FS
pub const ADFS = 68;
/// Satnet Monitoring
pub const SATMON = 69;
/// VISA Protocol
pub const VISA = 70;
/// Packet Core Utility
pub const IPCV = 71;
/// Comp. Prot. Net. Executive
pub const CPNX = 72;
/// Comp. Prot. HeartBeat
pub const CPHB = 73;
/// Wang Span Network
pub const WSN = 74;
/// Packet Video Protocol
pub const PVP = 75;
/// BackRoom SATNET Monitoring
pub const BRSATMON = 76;
/// Sun net disk proto (temp.)
pub const ND = 77;
/// WIDEBAND Monitoring
pub const WBMON = 78;
/// WIDEBAND EXPAK
pub const WBEXPAK = 79;
/// ISO cnlp
pub const EON = 80;
/// VMTP
pub const VMTP = 81;
/// Secure VMTP
pub const SVMTP = 82;
/// Banyon VINES
pub const VINES = 83;
/// TTP
pub const TTP = 84;
/// NSFNET-IGP
pub const IGP = 85;
/// dissimilar gateway prot.
pub const DGP = 86;
/// TCF
pub const TCF = 87;
/// Cisco/GXS IGRP
pub const IGRP = 88;
/// OSPFIGP
pub const OSPFIGP = 89;
/// Strite RPC protocol
pub const SRPC = 90;
/// Locus Address Resoloution
pub const LARP = 91;
/// Multicast Transport
pub const MTP = 92;
/// AX.25 Frames
pub const AX25 = 93;
/// IP encapsulated in IP
pub const IPEIP = 94;
/// Mobile Int.ing control
pub const MICP = 95;
/// Semaphore Comm. security
pub const SCCSP = 96;
/// Ethernet IP encapsulation
pub const ETHERIP = 97;
/// encapsulation header
pub const ENCAP = 98;
/// any private encr. scheme
pub const APES = 99;
/// GMTP
pub const GMTP = 100;
/// payload compression (IPComp)
pub const IPCOMP = 108;
/// SCTP
pub const SCTP = 132;
/// IPv6 Mobility Header
pub const MH = 135;
/// UDP-Lite
pub const UDPLITE = 136;
/// IP6 Host Identity Protocol
pub const HIP = 139;
/// IP6 Shim6 Protocol
pub const SHIM6 = 140;
/// Protocol Independent Mcast
pub const PIM = 103;
/// CARP
pub const CARP = 112;
/// PGM
pub const PGM = 113;
/// MPLS-in-IP
pub const MPLS = 137;
/// PFSYNC
pub const PFSYNC = 240;
/// Reserved
pub const RESERVED_253 = 253;
/// Reserved
pub const RESERVED_254 = 254;
},
.solaris, .illumos => struct {
/// dummy for IP
pub const IP = 0;
/// Hop by hop header for IPv6
pub const HOPOPTS = 0;
/// control message protocol
pub const ICMP = 1;
/// group control protocol
pub const IGMP = 2;
/// gateway^2 (deprecated)
pub const GGP = 3;
/// IP in IP encapsulation
pub const ENCAP = 4;
/// tcp
pub const TCP = 6;
/// exterior gateway protocol
pub const EGP = 8;
/// pup
pub const PUP = 12;
/// user datagram protocol
pub const UDP = 17;
/// xns idp
pub const IDP = 22;
/// IPv6 encapsulated in IP
pub const IPV6 = 41;
/// Routing header for IPv6
pub const ROUTING = 43;
/// Fragment header for IPv6
pub const FRAGMENT = 44;
/// rsvp
pub const RSVP = 46;
/// IPsec Encap. Sec. Payload
pub const ESP = 50;
/// IPsec Authentication Hdr.
pub const AH = 51;
/// ICMP for IPv6
pub const ICMPV6 = 58;
/// No next header for IPv6
pub const NONE = 59;
/// Destination options
pub const DSTOPTS = 60;
/// "hello" routing protocol
pub const HELLO = 63;
/// UNOFFICIAL net disk proto
pub const ND = 77;
/// ISO clnp
pub const EON = 80;
/// OSPF
pub const OSPF = 89;
/// PIM routing protocol
pub const PIM = 103;
/// Stream Control
pub const SCTP = 132;
/// raw IP packet
pub const RAW = 255;
/// Sockets Direct Protocol
pub const PROTO_SDP = 257;
},
.netbsd => struct {
/// dummy for IP
pub const IP = 0;
/// IP6 hop-by-hop options
pub const HOPOPTS = 0;
/// control message protocol
pub const ICMP = 1;
/// group mgmt protocol
pub const IGMP = 2;
/// gateway^2 (deprecated)
pub const GGP = 3;
/// IP header
pub const IPV4 = 4;
/// IP inside IP
pub const IPIP = 4;
/// tcp
pub const TCP = 6;
/// exterior gateway protocol
pub const EGP = 8;
/// pup
pub const PUP = 12;
/// user datagram protocol
pub const UDP = 17;
/// xns idp
pub const IDP = 22;
/// tp-4 w/ class negotiation
pub const TP = 29;
/// DCCP
pub const DCCP = 33;
/// IP6 header
pub const IPV6 = 41;
/// IP6 routing header
pub const ROUTING = 43;
/// IP6 fragmentation header
pub const FRAGMENT = 44;
/// resource reservation
pub const RSVP = 46;
/// GRE encaps RFC 1701
pub const GRE = 47;
/// encap. security payload
pub const ESP = 50;
/// authentication header
pub const AH = 51;
/// IP Mobility RFC 2004
pub const MOBILE = 55;
/// IPv6 ICMP
pub const IPV6_ICMP = 58;
/// ICMP6
pub const ICMPV6 = 58;
/// IP6 no next header
pub const NONE = 59;
/// IP6 destination option
pub const DSTOPTS = 60;
/// ISO cnlp
pub const EON = 80;
/// Ethernet-in-IP
pub const ETHERIP = 97;
/// encapsulation header
pub const ENCAP = 98;
/// Protocol indep. multicast
pub const PIM = 103;
/// IP Payload Comp. Protocol
pub const IPCOMP = 108;
/// VRRP RFC 2338
pub const VRRP = 112;
/// Common Address Resolution Protocol
pub const CARP = 112;
/// L2TPv3
pub const L2TP = 115;
/// SCTP
pub const SCTP = 132;
/// PFSYNC
pub const PFSYNC = 240;
/// raw IP packet
pub const RAW = 255;
},
.dragonfly => struct {
pub const IP = 0;
pub const ICMP = 1;
pub const TCP = 6;
pub const UDP = 17;
pub const IPV6 = 41;
pub const RAW = 255;
pub const HOPOPTS = 0;
pub const IGMP = 2;
pub const GGP = 3;
pub const IPV4 = 4;
pub const IPIP = IPV4;
pub const ST = 7;
pub const EGP = 8;
pub const PIGP = 9;
pub const RCCMON = 10;
pub const NVPII = 11;
pub const PUP = 12;
pub const ARGUS = 13;
pub const EMCON = 14;
pub const XNET = 15;
pub const CHAOS = 16;
pub const MUX = 18;
pub const MEAS = 19;
pub const HMP = 20;
pub const PRM = 21;
pub const IDP = 22;
pub const TRUNK1 = 23;
pub const TRUNK2 = 24;
pub const LEAF1 = 25;
pub const LEAF2 = 26;
pub const RDP = 27;
pub const IRTP = 28;
pub const TP = 29;
pub const BLT = 30;
pub const NSP = 31;
pub const INP = 32;
pub const SEP = 33;
pub const @"3PC" = 34;
pub const IDPR = 35;
pub const XTP = 36;
pub const DDP = 37;
pub const CMTP = 38;
pub const TPXX = 39;
pub const IL = 40;
pub const SDRP = 42;
pub const ROUTING = 43;
pub const FRAGMENT = 44;
pub const IDRP = 45;
pub const RSVP = 46;
pub const GRE = 47;
pub const MHRP = 48;
pub const BHA = 49;
pub const ESP = 50;
pub const AH = 51;
pub const INLSP = 52;
pub const SWIPE = 53;
pub const NHRP = 54;
pub const MOBILE = 55;
pub const TLSP = 56;
pub const SKIP = 57;
pub const ICMPV6 = 58;
pub const NONE = 59;
pub const DSTOPTS = 60;
pub const AHIP = 61;
pub const CFTP = 62;
pub const HELLO = 63;
pub const SATEXPAK = 64;
pub const KRYPTOLAN = 65;
pub const RVD = 66;
pub const IPPC = 67;
pub const ADFS = 68;
pub const SATMON = 69;
pub const VISA = 70;
pub const IPCV = 71;
pub const CPNX = 72;
pub const CPHB = 73;
pub const WSN = 74;
pub const PVP = 75;
pub const BRSATMON = 76;
pub const ND = 77;
pub const WBMON = 78;
pub const WBEXPAK = 79;
pub const EON = 80;
pub const VMTP = 81;
pub const SVMTP = 82;
pub const VINES = 83;
pub const TTP = 84;
pub const IGP = 85;
pub const DGP = 86;
pub const TCF = 87;
pub const IGRP = 88;
pub const OSPFIGP = 89;
pub const SRPC = 90;
pub const LARP = 91;
pub const MTP = 92;
pub const AX25 = 93;
pub const IPEIP = 94;
pub const MICP = 95;
pub const SCCSP = 96;
pub const ETHERIP = 97;
pub const ENCAP = 98;
pub const APES = 99;
pub const GMTP = 100;
pub const IPCOMP = 108;
pub const PIM = 103;
pub const CARP = 112;
pub const PGM = 113;
pub const PFSYNC = 240;
pub const DIVERT = 254;
pub const MAX = 256;
pub const DONE = 257;
pub const UNKNOWN = 258;
},
.haiku => struct {
pub const IP = 0;
pub const HOPOPTS = 0;
pub const ICMP = 1;
pub const IGMP = 2;
pub const TCP = 6;
pub const UDP = 17;
pub const IPV6 = 41;
pub const ROUTING = 43;
pub const FRAGMENT = 44;
pub const ESP = 50;
pub const AH = 51;
pub const ICMPV6 = 58;
pub const NONE = 59;
pub const DSTOPTS = 60;
pub const ETHERIP = 97;
pub const RAW = 255;
pub const MAX = 256;
},
.openbsd => struct {
/// dummy for IP
pub const IP = 0;
/// IP6 hop-by-hop options
pub const HOPOPTS = IP;
/// control message protocol
pub const ICMP = 1;
/// group mgmt protocol
pub const IGMP = 2;
/// gateway^2 (deprecated)
pub const GGP = 3;
/// IP header
pub const IPV4 = IPIP;
/// IP inside IP
pub const IPIP = 4;
/// tcp
pub const TCP = 6;
/// exterior gateway protocol
pub const EGP = 8;
/// pup
pub const PUP = 12;
/// user datagram protocol
pub const UDP = 17;
/// xns idp
pub const IDP = 22;
/// tp-4 w/ class negotiation
pub const TP = 29;
/// IP6 header
pub const IPV6 = 41;
/// IP6 routing header
pub const ROUTING = 43;
/// IP6 fragmentation header
pub const FRAGMENT = 44;
/// resource reservation
pub const RSVP = 46;
/// GRE encaps RFC 1701
pub const GRE = 47;
/// encap. security payload
pub const ESP = 50;
/// authentication header
pub const AH = 51;
/// IP Mobility RFC 2004
pub const MOBILE = 55;
/// IPv6 ICMP
pub const IPV6_ICMP = 58;
/// ICMP6
pub const ICMPV6 = 58;
/// IP6 no next header
pub const NONE = 59;
/// IP6 destination option
pub const DSTOPTS = 60;
/// ISO cnlp
pub const EON = 80;
/// Ethernet-in-IP
pub const ETHERIP = 97;
/// encapsulation header
pub const ENCAP = 98;
/// Protocol indep. multicast
pub const PIM = 103;
/// IP Payload Comp. Protocol
pub const IPCOMP = 108;
/// VRRP RFC 2338
pub const VRRP = 112;
/// Common Address Resolution Protocol
pub const CARP = 112;
/// PFSYNC
pub const PFSYNC = 240;
/// raw IP packet
pub const RAW = 255;
},
// https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L44-L54
.serenity => struct {
pub const IP = 0;
pub const ICMP = 1;
pub const IGMP = 2;
pub const IPIP = 4;
pub const TCP = 6;
pub const UDP = 17;
pub const IPV6 = 41;
pub const ESP = 50;
pub const AH = 51;
pub const ICMPV6 = 58;
pub const RAW = 255;
},
else => void,
}