Type sockaddr [src]

Members

Source

pub const sockaddr = switch (native_os) { .linux, .emscripten => linux.sockaddr, .windows => ws2_32.sockaddr, .macos, .ios, .tvos, .watchos, .visionos => extern struct { len: u8, family: sa_family_t, data: [14]u8, pub const SS_MAXSIZE = 128; pub const storage = extern struct { len: u8 align(8), family: sa_family_t, padding: [126]u8 = undefined, comptime { assert(@sizeOf(storage) == SS_MAXSIZE); assert(@alignOf(storage) == 8); } }; pub const in = extern struct { len: u8 = @sizeOf(in), family: sa_family_t = AF.INET, port: in_port_t, addr: u32, zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 }, }; pub const in6 = extern struct { len: u8 = @sizeOf(in6), family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: [16]u8, scope_id: u32, }; /// UNIX domain socket pub const un = extern struct { len: u8 = @sizeOf(un), family: sa_family_t = AF.UNIX, path: [104]u8, }; }, .freebsd => extern struct { /// total length len: u8, /// address family family: sa_family_t, /// actually longer; address value data: [14]u8, pub const SS_MAXSIZE = 128; pub const storage = extern struct { len: u8 align(8), family: sa_family_t, padding: [126]u8 = undefined, comptime { assert(@sizeOf(storage) == SS_MAXSIZE); assert(@alignOf(storage) == 8); } }; pub const in = extern struct { len: u8 = @sizeOf(in), family: sa_family_t = AF.INET, port: in_port_t, addr: u32, zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 }, }; pub const in6 = extern struct { len: u8 = @sizeOf(in6), family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: [16]u8, scope_id: u32, }; pub const un = extern struct { len: u8 = @sizeOf(un), family: sa_family_t = AF.UNIX, path: [104]u8, }; }, .solaris, .illumos => extern struct { /// address family family: sa_family_t, /// actually longer; address value data: [14]u8, pub const SS_MAXSIZE = 256; pub const storage = extern struct { family: sa_family_t align(8), padding: [254]u8 = undefined, comptime { assert(@sizeOf(storage) == SS_MAXSIZE); assert(@alignOf(storage) == 8); } }; pub const in = extern struct { family: sa_family_t = AF.INET, port: in_port_t, addr: u32, zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 }, }; pub const in6 = extern struct { family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: [16]u8, scope_id: u32, __src_id: u32 = 0, }; /// Definitions for UNIX IPC domain. pub const un = extern struct { family: sa_family_t = AF.UNIX, path: [108]u8, }; }, .netbsd => extern struct { /// total length len: u8, /// address family family: sa_family_t, /// actually longer; address value data: [14]u8, pub const SS_MAXSIZE = 128; pub const storage = extern struct { len: u8 align(8), family: sa_family_t, padding: [126]u8 = undefined, comptime { assert(@sizeOf(storage) == SS_MAXSIZE); assert(@alignOf(storage) == 8); } }; pub const in = extern struct { len: u8 = @sizeOf(in), family: sa_family_t = AF.INET, port: in_port_t, addr: u32, zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 }, }; pub const in6 = extern struct { len: u8 = @sizeOf(in6), family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: [16]u8, scope_id: u32, }; /// Definitions for UNIX IPC domain. pub const un = extern struct { /// total sockaddr length len: u8 = @sizeOf(un), family: sa_family_t = AF.LOCAL, /// path name path: [104]u8, }; }, .dragonfly => extern struct { len: u8, family: sa_family_t, data: [14]u8, pub const SS_MAXSIZE = 128; pub const storage = extern struct { len: u8 align(8), family: sa_family_t, padding: [126]u8 = undefined, comptime { assert(@sizeOf(storage) == SS_MAXSIZE); assert(@alignOf(storage) == 8); } }; pub const in = extern struct { len: u8 = @sizeOf(in), family: sa_family_t = AF.INET, port: in_port_t, addr: u32, zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 }, }; pub const in6 = extern struct { len: u8 = @sizeOf(in6), family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: [16]u8, scope_id: u32, }; pub const un = extern struct { len: u8 = @sizeOf(un), family: sa_family_t = AF.UNIX, path: [104]u8, }; }, .haiku => extern struct { /// total length len: u8, /// address family family: sa_family_t, /// actually longer; address value data: [14]u8, pub const SS_MAXSIZE = 128; pub const storage = extern struct { len: u8 align(8), family: sa_family_t, padding: [126]u8 = undefined, comptime { assert(@sizeOf(storage) == SS_MAXSIZE); assert(@alignOf(storage) == 8); } }; pub const in = extern struct { len: u8 = @sizeOf(in), family: sa_family_t = AF.INET, port: in_port_t, addr: u32, zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 }, }; pub const in6 = extern struct { len: u8 = @sizeOf(in6), family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: [16]u8, scope_id: u32, }; pub const un = extern struct { len: u8 = @sizeOf(un), family: sa_family_t = AF.UNIX, path: [104]u8, }; }, .openbsd => extern struct { /// total length len: u8, /// address family family: sa_family_t, /// actually longer; address value data: [14]u8, pub const SS_MAXSIZE = 256; pub const storage = extern struct { len: u8 align(8), family: sa_family_t, padding: [254]u8 = undefined, comptime { assert(@sizeOf(storage) == SS_MAXSIZE); assert(@alignOf(storage) == 8); } }; pub const in = extern struct { len: u8 = @sizeOf(in), family: sa_family_t = AF.INET, port: in_port_t, addr: u32, zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 }, }; pub const in6 = extern struct { len: u8 = @sizeOf(in6), family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: [16]u8, scope_id: u32, }; /// Definitions for UNIX IPC domain. pub const un = extern struct { /// total sockaddr length len: u8 = @sizeOf(un), family: sa_family_t = AF.LOCAL, /// path name path: [104]u8, }; }, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L110-L114 .serenity => extern struct { family: sa_family_t, data: [26]u8, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/netinet/in.h const in_addr = u32; const in6_addr = [16]u8; pub const in = extern struct { family: sa_family_t = AF.INET, port: in_port_t, addr: in_addr, zero: [8]u8 = @splat(0), }; pub const in6 = extern struct { family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: in6_addr, scope_id: u32, }; // https://github.com/SerenityOS/serenity/blob/b92e6b02e53b2927732f31b1442cad420b62d1ef/Kernel/API/POSIX/sys/un.h const UNIX_PATH_MAX = 108; pub const un = extern struct { family: sa_family_t = AF.LOCAL, path: [UNIX_PATH_MAX]u8, }; }, else => void, }