mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 08:14:48 +00:00
std: add in_pktinfo and in6_pktinfo structs defs
in_pktinfo is only used on a few targets for the IP_PKTINFO sockopt, as many BSDs use an alternate mechanism (IP_RECVDSTADDR) that doesn't require a special struct. in6_pktinfo is more universal.
This commit is contained in:
parent
c449a30213
commit
3e372f1994
@ -4087,6 +4087,35 @@ pub const ifreq = switch (native_os) {
|
||||
},
|
||||
else => void,
|
||||
};
|
||||
pub const in_pktinfo = switch (native_os) {
|
||||
.linux => linux.in_pktinfo,
|
||||
// https://github.com/kofemann/opensolaris/blob/80192cd83bf665e708269dae856f9145f7190f74/usr/src/uts/common/netinet/in.h#L1084
|
||||
// https://github.com/illumos/illumos-gate/blob/608eb926e14f4ba4736b2d59e891335f1cba9e1e/usr/src/uts/common/netinet/in.h#L1132
|
||||
// https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/netinet/in.h#L696
|
||||
.solaris, .illumos, .driverkit, .ios, .macos, .tvos, .watchos, .visionos => extern struct {
|
||||
ifindex: u32,
|
||||
spec_dst: u32,
|
||||
addr: u32,
|
||||
},
|
||||
else => void,
|
||||
};
|
||||
pub const in6_pktinfo = switch (native_os) {
|
||||
.linux => linux.in6_pktinfo,
|
||||
// https://github.com/freebsd/freebsd-src/blob/9bfbc6826f72eb385bf52f4cde8080bccf7e3ebd/sys/netinet6/in6.h#L547
|
||||
// https://github.com/DragonFlyBSD/DragonFlyBSD/blob/6098912863ed4c7b3f70d7483910ce2956cf4ed3/sys/netinet6/in6.h#L575
|
||||
// https://github.com/NetBSD/src/blob/80bf25a5691072d4755e84567ccbdf0729370dea/sys/netinet6/in6.h#L468
|
||||
// https://github.com/openbsd/src/blob/718a31b40d39fc6064de6355eb144e74633133fc/sys/netinet6/in6.h#L365
|
||||
// https://github.com/kofemann/opensolaris/blob/80192cd83bf665e708269dae856f9145f7190f74/usr/src/uts/common/netinet/in.h#L1093
|
||||
// https://github.com/illumos/illumos-gate/blob/608eb926e14f4ba4736b2d59e891335f1cba9e1e/usr/src/uts/common/netinet/in.h#L114IP1
|
||||
// https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/netinet6/in6.h#L737
|
||||
// https://github.com/haiku/haiku/blob/2aab5f5f14aeb3f34c3a3d9a9064cc3c0d914bea/headers/posix/netinet6/in6.h#L63
|
||||
// https://github.com/SerenityOS/serenity/blob/5bd8af99be0bc4b2e14f361fd7d7590e6bcfa4d6/Kernel/API/POSIX/sys/socket.h#L122
|
||||
.freebsd, .dragonfly, .netbsd, .openbsd, .solaris, .illumos, .driverkit, .ios, .macos, .tvos, .watchos, .visionos, .haiku, .serenity => extern struct {
|
||||
addr: [16]u8,
|
||||
ifindex: u32,
|
||||
},
|
||||
else => void,
|
||||
};
|
||||
pub const itimerspec = switch (native_os) {
|
||||
.linux => linux.itimerspec,
|
||||
.haiku => extern struct {
|
||||
|
||||
@ -4524,6 +4524,19 @@ pub const IPV6 = struct {
|
||||
pub const FREEBIND = 78;
|
||||
};
|
||||
|
||||
// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/in.h?id=64e844505bc08cde3f346f193cbbbab0096fef54#n250
|
||||
pub const in_pktinfo = extern struct {
|
||||
ifindex: i32,
|
||||
spec_dst: u32,
|
||||
addr: u32,
|
||||
};
|
||||
|
||||
// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/ipv6.h?id=f24987ef6959a7efaf79bffd265522c3df18d431#n22
|
||||
pub const in6_pktinfo = extern struct {
|
||||
addr: [16]u8,
|
||||
ifindex: i32,
|
||||
};
|
||||
|
||||
/// IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
|
||||
/// and FCS/CRC (frame check sequence).
|
||||
pub const ETH = struct {
|
||||
|
||||
@ -134,6 +134,8 @@ pub const fd_t = system.fd_t;
|
||||
pub const file_obj = system.file_obj;
|
||||
pub const gid_t = system.gid_t;
|
||||
pub const ifreq = system.ifreq;
|
||||
pub const in_pktinfo = system.in_pktinfo;
|
||||
pub const in6_pktinfo = system.in6_pktinfo;
|
||||
pub const ino_t = system.ino_t;
|
||||
pub const mcontext_t = system.mcontext_t;
|
||||
pub const mode_t = system.mode_t;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user