From c26146a6399908d11a09ba26c482280ac411c58b Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Mon, 19 Oct 2026 13:57:14 +0800 Subject: [PATCH 1/8] feat(c/net): add native libc networking bindings --- c/net/README.md | 24 + c/net/arpa-inet_darwin_arm64.go | 59 +++ c/net/arpa-inet_linux_amd64.go | 73 +++ c/net/asm-generic-socket_linux_amd64.go | 163 ++++++ c/net/asm-generic-sockios_linux_amd64.go | 19 + c/net/bits-netdb_linux_amd64.go | 20 + c/net/bits-sockaddr_linux_amd64.go | 14 + c/net/bits-socket_linux_amd64.go | 272 ++++++++++ c/net/bits-socket_type_linux_amd64.go | 22 + c/net/legacy_native.go | 92 ++++ c/net/llcppg.i_darwin_arm64.go | 8 + c/net/llcppg.i_linux_amd64.go | 8 + c/net/llcppg.pub | 67 ++- c/net/net-if_darwin_arm64.go | 345 ++++++++++++ c/net/net-if_linux_amd64.go | 175 +++++++ c/net/net-if_var_darwin_arm64.go | 95 ++++ c/net/net-net_kev_darwin_arm64.go | 94 ++++ c/net/net.go | 2 +- c/net/netdb_darwin_arm64.go | 302 +++++++++++ c/net/netdb_linux_amd64.go | 609 ++++++++++++++++++++++ c/net/netinet-in_darwin_arm64.go | 633 +++++++++++++++++++++++ c/net/netinet-in_linux_amd64.go | 222 ++++++++ c/net/netinet6-in6_darwin_arm64.go | 409 +++++++++++++++ c/net/rpc-netdb_linux_amd64.go | 45 ++ c/net/sys-socket_darwin_arm64.go | 560 ++++++++++++++++++++ c/net/sys-socket_linux_amd64.go | 92 ++++ c/net/sys-un_darwin_arm64.go | 35 ++ c/net/sys-un_linux_amd64.go | 18 + c/net/types_darwin_arm64.go | 66 +++ c/net/types_linux_amd64.go | 33 ++ 30 files changed, 4572 insertions(+), 4 deletions(-) create mode 100644 c/net/README.md create mode 100644 c/net/arpa-inet_darwin_arm64.go create mode 100644 c/net/arpa-inet_linux_amd64.go create mode 100644 c/net/asm-generic-socket_linux_amd64.go create mode 100644 c/net/asm-generic-sockios_linux_amd64.go create mode 100644 c/net/bits-netdb_linux_amd64.go create mode 100644 c/net/bits-sockaddr_linux_amd64.go create mode 100644 c/net/bits-socket_linux_amd64.go create mode 100644 c/net/bits-socket_type_linux_amd64.go create mode 100644 c/net/legacy_native.go create mode 100644 c/net/llcppg.i_darwin_arm64.go create mode 100644 c/net/llcppg.i_linux_amd64.go create mode 100644 c/net/net-if_darwin_arm64.go create mode 100644 c/net/net-if_linux_amd64.go create mode 100644 c/net/net-if_var_darwin_arm64.go create mode 100644 c/net/net-net_kev_darwin_arm64.go create mode 100644 c/net/netdb_darwin_arm64.go create mode 100644 c/net/netdb_linux_amd64.go create mode 100644 c/net/netinet-in_darwin_arm64.go create mode 100644 c/net/netinet-in_linux_amd64.go create mode 100644 c/net/netinet6-in6_darwin_arm64.go create mode 100644 c/net/rpc-netdb_linux_amd64.go create mode 100644 c/net/sys-socket_darwin_arm64.go create mode 100644 c/net/sys-socket_linux_amd64.go create mode 100644 c/net/sys-un_darwin_arm64.go create mode 100644 c/net/sys-un_linux_amd64.go create mode 100644 c/net/types_darwin_arm64.go create mode 100644 c/net/types_linux_amd64.go diff --git a/c/net/README.md b/c/net/README.md new file mode 100644 index 00000000..e00c826b --- /dev/null +++ b/c/net/README.md @@ -0,0 +1,24 @@ +# C networking bindings + +This package contains native bindings for `arpa/inet.h`, `net/if.h`, `netdb.h`, `netinet/in.h`, `sys/socket.h`, and `sys/un.h`, with the types those headers require. + +The generated Unix bindings are extracted from the [libc bindings](https://github.com/MeteorsLiu/libc/commit/7385771b1366f8ba181672ea0eef9f4951d6b284), generated with llcppg commit `0204f71b7441956a16511c0389dae8c8a2234060`: + +| Target | Header source | Build constraint | +| --- | --- | --- | +| macOS arm64 | macOS 14.0 SDK | `darwin && arm64 && !ios` | +| Linux amd64 | Bootlin glibc 2.44 | `linux && amd64 && !android` | + +Linux support assumes glibc. The existing Windows implementation and the existing fallback for other targets remain selected by their build constraints. + +`legacy_native.go` retains the existing Unix function names and signatures, including `Bind`, `Accept`, `GetHostByName`, `SetSockOpt`, and `Freeaddrinfo`. It also retains the five untyped socket constants so existing `Socket(..., SOCK_STREAM, ...)` calls compile. The generated address types use the existing field names for corresponding C fields; their layout and constants come from each platform's headers. Linux address families use a 16-bit field without the BSD length byte, and Linux `AddrInfo` places `Addr` before `CanOnName`. `In6Addr.U6Addr` remains a byte array with the native IPv6 union alignment. + +`Iovec` is an alias of the shared `c.Iovec` definition, retaining its existing fields and their platform-specific types. + +`llcppg.pub` lists the available network type mappings for dependent bindings. Availability follows the target platform; the manifest combines the platform mappings. + +The extraction keeps networking declarations and their required type declarations, omits duplicate C functions already covered by the retained API, and applies the platform build constraints. + +Known generation omissions include the inherited function skips, macOS packed structures whose generated alignment differs from C, and the Linux `cmsghdr` flexible array and its dependent helper. Opaque forward declarations remain pointer-only types. + +Validation compares C and Go sizes, alignments, and key field offsets, and exercises sockets, address resolution, IP address conversion, and interface names with LLGo on both generated targets. diff --git a/c/net/arpa-inet_darwin_arm64.go b/c/net/arpa-inet_darwin_arm64.go new file mode 100644 index 00000000..238831e2 --- /dev/null +++ b/c/net/arpa-inet_darwin_arm64.go @@ -0,0 +1,59 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +// llgo:link InAddr.InetNtoa C.inet_ntoa +func (self InAddr) InetNtoa() *c.Char { + return nil +} + +//go:linkname InetPton C.inet_pton +func InetPton(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 unsafe.Pointer) c.Int + +//go:linkname Ascii2addr C.ascii2addr +func Ascii2addr(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 unsafe.Pointer) c.Int + +//go:linkname Addr2ascii C.addr2ascii +func Addr2ascii(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.Int, _llcppg_param4 *c.Char) *c.Char + +//go:linkname InetAton C.inet_aton +func InetAton(_llcppg_param1 *c.Char, _llcppg_param2 *InAddr) c.Int + +// llgo:link InAddr.InetLnaof C.inet_lnaof +func (self InAddr) InetLnaof() InAddrT { + return 0 +} + +//go:linkname InetMakeaddr C.inet_makeaddr +func InetMakeaddr(_llcppg_param1 InAddrT, _llcppg_param2 InAddrT) InAddr + +// llgo:link InAddr.InetNetof C.inet_netof +func (self InAddr) InetNetof() InAddrT { + return 0 +} + +//go:linkname InetNetwork C.inet_network +func InetNetwork(_llcppg_param1 *c.Char) InAddrT + +//go:linkname InetNetNtop C.inet_net_ntop +func InetNetNtop(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.Int, _llcppg_param4 *c.Char, _llcppg_param5 X__DarwinSizeT) *c.Char + +//go:linkname InetNetPton C.inet_net_pton +func InetNetPton(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 unsafe.Pointer, _llcppg_param4 X__DarwinSizeT) c.Int + +//go:linkname InetNeta C.inet_neta +func InetNeta(_llcppg_param1 InAddrT, _llcppg_param2 *c.Char, _llcppg_param3 X__DarwinSizeT) *c.Char + +//go:linkname InetNsapAddr C.inet_nsap_addr +func InetNsapAddr(_llcppg_param1 *c.Char, _llcppg_param2 *uint8, _llcppg_param3 c.Int) c.Uint + +//go:linkname InetNsapNtoa C.inet_nsap_ntoa +func InetNsapNtoa(_llcppg_param1 c.Int, _llcppg_param2 *uint8, _llcppg_param3 *c.Char) *c.Char diff --git a/c/net/arpa-inet_linux_amd64.go b/c/net/arpa-inet_linux_amd64.go new file mode 100644 index 00000000..995be261 --- /dev/null +++ b/c/net/arpa-inet_linux_amd64.go @@ -0,0 +1,73 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_ARPA_INET_H = 1 + +// Return the local host address part of the Internet address in IN. +// +// llgo:link InAddr.InetLnaof C.inet_lnaof +func (self InAddr) InetLnaof() InAddrT { + return 0 +} + +// Make Internet host address in network byte order by combining the +// network number NET with the local address HOST. +// +//go:linkname InetMakeaddr C.inet_makeaddr +func InetMakeaddr(__net InAddrT, __host InAddrT) InAddr + +// Return network number part of the Internet address IN. +// +// llgo:link InAddr.InetNetof C.inet_netof +func (self InAddr) InetNetof() InAddrT { + return 0 +} + +// Extract the network number in network byte order from the address +// in numbers-and-dots natation starting at CP. +// +//go:linkname InetNetwork C.inet_network +func InetNetwork(__cp *c.Char) InAddrT + +// Convert Internet number in IN to ASCII representation. The return value +// is a pointer to an internal array containing the string. +// +// llgo:link InAddr.InetNtoa C.inet_ntoa +func (self InAddr) InetNtoa() *c.Char { + return nil +} + +// Convert from presentation format of an Internet number in buffer +// starting at CP to the binary network format and store result for +// interface type AF in buffer starting at BUF. +// +//go:linkname InetPton C.inet_pton +func InetPton(__af c.Int, __cp *c.Char, __buf unsafe.Pointer) c.Int + +// Convert Internet host address from numbers-and-dots notation in CP +// into binary data and store the result in the structure INP. +// +//go:linkname InetAton C.inet_aton +func InetAton(__cp *c.Char, __inp *InAddr) c.Int + +// Convert ASCII representation in hexadecimal form of the Internet +// address to binary form and place result in buffer of length LEN +// starting at BUF. +// +//go:linkname InetNsapAddr C.inet_nsap_addr +func InetNsapAddr(__cp *c.Char, __buf *uint8, __len c.Int) c.Uint + +// Convert internet address in binary form in LEN bytes starting at CP +// a presentation form and place result in BUF. +// +//go:linkname InetNsapNtoa C.inet_nsap_ntoa +func InetNsapNtoa(__len c.Int, __cp *uint8, __buf *c.Char) *c.Char diff --git a/c/net/asm-generic-socket_linux_amd64.go b/c/net/asm-generic-socket_linux_amd64.go new file mode 100644 index 00000000..8e8d2a3c --- /dev/null +++ b/c/net/asm-generic-socket_linux_amd64.go @@ -0,0 +1,163 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +// For setsockopt(2) +const SOL_SOCKET = 1 + +const ( + SO_DEBUG = 1 + SO_REUSEADDR = 2 + SO_TYPE = 3 + SO_ERROR = 4 + SO_DONTROUTE = 5 + SO_BROADCAST = 6 + SO_SNDBUF = 7 + SO_RCVBUF = 8 + SO_SNDBUFFORCE = 32 + SO_RCVBUFFORCE = 33 + SO_KEEPALIVE = 9 + SO_OOBINLINE = 10 + SO_NO_CHECK = 11 + SO_PRIORITY = 12 + SO_LINGER = 13 + SO_BSDCOMPAT = 14 + SO_REUSEPORT = 15 +) + +const ( + SO_PASSCRED = 16 + SO_PEERCRED = 17 + SO_RCVLOWAT = 18 + SO_SNDLOWAT = 19 + SO_RCVTIMEO_OLD = 20 + SO_SNDTIMEO_OLD = 21 +) + +// Security levels - as per NRL IPv6 - don't actually do anything +const ( + SO_SECURITY_AUTHENTICATION = 22 + SO_SECURITY_ENCRYPTION_TRANSPORT = 23 + SO_SECURITY_ENCRYPTION_NETWORK = 24 +) + +const SO_BINDTODEVICE = 25 + +// Socket filtering +const ( + SO_ATTACH_FILTER = 26 + SO_DETACH_FILTER = 27 + SO_GET_FILTER = 26 +) + +const SO_PEERNAME = 28 + +const SO_ACCEPTCONN = 30 + +const ( + SO_PEERSEC = 31 + SO_PASSSEC = 34 +) + +const SO_MARK = 36 + +const ( + SO_PROTOCOL = 38 + SO_DOMAIN = 39 +) + +const SO_RXQ_OVFL = 40 + +const ( + SO_WIFI_STATUS = 41 + SCM_WIFI_STATUS = 41 + SO_PEEK_OFF = 42 +) + +// Instruct lower device to use last 4-bytes of skb data as FCS +const SO_NOFCS = 43 + +const SO_LOCK_FILTER = 44 + +const SO_SELECT_ERR_QUEUE = 45 + +const SO_BUSY_POLL = 46 + +const SO_MAX_PACING_RATE = 47 + +const SO_BPF_EXTENSIONS = 48 + +const SO_INCOMING_CPU = 49 + +const ( + SO_ATTACH_BPF = 50 + SO_DETACH_BPF = 27 +) + +const ( + SO_ATTACH_REUSEPORT_CBPF = 51 + SO_ATTACH_REUSEPORT_EBPF = 52 +) + +const SO_CNX_ADVICE = 53 + +const SCM_TIMESTAMPING_OPT_STATS = 54 + +const SO_MEMINFO = 55 + +const SO_INCOMING_NAPI_ID = 56 + +const SO_COOKIE = 57 + +const SCM_TIMESTAMPING_PKTINFO = 58 + +const SO_PEERGROUPS = 59 + +const SO_ZEROCOPY = 60 + +const ( + SO_TXTIME = 61 + SCM_TXTIME = 61 +) + +const SO_BINDTOIFINDEX = 62 + +const ( + SO_TIMESTAMP_OLD = 29 + SO_TIMESTAMPNS_OLD = 35 + SO_TIMESTAMPING_OLD = 37 +) + +const ( + SO_TIMESTAMP_NEW = 63 + SO_TIMESTAMPNS_NEW = 64 + SO_TIMESTAMPING_NEW = 65 +) + +const ( + SO_RCVTIMEO_NEW = 66 + SO_SNDTIMEO_NEW = 67 +) + +const SO_DETACH_REUSEPORT_BPF = 68 + +// on 64-bit and x32, avoid the ?: operator +const ( + SO_TIMESTAMP = 29 + SO_TIMESTAMPNS = 35 + SO_TIMESTAMPING = 37 +) + +const ( + SO_RCVTIMEO = 20 + SO_SNDTIMEO = 21 +) + +const ( + SCM_TIMESTAMP = 29 + SCM_TIMESTAMPNS = 35 + SCM_TIMESTAMPING = 37 +) diff --git a/c/net/asm-generic-sockios_linux_amd64.go b/c/net/asm-generic-sockios_linux_amd64.go new file mode 100644 index 00000000..b514464b --- /dev/null +++ b/c/net/asm-generic-sockios_linux_amd64.go @@ -0,0 +1,19 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +// Socket-level I/O control calls. +const ( + FIOSETOWN = 35073 + SIOCSPGRP = 35074 + FIOGETOWN = 35075 + SIOCGPGRP = 35076 + SIOCATMARK = 35077 + // Get stamp (timeval) + SIOCGSTAMP_OLD = 35078 + // Get stamp (timespec) + SIOCGSTAMPNS_OLD = 35079 +) diff --git a/c/net/bits-netdb_linux_amd64.go b/c/net/bits-netdb_linux_amd64.go new file mode 100644 index 00000000..1a3e598e --- /dev/null +++ b/c/net/bits-netdb_linux_amd64.go @@ -0,0 +1,20 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" +) + +// Description of data base entry for a single network. NOTE: here a +// poor assumption is made. The network number is expected to fit +// into an unsigned long int variable. +type Netent struct { + NName *c.Char + NAliases **c.Char + NAddrtype c.Int + NNet Uint32T +} diff --git a/c/net/bits-sockaddr_linux_amd64.go b/c/net/bits-sockaddr_linux_amd64.go new file mode 100644 index 00000000..12e4afb6 --- /dev/null +++ b/c/net/bits-sockaddr_linux_amd64.go @@ -0,0 +1,14 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +const X_BITS_SOCKADDR_H = 1 + +// Size of struct sockaddr_storage. +const X_SS_SIZE = 128 + +// POSIX.1g specifies this type name for the `sa_family' member. +type SaFamilyT = uint16 diff --git a/c/net/bits-socket_linux_amd64.go b/c/net/bits-socket_linux_amd64.go new file mode 100644 index 00000000..7689ea2b --- /dev/null +++ b/c/net/bits-socket_linux_amd64.go @@ -0,0 +1,272 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +// Protocol families. +const ( + PF_UNSPEC = 0 + // Local to host (pipes and file-domain). + PF_LOCAL = 1 + // POSIX name for PF_LOCAL. + PF_UNIX = 1 + // Another non-standard name for PF_LOCAL. + PF_FILE = 1 + // IP protocol family. + PF_INET = 2 + // Amateur Radio AX.25. + PF_AX25 = 3 + // Novell Internet Protocol. + PF_IPX = 4 + // Appletalk DDP. + PF_APPLETALK = 5 + // Amateur radio NetROM. + PF_NETROM = 6 + // Multiprotocol bridge. + PF_BRIDGE = 7 + // ATM PVCs. + PF_ATMPVC = 8 + // Reserved for X.25 project. + PF_X25 = 9 + // IP version 6. + PF_INET6 = 10 + // Amateur Radio X.25 PLP. + PF_ROSE = 11 + // Reserved for DECnet project. + PF_DECnet = 12 + // Reserved for 802.2LLC project. + PF_NETBEUI = 13 + // Security callback pseudo AF. + PF_SECURITY = 14 + // PF_KEY key management API. + PF_KEY = 15 + PF_NETLINK = 16 + // Alias to emulate 4.4BSD. + PF_ROUTE = 16 + // Packet family. + PF_PACKET = 17 + // Ash. + PF_ASH = 18 + // Acorn Econet. + PF_ECONET = 19 + // ATM SVCs. + PF_ATMSVC = 20 + // RDS sockets. + PF_RDS = 21 + // Linux SNA Project + PF_SNA = 22 + // IRDA sockets. + PF_IRDA = 23 + // PPPoX sockets. + PF_PPPOX = 24 + // Wanpipe API sockets. + PF_WANPIPE = 25 + // Linux LLC. + PF_LLC = 26 + // Native InfiniBand address. + PF_IB = 27 + // MPLS. + PF_MPLS = 28 + // Controller Area Network. + PF_CAN = 29 + // TIPC sockets. + PF_TIPC = 30 + // Bluetooth sockets. + PF_BLUETOOTH = 31 + // IUCV sockets. + PF_IUCV = 32 + // RxRPC sockets. + PF_RXRPC = 33 + // mISDN sockets. + PF_ISDN = 34 + // Phonet sockets. + PF_PHONET = 35 + // IEEE 802.15.4 sockets. + PF_IEEE802154 = 36 + // CAIF sockets. + PF_CAIF = 37 + // Algorithm sockets. + PF_ALG = 38 + // NFC sockets. + PF_NFC = 39 + // vSockets. + PF_VSOCK = 40 + // Kernel Connection Multiplexor. + PF_KCM = 41 + // Qualcomm IPC Router. + PF_QIPCRTR = 42 + // SMC sockets. + PF_SMC = 43 + // XDP sockets. + PF_XDP = 44 + // Management component transport protocol. + PF_MCTP = 45 + // For now.. + PF_MAX = 46 +) + +// Address families. +const ( + AF_UNSPEC = 0 + AF_LOCAL = 1 + AF_UNIX = 1 + AF_FILE = 1 + AF_INET = 2 + AF_AX25 = 3 + AF_IPX = 4 + AF_APPLETALK = 5 + AF_NETROM = 6 + AF_BRIDGE = 7 + AF_ATMPVC = 8 + AF_X25 = 9 + AF_INET6 = 10 + AF_ROSE = 11 + AF_DECnet = 12 + AF_NETBEUI = 13 + AF_SECURITY = 14 + AF_KEY = 15 + AF_NETLINK = 16 + AF_ROUTE = 16 + AF_PACKET = 17 + AF_ASH = 18 + AF_ECONET = 19 + AF_ATMSVC = 20 + AF_RDS = 21 + AF_SNA = 22 + AF_IRDA = 23 + AF_PPPOX = 24 + AF_WANPIPE = 25 + AF_LLC = 26 + AF_IB = 27 + AF_MPLS = 28 + AF_CAN = 29 + AF_TIPC = 30 + AF_BLUETOOTH = 31 + AF_IUCV = 32 + AF_RXRPC = 33 + AF_ISDN = 34 + AF_PHONET = 35 + AF_IEEE802154 = 36 + AF_CAIF = 37 + AF_ALG = 38 + AF_NFC = 39 + AF_VSOCK = 40 + AF_KCM = 41 + AF_QIPCRTR = 42 + AF_SMC = 43 + AF_XDP = 44 + AF_MCTP = 45 + AF_MAX = 46 +) + +// Socket level values. Others are defined in the appropriate headers. +// +// XXX These definitions also should go into the appropriate headers as +// far as they are available. +const ( + SOL_RAW = 255 + SOL_DECNET = 261 + SOL_X25 = 262 + SOL_PACKET = 263 + // ATM layer (cell level). + SOL_ATM = 264 + // ATM Adaption Layer (packet level). + SOL_AAL = 265 + SOL_IRDA = 266 + SOL_NETBEUI = 267 + SOL_LLC = 268 + SOL_DCCP = 269 + SOL_NETLINK = 270 + SOL_TIPC = 271 + SOL_RXRPC = 272 + SOL_PPPOL2TP = 273 + SOL_BLUETOOTH = 274 + SOL_PNPIPE = 275 + SOL_RDS = 276 + SOL_IUCV = 277 + SOL_CAIF = 278 + SOL_ALG = 279 + SOL_NFC = 280 + SOL_KCM = 281 + SOL_TLS = 282 + SOL_XDP = 283 + SOL_MPTCP = 284 + SOL_MCTP = 285 + SOL_SMC = 286 + SOL_VSOCK = 287 +) + +// Maximum queue length specifiable by listen. +const SOMAXCONN = 4096 + +// Structure describing a generic socket address. +type SockAddr struct { + Family SaFamilyT + Data [14]c.Char +} + +type SockaddrStorage struct { + Family SaFamilyT + pad [118]c.Char + align c.Ulong +} + +// Bits in the FLAGS argument to `send', `recv', et al. +const ( + MSG_OOB = 1 + MSG_PEEK = 2 + MSG_DONTROUTE = 4 + MSG_CTRUNC = 8 + MSG_PROXY = 16 + MSG_TRUNC = 32 + MSG_DONTWAIT = 64 + MSG_EOR = 128 + MSG_WAITALL = 256 + MSG_FIN = 512 + MSG_SYN = 1024 + MSG_CONFIRM = 2048 + MSG_RST = 4096 + MSG_ERRQUEUE = 8192 + MSG_NOSIGNAL = 16384 + MSG_MORE = 32768 + MSG_WAITFORONE = 65536 + MSG_BATCH = 262144 + MSG_SOCK_DEVMEM = 33554432 + MSG_ZEROCOPY = 67108864 + MSG_FASTOPEN = 536870912 + // Set close_on_exit for file + // descriptor received through + // SCM_RIGHTS. + MSG_CMSG_CLOEXEC = 1073741824 +) + +// Structure describing messages sent by +// `sendmsg' and received by `recvmsg'. +type Msghdr struct { + MsgName unsafe.Pointer + MsgNamelen SocklenT + MsgIov *Iovec + MsgIovlen c.SizeT + MsgControl unsafe.Pointer + MsgControllen c.SizeT + MsgFlags c.Int +} + +// Socket level message types. This must match the definitions in +// . +const SCM_RIGHTS = 1 + +// Structure used to manipulate the SO_LINGER option. +type Linger struct { + LOnoff c.Int + LLinger c.Int +} + +type SocklenT = X__SocklenT diff --git a/c/net/bits-socket_type_linux_amd64.go b/c/net/bits-socket_type_linux_amd64.go new file mode 100644 index 00000000..67d46b99 --- /dev/null +++ b/c/net/bits-socket_type_linux_amd64.go @@ -0,0 +1,22 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" +) + +// Types of sockets. +type X__SocketType c.Uint + +const ( + SOCK_DCCP X__SocketType = 6 + SOCK_PACKET X__SocketType = 10 + SOCK_CLOEXEC X__SocketType = 524288 + // Atomically mark descriptor(s) as + // non-blocking. + SOCK_NONBLOCK X__SocketType = 2048 +) diff --git a/c/net/legacy_native.go b/c/net/legacy_native.go new file mode 100644 index 00000000..1bf6b253 --- /dev/null +++ b/c/net/legacy_native.go @@ -0,0 +1,92 @@ +//go:build (darwin && arm64 && !ios) || (linux && amd64 && !android) + +/* + * Copyright (c) 2024 The XGo Authors (xgo.dev). All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net + +import ( + "unsafe" + + "github.com/goplus/lib/c" +) + +// Keep the existing untyped constants usable with Socket's c.Int parameter. +const ( + SOCK_STREAM = 1 + SOCK_DGRAM = 2 + SOCK_RAW = 3 + SOCK_RDM = 4 + SOCK_SEQPACKET = 5 +) + +const ( + ALIGNSIZE = unsafe.Sizeof(c.LongLong(0)) + MAXSIZE = 128 + PAD1_SIZE = ALIGNSIZE - unsafe.Sizeof(byte(0)) - unsafe.Sizeof(byte(0)) + PAD2_SIZE = MAXSIZE - unsafe.Sizeof(byte(0)) - unsafe.Sizeof(byte(0)) - PAD1_SIZE - ALIGNSIZE +) + +//go:linkname Socket C.socket +func Socket(domain c.Int, typ c.Int, protocol c.Int) c.Int + +//go:linkname Bind C.bind +func Bind(sockfd c.Int, addr *SockaddrIn, addrlen c.Uint) c.Int + +//go:linkname Connect C.connect +func Connect(sockfd c.Int, addr *SockAddr, addrlen c.Uint) c.Int + +//go:linkname Listen C.listen +func Listen(sockfd c.Int, backlog c.Int) c.Int + +//go:linkname Accept C.accept +func Accept(sockfd c.Int, addr *SockaddrIn, addrlen *c.Uint) c.Int + +//go:linkname GetHostByName C.gethostbyname +func GetHostByName(name *c.Char) *Hostent + +//go:linkname InetNtop C.inet_ntop +func InetNtop(af c.Int, src c.Pointer, dst *c.Char, size c.Uint) *c.Char + +//go:linkname InetAddr C.inet_addr +func InetAddr(s *c.Char) c.Uint + +//go:linkname Send C.send +func Send(c.Int, c.Pointer, uintptr, c.Int) c.Long + +//go:linkname Recv C.recv +func Recv(c.Int, c.Pointer, uintptr, c.Int) c.Long + +//go:linkname SetSockOpt C.setsockopt +func SetSockOpt(socket c.Int, level c.Int, optionName c.Int, optionValue c.Pointer, sockLen c.Uint) c.Int + +//go:linkname Ntohs C.ntohs +func Ntohs(x uint16) uint16 + +//go:linkname Htons C.htons +func Htons(x uint16) uint16 + +//go:linkname Ntohl C.ntohl +func Ntohl(x c.Uint) c.Uint + +//go:linkname Htonl C.htonl +func Htonl(x c.Uint) c.Uint + +//go:linkname Getaddrinfo C.getaddrinfo +func Getaddrinfo(host *c.Char, port *c.Char, addrInfo *AddrInfo, result **AddrInfo) c.Int + +//go:linkname Freeaddrinfo C.freeaddrinfo +func Freeaddrinfo(addrInfo *AddrInfo) diff --git a/c/net/llcppg.i_darwin_arm64.go b/c/net/llcppg.i_darwin_arm64.go new file mode 100644 index 00000000..74ba64e7 --- /dev/null +++ b/c/net/llcppg.i_darwin_arm64.go @@ -0,0 +1,8 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package net + +const XGoPackage = true +const LLGoPackage = "link: -lSystem" diff --git a/c/net/llcppg.i_linux_amd64.go b/c/net/llcppg.i_linux_amd64.go new file mode 100644 index 00000000..a9e57d9d --- /dev/null +++ b/c/net/llcppg.i_linux_amd64.go @@ -0,0 +1,8 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +const XGoPackage = true +const LLGoPackage = "link: -lc" diff --git a/c/net/llcppg.pub b/c/net/llcppg.pub index a467ee4b..f8350061 100644 --- a/c/net/llcppg.pub +++ b/c/net/llcppg.pub @@ -1,3 +1,64 @@ -sockaddr SockAddr -hostent Hostent -addrinfo AddrInfo +D github.com/goplus/lib/c +T __sockaddr_header X__SockaddrHeader +T __socket_type X__SocketType +T addrinfo AddrInfo +T cmsghdr Cmsghdr +T group_filter GroupFilter +T group_req GroupReq +T group_source_req GroupSourceReq +T hostent Hostent +T if_clonereq IfClonereq +T if_data IfData +T if_msghdr IfMsghdr +T if_nameindex IfNameindex +T ifa_msghdr IfaMsghdr +T iface Iface +T ifaddr Ifaddr +T ifaliasreq Ifaliasreq +T ifconf Ifconf +T ifdevmtu Ifdevmtu +T ifkpi Ifkpi +T ifma_msghdr IfmaMsghdr +T ifma_msghdr2 IfmaMsghdr2 +T ifmap Ifmap +T ifnet_interface_advisory IfnetInterfaceAdvisory +T ifqueue Ifqueue +T ifreq Ifreq +T ifstat Ifstat +T in6_addr In6Addr +T in6_addr_t In6AddrT +T in6_pktinfo In6Pktinfo +T in_addr InAddr +T in_addr_t InAddrT +T in_pktinfo InPktinfo +T in_port_t InPortT +T ip6_mtuinfo Ip6Mtuinfo +T ip_mreq IpMreq +T ip_mreq_source IpMreqSource +T ip_mreqn IpMreqn +T ip_msfilter IpMsfilter +T ip_opts IpOpts +T ipv6_mreq Ipv6Mreq +T kev_dl_proto_data KevDlProtoData +T linger Linger +T msghdr Msghdr +T net_event_data NetEventData +T netent Netent +T protoent Protoent +T rpcent Rpcent +T rslvmulti_req RslvmultiReq +T sa_endpoints SaEndpoints +T sa_endpoints_t SaEndpointsT +T sa_family_t SaFamilyT +T sae_associd_t SaeAssocidT +T sae_connid_t SaeConnidT +T servent Servent +T sf_hdtr SfHdtr +T so_np_extensions SoNpExtensions +T sockaddr SockAddr +T sockaddr_in SockaddrIn +T sockaddr_in6 SockaddrIn6 +T sockaddr_storage SockaddrStorage +T sockaddr_un SockaddrUn +T socklen_t SocklenT +T sockproto Sockproto diff --git a/c/net/net-if_darwin_arm64.go b/c/net/net-if_darwin_arm64.go new file mode 100644 index 00000000..c91300e8 --- /dev/null +++ b/c/net/net-if_darwin_arm64.go @@ -0,0 +1,345 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const IF_NAMESIZE = 16 + +const ( + // interface is up + IFF_UP = 1 + // broadcast address valid + IFF_BROADCAST = 2 + // turn on debugging + IFF_DEBUG = 4 + // is a loopback net + IFF_LOOPBACK = 8 + // interface is point-to-point link + IFF_POINTOPOINT = 16 + // obsolete: avoid use of trailers + IFF_NOTRAILERS = 32 + // resources allocated + IFF_RUNNING = 64 + // no address resolution protocol + IFF_NOARP = 128 + // receive all packets + IFF_PROMISC = 256 + // receive all multicast packets + IFF_ALLMULTI = 512 + // transmission in progress + IFF_OACTIVE = 1024 + // can't hear own transmissions + IFF_SIMPLEX = 2048 + // per link layer defined bit + IFF_LINK0 = 4096 + // per link layer defined bit + IFF_LINK1 = 8192 + // per link layer defined bit + IFF_LINK2 = 16384 + // use alternate physical connection + IFF_ALTPHYS = 16384 + // supports multicast + IFF_MULTICAST = 32768 +) + +// Capabilities that interfaces can advertise. +// +// struct ifnet.if_capabilities +// +// contains the optional features & capabilities a particular interface +// supports (not only the driver but also the detected hw revision). +// Capabilities are defined by IFCAP_* below. +// +// struct ifnet.if_capenable +// +// contains the enabled (either by default or through ifconfig) optional +// features & capabilities on this interface. +// Capabilities are defined by IFCAP_* below. +// +// struct if_data.ifi_hwassist in IFNET_* form, defined in net/kpi_interface.h, +// +// contains the enabled optional features & capabilites that can be used +// individually per packet and are specified in the mbuf pkthdr.csum_flags +// field. IFCAP_* and IFNET_* do not match one to one and IFNET_* may be +// more detailed or differentiated than IFCAP_*. +// IFNET_* hwassist flags have corresponding CSUM_* in sys/mbuf.h +const ( + IFCAP_RXCSUM = 1 + // can offload checksum on TX + IFCAP_TXCSUM = 2 + // VLAN-compatible MTU + IFCAP_VLAN_MTU = 4 + // hardware VLAN tag support + IFCAP_VLAN_HWTAGGING = 8 + // 9000 byte MTU supported + IFCAP_JUMBO_MTU = 16 + // can do TCP Segmentation Offload + IFCAP_TSO4 = 32 + // can do TCP6 Segmentation Offload + IFCAP_TSO6 = 64 + // can do Large Receive Offload + IFCAP_LRO = 128 + // can do 802.1 AV Bridging + IFCAP_AV = 256 + // can return linklevel xmit status + IFCAP_TXSTATUS = 512 + // Skywalk mode supported/enabled + IFCAP_SKYWALK = 1024 + // Time stamping in hardware + IFCAP_HW_TIMESTAMP = 2048 + // Time stamping in software + IFCAP_SW_TIMESTAMP = 4096 + // can offload partial checksum + IFCAP_CSUM_PARTIAL = 8192 + // can invert 0 to -0 (0xffff) + IFCAP_CSUM_ZERO_INVERT = 16384 +) + +const ( + IFCAP_HWCSUM = 3 + IFCAP_TSO = 96 +) + +const IFCAP_VALID = 32767 + +const ( + IFQ_MAXLEN = 128 + // granularity is 1 second + IFNET_SLOWHZ = 1 +) + +// Wake capabilities of a interface +const IF_WAKE_ON_MAGIC_PACKET = 1 + +const ( + IFRTYPE_FUNCTIONAL_UNKNOWN = 0 + IFRTYPE_FUNCTIONAL_LOOPBACK = 1 + IFRTYPE_FUNCTIONAL_WIRED = 2 + IFRTYPE_FUNCTIONAL_WIFI_INFRA = 3 + IFRTYPE_FUNCTIONAL_WIFI_AWDL = 4 + IFRTYPE_FUNCTIONAL_CELLULAR = 5 + IFRTYPE_FUNCTIONAL_INTCOPROC = 6 + IFRTYPE_FUNCTIONAL_COMPANIONLINK = 7 + IFRTYPE_FUNCTIONAL_MANAGEMENT = 8 + IFRTYPE_FUNCTIONAL_LAST = 8 +) + +// 10 lines of text +const IFSTATMAX = 800 + +type IfClonereq struct { + IfcrTotal c.Int + IfcrCount c.Int + IfcrBuffer *c.Char +} + +// Message format for use in obtaining information about interfaces +// from sysctl and the routing socket +type IfMsghdr struct { + IfmMsglen uint16 + IfmVersion uint8 + IfmType uint8 + IfmAddrs c.Int + IfmFlags c.Int + IfmIndex uint16 + IfmData IfData +} + +// Message format for use in obtaining information about interface addresses +// from sysctl and the routing socket +type IfaMsghdr struct { + IfamMsglen uint16 + IfamVersion uint8 + IfamType uint8 + IfamAddrs c.Int + IfamFlags c.Int + IfamIndex uint16 + IfamMetric c.Int +} + +// Message format for use in obtaining information about multicast addresses +// from the routing socket +type IfmaMsghdr struct { + IfmamMsglen uint16 + IfmamVersion uint8 + IfmamType uint8 + IfmamAddrs c.Int + IfmamFlags c.Int + IfmamIndex uint16 +} + +// Message format for use in obtaining information about multicast addresses +// from sysctl +type IfmaMsghdr2 struct { + IfmamMsglen UShort + IfmamVersion UChar + IfmamType UChar + IfmamAddrs c.Int + IfmamFlags c.Int + IfmamIndex UShort + IfmamRefcount Int32T +} + +// ifdevmtu: interface device mtu +// +// Used with SIOCGIFDEVMTU to get the current mtu in use by the device, +// as well as the minimum and maximum mtu allowed by the device. +type Ifdevmtu struct { + IfdmCurrent c.Int + IfdmMin c.Int + IfdmMax c.Int +} + +type Ifkpi struct { + IfkModuleId c.Uint + IfkType c.Uint + IfkData _llcppg_anon_1 +} + +type Ifreq struct { + IfrName [16]c.Char + IfrIfru _llcppg_anon_2 +} + +type Ifaliasreq struct { + IfraName [16]c.Char + IfraAddr SockAddr + IfraBroadaddr SockAddr + IfraMask SockAddr +} + +type RslvmultiReq struct { + Sa *SockAddr + Llsa **SockAddr +} + +type Ifstat struct { + IfsName [16]c.Char + Ascii [801]c.Char +} + +type Ifconf struct { + IfcLen c.Int + IfcIfcu _llcppg_anon_3 +} + +// DLIL KEV_DL_PROTO_ATTACHED/DETACHED structure +type KevDlProtoData struct { + LinkData NetEventData + ProtoFamily UInt32T + ProtoRemainingCount UInt32T +} + +type IfNameindex struct { + IfIndex c.Uint + IfName *c.Char +} + +type _llcppg_anon_1 struct { + _xgo_union [2]uint32 +} + +type _llcppg_anon_2 struct { + _xgo_union [2]uint64 +} + +type _llcppg_anon_3 struct { + _xgo_union [2]uint32 +} + +func (p *_llcppg_anon_1) XGof_ref_ifk_ptr() *unsafe.Pointer { + return (*unsafe.Pointer)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_1) XGof_ref_ifk_value() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_addr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_dstaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_broadaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_flags() *int16 { + return (*int16)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_metric() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_mtu() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_phys() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_media() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_intval() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_data() *CaddrT { + return (*CaddrT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_devmtu() *Ifdevmtu { + return (*Ifdevmtu)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_kpi() *Ifkpi { + return (*Ifkpi)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_wake_flags() *UInt32T { + return (*UInt32T)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_route_refcnt() *UInt32T { + return (*UInt32T)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_cap() *[2]c.Int { + return (*[2]c.Int)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifru_functional_type() *UInt32T { + return (*UInt32T)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifcu_buf() *CaddrT { + return (*CaddrT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifcu_req() **Ifreq { + return (**Ifreq)(unsafe.Pointer(p)) +} + +//go:linkname IfNametoindex C.if_nametoindex +func IfNametoindex(_llcppg_param1 *c.Char) c.Uint + +//go:linkname IfIndextoname C.if_indextoname +func IfIndextoname(_llcppg_param1 c.Uint, _llcppg_param2 *c.Char) *c.Char + +// llgo:link (*IfNameindex).IfFreenameindex C.if_freenameindex +func (self *IfNameindex) IfFreenameindex() { +} diff --git a/c/net/net-if_linux_amd64.go b/c/net/net-if_linux_amd64.go new file mode 100644 index 00000000..acdc878b --- /dev/null +++ b/c/net/net-if_linux_amd64.go @@ -0,0 +1,175 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_NET_IF_H = 1 + +// Length of interface name. +const IF_NAMESIZE = 16 + +const ( + IFHWADDRLEN = 6 + IFNAMSIZ = 16 +) + +type IfNameindex struct { + IfIndex c.Uint + IfName *c.Char +} + +// Standard interface flags. +const ( + IFF_UP = 1 + IFF_BROADCAST = 2 + IFF_DEBUG = 4 + IFF_LOOPBACK = 8 + IFF_POINTOPOINT = 16 + IFF_NOTRAILERS = 32 + IFF_RUNNING = 64 + IFF_NOARP = 128 + IFF_PROMISC = 256 + // Not supported + IFF_ALLMULTI = 512 + IFF_MASTER = 1024 + IFF_SLAVE = 2048 + IFF_MULTICAST = 4096 + IFF_PORTSEL = 8192 + IFF_AUTOMEDIA = 16384 + // Dialup device with changing addresses. + IFF_DYNAMIC = 32768 +) + +type Ifaddr struct { + IfaAddr SockAddr + IfaIfu _llcppg_anon_1 + IfaIfp *Iface + IfaNext *Ifaddr +} + +type Ifmap struct { + MemStart c.Ulong + MemEnd c.Ulong + BaseAddr uint16 + Irq uint8 + Dma uint8 + Port uint8 +} + +type Ifreq struct { + IfrIfrn _llcppg_anon_2 + IfrIfru _llcppg_anon_3 +} + +type Ifconf struct { + IfcLen c.Int + IfcIfcu _llcppg_anon_4 +} + +type _llcppg_anon_1 struct { + _xgo_union [8]uint16 +} + +type Iface struct { +} + +type _llcppg_anon_2 struct { + _xgo_union [16]uint8 +} + +type _llcppg_anon_3 struct { + _xgo_union [3]uint64 +} + +type _llcppg_anon_4 struct { + _xgo_union [1]uint64 +} + +func (p *_llcppg_anon_1) XGof_ref_ifu_broadaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_1) XGof_ref_ifu_dstaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_2) XGof_ref_ifrn_name() *[16]c.Char { + return (*[16]c.Char)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_addr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_dstaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_broadaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_netmask() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_hwaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_flags() *int16 { + return (*int16)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_ivalue() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_mtu() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_map() *Ifmap { + return (*Ifmap)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_slave() *[16]c.Char { + return (*[16]c.Char)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_newname() *[16]c.Char { + return (*[16]c.Char)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_data() *X__CaddrT { + return (*X__CaddrT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_4) XGof_ref_ifcu_buf() *X__CaddrT { + return (*X__CaddrT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_4) XGof_ref_ifcu_req() **Ifreq { + return (**Ifreq)(unsafe.Pointer(p)) +} + +// Convert an interface name to an index, and vice versa. +// +//go:linkname IfNametoindex C.if_nametoindex +func IfNametoindex(__ifname *c.Char) c.Uint + +//go:linkname IfIndextoname C.if_indextoname +func IfIndextoname(__ifindex c.Uint, __ifname *c.Char) *c.Char + +// Free the data returned from if_nameindex. +// +// llgo:link (*IfNameindex).IfFreenameindex C.if_freenameindex +func (self *IfNameindex) IfFreenameindex() { +} diff --git a/c/net/net-if_var_darwin_arm64.go b/c/net/net-if_var_darwin_arm64.go new file mode 100644 index 00000000..13d2efa1 --- /dev/null +++ b/c/net/net-if_var_darwin_arm64.go @@ -0,0 +1,95 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const ( + APPLE_IF_FAM_LOOPBACK = 1 + APPLE_IF_FAM_ETHERNET = 2 + APPLE_IF_FAM_SLIP = 3 + APPLE_IF_FAM_TUN = 4 + APPLE_IF_FAM_VLAN = 5 + APPLE_IF_FAM_PPP = 6 + APPLE_IF_FAM_PVC = 7 + APPLE_IF_FAM_DISC = 8 + APPLE_IF_FAM_MDECAP = 9 + APPLE_IF_FAM_GIF = 10 + // deprecated + APPLE_IF_FAM_FAITH = 11 + APPLE_IF_FAM_STF = 12 + APPLE_IF_FAM_FIREWIRE = 13 + APPLE_IF_FAM_BOND = 14 + APPLE_IF_FAM_CELLULAR = 15 + // Un-used + APPLE_IF_FAM_UNUSED_16 = 16 + APPLE_IF_FAM_UTUN = 17 + APPLE_IF_FAM_IPSEC = 18 +) + +// 72 was chosen below because it is the size of a TCP/IP +// header (40) + the minimum mss (32). +const ( + IF_MINMTU = 72 + IF_MAXMTU = 65535 +) + +const IFNAMSIZ = 16 + +type NetEventData struct { + IfFamily UInt32T + IfUnit UInt32T + IfName [16]c.Char +} + +// Structure describing information about an interface +// which may be of interest to management entities. +type IfData struct { + IfiType UChar + IfiTypelen UChar + IfiPhysical UChar + IfiAddrlen UChar + IfiHdrlen UChar + IfiRecvquota UChar + IfiXmitquota UChar + IfiUnused1 UChar + IfiMtu UInt32T + IfiMetric UInt32T + IfiBaudrate UInt32T + IfiIpackets UInt32T + IfiIerrors UInt32T + IfiOpackets UInt32T + IfiOerrors UInt32T + IfiCollisions UInt32T + IfiIbytes UInt32T + IfiObytes UInt32T + IfiImcasts UInt32T + IfiOmcasts UInt32T + IfiIqdrops UInt32T + IfiNoproto UInt32T + IfiRecvtiming UInt32T + IfiXmittiming UInt32T + IfiLastchange Timeval32 + IfiUnused2 UInt32T + IfiHwassist UInt32T + IfiReserved1 UInt32T + IfiReserved2 UInt32T +} + +// Structure defining a queue for a network interface. +type Ifqueue struct { + IfqHead unsafe.Pointer + IfqTail unsafe.Pointer + IfqLen c.Int + IfqMaxlen c.Int + IfqDrops c.Int +} + +type IfnetInterfaceAdvisory struct { +} diff --git a/c/net/net-net_kev_darwin_arm64.go b/c/net/net-net_kev_darwin_arm64.go new file mode 100644 index 00000000..5cd2a094 --- /dev/null +++ b/c/net/net-net_kev_darwin_arm64.go @@ -0,0 +1,94 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +// Kernel event subclass identifiers for KEV_NETWORK_CLASS +const KEV_INET_SUBCLASS = 1 + +// KEV_INET_SUBCLASS event codes +const ( + KEV_INET_NEW_ADDR = 1 + // Address changed event + KEV_INET_CHANGED_ADDR = 2 + // IPv6 address was deleted + KEV_INET_ADDR_DELETED = 3 + // Dest. address was set + KEV_INET_SIFDSTADDR = 4 + // Broadcast address was set + KEV_INET_SIFBRDADDR = 5 + // Netmask was set + KEV_INET_SIFNETMASK = 6 + // ARP collision detected + KEV_INET_ARPCOLLISION = 7 +) + +// use ken_in_portinuse +const KEV_INET_PORTINUSE = 8 + +const ( + // ARP resolution failed for router + KEV_INET_ARPRTRFAILURE = 9 + // ARP resolution succeeded for router + KEV_INET_ARPRTRALIVE = 10 +) + +// Data Link subclass +const KEV_DL_SUBCLASS = 2 + +// Define Data-Link event subclass, and associated +// events. +const ( + KEV_DL_SIFFLAGS = 1 + KEV_DL_SIFMETRICS = 2 + KEV_DL_SIFMTU = 3 + KEV_DL_SIFPHYS = 4 + KEV_DL_SIFMEDIA = 5 + KEV_DL_SIFGENERIC = 6 + KEV_DL_ADDMULTI = 7 + KEV_DL_DELMULTI = 8 + KEV_DL_IF_ATTACHED = 9 + KEV_DL_IF_DETACHING = 10 + KEV_DL_IF_DETACHED = 11 + KEV_DL_LINK_OFF = 12 + KEV_DL_LINK_ON = 13 + KEV_DL_PROTO_ATTACHED = 14 + KEV_DL_PROTO_DETACHED = 15 + KEV_DL_LINK_ADDRESS_CHANGED = 16 + KEV_DL_WAKEFLAGS_CHANGED = 17 + KEV_DL_IF_IDLE_ROUTE_REFCNT = 18 + KEV_DL_IFCAP_CHANGED = 19 + KEV_DL_LINK_QUALITY_METRIC_CHANGED = 20 + KEV_DL_NODE_PRESENCE = 21 + KEV_DL_NODE_ABSENCE = 22 + KEV_DL_PRIMARY_ELECTED = 23 + KEV_DL_ISSUES = 24 + KEV_DL_IFDELEGATE_CHANGED = 25 + KEV_DL_AWDL_RESTRICTED = 26 + KEV_DL_AWDL_UNRESTRICTED = 27 + KEV_DL_RRC_STATE_CHANGED = 28 + KEV_DL_QOS_MODE_CHANGED = 29 + KEV_DL_LOW_POWER_MODE_CHANGED = 30 +) + +// inet6 subclass +const KEV_INET6_SUBCLASS = 6 + +// KEV_INET6_SUBCLASS event codes +const ( + KEV_INET6_NEW_USER_ADDR = 1 + // Address changed event (future) + KEV_INET6_CHANGED_ADDR = 2 + // IPv6 address was deleted + KEV_INET6_ADDR_DELETED = 3 + // Autoconf LL address appeared + KEV_INET6_NEW_LL_ADDR = 4 + // Autoconf address has appeared + KEV_INET6_NEW_RTADV_ADDR = 5 + // Default router detected + KEV_INET6_DEFROUTER = 6 + // Asking for the NAT64-prefix + KEV_INET6_REQUEST_NAT64_PREFIX = 7 +) diff --git a/c/net/net.go b/c/net/net.go index db106144..b7d685b6 100644 --- a/c/net/net.go +++ b/c/net/net.go @@ -1,4 +1,4 @@ -//go:build !windows +//go:build !windows && !(darwin && arm64 && !ios) && !(linux && amd64 && !android) /* * Copyright (c) 2024 The XGo Authors (xgo.dev). All rights reserved. diff --git a/c/net/netdb_darwin_arm64.go b/c/net/netdb_darwin_arm64.go new file mode 100644 index 00000000..32bb6e73 --- /dev/null +++ b/c/net/netdb_darwin_arm64.go @@ -0,0 +1,302 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_PATH_HEQUIV = "/etc/hosts.equiv" + +const ( + X_PATH_HOSTS = "/etc/hosts" + X_PATH_NETWORKS = "/etc/networks" + X_PATH_PROTOCOLS = "/etc/protocols" + X_PATH_SERVICES = "/etc/services" +) + +const ( + // see errno + NETDB_INTERNAL = -1 + // no problem + NETDB_SUCCESS = 0 +) + +const ( + // Authoritative Answer Host not found + HOST_NOT_FOUND = 1 + // Non-Authoritative Host not found, or SERVERFAIL + TRY_AGAIN = 2 + // Non recoverable errors, FORMERR, REFUSED, NOTIMP + NO_RECOVERY = 3 + // Valid name, no data record of requested type + NO_DATA = 4 +) + +// no address, look for MX record +const NO_ADDRESS = 4 + +// address family for hostname not supported +const EAI_ADDRFAMILY = 1 + +const ( + // temporary failure in name resolution + EAI_AGAIN = 2 + // invalid value for ai_flags + EAI_BADFLAGS = 3 + // non-recoverable failure in name resolution + EAI_FAIL = 4 + // ai_family not supported + EAI_FAMILY = 5 + // memory allocation failure + EAI_MEMORY = 6 +) + +// no address associated with hostname +const EAI_NODATA = 7 + +const ( + // hostname nor servname provided, or not known + EAI_NONAME = 8 + // servname not supported for ai_socktype + EAI_SERVICE = 9 + // ai_socktype not supported + EAI_SOCKTYPE = 10 + // system error returned in errno + EAI_SYSTEM = 11 +) + +const ( + // invalid value for hints + EAI_BADHINTS = 12 + // resolved protocol is unknown + EAI_PROTOCOL = 13 +) + +// argument buffer overflow +const EAI_OVERFLOW = 14 + +const EAI_MAX = 15 + +// Flag values for getaddrinfo() +const ( + AI_PASSIVE = 1 + // fill ai_canonname + AI_CANONNAME = 2 + // prevent host name resolution + AI_NUMERICHOST = 4 + // prevent service name resolution + AI_NUMERICSERV = 4096 +) + +// IPv6 and IPv4-mapped (with AI_V4MAPPED) +const AI_ALL = 256 + +// accept IPv4-mapped if kernel supports +const AI_V4MAPPED_CFG = 512 + +const ( + // only if any address is assigned + AI_ADDRCONFIG = 1024 + // accept IPv4-mapped IPv6 address + AI_V4MAPPED = 2048 +) + +// If the hints pointer is null or ai_flags is zero, getaddrinfo() automatically defaults to the AI_DEFAULT behavior. +// To override this default behavior, thereby causing unusable addresses to be included in the results, pass any nonzero +// value for ai_flags, by setting any desired flag values, or by setting AI_UNUSABLE if no other flags are desired. +const AI_DEFAULT = 1536 + +// If the hints pointer is null or ai_flags is zero, getaddrinfo() automatically defaults to the AI_DEFAULT behavior. +// To override this default behavior, thereby causing unusable addresses to be included in the results, pass any nonzero +// value for ai_flags, by setting any desired flag values, or by setting AI_UNUSABLE if no other flags are desired. +const AI_UNUSABLE = 268435456 + +const ( + NI_MAXHOST = 1025 + NI_MAXSERV = 32 +) + +// Flag values for getnameinfo() +const ( + NI_NOFQDN = 1 + NI_NUMERICHOST = 2 + NI_NAMEREQD = 4 + NI_NUMERICSERV = 8 + NI_NUMERICSCOPE = 256 + NI_DGRAM = 16 +) + +const NI_WITHSCOPEID = 32 + +// Structures returned by network data base library. All addresses are +// supplied in host order, and returned in network order (suitable for +// use in system calls). +type Hostent struct { + Name *c.Char + Aliases **c.Char + AddrType c.Int + Length c.Int + AddrList **c.Char +} + +// Assumption here is that a network number +// fits in an unsigned long -- probably a poor one. +type Netent struct { + NName *c.Char + NAliases **c.Char + NAddrtype c.Int + NNet Uint32T +} + +type Servent struct { + SName *c.Char + SAliases **c.Char + SPort c.Int + SProto *c.Char +} + +type Protoent struct { + PName *c.Char + PAliases **c.Char + PProto c.Int +} + +type AddrInfo struct { + Flags c.Int + Family c.Int + SockType c.Int + Protocol c.Int + AddrLen SocklenT + CanOnName *c.Char + Addr *SockAddr + Next *AddrInfo +} + +type Rpcent struct { + RName *c.Char + RAliases **c.Char + RNumber c.Int +} + +//go:linkname HErrno C.h_errno +var HErrno c.Int + +//go:linkname Endhostent C.endhostent +func Endhostent() + +//go:linkname Endnetent C.endnetent +func Endnetent() + +//go:linkname Endprotoent C.endprotoent +func Endprotoent() + +//go:linkname Endservent C.endservent +func Endservent() + +//go:linkname GaiStrerror C.gai_strerror +func GaiStrerror(_llcppg_param1 c.Int) *c.Char + +//go:linkname Gethostbyaddr C.gethostbyaddr +func Gethostbyaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int) *Hostent + +//go:linkname Gethostent C.gethostent +func Gethostent() *Hostent + +// llgo:link (*SockAddr).Getnameinfo C.getnameinfo +func (self *SockAddr) Getnameinfo(_llcppg_param2 SocklenT, _llcppg_param3 *c.Char, _llcppg_param4 SocklenT, _llcppg_param5 *c.Char, _llcppg_param6 SocklenT, _llcppg_param7 c.Int) c.Int { + return 0 +} + +//go:linkname Getnetbyaddr C.getnetbyaddr +func Getnetbyaddr(_llcppg_param1 Uint32T, _llcppg_param2 c.Int) *Netent + +//go:linkname Getnetbyname C.getnetbyname +func Getnetbyname(_llcppg_param1 *c.Char) *Netent + +//go:linkname Getnetent C.getnetent +func Getnetent() *Netent + +//go:linkname Getprotobyname C.getprotobyname +func Getprotobyname(_llcppg_param1 *c.Char) *Protoent + +//go:linkname Getprotobynumber C.getprotobynumber +func Getprotobynumber(_llcppg_param1 c.Int) *Protoent + +//go:linkname Getprotoent C.getprotoent +func Getprotoent() *Protoent + +//go:linkname Getservbyname C.getservbyname +func Getservbyname(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) *Servent + +//go:linkname Getservbyport C.getservbyport +func Getservbyport(_llcppg_param1 c.Int, _llcppg_param2 *c.Char) *Servent + +//go:linkname Getservent C.getservent +func Getservent() *Servent + +// void sethostfile(const char *); +// +//go:linkname Sethostent C.sethostent +func Sethostent(_llcppg_param1 c.Int) + +// void sethostfile(const char *); +// +//go:linkname Setnetent C.setnetent +func Setnetent(_llcppg_param1 c.Int) + +//go:linkname Setprotoent C.setprotoent +func Setprotoent(_llcppg_param1 c.Int) + +//go:linkname Setservent C.setservent +func Setservent(_llcppg_param1 c.Int) + +// llgo:link (*Hostent).Free C.freehostent +func (self *Hostent) Free() { +} + +//go:linkname Gethostbyname2 C.gethostbyname2 +func Gethostbyname2(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) *Hostent + +//go:linkname Getipnodebyaddr C.getipnodebyaddr +func Getipnodebyaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) *Hostent + +//go:linkname Getipnodebyname C.getipnodebyname +func Getipnodebyname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) *Hostent + +//go:linkname Getrpcbyname C.getrpcbyname +func Getrpcbyname(name *c.Char) *Rpcent + +//go:linkname Getrpcbynumber C.getrpcbynumber +func Getrpcbynumber(number c.Int) *Rpcent + +//go:linkname Getrpcent C.getrpcent +func Getrpcent() *Rpcent + +//go:linkname Setrpcent C.setrpcent +func Setrpcent(stayopen c.Int) + +//go:linkname Endrpcent C.endrpcent +func Endrpcent() + +//go:linkname Herror C.herror +func Herror(_llcppg_param1 *c.Char) + +//go:linkname Hstrerror C.hstrerror +func Hstrerror(_llcppg_param1 c.Int) *c.Char + +//go:linkname Innetgr C.innetgr +func Innetgr(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char) c.Int + +//go:linkname Getnetgrent C.getnetgrent +func Getnetgrent(_llcppg_param1 **c.Char, _llcppg_param2 **c.Char, _llcppg_param3 **c.Char) c.Int + +//go:linkname Endnetgrent C.endnetgrent +func Endnetgrent() + +//go:linkname Setnetgrent C.setnetgrent +func Setnetgrent(_llcppg_param1 *c.Char) diff --git a/c/net/netdb_linux_amd64.go b/c/net/netdb_linux_amd64.go new file mode 100644 index 00000000..32808e8c --- /dev/null +++ b/c/net/netdb_linux_amd64.go @@ -0,0 +1,609 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_NETDB_H = 1 + +// Absolute file name for network data base files. +const ( + X_PATH_HEQUIV = "/etc/hosts.equiv" + X_PATH_HOSTS = "/etc/hosts" + X_PATH_NETWORKS = "/etc/networks" + X_PATH_NSSWITCH_CONF = "/etc/nsswitch.conf" + X_PATH_PROTOCOLS = "/etc/protocols" + X_PATH_SERVICES = "/etc/services" +) + +// Possible values left in `h_errno'. +const ( + HOST_NOT_FOUND = 1 + // Non-Authoritative Host not found, + // or SERVERFAIL. + TRY_AGAIN = 2 +) + +// Non recoverable errors, FORMERR, REFUSED, +// NOTIMP. +const NO_RECOVERY = 3 + +// Valid name, no data record of requested +// type. +const NO_DATA = 4 + +const ( + // See errno. + NETDB_INTERNAL = -1 + // No problem. + NETDB_SUCCESS = 0 + // No address, look for MX record. + NO_ADDRESS = 4 +) + +// Possible values for `ai_flags' field in `addrinfo' structure. +const ( + AI_PASSIVE = 1 + // Request for canonical name. + AI_CANONNAME = 2 + // Don't use name resolution. + AI_NUMERICHOST = 4 + // IPv4 mapped addresses are acceptable. + AI_V4MAPPED = 8 + // Return IPv4 mapped and IPv6 addresses. + AI_ALL = 16 + // Use configuration of this host to choose + // returned address type.. + AI_ADDRCONFIG = 32 +) + +// Don't use name resolution. +const AI_NUMERICSERV = 1024 + +// Error values for `getaddrinfo' function. +const ( + EAI_BADFLAGS = -1 + // NAME or SERVICE is unknown. + EAI_NONAME = -2 + // Temporary failure in name resolution. + EAI_AGAIN = -3 + // Non-recoverable failure in name res. + EAI_FAIL = -4 + // `ai_family' not supported. + EAI_FAMILY = -6 + // `ai_socktype' not supported. + EAI_SOCKTYPE = -7 + // SERVICE not supported for `ai_socktype'. + EAI_SERVICE = -8 + // Memory allocation failure. + EAI_MEMORY = -10 + // System error returned in `errno'. + EAI_SYSTEM = -11 + // Argument buffer overflow. + EAI_OVERFLOW = -12 +) + +const ( + NI_MAXHOST = 1025 + NI_MAXSERV = 32 +) + +const ( + // Don't try to look up hostname. + NI_NUMERICHOST = 1 + // Don't convert port number to name. + NI_NUMERICSERV = 2 + // Only return nodename portion. + NI_NOFQDN = 4 + // Don't return numeric addresses. + NI_NAMEREQD = 8 + // Look up UDP service rather than TCP. + NI_DGRAM = 16 +) + +// Description of data base entry for a single host. +type Hostent struct { + Name *c.Char + Aliases **c.Char + AddrType c.Int + Length c.Int + AddrList **c.Char +} + +// Description of data base entry for a single service. +type Servent struct { + SName *c.Char + SAliases **c.Char + SPort c.Int + SProto *c.Char +} + +// Description of data base entry for a single service. +type Protoent struct { + PName *c.Char + PAliases **c.Char + PProto c.Int +} + +// Structure to contain information about address of a service provider. +type AddrInfo struct { + Flags c.Int + Family c.Int + SockType c.Int + Protocol c.Int + AddrLen SocklenT + Addr *SockAddr + CanOnName *c.Char + Next *AddrInfo +} + +// Function to get address of global `h_errno' variable. +// +//go:linkname X__HErrnoLocation C.__h_errno_location +func X__HErrnoLocation() *c.Int + +// Print error indicated by `h_errno' variable on standard error. STR +// if non-null is printed before the error string. +// +//go:linkname Herror C.herror +func Herror(__str *c.Char) + +// Return string associated with error ERR_NUM. +// +//go:linkname Hstrerror C.hstrerror +func Hstrerror(__err_num c.Int) *c.Char + +// Open host data base files and mark them as staying open even after +// a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Sethostent C.sethostent +func Sethostent(__stay_open c.Int) + +// Close host data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endhostent C.endhostent +func Endhostent() + +// Get next entry from host data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Gethostent C.gethostent +func Gethostent() *Hostent + +// Return entry from host data base which address match ADDR with +// length LEN and type TYPE. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Gethostbyaddr C.gethostbyaddr +func Gethostbyaddr(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int) *Hostent + +// Return entry from host data base for host with NAME. AF must be +// set to the address type which is `AF_INET' for IPv4 or `AF_INET6' +// for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Gethostbyname2 C.gethostbyname2 +func Gethostbyname2(__name *c.Char, __af c.Int) *Hostent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. The last +// argument is a pointer to a variable which gets the value which +// would be stored in the global variable `herrno' by the +// non-reentrant functions. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Hostent).GethostentR C.gethostent_r +func (self *Hostent) GethostentR(__buf *c.Char, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int { + return 0 +} + +//go:linkname GethostbyaddrR C.gethostbyaddr_r +func GethostbyaddrR(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int, __result_buf *Hostent, __buf *c.Char, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int + +//go:linkname GethostbynameR C.gethostbyname_r +func GethostbynameR(__name *c.Char, __result_buf *Hostent, __buf *c.Char, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int + +//go:linkname Gethostbyname2R C.gethostbyname2_r +func Gethostbyname2R(__name *c.Char, __af c.Int, __result_buf *Hostent, __buf *c.Char, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int + +// Open network data base files and mark them as staying open even +// after a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setnetent C.setnetent +func Setnetent(__stay_open c.Int) + +// Close network data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endnetent C.endnetent +func Endnetent() + +// Get next entry from network data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getnetent C.getnetent +func Getnetent() *Netent + +// Return entry from network data base which address match NET and +// type TYPE. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getnetbyaddr C.getnetbyaddr +func Getnetbyaddr(__net Uint32T, __type c.Int) *Netent + +// Return entry from network data base for network with NAME. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getnetbyname C.getnetbyname +func Getnetbyname(__name *c.Char) *Netent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. The last +// argument is a pointer to a variable which gets the value which +// would be stored in the global variable `herrno' by the +// non-reentrant functions. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Netent).GetnetentR C.getnetent_r +func (self *Netent) GetnetentR(__buf *c.Char, __buflen SizeT, __result **Netent, __h_errnop *c.Int) c.Int { + return 0 +} + +//go:linkname GetnetbyaddrR C.getnetbyaddr_r +func GetnetbyaddrR(__net Uint32T, __type c.Int, __result_buf *Netent, __buf *c.Char, __buflen SizeT, __result **Netent, __h_errnop *c.Int) c.Int + +//go:linkname GetnetbynameR C.getnetbyname_r +func GetnetbynameR(__name *c.Char, __result_buf *Netent, __buf *c.Char, __buflen SizeT, __result **Netent, __h_errnop *c.Int) c.Int + +// Open service data base files and mark them as staying open even +// after a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setservent C.setservent +func Setservent(__stay_open c.Int) + +// Close service data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endservent C.endservent +func Endservent() + +// Get next entry from service data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getservent C.getservent +func Getservent() *Servent + +// Return entry from network data base for network with NAME and +// protocol PROTO. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getservbyname C.getservbyname +func Getservbyname(__name *c.Char, __proto *c.Char) *Servent + +// Return entry from service data base which matches port PORT and +// protocol PROTO. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getservbyport C.getservbyport +func Getservbyport(__port c.Int, __proto *c.Char) *Servent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Servent).GetserventR C.getservent_r +func (self *Servent) GetserventR(__buf *c.Char, __buflen SizeT, __result **Servent) c.Int { + return 0 +} + +//go:linkname GetservbynameR C.getservbyname_r +func GetservbynameR(__name *c.Char, __proto *c.Char, __result_buf *Servent, __buf *c.Char, __buflen SizeT, __result **Servent) c.Int + +//go:linkname GetservbyportR C.getservbyport_r +func GetservbyportR(__port c.Int, __proto *c.Char, __result_buf *Servent, __buf *c.Char, __buflen SizeT, __result **Servent) c.Int + +// Open protocol data base files and mark them as staying open even +// after a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setprotoent C.setprotoent +func Setprotoent(__stay_open c.Int) + +// Close protocol data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endprotoent C.endprotoent +func Endprotoent() + +// Get next entry from protocol data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getprotoent C.getprotoent +func Getprotoent() *Protoent + +// Return entry from protocol data base for network with NAME. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getprotobyname C.getprotobyname +func Getprotobyname(__name *c.Char) *Protoent + +// Return entry from protocol data base which number is PROTO. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getprotobynumber C.getprotobynumber +func Getprotobynumber(__proto c.Int) *Protoent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Protoent).GetprotoentR C.getprotoent_r +func (self *Protoent) GetprotoentR(__buf *c.Char, __buflen SizeT, __result **Protoent) c.Int { + return 0 +} + +//go:linkname GetprotobynameR C.getprotobyname_r +func GetprotobynameR(__name *c.Char, __result_buf *Protoent, __buf *c.Char, __buflen SizeT, __result **Protoent) c.Int + +//go:linkname GetprotobynumberR C.getprotobynumber_r +func GetprotobynumberR(__proto c.Int, __result_buf *Protoent, __buf *c.Char, __buflen SizeT, __result **Protoent) c.Int + +// Establish network group NETGROUP for enumeration. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Setnetgrent C.setnetgrent +func Setnetgrent(__netgroup *c.Char) c.Int + +// Free all space allocated by previous `setnetgrent' call. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Endnetgrent C.endnetgrent +func Endnetgrent() + +// Get next member of netgroup established by last `setnetgrent' call +// and return pointers to elements in HOSTP, USERP, and DOMAINP. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Getnetgrent C.getnetgrent +func Getnetgrent(__hostp **c.Char, __userp **c.Char, __domainp **c.Char) c.Int + +// Test whether NETGROUP contains the triple (HOST,USER,DOMAIN). +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Innetgr C.innetgr +func Innetgr(__netgroup *c.Char, __host *c.Char, __user *c.Char, __domain *c.Char) c.Int + +// Reentrant version of `getnetgrent' where result is placed in BUFFER. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname GetnetgrentR C.getnetgrent_r +func GetnetgrentR(__hostp **c.Char, __userp **c.Char, __domainp **c.Char, __buffer *c.Char, __buflen SizeT) c.Int + +// Call `rshd' at port RPORT on remote machine *AHOST to execute CMD. +// The local user is LOCUSER, on the remote machine the command is +// executed as REMUSER. In *FD2P the descriptor to the socket for the +// connection is returned. The caller must have the right to use a +// reserved port. When the function returns *AHOST contains the +// official host name. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Rcmd C.rcmd +func Rcmd(__ahost **c.Char, __rport uint16, __locuser *c.Char, __remuser *c.Char, __cmd *c.Char, __fd2p *c.Int) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RcmdAf C.rcmd_af +func RcmdAf(__ahost **c.Char, __rport uint16, __locuser *c.Char, __remuser *c.Char, __cmd *c.Char, __fd2p *c.Int, __af SaFamilyT) c.Int + +// Call `rexecd' at port RPORT on remote machine *AHOST to execute +// CMD. The process runs at the remote machine using the ID of user +// NAME whose cleartext password is PASSWD. In *FD2P the descriptor +// to the socket for the connection is returned. When the function +// returns *AHOST contains the official host name. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Rexec C.rexec +func Rexec(__ahost **c.Char, __rport c.Int, __name *c.Char, __pass *c.Char, __cmd *c.Char, __fd2p *c.Int) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RexecAf C.rexec_af +func RexecAf(__ahost **c.Char, __rport c.Int, __name *c.Char, __pass *c.Char, __cmd *c.Char, __fd2p *c.Int, __af SaFamilyT) c.Int + +// Check whether user REMUSER on system RHOST is allowed to login as LOCUSER. +// If SUSER is not zero the user tries to become superuser. Return 0 if +// it is possible. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Ruserok C.ruserok +func Ruserok(__rhost *c.Char, __suser c.Int, __remuser *c.Char, __locuser *c.Char) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RuserokAf C.ruserok_af +func RuserokAf(__rhost *c.Char, __suser c.Int, __remuser *c.Char, __locuser *c.Char, __af SaFamilyT) c.Int + +// Check whether user REMUSER on system indicated by IPv4 address +// RADDR is allowed to login as LOCUSER. Non-IPv4 (e.g., IPv6) are +// not supported. If SUSER is not zero the user tries to become +// superuser. Return 0 if it is possible. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Iruserok C.iruserok +func Iruserok(__raddr Uint32T, __suser c.Int, __remuser *c.Char, __locuser *c.Char) c.Int + +// This is the equivalent function where the pfamiliy if the address +// pointed to by RADDR is determined by the value of AF. It therefore +// can be used for IPv6 +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname IruserokAf C.iruserok_af +func IruserokAf(__raddr unsafe.Pointer, __suser c.Int, __remuser *c.Char, __locuser *c.Char, __af SaFamilyT) c.Int + +// Try to allocate reserved port, returning a descriptor for a socket opened +// at this port or -1 if unsuccessful. The search for an available port +// will start at ALPORT and continues with lower numbers. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Rresvport C.rresvport +func Rresvport(__alport *c.Int) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RresvportAf C.rresvport_af +func RresvportAf(__alport *c.Int, __af SaFamilyT) c.Int + +// Convert error return from getaddrinfo() to a string. +// +//go:linkname GaiStrerror C.gai_strerror +func GaiStrerror(__ecode c.Int) *c.Char + +// Translate a socket address to a location and service name. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +// llgo:link (*SockAddr).Getnameinfo C.getnameinfo +func (self *SockAddr) Getnameinfo(__salen SocklenT, __host *c.Char, __hostlen SocklenT, __serv *c.Char, __servlen SocklenT, __flags c.Int) c.Int { + return 0 +} diff --git a/c/net/netinet-in_darwin_arm64.go b/c/net/netinet-in_darwin_arm64.go new file mode 100644 index 00000000..31215d48 --- /dev/null +++ b/c/net/netinet-in_darwin_arm64.go @@ -0,0 +1,633 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +// Protocols (RFC 1700) +const IPPROTO_IP = 0 + +// IP6 hop-by-hop options +const IPPROTO_HOPOPTS = 0 + +// control message protocol +const IPPROTO_ICMP = 1 + +const ( + // group mgmt protocol + IPPROTO_IGMP = 2 + // gateway^2 (deprecated) + IPPROTO_GGP = 3 + // IPv4 encapsulation + IPPROTO_IPV4 = 4 + // for compatibility + IPPROTO_IPIP = 4 +) + +// tcp +const IPPROTO_TCP = 6 + +const ( + // Stream protocol II + IPPROTO_ST = 7 + // exterior gateway protocol + IPPROTO_EGP = 8 + // private interior gateway + IPPROTO_PIGP = 9 + // BBN RCC Monitoring + IPPROTO_RCCMON = 10 + // network voice protocol + IPPROTO_NVPII = 11 + // pup + IPPROTO_PUP = 12 + // Argus + IPPROTO_ARGUS = 13 + // EMCON + IPPROTO_EMCON = 14 + // Cross Net Debugger + IPPROTO_XNET = 15 + // Chaos + IPPROTO_CHAOS = 16 +) + +// user datagram protocol +const IPPROTO_UDP = 17 + +const ( + // Multiplexing + IPPROTO_MUX = 18 + // DCN Measurement Subsystems + IPPROTO_MEAS = 19 + // Host Monitoring + IPPROTO_HMP = 20 + // Packet Radio Measurement + IPPROTO_PRM = 21 + // xns idp + IPPROTO_IDP = 22 + // Trunk-1 + IPPROTO_TRUNK1 = 23 + // Trunk-2 + IPPROTO_TRUNK2 = 24 + // Leaf-1 + IPPROTO_LEAF1 = 25 + // Leaf-2 + IPPROTO_LEAF2 = 26 + // Reliable Data + IPPROTO_RDP = 27 + // Reliable Transaction + IPPROTO_IRTP = 28 + // tp-4 w/ class negotiation + IPPROTO_TP = 29 + // Bulk Data Transfer + IPPROTO_BLT = 30 + // Network Services + IPPROTO_NSP = 31 + // Merit Internodal + IPPROTO_INP = 32 + // Sequential Exchange + IPPROTO_SEP = 33 + // Third Party Connect + IPPROTO_3PC = 34 + // InterDomain Policy Routing + IPPROTO_IDPR = 35 + // XTP + IPPROTO_XTP = 36 + // Datagram Delivery + IPPROTO_DDP = 37 + // Control Message Transport + IPPROTO_CMTP = 38 + // TP++ Transport + IPPROTO_TPXX = 39 + // IL transport protocol + IPPROTO_IL = 40 +) + +// IP6 header +const IPPROTO_IPV6 = 41 + +const ( + // Source Demand Routing + IPPROTO_SDRP = 42 + // IP6 routing header + IPPROTO_ROUTING = 43 + // IP6 fragmentation header + IPPROTO_FRAGMENT = 44 + // InterDomain Routing + IPPROTO_IDRP = 45 + // resource reservation + IPPROTO_RSVP = 46 + // General Routing Encap. + IPPROTO_GRE = 47 + // Mobile Host Routing + IPPROTO_MHRP = 48 + // BHA + IPPROTO_BHA = 49 + // IP6 Encap Sec. Payload + IPPROTO_ESP = 50 + // IP6 Auth Header + IPPROTO_AH = 51 + // Integ. Net Layer Security + IPPROTO_INLSP = 52 + // IP with encryption + IPPROTO_SWIPE = 53 + // Next Hop Resolution + IPPROTO_NHRP = 54 +) + +// 55-57: Unassigned +const ( + IPPROTO_ICMPV6 = 58 + // IP6 no next header + IPPROTO_NONE = 59 + // IP6 destination option + IPPROTO_DSTOPTS = 60 + // any host internal protocol + IPPROTO_AHIP = 61 + // CFTP + IPPROTO_CFTP = 62 + // "hello" routing protocol + IPPROTO_HELLO = 63 + // SATNET/Backroom EXPAK + IPPROTO_SATEXPAK = 64 + // Kryptolan + IPPROTO_KRYPTOLAN = 65 + // Remote Virtual Disk + IPPROTO_RVD = 66 + // Pluribus Packet Core + IPPROTO_IPPC = 67 + // Any distributed FS + IPPROTO_ADFS = 68 + // Satnet Monitoring + IPPROTO_SATMON = 69 + // VISA Protocol + IPPROTO_VISA = 70 + // Packet Core Utility + IPPROTO_IPCV = 71 + // Comp. Prot. Net. Executive + IPPROTO_CPNX = 72 + // Comp. Prot. HeartBeat + IPPROTO_CPHB = 73 + // Wang Span Network + IPPROTO_WSN = 74 + // Packet Video Protocol + IPPROTO_PVP = 75 + // BackRoom SATNET Monitoring + IPPROTO_BRSATMON = 76 + // Sun net disk proto (temp.) + IPPROTO_ND = 77 + // WIDEBAND Monitoring + IPPROTO_WBMON = 78 + // WIDEBAND EXPAK + IPPROTO_WBEXPAK = 79 + // ISO cnlp + IPPROTO_EON = 80 + // VMTP + IPPROTO_VMTP = 81 + // Secure VMTP + IPPROTO_SVMTP = 82 + // Banyon VINES + IPPROTO_VINES = 83 + // TTP + IPPROTO_TTP = 84 + // NSFNET-IGP + IPPROTO_IGP = 85 + // dissimilar gateway prot. + IPPROTO_DGP = 86 + // TCF + IPPROTO_TCF = 87 + // Cisco/GXS IGRP + IPPROTO_IGRP = 88 + // OSPFIGP + IPPROTO_OSPFIGP = 89 + // Strite RPC protocol + IPPROTO_SRPC = 90 + // Locus Address Resoloution + IPPROTO_LARP = 91 + // Multicast Transport + IPPROTO_MTP = 92 + // AX.25 Frames + IPPROTO_AX25 = 93 + // IP encapsulated in IP + IPPROTO_IPEIP = 94 + // Mobile Int.ing control + IPPROTO_MICP = 95 + // Semaphore Comm. security + IPPROTO_SCCSP = 96 + // Ethernet IP encapsulation + IPPROTO_ETHERIP = 97 + // encapsulation header + IPPROTO_ENCAP = 98 + // any private encr. scheme + IPPROTO_APES = 99 + // GMTP + IPPROTO_GMTP = 100 +) + +// 101-252: Partly Unassigned +const ( + IPPROTO_PIM = 103 + // payload compression (IPComp) + IPPROTO_IPCOMP = 108 + // PGM + IPPROTO_PGM = 113 + // SCTP + IPPROTO_SCTP = 132 +) + +// BSD Private, local use, namespace incursion +const IPPROTO_DIVERT = 254 + +// raw IP packet +const IPPROTO_RAW = 255 + +const IPPROTO_MAX = 256 + +// last return value of *_input(), meaning "all job for this pkt is done". +const IPPROTO_DONE = 257 + +const X__DARWIN_IPPORT_RESERVED = 1024 + +const IPPORT_RESERVED = 1024 + +const IPPORT_USERRESERVED = 5000 + +// Default local port range to use by setting IP_PORTRANGE_HIGH +const ( + IPPORT_HIFIRSTAUTO = 49152 + IPPORT_HILASTAUTO = 65535 +) + +// Scanning for a free reserved port return a value below IPPORT_RESERVED, +// but higher than IPPORT_RESERVEDSTART. Traditionally the start value was +// 512, but that conflicts with some well-known-services that firewalls may +// have a fit if we use. +const IPPORT_RESERVEDSTART = 600 + +const ( + IN_CLASSA_NET = 4278190080 + IN_CLASSA_NSHIFT = 24 + IN_CLASSA_HOST = 16777215 + IN_CLASSA_MAX = 128 +) + +const ( + IN_CLASSB_NET = 4294901760 + IN_CLASSB_NSHIFT = 16 + IN_CLASSB_HOST = 65535 + IN_CLASSB_MAX = 65536 +) + +const ( + IN_CLASSC_NET = 4294967040 + IN_CLASSC_NSHIFT = 8 + IN_CLASSC_HOST = 255 +) + +const ( + // These ones aren't really + IN_CLASSD_NET = 4026531840 + // net and host fields, but + IN_CLASSD_NSHIFT = 28 + // routing needn't know. + IN_CLASSD_HOST = 268435455 +) + +// -1 return +const INADDR_NONE = 4294967295 + +// official! +const IN_LOOPBACKNET = 127 + +const INET_ADDRSTRLEN = 16 + +// Options for use with [gs]etsockopt at the IP level. +// First word of comment is data type; bool is stored in int. +const ( + IP_OPTIONS = 1 + // int; header is included with data + IP_HDRINCL = 2 + // int; IP type of service and preced. + IP_TOS = 3 + // int; IP time to live + IP_TTL = 4 + // bool; receive all IP opts w/dgram + IP_RECVOPTS = 5 + // bool; receive IP opts for response + IP_RECVRETOPTS = 6 + // bool; receive IP dst addr w/dgram + IP_RECVDSTADDR = 7 + // ip_opts; set/get IP options + IP_RETOPTS = 8 + // u_char; set/get IP multicast i/f + IP_MULTICAST_IF = 9 + // u_char; set/get IP multicast ttl + IP_MULTICAST_TTL = 10 + // u_char; set/get IP multicast loopback + IP_MULTICAST_LOOP = 11 + // ip_mreq; add an IP group membership + IP_ADD_MEMBERSHIP = 12 + // ip_mreq; drop an IP group membership + IP_DROP_MEMBERSHIP = 13 + // set/get IP mcast virt. iface + IP_MULTICAST_VIF = 14 + // enable RSVP in kernel + IP_RSVP_ON = 15 + // disable RSVP in kernel + IP_RSVP_OFF = 16 + // set RSVP per-vif socket + IP_RSVP_VIF_ON = 17 + // unset RSVP per-vif socket + IP_RSVP_VIF_OFF = 18 + // int; range to choose for unspec port + IP_PORTRANGE = 19 + // bool; receive reception if w/dgram + IP_RECVIF = 20 +) + +// for IPSEC +const ( + IP_IPSEC_POLICY = 21 + // deprecated + IP_FAITH = 22 +) + +// bool: drop receive of raw IP header +const IP_STRIPHDR = 23 + +const ( + // bool; receive reception TTL w/dgram + IP_RECVTTL = 24 + // int; set/get bound interface + IP_BOUND_IF = 25 + // get pktinfo on recv socket, set src on sent dgram + IP_PKTINFO = 26 + // receive pktinfo w/dgram + IP_RECVPKTINFO = 26 + // bool; receive IP TOS w/dgram + IP_RECVTOS = 27 + // don't fragment packet + IP_DONTFRAG = 28 +) + +const ( + // add a firewall rule to chain + IP_FW_ADD = 40 + // delete a firewall rule from chain + IP_FW_DEL = 41 + // flush firewall rule chain + IP_FW_FLUSH = 42 + // clear single/all firewall counter(s) + IP_FW_ZERO = 43 + // get entire firewall rule chain + IP_FW_GET = 44 + // reset logging counters + IP_FW_RESETLOG = 45 +) + +// These older firewall socket option codes are maintained for backward compatibility. +const ( + IP_OLD_FW_ADD = 50 + // delete a firewall rule from chain + IP_OLD_FW_DEL = 51 + // flush firewall rule chain + IP_OLD_FW_FLUSH = 52 + // clear single/all firewall counter(s) + IP_OLD_FW_ZERO = 53 + // get entire firewall rule chain + IP_OLD_FW_GET = 54 + // set/get NAT opts XXX Deprecated, do not use + IP_NAT__XXX = 55 + // reset logging counters + IP_OLD_FW_RESETLOG = 56 +) + +const ( + // add/configure a dummynet pipe + IP_DUMMYNET_CONFIGURE = 60 + // delete a dummynet pipe from chain + IP_DUMMYNET_DEL = 61 + // flush dummynet + IP_DUMMYNET_FLUSH = 62 + // get entire dummynet pipes + IP_DUMMYNET_GET = 64 +) + +const ( + // int*; get background IO flags; set background IO + IP_TRAFFIC_MGT_BACKGROUND = 65 + // int*; set/get IP multicast i/f index + IP_MULTICAST_IFINDEX = 66 +) + +// IPv4 Source Filter Multicast API [RFC3678] +const ( + IP_ADD_SOURCE_MEMBERSHIP = 70 + // drop a single source + IP_DROP_SOURCE_MEMBERSHIP = 71 + // block a source + IP_BLOCK_SOURCE = 72 + // unblock a source + IP_UNBLOCK_SOURCE = 73 +) + +// The following option is private; do not use it from user applications. +const IP_MSFILTER = 74 + +// Protocol Independent Multicast API [RFC3678] +const ( + MCAST_JOIN_GROUP = 80 + // leave all sources for group + MCAST_LEAVE_GROUP = 81 + // join a source-specific group + MCAST_JOIN_SOURCE_GROUP = 82 + // leave a single source + MCAST_LEAVE_SOURCE_GROUP = 83 + // block a source + MCAST_BLOCK_SOURCE = 84 + // unblock a source + MCAST_UNBLOCK_SOURCE = 85 +) + +// Defaults and limits for options +const ( + IP_DEFAULT_MULTICAST_TTL = 1 + // normally hear sends if a member + IP_DEFAULT_MULTICAST_LOOP = 1 +) + +// The imo_membership vector for each socket is now dynamically allocated at +// run-time, bounded by USHRT_MAX, and is reallocated when needed, sized +// according to a power-of-two increment. +const ( + IP_MIN_MEMBERSHIPS = 31 + IP_MAX_MEMBERSHIPS = 4095 +) + +// Default resource limits for IPv4 multicast source filtering. +// These may be modified by sysctl. +const ( + IP_MAX_GROUP_SRC_FILTER = 512 + // sources per socket/group + IP_MAX_SOCK_SRC_FILTER = 128 + // XXX no longer used + IP_MAX_SOCK_MUTE_FILTER = 128 +) + +// Filter modes; also used to represent per-socket filter mode internally. +const ( + MCAST_UNDEFINED = 0 + // fmode: include these source(s) + MCAST_INCLUDE = 1 + // fmode: exclude these source(s) + MCAST_EXCLUDE = 2 +) + +// Argument for IP_PORTRANGE: +// - which range to search when port is unspecified at bind() or connect() +const ( + IP_PORTRANGE_DEFAULT = 0 + // "high" - request firewall bypass + IP_PORTRANGE_HIGH = 1 + // "low" - vouchsafe security + IP_PORTRANGE_LOW = 2 +) + +// Definitions for inet sysctl operations. +// +// Third level is protocol number. +// Fourth level is desired variable within that protocol. +const IPPROTO_MAXID = 52 + +// Names for IP sysctl objects +const ( + IPCTL_FORWARDING = 1 + // may send redirects when forwarding + IPCTL_SENDREDIRECTS = 2 + // default TTL + IPCTL_DEFTTL = 3 +) + +const ( + // cloned route expiration time + IPCTL_RTEXPIRE = 5 + // min value for expiration time + IPCTL_RTMINEXPIRE = 6 + // trigger level for dynamic expire + IPCTL_RTMAXCACHE = 7 + // may perform source routes + IPCTL_SOURCEROUTE = 8 + // may re-broadcast received packets + IPCTL_DIRECTEDBROADCAST = 9 + // max length of netisr queue + IPCTL_INTRQMAXLEN = 10 + // number of netisr q drops + IPCTL_INTRQDROPS = 11 + // ipstat structure + IPCTL_STATS = 12 + // may accept source routed packets + IPCTL_ACCEPTSOURCEROUTE = 13 + // use fast IP forwarding code + IPCTL_FASTFORWARDING = 14 + // deprecated + IPCTL_KEEPFAITH = 15 + // default TTL for gif encap packet + IPCTL_GIF_TTL = 16 + IPCTL_MAXID = 17 +) + +// Internet address (a structure for historical reasons) +type InAddr struct { + Addr InAddrT +} + +// Socket address, internet style. +type SockaddrIn struct { + Len X__Uint8T + Family SaFamilyT + Port InPortT + Addr InAddr + Zero [8]c.Char +} + +// Structure used to describe IP options. +// Used to store options internally, to pass them to a process, +// or to restore options retrieved earlier. +// The ip_dst is used for the first-hop gateway when using a source route +// (this gets put into the header proper). +type IpOpts struct { + IpDst InAddr + IpOpts [40]c.Char +} + +// Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. +type IpMreq struct { + ImrMultiaddr InAddr + ImrInterface InAddr +} + +// Modified argument structure for IP_MULTICAST_IF, obtained from Linux. +// This is used to specify an interface index for multicast sends, as +// the IPv4 legacy APIs do not support this (unless IP_SENDIF is available). +type IpMreqn struct { + ImrMultiaddr InAddr + ImrAddress InAddr + ImrIfindex c.Int +} + +// Argument structure for IPv4 Multicast Source Filter APIs. [RFC3678] +type IpMreqSource struct { + ImrMultiaddr InAddr + ImrSourceaddr InAddr + ImrInterface InAddr +} + +// IP_PKTINFO: Packet information (equivalent to RFC2292 sec 5 for IPv4) +// This structure is used for +// +// 1. Receiving ancilliary data about the datagram if IP_PKTINFO sockopt is +// set on the socket. In this case ipi_ifindex will contain the interface +// index the datagram was received on, ipi_addr is the IP address the +// datagram was received to. +// +// 2. Sending a datagram using a specific interface or IP source address. +// if ipi_ifindex is set to non-zero when in_pktinfo is passed as +// ancilliary data of type IP_PKTINFO, this will be used as the source +// interface to send the datagram from. If ipi_ifindex is null, ip_spec_dst +// will be used for the source address. +// +// Note: if IP_BOUND_IF is set on the socket, ipi_ifindex in the ancillary +// IP_PKTINFO option silently overrides the bound interface when it is +// specified during send time. +type InPktinfo struct { + IpiIfindex c.Uint + IpiSpecDst InAddr + IpiAddr InAddr +} + +// Advanced (Full-state) APIs [RFC3678] +// The RFC specifies uint_t for the 6th argument to [sg]etsourcefilter(). +// We use uint32_t here to be consistent. +// +//go:linkname Setipv4sourcefilter C.setipv4sourcefilter +func Setipv4sourcefilter(_llcppg_param1 c.Int, _llcppg_param2 InAddr, _llcppg_param3 InAddr, _llcppg_param4 Uint32T, _llcppg_param5 Uint32T, _llcppg_param6 *InAddr) c.Int + +//go:linkname Getipv4sourcefilter C.getipv4sourcefilter +func Getipv4sourcefilter(_llcppg_param1 c.Int, _llcppg_param2 InAddr, _llcppg_param3 InAddr, _llcppg_param4 *Uint32T, _llcppg_param5 *Uint32T, _llcppg_param6 *InAddr) c.Int + +//go:linkname Setsourcefilter C.setsourcefilter +func Setsourcefilter(_llcppg_param1 c.Int, _llcppg_param2 Uint32T, _llcppg_param3 *SockAddr, _llcppg_param4 SocklenT, _llcppg_param5 Uint32T, _llcppg_param6 Uint32T, _llcppg_param7 *SockaddrStorage) c.Int + +//go:linkname Getsourcefilter C.getsourcefilter +func Getsourcefilter(_llcppg_param1 c.Int, _llcppg_param2 Uint32T, _llcppg_param3 *SockAddr, _llcppg_param4 SocklenT, _llcppg_param5 *Uint32T, _llcppg_param6 *Uint32T, _llcppg_param7 *SockaddrStorage) c.Int + +//go:linkname Bindresvport C.bindresvport +func Bindresvport(_llcppg_param1 c.Int, _llcppg_param2 *SockaddrIn) c.Int + +//go:linkname BindresvportSa C.bindresvport_sa +func BindresvportSa(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr) c.Int diff --git a/c/net/netinet-in_linux_amd64.go b/c/net/netinet-in_linux_amd64.go new file mode 100644 index 00000000..624bd2a9 --- /dev/null +++ b/c/net/netinet-in_linux_amd64.go @@ -0,0 +1,222 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_NETINET_IN_H = 1 + +const ( + IN_CLASSA_NET = 4278190080 + IN_CLASSA_NSHIFT = 24 + IN_CLASSA_HOST = 16777215 + IN_CLASSA_MAX = 128 +) + +const ( + IN_CLASSB_NET = 4294901760 + IN_CLASSB_NSHIFT = 16 + IN_CLASSB_HOST = 65535 + IN_CLASSB_MAX = 65536 +) + +const ( + IN_CLASSC_NET = 4294967040 + IN_CLASSC_NSHIFT = 8 + IN_CLASSC_HOST = 255 +) + +// Network number for local host loopback. +const IN_LOOPBACKNET = 127 + +const ( + INET_ADDRSTRLEN = 16 + INET6_ADDRSTRLEN = 46 +) + +type InAddr struct { + Addr InAddrT +} + +// Standard well-defined IP protocols. +const ( + IPPROTO_IP = 0 + IPPROTO_ICMP = 1 + IPPROTO_IGMP = 2 + IPPROTO_IPIP = 4 + IPPROTO_TCP = 6 + IPPROTO_EGP = 8 + IPPROTO_PUP = 12 + IPPROTO_UDP = 17 + IPPROTO_IDP = 22 + IPPROTO_TP = 29 + IPPROTO_DCCP = 33 + IPPROTO_IPV6 = 41 + IPPROTO_RSVP = 46 + IPPROTO_GRE = 47 + IPPROTO_ESP = 50 + IPPROTO_AH = 51 + IPPROTO_MTP = 92 + IPPROTO_BEETPH = 94 + IPPROTO_ENCAP = 98 + IPPROTO_PIM = 103 + IPPROTO_COMP = 108 + IPPROTO_L2TP = 115 + IPPROTO_SCTP = 132 + IPPROTO_UDPLITE = 136 + IPPROTO_MPLS = 137 + IPPROTO_ETHERNET = 143 + IPPROTO_AGGFRAG = 144 + IPPROTO_RAW = 255 + IPPROTO_SMC = 256 + IPPROTO_MPTCP = 262 + IPPROTO_MAX = 263 +) + +const ( + IPPROTO_HOPOPTS = 0 + IPPROTO_ROUTING = 43 + IPPROTO_FRAGMENT = 44 + IPPROTO_ICMPV6 = 58 + IPPROTO_NONE = 59 + IPPROTO_DSTOPTS = 60 + // IPv6 mobility header. + IPPROTO_MH = 135 +) + +// Standard well-known ports. +const ( + IPPORT_ECHO = 7 + IPPORT_DISCARD = 9 + IPPORT_SYSTAT = 11 + IPPORT_DAYTIME = 13 + IPPORT_NETSTAT = 15 + IPPORT_FTP = 21 + IPPORT_TELNET = 23 + IPPORT_SMTP = 25 + IPPORT_TIMESERVER = 37 + IPPORT_NAMESERVER = 42 + IPPORT_WHOIS = 43 + IPPORT_MTP = 57 + IPPORT_TFTP = 69 + IPPORT_RJE = 77 + IPPORT_FINGER = 79 + IPPORT_TTYLINK = 87 + IPPORT_SUPDUP = 95 + IPPORT_EXECSERVER = 512 + IPPORT_LOGINSERVER = 513 + IPPORT_CMDSERVER = 514 + IPPORT_EFSSERVER = 520 + // UDP ports. + IPPORT_BIFFUDP = 512 + IPPORT_WHOSERVER = 513 + IPPORT_ROUTESERVER = 520 + // Ports less than this value are reserved for privileged processes. + IPPORT_RESERVED = 1024 + // Ports greater this value are reserved for (non-privileged) servers. + IPPORT_USERRESERVED = 5000 +) + +// In6Addr retains the byte array API and the native IPv6 union alignment. +type In6Addr struct { + _ [0]uint32 + U6Addr [16]uint8 +} + +// Structure describing an Internet socket address. +type SockaddrIn struct { + Family SaFamilyT + Port InPortT + Addr InAddr + Zero [8]uint8 +} + +// Ditto, for IPv6. +type SockaddrIn6 struct { + Family SaFamilyT + Port InPortT + Flowinfo Uint32T + Addr In6Addr + ScopeId Uint32T +} + +// IPv4 multicast request. +type IpMreq struct { + ImrMultiaddr InAddr + ImrInterface InAddr +} + +// IPv4 multicast request with interface index. +type IpMreqn struct { + ImrMultiaddr InAddr + ImrAddress InAddr + ImrIfindex c.Int +} + +type IpMreqSource struct { + ImrMultiaddr InAddr + ImrInterface InAddr + ImrSourceaddr InAddr +} + +// Likewise, for IPv6. +type Ipv6Mreq struct { + Ipv6mrMultiaddr In6Addr + Ipv6mrInterface c.Uint +} + +// Multicast group request. +type GroupReq struct { + GrInterface Uint32T + GrGroup SockaddrStorage +} + +type GroupSourceReq struct { + GsrInterface Uint32T + GsrGroup SockaddrStorage + GsrSource SockaddrStorage +} + +// Full-state filter operations. +type IpMsfilter struct { + ImsfMultiaddr InAddr + ImsfInterface InAddr + ImsfFmode Uint32T + ImsfNumsrc Uint32T + ImsfSlist [1]InAddr +} + +type GroupFilter struct { + GfInterface Uint32T + GfGroup SockaddrStorage + GfFmode Uint32T + GfNumsrc Uint32T + GfSlist [1]SockaddrStorage +} + +// Internet address. +type InAddrT = Uint32T + +// Type to represent a port. +type InPortT = Uint16T + +// :: +// +//go:linkname In6addrAny C.in6addr_any +var In6addrAny In6Addr + +// ::1 +// +//go:linkname In6addrLoopback C.in6addr_loopback +var In6addrLoopback In6Addr + +// Bind socket to a privileged IP port. +// +//go:linkname Bindresvport C.bindresvport +func Bindresvport(__sockfd c.Int, __sock_in *SockaddrIn) c.Int diff --git a/c/net/netinet6-in6_darwin_arm64.go b/c/net/netinet6-in6_darwin_arm64.go new file mode 100644 index 00000000..b3829cde --- /dev/null +++ b/c/net/netinet6-in6_darwin_arm64.go @@ -0,0 +1,409 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +// Identification of the network protocol stack +// for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE +// has the table of implementation/integration differences. +const X__KAME_VERSION = "2009/apple-darwin" + +const ( + IPV6PORT_RESERVED = 1024 + IPV6PORT_ANONMIN = 49152 + IPV6PORT_ANONMAX = 65535 + IPV6PORT_RESERVEDMIN = 600 + IPV6PORT_RESERVEDMAX = 1023 +) + +const INET6_ADDRSTRLEN = 46 + +const ( + X__IPV6_ADDR_SCOPE_NODELOCAL = 1 + X__IPV6_ADDR_SCOPE_INTFACELOCAL = 1 + X__IPV6_ADDR_SCOPE_LINKLOCAL = 2 + X__IPV6_ADDR_SCOPE_SITELOCAL = 5 + // just used in this file + X__IPV6_ADDR_SCOPE_ORGLOCAL = 8 + X__IPV6_ADDR_SCOPE_GLOBAL = 14 +) + +const ( + IPV6_ADDR_MC_FLAGS_TRANSIENT = 16 + IPV6_ADDR_MC_FLAGS_PREFIX = 32 + IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 48 +) + +// reserved for future use +const IPV6_SOCKOPT_RESERVED1 = 3 + +const ( + // int; IP6 hops + IPV6_UNICAST_HOPS = 4 + // u_int; set/get IP6 multicast i/f + IPV6_MULTICAST_IF = 9 + // int; set/get IP6 multicast hops + IPV6_MULTICAST_HOPS = 10 + // u_int; set/get IP6 mcast loopback + IPV6_MULTICAST_LOOP = 11 + // ip6_mreq; join a group membership + IPV6_JOIN_GROUP = 12 + // ip6_mreq; leave a group membership + IPV6_LEAVE_GROUP = 13 +) + +const ( + // int; range to choose for unspec port + IPV6_PORTRANGE = 14 + // icmp6_filter; icmp6 filter + ICMP6_FILTER = 18 + // bool; send/recv if, src/dst addr + IPV6_2292PKTINFO = 19 + // bool; hop limit + IPV6_2292HOPLIMIT = 20 + // bool; next hop addr + IPV6_2292NEXTHOP = 21 + // bool; hop-by-hop option + IPV6_2292HOPOPTS = 22 + // bool; destinaion option + IPV6_2292DSTOPTS = 23 + // ip6_rthdr: routing header + IPV6_2292RTHDR = 24 +) + +// buf/cmsghdr; set/get IPv6 options [obsoleted by RFC3542] +const IPV6_2292PKTOPTIONS = 25 + +// int; checksum offset for raw socket +const IPV6_CHECKSUM = 26 + +// bool; only bind INET6 at wildcard bind +const IPV6_V6ONLY = 27 + +const IPV6_BINDV6ONLY = 27 + +// struct; get/set security policy +const IPV6_IPSEC_POLICY = 28 + +// deprecated +const IPV6_FAITH = 29 + +const ( + // add a firewall rule to chain + IPV6_FW_ADD = 30 + // delete a firewall rule from chain + IPV6_FW_DEL = 31 + // flush firewall rule chain + IPV6_FW_FLUSH = 32 + // clear single/all firewall counter(s) + IPV6_FW_ZERO = 33 + // get entire firewall rule chain + IPV6_FW_GET = 34 +) + +// APPLE: NOTE the value of those 2 options is kept unchanged from +// +// previous version of darwin/OS X for binary compatibility reasons +// and differ from FreeBSD (values 57 and 61). See below. +const ( + IPV6_RECVTCLASS = 35 + // int; send traffic class value + IPV6_TCLASS = 36 +) + +// int; set/get bound interface +const IPV6_BOUND_IF = 125 + +const ( + // this hop need not be a neighbor. + IPV6_RTHDR_LOOSE = 0 + // this hop must be a neighbor. + IPV6_RTHDR_STRICT = 1 + // IPv6 routing header type 0 + IPV6_RTHDR_TYPE_0 = 0 +) + +// Defaults and limits for options +const ( + IPV6_DEFAULT_MULTICAST_HOPS = 1 + // normally hear sends if a member + IPV6_DEFAULT_MULTICAST_LOOP = 1 +) + +// The im6o_membership vector for each socket is now dynamically allocated at +// run-time, bounded by USHRT_MAX, and is reallocated when needed, sized +// according to a power-of-two increment. +const ( + IPV6_MIN_MEMBERSHIPS = 31 + IPV6_MAX_MEMBERSHIPS = 4095 +) + +// Default resource limits for IPv6 multicast source filtering. +// These may be modified by sysctl. +const ( + IPV6_MAX_GROUP_SRC_FILTER = 512 + // sources per socket/group + IPV6_MAX_SOCK_SRC_FILTER = 128 +) + +// Argument for IPV6_PORTRANGE: +// - which range to search when port is unspecified at bind() or connect() +const ( + IPV6_PORTRANGE_DEFAULT = 0 + // "high" - request firewall bypass + IPV6_PORTRANGE_HIGH = 1 + // "low" - vouchsafe security + IPV6_PORTRANGE_LOW = 2 +) + +// Definitions for inet6 sysctl operations. +// +// Third level is protocol number. +// Fourth level is desired variable within that protocol. +const IPV6PROTO_MAXID = 104 + +// Names for IP sysctl objects +const ( + IPV6CTL_FORWARDING = 1 + // may send redirects when forwarding + IPV6CTL_SENDREDIRECTS = 2 + // default Hop-Limit + IPV6CTL_DEFHLIM = 3 +) + +const ( + // forward source-routed dgrams + IPV6CTL_FORWSRCRT = 5 + // stats + IPV6CTL_STATS = 6 + // multicast forwarding stats + IPV6CTL_MRTSTATS = 7 + // multicast routing protocol + IPV6CTL_MRTPROTO = 8 + // max packets reassembly queue + IPV6CTL_MAXFRAGPACKETS = 9 + // verify source route and intf + IPV6CTL_SOURCECHECK = 10 + // minimume logging interval + IPV6CTL_SOURCECHECK_LOGINT = 11 + IPV6CTL_ACCEPT_RTADV = 12 + // deprecated + IPV6CTL_KEEPFAITH = 13 + IPV6CTL_LOG_INTERVAL = 14 + IPV6CTL_HDRNESTLIMIT = 15 + IPV6CTL_DAD_COUNT = 16 + IPV6CTL_AUTO_FLOWLABEL = 17 + IPV6CTL_DEFMCASTHLIM = 18 + // default HLIM for gif encap packet + IPV6CTL_GIF_HLIM = 19 + IPV6CTL_KAME_VERSION = 20 + // use deprec addr (RFC2462 5.5.4) + IPV6CTL_USE_DEPRECATED = 21 + // walk timer for router renumbering + IPV6CTL_RR_PRUNE = 22 +) + +const ( + IPV6CTL_V6ONLY = 24 + // cloned route expiration time + IPV6CTL_RTEXPIRE = 25 + // min value for expiration time + IPV6CTL_RTMINEXPIRE = 26 + // trigger level for dynamic expire + IPV6CTL_RTMAXCACHE = 27 +) + +const ( + // use temporary addresses [RFC 4941] + IPV6CTL_USETEMPADDR = 32 + // preferred lifetime for tmpaddrs + IPV6CTL_TEMPPLTIME = 33 + // valid lifetime for tmpaddrs + IPV6CTL_TEMPVLTIME = 34 + // automatic link-local addr assign + IPV6CTL_AUTO_LINKLOCAL = 35 + // raw_ip6 stats + IPV6CTL_RIP6STATS = 36 + // prefer temporary addr as src + IPV6CTL_PREFER_TEMPADDR = 37 + // get/set address selection policy + IPV6CTL_ADDRCTLPOLICY = 38 + // use default scope zone + IPV6CTL_USE_DEFAULTZONE = 39 +) + +const ( + // max fragments + IPV6CTL_MAXFRAGS = 41 + // enable pMTU discovery for mcast? + IPV6CTL_MCAST_PMTU = 44 +) + +const ( + IPV6CTL_NEIGHBORGCTHRESH = 46 + IPV6CTL_MAXIFPREFIXES = 47 + IPV6CTL_MAXIFDEFROUTERS = 48 + IPV6CTL_MAXDYNROUTES = 49 + ICMPV6CTL_ND6_ONLINKNSRFC4861 = 50 + IPV6CTL_ULA_USETEMPADDR = 51 +) + +// to define items, should talk with KAME guys first, for *BSD compatibility +const IPV6CTL_MAXID = 51 + +// In6Addr retains the byte array API and the native IPv6 union alignment. +type In6Addr struct { + _ [0]uint32 + U6Addr [16]uint8 +} + +type SockaddrIn6 struct { + Len X__Uint8T + Family SaFamilyT + Port InPortT + Flowinfo X__Uint32T + Addr In6Addr + ScopeId X__Uint32T +} + +// Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP. +type Ipv6Mreq struct { + Ipv6mrMultiaddr In6Addr + Ipv6mrInterface c.Uint +} + +// IPV6_2292PKTINFO: Packet information(RFC2292 sec 5) +type In6Pktinfo struct { + Ipi6Addr In6Addr + Ipi6Ifindex c.Uint +} + +// Control structure for IPV6_RECVPATHMTU socket option. +type Ip6Mtuinfo struct { + Ip6mAddr SockaddrIn6 + Ip6mMtu Uint32T +} + +// IPv6 address +type In6AddrT = In6Addr + +//go:linkname In6addrAny C.in6addr_any +var In6addrAny In6Addr + +//go:linkname In6addrLoopback C.in6addr_loopback +var In6addrLoopback In6Addr + +//go:linkname In6addrNodelocalAllnodes C.in6addr_nodelocal_allnodes +var In6addrNodelocalAllnodes In6Addr + +//go:linkname In6addrLinklocalAllnodes C.in6addr_linklocal_allnodes +var In6addrLinklocalAllnodes In6Addr + +//go:linkname In6addrLinklocalAllrouters C.in6addr_linklocal_allrouters +var In6addrLinklocalAllrouters In6Addr + +//go:linkname In6addrLinklocalAllv2routers C.in6addr_linklocal_allv2routers +var In6addrLinklocalAllv2routers In6Addr + +//go:linkname Inet6OptionSpace C.inet6_option_space +func Inet6OptionSpace(_llcppg_param1 c.Int) c.Int + +//go:linkname Inet6OptionInit C.inet6_option_init +func Inet6OptionInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 **Cmsghdr, _llcppg_param3 c.Int) c.Int + +// llgo:link (*Cmsghdr).Inet6OptionAppend C.inet6_option_append +func (self *Cmsghdr) Inet6OptionAppend(_llcppg_param2 *X__Uint8T, _llcppg_param3 c.Int, _llcppg_param4 c.Int) c.Int { + return 0 +} + +// llgo:link (*Cmsghdr).Inet6OptionAlloc C.inet6_option_alloc +func (self *Cmsghdr) Inet6OptionAlloc(_llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 c.Int) *X__Uint8T { + return nil +} + +// llgo:link (*Cmsghdr).Inet6OptionNext C.inet6_option_next +func (self *Cmsghdr) Inet6OptionNext(_llcppg_param2 **X__Uint8T) c.Int { + return 0 +} + +// llgo:link (*Cmsghdr).Inet6OptionFind C.inet6_option_find +func (self *Cmsghdr) Inet6OptionFind(_llcppg_param2 **X__Uint8T, _llcppg_param3 c.Int) c.Int { + return 0 +} + +//go:linkname Inet6RthdrSpace C.inet6_rthdr_space +func Inet6RthdrSpace(_llcppg_param1 c.Int, _llcppg_param2 c.Int) SizeT + +//go:linkname Inet6RthdrInit C.inet6_rthdr_init +func Inet6RthdrInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int) *Cmsghdr + +// llgo:link (*Cmsghdr).Inet6RthdrAdd C.inet6_rthdr_add +func (self *Cmsghdr) Inet6RthdrAdd(_llcppg_param2 *In6Addr, _llcppg_param3 c.Uint) c.Int { + return 0 +} + +// llgo:link (*Cmsghdr).Inet6RthdrLasthop C.inet6_rthdr_lasthop +func (self *Cmsghdr) Inet6RthdrLasthop(_llcppg_param2 c.Uint) c.Int { + return 0 +} + +// llgo:link (*Cmsghdr).Inet6RthdrSegments C.inet6_rthdr_segments +func (self *Cmsghdr) Inet6RthdrSegments() c.Int { + return 0 +} + +// llgo:link (*Cmsghdr).Inet6RthdrGetaddr C.inet6_rthdr_getaddr +func (self *Cmsghdr) Inet6RthdrGetaddr(_llcppg_param2 c.Int) *In6Addr { + return nil +} + +// llgo:link (*Cmsghdr).Inet6RthdrGetflags C.inet6_rthdr_getflags +func (self *Cmsghdr) Inet6RthdrGetflags(_llcppg_param2 c.Int) c.Int { + return 0 +} + +//go:linkname Inet6OptInit C.inet6_opt_init +func Inet6OptInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT) c.Int + +//go:linkname Inet6OptAppend C.inet6_opt_append +func Inet6OptAppend(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int, _llcppg_param4 X__Uint8T, _llcppg_param5 SocklenT, _llcppg_param6 X__Uint8T, _llcppg_param7 *unsafe.Pointer) c.Int + +//go:linkname Inet6OptFinish C.inet6_opt_finish +func Inet6OptFinish(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int) c.Int + +//go:linkname Inet6OptSetVal C.inet6_opt_set_val +func Inet6OptSetVal(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SocklenT) c.Int + +//go:linkname Inet6OptNext C.inet6_opt_next +func Inet6OptNext(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int, _llcppg_param4 *X__Uint8T, _llcppg_param5 *SocklenT, _llcppg_param6 *unsafe.Pointer) c.Int + +//go:linkname Inet6OptFind C.inet6_opt_find +func Inet6OptFind(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int, _llcppg_param4 X__Uint8T, _llcppg_param5 *SocklenT, _llcppg_param6 *unsafe.Pointer) c.Int + +//go:linkname Inet6OptGetVal C.inet6_opt_get_val +func Inet6OptGetVal(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SocklenT) c.Int + +//go:linkname Inet6RthSpace C.inet6_rth_space +func Inet6RthSpace(_llcppg_param1 c.Int, _llcppg_param2 c.Int) SocklenT + +//go:linkname Inet6RthInit C.inet6_rth_init +func Inet6RthInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int, _llcppg_param4 c.Int) unsafe.Pointer + +//go:linkname Inet6RthAdd C.inet6_rth_add +func Inet6RthAdd(_llcppg_param1 unsafe.Pointer, _llcppg_param2 *In6Addr) c.Int + +//go:linkname Inet6RthReverse C.inet6_rth_reverse +func Inet6RthReverse(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer) c.Int + +//go:linkname Inet6RthSegments C.inet6_rth_segments +func Inet6RthSegments(_llcppg_param1 unsafe.Pointer) c.Int + +//go:linkname Inet6RthGetaddr C.inet6_rth_getaddr +func Inet6RthGetaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int) *In6Addr diff --git a/c/net/rpc-netdb_linux_amd64.go b/c/net/rpc-netdb_linux_amd64.go new file mode 100644 index 00000000..1200523b --- /dev/null +++ b/c/net/rpc-netdb_linux_amd64.go @@ -0,0 +1,45 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_RPC_NETDB_H = 1 + +type Rpcent struct { + RName *c.Char + RAliases **c.Char + RNumber c.Int +} + +//go:linkname Setrpcent C.setrpcent +func Setrpcent(__stayopen c.Int) + +//go:linkname Endrpcent C.endrpcent +func Endrpcent() + +//go:linkname Getrpcbyname C.getrpcbyname +func Getrpcbyname(__name *c.Char) *Rpcent + +//go:linkname Getrpcbynumber C.getrpcbynumber +func Getrpcbynumber(__number c.Int) *Rpcent + +//go:linkname Getrpcent C.getrpcent +func Getrpcent() *Rpcent + +//go:linkname GetrpcbynameR C.getrpcbyname_r +func GetrpcbynameR(__name *c.Char, __result_buf *Rpcent, __buffer *c.Char, __buflen SizeT, __result **Rpcent) c.Int + +//go:linkname GetrpcbynumberR C.getrpcbynumber_r +func GetrpcbynumberR(__number c.Int, __result_buf *Rpcent, __buffer *c.Char, __buflen SizeT, __result **Rpcent) c.Int + +// llgo:link (*Rpcent).GetrpcentR C.getrpcent_r +func (self *Rpcent) GetrpcentR(__buffer *c.Char, __buflen SizeT, __result **Rpcent) c.Int { + return 0 +} diff --git a/c/net/sys-socket_darwin_arm64.go b/c/net/sys-socket_darwin_arm64.go new file mode 100644 index 00000000..6fc665c1 --- /dev/null +++ b/c/net/sys-socket_darwin_arm64.go @@ -0,0 +1,560 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +// Option flags per-socket. +const ( + SO_DEBUG = 1 + // socket has had listen() + SO_ACCEPTCONN = 2 + // allow local address reuse + SO_REUSEADDR = 4 + // keep connections alive + SO_KEEPALIVE = 8 + // just use interface addresses + SO_DONTROUTE = 16 + // permit sending of broadcast msgs + SO_BROADCAST = 32 +) + +const ( + // bypass hardware when possible + SO_USELOOPBACK = 64 + // linger on close if data present (in ticks) + SO_LINGER = 128 + // linger on close if data present (in seconds) + SO_LINGER_SEC = 4224 +) + +// leave received OOB data in line +const SO_OOBINLINE = 256 + +const ( + // allow local address & port reuse + SO_REUSEPORT = 512 + // timestamp received dgram traffic + SO_TIMESTAMP = 1024 + // Monotonically increasing timestamp on rcvd dgram + SO_TIMESTAMP_MONOTONIC = 2048 +) + +// APPLE: Retain unread data +const SO_DONTTRUNC = 8192 + +// (ATOMIC proto) +const ( + SO_WANTMORE = 16384 + // APPLE: Want OOB in MSG_FLAG on receive + SO_WANTOOBFLAG = 32768 +) + +// Additional options, not kept in so_options. +const ( + SO_SNDBUF = 4097 + // receive buffer size + SO_RCVBUF = 4098 + // send low-water mark + SO_SNDLOWAT = 4099 + // receive low-water mark + SO_RCVLOWAT = 4100 + // send timeout + SO_SNDTIMEO = 4101 + // receive timeout + SO_RCVTIMEO = 4102 + // get error status and clear + SO_ERROR = 4103 + // get socket type + SO_TYPE = 4104 +) + +const ( + // deprecated + SO_LABEL = 4112 + // deprecated + SO_PEERLABEL = 4113 +) + +const ( + // APPLE: get 1st-packet byte count + SO_NREAD = 4128 + // APPLE: Install socket-level NKE + SO_NKE = 4129 + // APPLE: No SIGPIPE on EPIPE + SO_NOSIGPIPE = 4130 + // APPLE: Returns EADDRNOTAVAIL when src is not available anymore + SO_NOADDRERR = 4131 + // APPLE: Get number of bytes currently in send socket buffer + SO_NWRITE = 4132 + // APPLE: Allow reuse of port/socket by different userids + SO_REUSESHAREUID = 4133 +) + +const ( + // APPLE: send notification if there is a bind on a port which is already in use + SO_NOTIFYCONFLICT = 4134 + // APPLE: block on close until an upcall returns + SO_UPCALLCLOSEWAIT = 4135 +) + +const ( + // APPLE: request local port randomization + SO_RANDOMPORT = 4226 + // To turn off some POSIX behavior + SO_NP_EXTENSIONS = 4227 +) + +const ( + // number of datagrams in receive socket buffer + SO_NUMRCVPKT = 4370 + // Network service type + SO_NET_SERVICE_TYPE = 4374 +) + +// Get QoS marking in effect for socket +const SO_NETSVC_MARKING_LEVEL = 4377 + +// A signed data blob from the system resolver +const SO_RESOLVER_SIGNATURE = 4401 + +const ( + // Best effort + NET_SERVICE_TYPE_BE = 0 + // Background system initiated + NET_SERVICE_TYPE_BK = 1 + // Signaling + NET_SERVICE_TYPE_SIG = 2 + // Interactive Video + NET_SERVICE_TYPE_VI = 3 + // Interactive Voice + NET_SERVICE_TYPE_VO = 4 + // Responsive Multimedia Audio/Video + NET_SERVICE_TYPE_RV = 5 + // Multimedia Audio/Video Streaming + NET_SERVICE_TYPE_AV = 6 + // Operations, Administration, and Management + NET_SERVICE_TYPE_OAM = 7 + // Responsive Data + NET_SERVICE_TYPE_RD = 8 +) + +// These are supported values for SO_NETSVC_MARKING_LEVEL +const ( + NETSVC_MRKNG_UNKNOWN = 0 + // Default marking at layer 2 (for example Wi-Fi WMM) + NETSVC_MRKNG_LVL_L2 = 1 + // Layer 3 DSCP marking and layer 2 marking for all Network Service Types + NETSVC_MRKNG_LVL_L3L2_ALL = 2 + // The system policy limits layer 3 DSCP marking and layer 2 marking + // to background Network Service Types + NETSVC_MRKNG_LVL_L3L2_BK = 3 +) + +const SAE_ASSOCID_ANY = 0 + +const SAE_CONNID_ANY = 0 + +// connectx() flag parameters +const ( + CONNECT_RESUME_ON_READ_WRITE = 1 + // data is idempotent + CONNECT_DATA_IDEMPOTENT = 2 + // data includes security that replaces the TFO-cookie + CONNECT_DATA_AUTHENTICATED = 4 +) + +// flag for allowing setsockopt after shutdown +const SONPX_SETOPTSHUT = 1 + +// Level number for (get/set)sockopt() to apply to socket itself. +const SOL_SOCKET = 65535 + +// Address families. +const ( + AF_UNSPEC = 0 + // local to host (pipes) + AF_UNIX = 1 +) + +// backward compatibility +const AF_LOCAL = 1 + +// internetwork: UDP, TCP, etc. +const AF_INET = 2 + +const ( + // arpanet imp addresses + AF_IMPLINK = 3 + // pup protocols: e.g. BSP + AF_PUP = 4 + // mit CHAOS protocols + AF_CHAOS = 5 + // XEROX NS protocols + AF_NS = 6 + // ISO protocols + AF_ISO = 7 + AF_OSI = 7 + // European computer manufacturers + AF_ECMA = 8 + // datakit protocols + AF_DATAKIT = 9 + // CCITT protocols, X.25 etc + AF_CCITT = 10 + // IBM SNA + AF_SNA = 11 + // DECnet + AF_DECnet = 12 + // DEC Direct data link interface + AF_DLI = 13 + // LAT + AF_LAT = 14 + // NSC Hyperchannel + AF_HYLINK = 15 + // Apple Talk + AF_APPLETALK = 16 + // Internal Routing Protocol + AF_ROUTE = 17 + // Link layer interface + AF_LINK = 18 + // eXpress Transfer Protocol (no AF) + Pseudo_AF_XTP = 19 + // connection-oriented IP, aka ST II + AF_COIP = 20 + // Computer Network Technology + AF_CNT = 21 + // Help Identify RTIP packets + Pseudo_AF_RTIP = 22 + // Novell Internet Protocol + AF_IPX = 23 + // Simple Internet Protocol + AF_SIP = 24 + // Help Identify PIP packets + Pseudo_AF_PIP = 25 + // Network Driver 'raw' access + AF_NDRV = 27 + // Integrated Services Digital Network + AF_ISDN = 28 + // CCITT E.164 recommendation + AF_E164 = 28 + // Internal key-management function + Pseudo_AF_KEY = 29 +) + +// IPv6 +const AF_INET6 = 30 + +const ( + // native ATM access + AF_NATM = 31 + // Kernel event messages + AF_SYSTEM = 32 + // NetBIOS + AF_NETBIOS = 33 + // PPP communication protocol + AF_PPP = 34 + // Used by BPF to not rewrite headers + // in interface output routine + Pseudo_AF_HDRCMPLT = 35 +) + +const ( + // Reserved for internal usage + AF_RESERVED_36 = 36 + // IEEE 802.11 protocol + AF_IEEE80211 = 37 + AF_UTUN = 38 + // VM Sockets + AF_VSOCK = 40 + AF_MAX = 41 +) + +// longest possible addresses +const SOCK_MAXADDRLEN = 255 + +// RFC 2553: protocol-independent placeholder for socket addresses +const X_SS_MAXSIZE = 128 + +// Protocol families, same as address families for now. +const ( + PF_UNSPEC = 0 + PF_LOCAL = 1 + // backward compatibility + PF_UNIX = 1 + PF_INET = 2 + PF_IMPLINK = 3 + PF_PUP = 4 + PF_CHAOS = 5 + PF_NS = 6 + PF_ISO = 7 + PF_OSI = 7 + PF_ECMA = 8 + PF_DATAKIT = 9 + PF_CCITT = 10 + PF_SNA = 11 + PF_DECnet = 12 + PF_DLI = 13 + PF_LAT = 14 + PF_HYLINK = 15 + PF_APPLETALK = 16 + PF_ROUTE = 17 + PF_LINK = 18 + // really just proto family, no AF + PF_XTP = 19 + PF_COIP = 20 + PF_CNT = 21 + PF_SIP = 24 + // same format as AF_NS + PF_IPX = 23 + // same format as AF_INET + PF_RTIP = 22 + PF_PIP = 25 + PF_NDRV = 27 + PF_ISDN = 28 + PF_KEY = 29 + PF_INET6 = 30 + PF_NATM = 31 + PF_SYSTEM = 32 + PF_NETBIOS = 33 + PF_PPP = 34 + PF_RESERVED_36 = 36 + PF_UTUN = 38 + PF_VSOCK = 40 + PF_MAX = 41 +) + +const NET_MAXID = 41 + +// PF_ROUTE - Routing table +// +// Three additional levels are defined: +// +// Fourth: address family, 0 is wildcard +// Fifth: type of info, defined below +// Sixth: flag(s) to mask with for NET_RT_FLAGS +const ( + NET_RT_DUMP = 1 + // by flags, e.g. RESOLVING + NET_RT_FLAGS = 2 + // survey interface list + NET_RT_IFLIST = 3 + // routing statistics + NET_RT_STAT = 4 + // routes not in table but not freed + NET_RT_TRASH = 5 + // interface list with addresses + NET_RT_IFLIST2 = 6 + // dump; may limit to a.f. + NET_RT_DUMP2 = 7 +) + +// Allows read access non-local host's MAC address +// if the process has neighbor cache entitlement. +const ( + NET_RT_FLAGS_PRIV = 10 + NET_RT_MAXID = 11 +) + +// Maximum queue length specifiable by listen. +const SOMAXCONN = 128 + +const ( + // process out-of-band data + MSG_OOB = 1 + // peek at incoming message + MSG_PEEK = 2 + // send without using routing tables + MSG_DONTROUTE = 4 + // data completes record + MSG_EOR = 8 + // data discarded before delivery + MSG_TRUNC = 16 + // control data lost before delivery + MSG_CTRUNC = 32 + // wait for full request or error + MSG_WAITALL = 64 +) + +const ( + // this message should be nonblocking + MSG_DONTWAIT = 128 + // data completes connection + MSG_EOF = 256 +) + +// wait up to full request.. may return partial +const MSG_WAITSTREAM = 512 + +const ( + // Start of 'hold' seq; dump so_temp, deprecated + MSG_FLUSH = 1024 + // Hold frag in so_temp, deprecated + MSG_HOLD = 2048 + // Send the packet in so_temp, deprecated + MSG_SEND = 4096 + // Data ready to be read + MSG_HAVEMORE = 8192 + // Data remains in current pkt + MSG_RCVMORE = 16384 +) + +// Fail receive if socket address cannot be allocated +const MSG_NEEDSA = 65536 + +// do not generate SIGPIPE on EOF +const MSG_NOSIGNAL = 524288 + +// "Socket"-level control message types: +const SCM_RIGHTS = 1 + +const ( + // timestamp (struct timeval) + SCM_TIMESTAMP = 2 + // process creds (struct cmsgcred) + SCM_CREDS = 3 + // timestamp (uint64_t) + SCM_TIMESTAMP_MONOTONIC = 4 +) + +// howto arguments for shutdown(2), specified by Posix.1g. +const ( + SHUT_RD = 0 + // shut down the writing side + SHUT_WR = 1 + // shut down both sides + SHUT_RDWR = 2 +) + +// sockaddr endpoints +type SaEndpoints struct { + SaeSrcif c.Uint + SaeSrcaddr *SockAddr + SaeSrcaddrlen SocklenT + SaeDstaddr *SockAddr + SaeDstaddrlen SocklenT +} + +// Structure used for manipulating linger option. +type Linger struct { + LOnoff c.Int + LLinger c.Int +} + +// Structure to control non-portable Sockets extension to POSIX +type SoNpExtensions struct { + NpxFlags UInt32T + NpxMask UInt32T +} + +// [XSI] Structure used by kernel to store most addresses. +type SockAddr struct { + Len X__Uint8T + Family SaFamilyT + Data [14]c.Char +} + +// Least amount of information that a sockaddr requires. +// Sockaddr_header is a compatible prefix structure of +// all sockaddr objects. +type X__SockaddrHeader struct { + SaLen X__Uint8T + SaFamily SaFamilyT +} + +// Structure used by kernel to pass protocol +// information in raw sockets. +type Sockproto struct { + SpFamily X__Uint16T + SpProtocol X__Uint16T +} + +// [XSI] sockaddr_storage +type SockaddrStorage struct { + Len X__Uint8T + Family SaFamilyT + pad1 [6]c.Char + align X__Int64T + pad2 [112]c.Char +} + +// [XSI] Message header for recvmsg and sendmsg calls. +// Used value-result for recvmsg, value only for sendmsg. +type Msghdr struct { + MsgName unsafe.Pointer + MsgNamelen SocklenT + MsgIov *Iovec + MsgIovlen c.Int + MsgControl unsafe.Pointer + MsgControllen SocklenT + MsgFlags c.Int +} + +// Header for ancillary data objects in msg_control buffer. +// Used for additional information with/about a datagram +// not expressible by flags. The format is a sequence +// of message elements headed by cmsghdr structures. +type Cmsghdr struct { + CmsgLen SocklenT + CmsgLevel c.Int + CmsgType c.Int +} + +// sendfile(2) header/trailer struct +type SfHdtr struct { + Headers *Iovec + HdrCnt c.Int + Trailers *Iovec + TrlCnt c.Int +} + +type SaeAssocidT = X__Uint32T + +type SaeConnidT = X__Uint32T + +// sockaddr endpoints +type SaEndpointsT = SaEndpoints + +//go:linkname Getpeername C.getpeername +func Getpeername(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 *SocklenT) c.Int + +//go:linkname Getsockname C.getsockname +func Getsockname(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 *SocklenT) c.Int + +//go:linkname Getsockopt C.getsockopt +func Getsockopt(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 unsafe.Pointer, _llcppg_param5 *SocklenT) c.Int + +//go:linkname Recvfrom C.recvfrom +func Recvfrom(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int, _llcppg_param5 *SockAddr, _llcppg_param6 *SocklenT) SsizeT + +//go:linkname Recvmsg C.recvmsg +func Recvmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) SsizeT + +//go:linkname Sendmsg C.sendmsg +func Sendmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) SsizeT + +//go:linkname Sendto C.sendto +func Sendto(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int, _llcppg_param5 *SockAddr, _llcppg_param6 SocklenT) SsizeT + +//go:linkname Shutdown C.shutdown +func Shutdown(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Sockatmark C.sockatmark +func Sockatmark(_llcppg_param1 c.Int) c.Int + +//go:linkname Socketpair C.socketpair +func Socketpair(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) c.Int + +//go:linkname Sendfile C.sendfile +func Sendfile(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 OffT, _llcppg_param4 *OffT, _llcppg_param5 *SfHdtr, _llcppg_param6 c.Int) c.Int + +//go:linkname Connectx C.connectx +func Connectx(_llcppg_param1 c.Int, _llcppg_param2 *SaEndpointsT, _llcppg_param3 SaeAssocidT, _llcppg_param4 c.Uint, _llcppg_param5 *Iovec, _llcppg_param6 c.Uint, _llcppg_param7 *SizeT, _llcppg_param8 *SaeConnidT) c.Int + +//go:linkname Disconnectx C.disconnectx +func Disconnectx(_llcppg_param1 c.Int, _llcppg_param2 SaeAssocidT, _llcppg_param3 SaeConnidT) c.Int diff --git a/c/net/sys-socket_linux_amd64.go b/c/net/sys-socket_linux_amd64.go new file mode 100644 index 00000000..91bd97a5 --- /dev/null +++ b/c/net/sys-socket_linux_amd64.go @@ -0,0 +1,92 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_SYS_SOCKET_H = 1 + +// The following constants should be used for the second parameter of +// `shutdown'. +const ( + SHUT_RD = 0 + SHUT_WR = 1 + // No more receptions or transmissions. + SHUT_RDWR = 2 +) + +// Create two new sockets, of type TYPE in domain DOMAIN and using +// protocol PROTOCOL, which are connected to each other, and put file +// descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero, +// one will be chosen automatically. Returns 0 on success, -1 for errors. +// +//go:linkname Socketpair C.socketpair +func Socketpair(__domain c.Int, __type c.Int, __protocol c.Int, __fds *c.Int) c.Int + +// Put the local address of FD into *ADDR and its length in *LEN. +// +//go:linkname Getsockname C.getsockname +func Getsockname(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int + +// Put the address of the peer connected to socket FD into *ADDR +// (which is *LEN bytes long), and its actual length into *LEN. +// +//go:linkname Getpeername C.getpeername +func Getpeername(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int + +// Send N bytes of BUF on socket FD to peer at address ADDR (which is +// ADDR_LEN bytes long). Returns the number sent, or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Sendto C.sendto +func Sendto(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int, __addr *SockAddr, __addr_len SocklenT) SsizeT + +// Read N bytes into BUF through socket FD. +// If ADDR is not NULL, fill in *ADDR_LEN bytes of it with the address of +// the sender, and store the actual size of the address in *ADDR_LEN. +// Returns the number of bytes read or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Recvfrom C.recvfrom +func Recvfrom(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int, __addr *SockAddr, __addr_len *SocklenT) SsizeT + +//go:linkname Sendmsg C.sendmsg +func Sendmsg(__fd c.Int, __message *Msghdr, __flags c.Int) SsizeT + +//go:linkname Recvmsg C.recvmsg +func Recvmsg(__fd c.Int, __message *Msghdr, __flags c.Int) SsizeT + +//go:linkname Getsockopt C.getsockopt +func Getsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen *SocklenT) c.Int + +// Shut down all or part of the connection open on socket FD. +// HOW determines what to shut down: +// SHUT_RD = No more receptions; +// SHUT_WR = No more transmissions; +// SHUT_RDWR = No more receptions or transmissions. +// Returns 0 on success, -1 for errors. +// +//go:linkname Shutdown C.shutdown +func Shutdown(__fd c.Int, __how c.Int) c.Int + +// Determine whether socket is at a out-of-band mark. +// +//go:linkname Sockatmark C.sockatmark +func Sockatmark(__fd c.Int) c.Int + +// FDTYPE is S_IFSOCK or another S_IF* macro defined in ; +// returns 1 if FD is open on an object of the indicated type, 0 if not, +// or -1 for errors (setting errno). +// +//go:linkname Isfdtype C.isfdtype +func Isfdtype(__fd c.Int, __fdtype c.Int) c.Int diff --git a/c/net/sys-un_darwin_arm64.go b/c/net/sys-un_darwin_arm64.go new file mode 100644 index 00000000..c8f39e3c --- /dev/null +++ b/c/net/sys-un_darwin_arm64.go @@ -0,0 +1,35 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" +) + +// Level number of get/setsockopt for local domain sockets +const SOL_LOCAL = 0 + +// Socket options. +const ( + LOCAL_PEERCRED = 1 + // retrieve peer pid + LOCAL_PEERPID = 2 + // retrieve eff. peer pid + LOCAL_PEEREPID = 3 + // retrieve peer UUID + LOCAL_PEERUUID = 4 + // retrieve eff. peer UUID + LOCAL_PEEREUUID = 5 + // retrieve peer audit token + LOCAL_PEERTOKEN = 6 +) + +// [XSI] Definitions for UNIX IPC domain. +type SockaddrUn struct { + SunLen uint8 + SunFamily SaFamilyT + SunPath [104]c.Char +} diff --git a/c/net/sys-un_linux_amd64.go b/c/net/sys-un_linux_amd64.go new file mode 100644 index 00000000..f36af8c9 --- /dev/null +++ b/c/net/sys-un_linux_amd64.go @@ -0,0 +1,18 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" +) + +const X_SYS_UN_H = 1 + +// Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. +type SockaddrUn struct { + SunFamily SaFamilyT + SunPath [108]c.Char +} diff --git a/c/net/types_darwin_arm64.go b/c/net/types_darwin_arm64.go new file mode 100644 index 00000000..925f617c --- /dev/null +++ b/c/net/types_darwin_arm64.go @@ -0,0 +1,66 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" +) + +type X__Uint8T = uint8 + +type X__Uint16T = uint16 + +type X__Int32T = c.Int + +type X__Uint32T = c.Uint + +type X__Int64T = c.LongLong + +// sizeof() +type X__DarwinSizeT = c.Ulong + +// socklen_t (duh) +type X__DarwinSocklenT = X__Uint32T + +// byte count or error +type X__DarwinSsizeT = c.Long + +type CaddrT = *c.Char + +// base type for internet address +type InAddrT = X__Uint32T + +type InPortT = X__Uint16T + +type Int32T = c.Int + +type Iovec = c.Iovec + +type OffT = X__DarwinOffT + +type SaFamilyT = X__Uint8T + +type SizeT = X__DarwinSizeT + +type SocklenT = X__DarwinSocklenT + +type SsizeT = X__DarwinSsizeT + +type Timeval32 struct { + TvSec X__Int32T + TvUsec X__Int32T +} + +type UChar = uint8 + +type UInt32T = c.Uint + +type UShort = uint16 + +// [???] Used for file sizes +type X__DarwinOffT = X__Int64T + +type Uint32T = c.Uint diff --git a/c/net/types_linux_amd64.go b/c/net/types_linux_amd64.go new file mode 100644 index 00000000..2adb1d68 --- /dev/null +++ b/c/net/types_linux_amd64.go @@ -0,0 +1,33 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" +) + +type Uint16T = X__Uint16T + +type Uint32T = X__Uint32T + +// Structure for scatter/gather I/O. +type Iovec = c.Iovec + +type X__Uint16T = uint16 + +type X__Uint32T = c.Uint + +// Type of a byte count, or error. +type X__SsizeT = c.Long + +type X__CaddrT = *c.Char + +// Duplicate info from sys/socket.h. +type X__SocklenT = c.Uint + +type SizeT = c.Ulong + +type SsizeT = X__SsizeT From a3edbbab0ad9d5c653387abe5aae9bee84911b97 Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Mon, 19 Oct 2026 17:46:25 +0800 Subject: [PATCH 2/8] Regenerate c/net independently with native platform inputs --- c/net/README.md | 21 +- c/net/arm-_types_darwin_arm64.go | 64 ++ c/net/arpa-inet_darwin_arm64.go | 1 - c/net/arpa-inet_linux_amd64.go | 21 +- c/net/arpa-inet_linux_arm64.go | 92 +++ c/net/asm-generic-socket_linux_amd64.go | 119 +--- c/net/asm-generic-socket_linux_arm64.go | 82 +++ c/net/asm-generic-sockios_linux_amd64.go | 5 +- c/net/asm-generic-sockios_linux_arm64.go | 18 + c/net/bits-in_linux_amd64.go | 252 ++++++++ c/net/bits-in_linux_arm64.go | 252 ++++++++ c/net/bits-netdb_linux_amd64.go | 7 +- c/net/bits-netdb_linux_arm64.go | 17 + c/net/bits-sockaddr_linux_amd64.go | 1 - c/net/bits-sockaddr_linux_arm64.go | 13 + c/net/bits-socket_linux_amd64.go | 89 ++- c/net/bits-socket_linux_arm64.go | 259 ++++++++ c/net/bits-socket_type_linux_amd64.go | 16 +- c/net/bits-socket_type_linux_arm64.go | 24 + c/net/bits-types_linux_amd64.go | 133 ++++ c/net/bits-types_linux_arm64.go | 133 ++++ c/net/legacy_native.go | 2 +- c/net/llcppg-linux_amd64.cfg | 96 +++ c/net/llcppg-linux_arm64.cfg | 96 +++ c/net/llcppg.cfg | 96 +++ c/net/llcppg.i_darwin_arm64.go | 2 +- c/net/llcppg.i_linux_arm64.go | 8 + c/net/llcppg.pub | 100 ++- c/net/llcppg_darwin_arm64.go | 17 + c/net/llcppg_linux_amd64.go | 17 + c/net/llcppg_linux_arm64.go | 17 + c/net/net-if_darwin_arm64.go | 68 +- c/net/net-if_linux_amd64.go | 26 - c/net/net-if_linux_arm64.go | 149 +++++ c/net/net-if_var_darwin_arm64.go | 33 +- c/net/net-net_kev_darwin_arm64.go | 2 - c/net/net.go | 2 +- c/net/netdb_darwin_arm64.go | 33 +- c/net/netdb_linux_amd64.go | 48 +- c/net/netdb_linux_arm64.go | 605 ++++++++++++++++++ c/net/netinet-in_darwin_arm64.go | 60 +- c/net/netinet-in_linux_amd64.go | 138 ++-- c/net/netinet-in_linux_arm64.go | 218 +++++++ c/net/netinet6-in6_darwin_arm64.go | 76 ++- c/net/rpc-netdb_linux_amd64.go | 7 +- c/net/rpc-netdb_linux_arm64.go | 44 ++ c/net/sys-_types-_caddr_t_darwin_arm64.go | 9 + c/net/sys-_types-_in_addr_t_darwin_arm64.go | 8 + c/net/sys-_types-_in_port_t_darwin_arm64.go | 7 + c/net/sys-_types-_sa_family_t_darwin_arm64.go | 7 + c/net/sys-_types-_socklen_t_darwin_arm64.go | 7 + c/net/sys-_types-_timeval32_darwin_arm64.go | 10 + c/net/sys-_types-_u_char_darwin_arm64.go | 7 + c/net/sys-_types-_u_int32_t_darwin_arm64.go | 9 + c/net/sys-_types-_u_int64_t_darwin_arm64.go | 9 + c/net/sys-_types-_u_short_darwin_arm64.go | 7 + c/net/sys-_types_darwin_arm64.go | 63 ++ c/net/sys-socket_darwin_arm64.go | 70 +- c/net/sys-socket_linux_amd64.go | 36 +- c/net/sys-socket_linux_arm64.go | 114 ++++ c/net/sys-un_darwin_arm64.go | 5 +- c/net/sys-un_linux_amd64.go | 5 +- c/net/sys-un_linux_arm64.go | 13 + c/net/types_darwin_arm64.go | 66 -- c/net/types_linux_amd64.go | 33 - 65 files changed, 3466 insertions(+), 598 deletions(-) create mode 100644 c/net/arm-_types_darwin_arm64.go create mode 100644 c/net/arpa-inet_linux_arm64.go create mode 100644 c/net/asm-generic-socket_linux_arm64.go create mode 100644 c/net/asm-generic-sockios_linux_arm64.go create mode 100644 c/net/bits-in_linux_amd64.go create mode 100644 c/net/bits-in_linux_arm64.go create mode 100644 c/net/bits-netdb_linux_arm64.go create mode 100644 c/net/bits-sockaddr_linux_arm64.go create mode 100644 c/net/bits-socket_linux_arm64.go create mode 100644 c/net/bits-socket_type_linux_arm64.go create mode 100644 c/net/bits-types_linux_amd64.go create mode 100644 c/net/bits-types_linux_arm64.go create mode 100644 c/net/llcppg-linux_amd64.cfg create mode 100644 c/net/llcppg-linux_arm64.cfg create mode 100644 c/net/llcppg.cfg create mode 100644 c/net/llcppg.i_linux_arm64.go create mode 100644 c/net/llcppg_darwin_arm64.go create mode 100644 c/net/llcppg_linux_amd64.go create mode 100644 c/net/llcppg_linux_arm64.go create mode 100644 c/net/net-if_linux_arm64.go create mode 100644 c/net/netdb_linux_arm64.go create mode 100644 c/net/netinet-in_linux_arm64.go create mode 100644 c/net/rpc-netdb_linux_arm64.go create mode 100644 c/net/sys-_types-_caddr_t_darwin_arm64.go create mode 100644 c/net/sys-_types-_in_addr_t_darwin_arm64.go create mode 100644 c/net/sys-_types-_in_port_t_darwin_arm64.go create mode 100644 c/net/sys-_types-_sa_family_t_darwin_arm64.go create mode 100644 c/net/sys-_types-_socklen_t_darwin_arm64.go create mode 100644 c/net/sys-_types-_timeval32_darwin_arm64.go create mode 100644 c/net/sys-_types-_u_char_darwin_arm64.go create mode 100644 c/net/sys-_types-_u_int32_t_darwin_arm64.go create mode 100644 c/net/sys-_types-_u_int64_t_darwin_arm64.go create mode 100644 c/net/sys-_types-_u_short_darwin_arm64.go create mode 100644 c/net/sys-_types_darwin_arm64.go create mode 100644 c/net/sys-socket_linux_arm64.go create mode 100644 c/net/sys-un_linux_arm64.go delete mode 100644 c/net/types_darwin_arm64.go delete mode 100644 c/net/types_linux_amd64.go diff --git a/c/net/README.md b/c/net/README.md index e00c826b..22092169 100644 --- a/c/net/README.md +++ b/c/net/README.md @@ -1,24 +1,19 @@ # C networking bindings -This package contains native bindings for `arpa/inet.h`, `net/if.h`, `netdb.h`, `netinet/in.h`, `sys/socket.h`, and `sys/un.h`, with the types those headers require. - -The generated Unix bindings are extracted from the [libc bindings](https://github.com/MeteorsLiu/libc/commit/7385771b1366f8ba181672ea0eef9f4951d6b284), generated with llcppg commit `0204f71b7441956a16511c0389dae8c8a2234060`: +This package binds `arpa/inet.h`, `net/if.h`, `netdb.h`, `netinet/in.h`, `sys/socket.h`, and `sys/un.h`, together with the C types those headers require. Each target is generated independently for this directory with unmodified llcppg commit `4724a68a99e7f8872ae0ba41bce2a5938acd7f9c`. | Target | Header source | Build constraint | | --- | --- | --- | | macOS arm64 | macOS 14.0 SDK | `darwin && arm64 && !ios` | -| Linux amd64 | Bootlin glibc 2.44 | `linux && amd64 && !android` | - -Linux support assumes glibc. The existing Windows implementation and the existing fallback for other targets remain selected by their build constraints. - -`legacy_native.go` retains the existing Unix function names and signatures, including `Bind`, `Accept`, `GetHostByName`, `SetSockOpt`, and `Freeaddrinfo`. It also retains the five untyped socket constants so existing `Socket(..., SOCK_STREAM, ...)` calls compile. The generated address types use the existing field names for corresponding C fields; their layout and constants come from each platform's headers. Linux address families use a 16-bit field without the BSD length byte, and Linux `AddrInfo` places `Addr` before `CanOnName`. `In6Addr.U6Addr` remains a byte array with the native IPv6 union alignment. +| Linux amd64 | Bootlin stable 2017.05, glibc 2.24 | `linux && amd64 && !android` | +| Linux arm64 | Bootlin stable 2017.05, glibc 2.24 | `linux && arm64 && !android` | -`Iovec` is an alias of the shared `c.Iovec` definition, retaining its existing fields and their platform-specific types. +Linux support assumes glibc. Existing implementations remain selected for other targets. -`llcppg.pub` lists the available network type mappings for dependent bindings. Availability follows the target platform; the manifest combines the platform mappings. +`legacy_native.go` retains the existing Unix function names and signatures, including `Bind`, `Accept`, `GetHostByName`, `SetSockOpt`, and `Freeaddrinfo`, along with the five untyped socket constants. Address types retain the existing field names for corresponding C fields. Linux address families use a 16-bit field without the BSD length byte, and Linux `AddrInfo` places `Addr` before `CanOnName`. `In6Addr.U6Addr` remains a byte array with native IPv6 alignment. `Iovec` aliases the shared `c.Iovec` definition. -The extraction keeps networking declarations and their required type declarations, omits duplicate C functions already covered by the retained API, and applies the platform build constraints. +`llcppg.cfg` selects macOS arm64; `llcppg-linux_amd64.cfg` and `llcppg-linux_arm64.cfg` record the Linux inputs. `Dir` and `Stdlib` refer to locally prepared headers under ignored `.sysroot` directories. `Deps` contains directories such as `..`. Local generation resolves these directories through the existing `Config.IncludeDir` callback before calling `Config.NewPackage`; the llcppg command itself is unchanged. Generated Go files receive target build constraints. `llcppg.pub` combines the available platform type mappings for dependent bindings. -Known generation omissions include the inherited function skips, macOS packed structures whose generated alignment differs from C, and the Linux `cmsghdr` flexible array and its dependent helper. Opaque forward declarations remain pointer-only types. +The input configuration preserves existing handwritten functions and skips unsupported declarations, including the flexible array in Linux `cmsghdr` and the `if_nameindex` name collision. macOS declarations requiring unsupported dependency types are also omitted. This is a selection of common native APIs, rather than a complete libc binding. -Validation compares C and Go sizes, alignments, and key field offsets, and exercises sockets, address resolution, IP address conversion, and interface names with LLGo on both generated targets. +Validation compares C and Go sizes, alignments, field offsets, and field widths using the original target headers. LLGo runtime checks exercise sockets, address resolution, IPv6 conversion, and interface names in both GC and nogc modes on all three targets. Linux runtime checks ran on newer glibc installations; the generation baseline is glibc 2.24. diff --git a/c/net/arm-_types_darwin_arm64.go b/c/net/arm-_types_darwin_arm64.go new file mode 100644 index 00000000..0a5f357a --- /dev/null +++ b/c/net/arm-_types_darwin_arm64.go @@ -0,0 +1,64 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +type X__MbstateT struct { + _xgo_union [16]uint64 +} +type X__Int8T = int8 +type X__Uint8T = uint8 +type X__Int16T = int16 +type X__Uint16T = uint16 +type X__Int32T = c.Int +type X__Uint32T = c.Uint +type X__Int64T = c.LongLong +type X__Uint64T = c.UlongLong +type X__DarwinIntptrT = c.Long +type X__DarwinNaturalT = c.Uint + +// ct_rune_t +type X__DarwinCtRuneT = c.Int + +// mbstate_t +type X__DarwinMbstateT = X__MbstateT + +// ptr1 - ptr2 +type X__DarwinPtrdiffT = c.Long + +// sizeof() +type X__DarwinSizeT = c.Ulong + +// wchar_t +type X__DarwinWcharT = c.Int + +// rune_t +type X__DarwinRuneT = X__DarwinWcharT + +// wint_t +type X__DarwinWintT = c.Int + +// clock() +type X__DarwinClockT = c.Ulong + +// socklen_t (duh) +type X__DarwinSocklenT = X__Uint32T + +// byte count or error +type X__DarwinSsizeT = c.Long + +// time() +type X__DarwinTimeT = c.Long + +func (p *X__MbstateT) XGof_ref___mbstate8() *[128]c.Char { + return (*[128]c.Char)(unsafe.Pointer(p)) +} +func (p *X__MbstateT) XGof_ref__mbstateL() *c.LongLong { + return (*c.LongLong)(unsafe.Pointer(p)) +} diff --git a/c/net/arpa-inet_darwin_arm64.go b/c/net/arpa-inet_darwin_arm64.go index 238831e2..17375b88 100644 --- a/c/net/arpa-inet_darwin_arm64.go +++ b/c/net/arpa-inet_darwin_arm64.go @@ -1,7 +1,6 @@ //go:build darwin && arm64 && !ios // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net diff --git a/c/net/arpa-inet_linux_amd64.go b/c/net/arpa-inet_linux_amd64.go index 995be261..fe21eae8 100644 --- a/c/net/arpa-inet_linux_amd64.go +++ b/c/net/arpa-inet_linux_amd64.go @@ -1,7 +1,6 @@ //go:build linux && amd64 && !android // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net @@ -59,6 +58,26 @@ func InetPton(__af c.Int, __cp *c.Char, __buf unsafe.Pointer) c.Int //go:linkname InetAton C.inet_aton func InetAton(__cp *c.Char, __inp *InAddr) c.Int +// Format a network number NET into presentation format and place result +// in buffer starting at BUF with length of LEN bytes. +// +//go:linkname InetNeta C.inet_neta +func InetNeta(__net InAddrT, __buf *c.Char, __len c.SizeT) *c.Char + +// Convert network number for interface type AF in buffer starting at +// CP to presentation format. The result will specifiy BITS bits of +// the number. +// +//go:linkname InetNetNtop C.inet_net_ntop +func InetNetNtop(__af c.Int, __cp unsafe.Pointer, __bits c.Int, __buf *c.Char, __len c.SizeT) *c.Char + +// Convert network number for interface type AF from presentation in +// buffer starting at CP to network format and store result int +// buffer starting at BUF of size LEN. +// +//go:linkname InetNetPton C.inet_net_pton +func InetNetPton(__af c.Int, __cp *c.Char, __buf unsafe.Pointer, __len c.SizeT) c.Int + // Convert ASCII representation in hexadecimal form of the Internet // address to binary form and place result in buffer of length LEN // starting at BUF. diff --git a/c/net/arpa-inet_linux_arm64.go b/c/net/arpa-inet_linux_arm64.go new file mode 100644 index 00000000..7594b46e --- /dev/null +++ b/c/net/arpa-inet_linux_arm64.go @@ -0,0 +1,92 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_ARPA_INET_H = 1 + +// Return the local host address part of the Internet address in IN. +// +// llgo:link InAddr.InetLnaof C.inet_lnaof +func (self InAddr) InetLnaof() InAddrT { + return 0 +} + +// Make Internet host address in network byte order by combining the +// network number NET with the local address HOST. +// +//go:linkname InetMakeaddr C.inet_makeaddr +func InetMakeaddr(__net InAddrT, __host InAddrT) InAddr + +// Return network number part of the Internet address IN. +// +// llgo:link InAddr.InetNetof C.inet_netof +func (self InAddr) InetNetof() InAddrT { + return 0 +} + +// Extract the network number in network byte order from the address +// in numbers-and-dots natation starting at CP. +// +//go:linkname InetNetwork C.inet_network +func InetNetwork(__cp *uint8) InAddrT + +// Convert Internet number in IN to ASCII representation. The return value +// is a pointer to an internal array containing the string. +// +// llgo:link InAddr.InetNtoa C.inet_ntoa +func (self InAddr) InetNtoa() *uint8 { + return nil +} + +// Convert from presentation format of an Internet number in buffer +// starting at CP to the binary network format and store result for +// interface type AF in buffer starting at BUF. +// +//go:linkname InetPton C.inet_pton +func InetPton(__af c.Int, __cp *uint8, __buf unsafe.Pointer) c.Int + +// Convert Internet host address from numbers-and-dots notation in CP +// into binary data and store the result in the structure INP. +// +//go:linkname InetAton C.inet_aton +func InetAton(__cp *uint8, __inp *InAddr) c.Int + +// Format a network number NET into presentation format and place result +// in buffer starting at BUF with length of LEN bytes. +// +//go:linkname InetNeta C.inet_neta +func InetNeta(__net InAddrT, __buf *uint8, __len c.SizeT) *uint8 + +// Convert network number for interface type AF in buffer starting at +// CP to presentation format. The result will specifiy BITS bits of +// the number. +// +//go:linkname InetNetNtop C.inet_net_ntop +func InetNetNtop(__af c.Int, __cp unsafe.Pointer, __bits c.Int, __buf *uint8, __len c.SizeT) *uint8 + +// Convert network number for interface type AF from presentation in +// buffer starting at CP to network format and store result int +// buffer starting at BUF of size LEN. +// +//go:linkname InetNetPton C.inet_net_pton +func InetNetPton(__af c.Int, __cp *uint8, __buf unsafe.Pointer, __len c.SizeT) c.Int + +// Convert ASCII representation in hexadecimal form of the Internet +// address to binary form and place result in buffer of length LEN +// starting at BUF. +// +//go:linkname InetNsapAddr C.inet_nsap_addr +func InetNsapAddr(__cp *uint8, __buf *uint8, __len c.Int) c.Uint + +// Convert internet address in binary form in LEN bytes starting at CP +// a presentation form and place result in BUF. +// +//go:linkname InetNsapNtoa C.inet_nsap_ntoa +func InetNsapNtoa(__len c.Int, __cp *uint8, __buf *uint8) *uint8 diff --git a/c/net/asm-generic-socket_linux_amd64.go b/c/net/asm-generic-socket_linux_amd64.go index 8e8d2a3c..ad78eb32 100644 --- a/c/net/asm-generic-socket_linux_amd64.go +++ b/c/net/asm-generic-socket_linux_amd64.go @@ -1,13 +1,11 @@ //go:build linux && amd64 && !android // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net // For setsockopt(2) const SOL_SOCKET = 1 - const ( SO_DEBUG = 1 SO_REUSEADDR = 2 @@ -27,14 +25,13 @@ const ( SO_BSDCOMPAT = 14 SO_REUSEPORT = 15 ) - const ( - SO_PASSCRED = 16 - SO_PEERCRED = 17 - SO_RCVLOWAT = 18 - SO_SNDLOWAT = 19 - SO_RCVTIMEO_OLD = 20 - SO_SNDTIMEO_OLD = 21 + SO_PASSCRED = 16 + SO_PEERCRED = 17 + SO_RCVLOWAT = 18 + SO_SNDLOWAT = 19 + SO_RCVTIMEO = 20 + SO_SNDTIMEO = 21 ) // Security levels - as per NRL IPv6 - don't actually do anything @@ -43,7 +40,6 @@ const ( SO_SECURITY_ENCRYPTION_TRANSPORT = 23 SO_SECURITY_ENCRYPTION_NETWORK = 24 ) - const SO_BINDTODEVICE = 25 // Socket filtering @@ -52,25 +48,28 @@ const ( SO_DETACH_FILTER = 27 SO_GET_FILTER = 26 ) - -const SO_PEERNAME = 28 - +const ( + SO_PEERNAME = 28 + SO_TIMESTAMP = 29 + SCM_TIMESTAMP = 29 +) const SO_ACCEPTCONN = 30 - const ( - SO_PEERSEC = 31 - SO_PASSSEC = 34 + SO_PEERSEC = 31 + SO_PASSSEC = 34 + SO_TIMESTAMPNS = 35 + SCM_TIMESTAMPNS = 35 ) - const SO_MARK = 36 - +const ( + SO_TIMESTAMPING = 37 + SCM_TIMESTAMPING = 37 +) const ( SO_PROTOCOL = 38 SO_DOMAIN = 39 ) - const SO_RXQ_OVFL = 40 - const ( SO_WIFI_STATUS = 41 SCM_WIFI_STATUS = 41 @@ -79,85 +78,5 @@ const ( // Instruct lower device to use last 4-bytes of skb data as FCS const SO_NOFCS = 43 - const SO_LOCK_FILTER = 44 - const SO_SELECT_ERR_QUEUE = 45 - -const SO_BUSY_POLL = 46 - -const SO_MAX_PACING_RATE = 47 - -const SO_BPF_EXTENSIONS = 48 - -const SO_INCOMING_CPU = 49 - -const ( - SO_ATTACH_BPF = 50 - SO_DETACH_BPF = 27 -) - -const ( - SO_ATTACH_REUSEPORT_CBPF = 51 - SO_ATTACH_REUSEPORT_EBPF = 52 -) - -const SO_CNX_ADVICE = 53 - -const SCM_TIMESTAMPING_OPT_STATS = 54 - -const SO_MEMINFO = 55 - -const SO_INCOMING_NAPI_ID = 56 - -const SO_COOKIE = 57 - -const SCM_TIMESTAMPING_PKTINFO = 58 - -const SO_PEERGROUPS = 59 - -const SO_ZEROCOPY = 60 - -const ( - SO_TXTIME = 61 - SCM_TXTIME = 61 -) - -const SO_BINDTOIFINDEX = 62 - -const ( - SO_TIMESTAMP_OLD = 29 - SO_TIMESTAMPNS_OLD = 35 - SO_TIMESTAMPING_OLD = 37 -) - -const ( - SO_TIMESTAMP_NEW = 63 - SO_TIMESTAMPNS_NEW = 64 - SO_TIMESTAMPING_NEW = 65 -) - -const ( - SO_RCVTIMEO_NEW = 66 - SO_SNDTIMEO_NEW = 67 -) - -const SO_DETACH_REUSEPORT_BPF = 68 - -// on 64-bit and x32, avoid the ?: operator -const ( - SO_TIMESTAMP = 29 - SO_TIMESTAMPNS = 35 - SO_TIMESTAMPING = 37 -) - -const ( - SO_RCVTIMEO = 20 - SO_SNDTIMEO = 21 -) - -const ( - SCM_TIMESTAMP = 29 - SCM_TIMESTAMPNS = 35 - SCM_TIMESTAMPING = 37 -) diff --git a/c/net/asm-generic-socket_linux_arm64.go b/c/net/asm-generic-socket_linux_arm64.go new file mode 100644 index 00000000..2f204f10 --- /dev/null +++ b/c/net/asm-generic-socket_linux_arm64.go @@ -0,0 +1,82 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +// For setsockopt(2) +const SOL_SOCKET = 1 +const ( + SO_DEBUG = 1 + SO_REUSEADDR = 2 + SO_TYPE = 3 + SO_ERROR = 4 + SO_DONTROUTE = 5 + SO_BROADCAST = 6 + SO_SNDBUF = 7 + SO_RCVBUF = 8 + SO_SNDBUFFORCE = 32 + SO_RCVBUFFORCE = 33 + SO_KEEPALIVE = 9 + SO_OOBINLINE = 10 + SO_NO_CHECK = 11 + SO_PRIORITY = 12 + SO_LINGER = 13 + SO_BSDCOMPAT = 14 + SO_REUSEPORT = 15 +) +const ( + SO_PASSCRED = 16 + SO_PEERCRED = 17 + SO_RCVLOWAT = 18 + SO_SNDLOWAT = 19 + SO_RCVTIMEO = 20 + SO_SNDTIMEO = 21 +) + +// Security levels - as per NRL IPv6 - don't actually do anything +const ( + SO_SECURITY_AUTHENTICATION = 22 + SO_SECURITY_ENCRYPTION_TRANSPORT = 23 + SO_SECURITY_ENCRYPTION_NETWORK = 24 +) +const SO_BINDTODEVICE = 25 + +// Socket filtering +const ( + SO_ATTACH_FILTER = 26 + SO_DETACH_FILTER = 27 + SO_GET_FILTER = 26 +) +const ( + SO_PEERNAME = 28 + SO_TIMESTAMP = 29 + SCM_TIMESTAMP = 29 +) +const SO_ACCEPTCONN = 30 +const ( + SO_PEERSEC = 31 + SO_PASSSEC = 34 + SO_TIMESTAMPNS = 35 + SCM_TIMESTAMPNS = 35 +) +const SO_MARK = 36 +const ( + SO_TIMESTAMPING = 37 + SCM_TIMESTAMPING = 37 +) +const ( + SO_PROTOCOL = 38 + SO_DOMAIN = 39 +) +const SO_RXQ_OVFL = 40 +const ( + SO_WIFI_STATUS = 41 + SCM_WIFI_STATUS = 41 + SO_PEEK_OFF = 42 +) + +// Instruct lower device to use last 4-bytes of skb data as FCS +const SO_NOFCS = 43 +const SO_LOCK_FILTER = 44 +const SO_SELECT_ERR_QUEUE = 45 diff --git a/c/net/asm-generic-sockios_linux_amd64.go b/c/net/asm-generic-sockios_linux_amd64.go index b514464b..ff37efa5 100644 --- a/c/net/asm-generic-sockios_linux_amd64.go +++ b/c/net/asm-generic-sockios_linux_amd64.go @@ -1,7 +1,6 @@ //go:build linux && amd64 && !android // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net @@ -13,7 +12,7 @@ const ( SIOCGPGRP = 35076 SIOCATMARK = 35077 // Get stamp (timeval) - SIOCGSTAMP_OLD = 35078 + SIOCGSTAMP = 35078 // Get stamp (timespec) - SIOCGSTAMPNS_OLD = 35079 + SIOCGSTAMPNS = 35079 ) diff --git a/c/net/asm-generic-sockios_linux_arm64.go b/c/net/asm-generic-sockios_linux_arm64.go new file mode 100644 index 00000000..f175e5d9 --- /dev/null +++ b/c/net/asm-generic-sockios_linux_arm64.go @@ -0,0 +1,18 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +// Socket-level I/O control calls. +const ( + FIOSETOWN = 35073 + SIOCSPGRP = 35074 + FIOGETOWN = 35075 + SIOCGPGRP = 35076 + SIOCATMARK = 35077 + // Get stamp (timeval) + SIOCGSTAMP = 35078 + // Get stamp (timespec) + SIOCGSTAMPNS = 35079 +) diff --git a/c/net/bits-in_linux_amd64.go b/c/net/bits-in_linux_amd64.go new file mode 100644 index 00000000..75728be4 --- /dev/null +++ b/c/net/bits-in_linux_amd64.go @@ -0,0 +1,252 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import "github.com/goplus/lib/c" + +const X__USE_KERNEL_IPV6_DEFS = 0 + +// Options for use with `getsockopt' and `setsockopt' at the IP level. +// The first word in the comment at the right is the data type used; +// "bool" means a boolean value stored in an `int'. +const ( + IP_OPTIONS = 4 + // int; Header is included with data. + IP_HDRINCL = 3 + // int; IP type of service and precedence. + IP_TOS = 1 + // int; IP time to live. + IP_TTL = 2 + // bool; Receive all IP options w/datagram. + IP_RECVOPTS = 6 +) + +// For BSD compatibility. +const ( + // ip_opts; Set/get IP per-packet options. + IP_RETOPTS = 7 + // in_addr; set/get IP multicast i/f + IP_MULTICAST_IF = 32 + // u_char; set/get IP multicast ttl + IP_MULTICAST_TTL = 33 + // i_char; set/get IP multicast loopback + IP_MULTICAST_LOOP = 34 + // ip_mreq; add an IP group membership + IP_ADD_MEMBERSHIP = 35 + // ip_mreq; drop an IP group membership + IP_DROP_MEMBERSHIP = 36 + // ip_mreq_source: unblock data from source + IP_UNBLOCK_SOURCE = 37 + // ip_mreq_source: block data from source + IP_BLOCK_SOURCE = 38 + // ip_mreq_source: join source group + IP_ADD_SOURCE_MEMBERSHIP = 39 + // ip_mreq_source: leave source group + IP_DROP_SOURCE_MEMBERSHIP = 40 + IP_MSFILTER = 41 +) +const ( + // group_req: join any-source group + MCAST_JOIN_GROUP = 42 + // group_source_req: block from given group + MCAST_BLOCK_SOURCE = 43 + // group_source_req: unblock from given group + MCAST_UNBLOCK_SOURCE = 44 + // group_req: leave any-source group + MCAST_LEAVE_GROUP = 45 + // group_source_req: join source-spec gr + MCAST_JOIN_SOURCE_GROUP = 46 + // group_source_req: leave source-spec gr + MCAST_LEAVE_SOURCE_GROUP = 47 + MCAST_MSFILTER = 48 + IP_MULTICAST_ALL = 49 + IP_UNICAST_IF = 50 +) +const ( + MCAST_EXCLUDE = 0 + MCAST_INCLUDE = 1 +) +const ( + // bool + IP_ROUTER_ALERT = 5 + // bool + IP_PKTINFO = 8 + IP_PKTOPTIONS = 9 + // obsolete name? + IP_PMTUDISC = 10 + // int; see below + IP_MTU_DISCOVER = 10 + // bool + IP_RECVERR = 11 + // bool + IP_RECVTTL = 12 + // bool + IP_RECVTOS = 13 + // int + IP_MTU = 14 + IP_FREEBIND = 15 + IP_IPSEC_POLICY = 16 + IP_XFRM_POLICY = 17 + IP_PASSSEC = 18 + IP_TRANSPARENT = 19 +) + +// TProxy original addresses +const ( + IP_ORIGDSTADDR = 20 + IP_RECVORIGDSTADDR = 20 +) +const ( + IP_MINTTL = 21 + IP_NODEFRAG = 22 + IP_CHECKSUM = 23 + IP_BIND_ADDRESS_NO_PORT = 24 +) + +// IP_MTU_DISCOVER arguments. +const ( + IP_PMTUDISC_DONT = 0 + // Use per route hints. + IP_PMTUDISC_WANT = 1 + // Always DF. + IP_PMTUDISC_DO = 2 + // Ignore dst pmtu. + IP_PMTUDISC_PROBE = 3 +) + +// Always use interface mtu (ignores dst pmtu) but don't set DF flag. +// Also incoming ICMP frag_needed notifications will be ignored on +// this socket to prevent accepting spoofed ones. +const IP_PMTUDISC_INTERFACE = 4 + +// Like IP_PMTUDISC_INTERFACE but allow packets to be fragmented. +const IP_PMTUDISC_OMIT = 5 + +// To select the IP level. +const SOL_IP = 0 +const ( + IP_DEFAULT_MULTICAST_TTL = 1 + IP_DEFAULT_MULTICAST_LOOP = 1 + IP_MAX_MEMBERSHIPS = 20 +) + +// Options for use with `getsockopt' and `setsockopt' at the IPv6 level. +// The first word in the comment at the right is the data type used; +// "bool" means a boolean value stored in an `int'. +const ( + IPV6_ADDRFORM = 1 + IPV6_2292PKTINFO = 2 + IPV6_2292HOPOPTS = 3 + IPV6_2292DSTOPTS = 4 + IPV6_2292RTHDR = 5 + IPV6_2292PKTOPTIONS = 6 + IPV6_CHECKSUM = 7 + IPV6_2292HOPLIMIT = 8 +) +const ( + IPV6_NEXTHOP = 9 + IPV6_AUTHHDR = 10 + IPV6_UNICAST_HOPS = 16 + IPV6_MULTICAST_IF = 17 + IPV6_MULTICAST_HOPS = 18 + IPV6_MULTICAST_LOOP = 19 + IPV6_JOIN_GROUP = 20 + IPV6_LEAVE_GROUP = 21 + IPV6_ROUTER_ALERT = 22 + IPV6_MTU_DISCOVER = 23 + IPV6_MTU = 24 + IPV6_RECVERR = 25 + IPV6_V6ONLY = 26 + IPV6_JOIN_ANYCAST = 27 + IPV6_LEAVE_ANYCAST = 28 + IPV6_IPSEC_POLICY = 34 + IPV6_XFRM_POLICY = 35 + IPV6_HDRINCL = 36 +) + +// Advanced API (RFC3542) (1). +const ( + IPV6_RECVPKTINFO = 49 + IPV6_PKTINFO = 50 + IPV6_RECVHOPLIMIT = 51 + IPV6_HOPLIMIT = 52 + IPV6_RECVHOPOPTS = 53 + IPV6_HOPOPTS = 54 + IPV6_RTHDRDSTOPTS = 55 + IPV6_RECVRTHDR = 56 + IPV6_RTHDR = 57 + IPV6_RECVDSTOPTS = 58 + IPV6_DSTOPTS = 59 + IPV6_RECVPATHMTU = 60 + IPV6_PATHMTU = 61 + IPV6_DONTFRAG = 62 +) + +// Advanced API (RFC3542) (2). +const ( + IPV6_RECVTCLASS = 66 + IPV6_TCLASS = 67 +) +const ( + IPV6_ADD_MEMBERSHIP = 20 + IPV6_DROP_MEMBERSHIP = 21 +) +const ( + IPV6_RXHOPOPTS = 54 + IPV6_RXDSTOPTS = 59 +) + +// IPV6_MTU_DISCOVER values. +const ( + IPV6_PMTUDISC_DONT = 0 + // Use per route hints. + IPV6_PMTUDISC_WANT = 1 + // Always DF. + IPV6_PMTUDISC_DO = 2 + // Ignore dst pmtu. + IPV6_PMTUDISC_PROBE = 3 + // See IP_PMTUDISC_INTERFACE. + IPV6_PMTUDISC_INTERFACE = 4 + // See IP_PMTUDISC_OMIT. + IPV6_PMTUDISC_OMIT = 5 +) + +// Socket level values for IPv6. +const ( + SOL_IPV6 = 41 + SOL_ICMPV6 = 58 +) + +// Routing header options for IPv6. +const ( + IPV6_RTHDR_LOOSE = 0 + // Hop must be a neighbour. + IPV6_RTHDR_STRICT = 1 +) + +// IPv6 Routing header type 0. +const IPV6_RTHDR_TYPE_0 = 0 + +// Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. +// The `ip_dst' field is used for the first-hop gateway when using a +// source route (this gets put into the header proper). +type IpOpts struct { + IpDst InAddr + IpOpts [40]c.Char +} + +// Like `struct ip_mreq' but including interface specification by index. +type IpMreqn struct { + ImrMultiaddr InAddr + ImrAddress InAddr + ImrIfindex c.Int +} + +// Structure used for IP_PKTINFO. +type InPktinfo struct { + IpiIfindex c.Int + IpiSpecDst InAddr + IpiAddr InAddr +} diff --git a/c/net/bits-in_linux_arm64.go b/c/net/bits-in_linux_arm64.go new file mode 100644 index 00000000..3a7c2e4a --- /dev/null +++ b/c/net/bits-in_linux_arm64.go @@ -0,0 +1,252 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import "github.com/goplus/lib/c" + +const X__USE_KERNEL_IPV6_DEFS = 0 + +// Options for use with `getsockopt' and `setsockopt' at the IP level. +// The first word in the comment at the right is the data type used; +// "bool" means a boolean value stored in an `int'. +const ( + IP_OPTIONS = 4 + // int; Header is included with data. + IP_HDRINCL = 3 + // int; IP type of service and precedence. + IP_TOS = 1 + // int; IP time to live. + IP_TTL = 2 + // bool; Receive all IP options w/datagram. + IP_RECVOPTS = 6 +) + +// For BSD compatibility. +const ( + // ip_opts; Set/get IP per-packet options. + IP_RETOPTS = 7 + // in_addr; set/get IP multicast i/f + IP_MULTICAST_IF = 32 + // u_char; set/get IP multicast ttl + IP_MULTICAST_TTL = 33 + // i_char; set/get IP multicast loopback + IP_MULTICAST_LOOP = 34 + // ip_mreq; add an IP group membership + IP_ADD_MEMBERSHIP = 35 + // ip_mreq; drop an IP group membership + IP_DROP_MEMBERSHIP = 36 + // ip_mreq_source: unblock data from source + IP_UNBLOCK_SOURCE = 37 + // ip_mreq_source: block data from source + IP_BLOCK_SOURCE = 38 + // ip_mreq_source: join source group + IP_ADD_SOURCE_MEMBERSHIP = 39 + // ip_mreq_source: leave source group + IP_DROP_SOURCE_MEMBERSHIP = 40 + IP_MSFILTER = 41 +) +const ( + // group_req: join any-source group + MCAST_JOIN_GROUP = 42 + // group_source_req: block from given group + MCAST_BLOCK_SOURCE = 43 + // group_source_req: unblock from given group + MCAST_UNBLOCK_SOURCE = 44 + // group_req: leave any-source group + MCAST_LEAVE_GROUP = 45 + // group_source_req: join source-spec gr + MCAST_JOIN_SOURCE_GROUP = 46 + // group_source_req: leave source-spec gr + MCAST_LEAVE_SOURCE_GROUP = 47 + MCAST_MSFILTER = 48 + IP_MULTICAST_ALL = 49 + IP_UNICAST_IF = 50 +) +const ( + MCAST_EXCLUDE = 0 + MCAST_INCLUDE = 1 +) +const ( + // bool + IP_ROUTER_ALERT = 5 + // bool + IP_PKTINFO = 8 + IP_PKTOPTIONS = 9 + // obsolete name? + IP_PMTUDISC = 10 + // int; see below + IP_MTU_DISCOVER = 10 + // bool + IP_RECVERR = 11 + // bool + IP_RECVTTL = 12 + // bool + IP_RECVTOS = 13 + // int + IP_MTU = 14 + IP_FREEBIND = 15 + IP_IPSEC_POLICY = 16 + IP_XFRM_POLICY = 17 + IP_PASSSEC = 18 + IP_TRANSPARENT = 19 +) + +// TProxy original addresses +const ( + IP_ORIGDSTADDR = 20 + IP_RECVORIGDSTADDR = 20 +) +const ( + IP_MINTTL = 21 + IP_NODEFRAG = 22 + IP_CHECKSUM = 23 + IP_BIND_ADDRESS_NO_PORT = 24 +) + +// IP_MTU_DISCOVER arguments. +const ( + IP_PMTUDISC_DONT = 0 + // Use per route hints. + IP_PMTUDISC_WANT = 1 + // Always DF. + IP_PMTUDISC_DO = 2 + // Ignore dst pmtu. + IP_PMTUDISC_PROBE = 3 +) + +// Always use interface mtu (ignores dst pmtu) but don't set DF flag. +// Also incoming ICMP frag_needed notifications will be ignored on +// this socket to prevent accepting spoofed ones. +const IP_PMTUDISC_INTERFACE = 4 + +// Like IP_PMTUDISC_INTERFACE but allow packets to be fragmented. +const IP_PMTUDISC_OMIT = 5 + +// To select the IP level. +const SOL_IP = 0 +const ( + IP_DEFAULT_MULTICAST_TTL = 1 + IP_DEFAULT_MULTICAST_LOOP = 1 + IP_MAX_MEMBERSHIPS = 20 +) + +// Options for use with `getsockopt' and `setsockopt' at the IPv6 level. +// The first word in the comment at the right is the data type used; +// "bool" means a boolean value stored in an `int'. +const ( + IPV6_ADDRFORM = 1 + IPV6_2292PKTINFO = 2 + IPV6_2292HOPOPTS = 3 + IPV6_2292DSTOPTS = 4 + IPV6_2292RTHDR = 5 + IPV6_2292PKTOPTIONS = 6 + IPV6_CHECKSUM = 7 + IPV6_2292HOPLIMIT = 8 +) +const ( + IPV6_NEXTHOP = 9 + IPV6_AUTHHDR = 10 + IPV6_UNICAST_HOPS = 16 + IPV6_MULTICAST_IF = 17 + IPV6_MULTICAST_HOPS = 18 + IPV6_MULTICAST_LOOP = 19 + IPV6_JOIN_GROUP = 20 + IPV6_LEAVE_GROUP = 21 + IPV6_ROUTER_ALERT = 22 + IPV6_MTU_DISCOVER = 23 + IPV6_MTU = 24 + IPV6_RECVERR = 25 + IPV6_V6ONLY = 26 + IPV6_JOIN_ANYCAST = 27 + IPV6_LEAVE_ANYCAST = 28 + IPV6_IPSEC_POLICY = 34 + IPV6_XFRM_POLICY = 35 + IPV6_HDRINCL = 36 +) + +// Advanced API (RFC3542) (1). +const ( + IPV6_RECVPKTINFO = 49 + IPV6_PKTINFO = 50 + IPV6_RECVHOPLIMIT = 51 + IPV6_HOPLIMIT = 52 + IPV6_RECVHOPOPTS = 53 + IPV6_HOPOPTS = 54 + IPV6_RTHDRDSTOPTS = 55 + IPV6_RECVRTHDR = 56 + IPV6_RTHDR = 57 + IPV6_RECVDSTOPTS = 58 + IPV6_DSTOPTS = 59 + IPV6_RECVPATHMTU = 60 + IPV6_PATHMTU = 61 + IPV6_DONTFRAG = 62 +) + +// Advanced API (RFC3542) (2). +const ( + IPV6_RECVTCLASS = 66 + IPV6_TCLASS = 67 +) +const ( + IPV6_ADD_MEMBERSHIP = 20 + IPV6_DROP_MEMBERSHIP = 21 +) +const ( + IPV6_RXHOPOPTS = 54 + IPV6_RXDSTOPTS = 59 +) + +// IPV6_MTU_DISCOVER values. +const ( + IPV6_PMTUDISC_DONT = 0 + // Use per route hints. + IPV6_PMTUDISC_WANT = 1 + // Always DF. + IPV6_PMTUDISC_DO = 2 + // Ignore dst pmtu. + IPV6_PMTUDISC_PROBE = 3 + // See IP_PMTUDISC_INTERFACE. + IPV6_PMTUDISC_INTERFACE = 4 + // See IP_PMTUDISC_OMIT. + IPV6_PMTUDISC_OMIT = 5 +) + +// Socket level values for IPv6. +const ( + SOL_IPV6 = 41 + SOL_ICMPV6 = 58 +) + +// Routing header options for IPv6. +const ( + IPV6_RTHDR_LOOSE = 0 + // Hop must be a neighbour. + IPV6_RTHDR_STRICT = 1 +) + +// IPv6 Routing header type 0. +const IPV6_RTHDR_TYPE_0 = 0 + +// Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. +// The `ip_dst' field is used for the first-hop gateway when using a +// source route (this gets put into the header proper). +type IpOpts struct { + IpDst InAddr + IpOpts [40]uint8 +} + +// Like `struct ip_mreq' but including interface specification by index. +type IpMreqn struct { + ImrMultiaddr InAddr + ImrAddress InAddr + ImrIfindex c.Int +} + +// Structure used for IP_PKTINFO. +type InPktinfo struct { + IpiIfindex c.Int + IpiSpecDst InAddr + IpiAddr InAddr +} diff --git a/c/net/bits-netdb_linux_amd64.go b/c/net/bits-netdb_linux_amd64.go index 1a3e598e..987658c8 100644 --- a/c/net/bits-netdb_linux_amd64.go +++ b/c/net/bits-netdb_linux_amd64.go @@ -1,13 +1,10 @@ //go:build linux && amd64 && !android // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net -import ( - "github.com/goplus/lib/c" -) +import "github.com/goplus/lib/c" // Description of data base entry for a single network. NOTE: here a // poor assumption is made. The network number is expected to fit @@ -16,5 +13,5 @@ type Netent struct { NName *c.Char NAliases **c.Char NAddrtype c.Int - NNet Uint32T + NNet c.Uint32T } diff --git a/c/net/bits-netdb_linux_arm64.go b/c/net/bits-netdb_linux_arm64.go new file mode 100644 index 00000000..b122bd76 --- /dev/null +++ b/c/net/bits-netdb_linux_arm64.go @@ -0,0 +1,17 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import "github.com/goplus/lib/c" + +// Description of data base entry for a single network. NOTE: here a +// poor assumption is made. The network number is expected to fit +// into an unsigned long int variable. +type Netent struct { + NName *uint8 + NAliases **uint8 + NAddrtype c.Int + NNet c.Uint32T +} diff --git a/c/net/bits-sockaddr_linux_amd64.go b/c/net/bits-sockaddr_linux_amd64.go index 12e4afb6..a4551a5d 100644 --- a/c/net/bits-sockaddr_linux_amd64.go +++ b/c/net/bits-sockaddr_linux_amd64.go @@ -1,7 +1,6 @@ //go:build linux && amd64 && !android // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net diff --git a/c/net/bits-sockaddr_linux_arm64.go b/c/net/bits-sockaddr_linux_arm64.go new file mode 100644 index 00000000..0be98026 --- /dev/null +++ b/c/net/bits-sockaddr_linux_arm64.go @@ -0,0 +1,13 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +const X_BITS_SOCKADDR_H = 1 + +// Size of struct sockaddr_storage. +const X_SS_SIZE = 128 + +// POSIX.1g specifies this type name for the `sa_family' member. +type SaFamilyT = uint16 diff --git a/c/net/bits-socket_linux_amd64.go b/c/net/bits-socket_linux_amd64.go index 7689ea2b..dbecf5d4 100644 --- a/c/net/bits-socket_linux_amd64.go +++ b/c/net/bits-socket_linux_amd64.go @@ -1,7 +1,6 @@ //go:build linux && amd64 && !android // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net @@ -100,16 +99,8 @@ const ( PF_VSOCK = 40 // Kernel Connection Multiplexor. PF_KCM = 41 - // Qualcomm IPC Router. - PF_QIPCRTR = 42 - // SMC sockets. - PF_SMC = 43 - // XDP sockets. - PF_XDP = 44 - // Management component transport protocol. - PF_MCTP = 45 // For now.. - PF_MAX = 46 + PF_MAX = 42 ) // Address families. @@ -159,11 +150,7 @@ const ( AF_NFC = 39 AF_VSOCK = 40 AF_KCM = 41 - AF_QIPCRTR = 42 - AF_SMC = 43 - AF_XDP = 44 - AF_MCTP = 45 - AF_MAX = 46 + AF_MAX = 42 ) // Socket level values. Others are defined in the appropriate headers. @@ -195,52 +182,43 @@ const ( SOL_ALG = 279 SOL_NFC = 280 SOL_KCM = 281 - SOL_TLS = 282 - SOL_XDP = 283 - SOL_MPTCP = 284 - SOL_MCTP = 285 - SOL_SMC = 286 - SOL_VSOCK = 287 ) // Maximum queue length specifiable by listen. -const SOMAXCONN = 4096 +const SOMAXCONN = 128 // Structure describing a generic socket address. type SockAddr struct { - Family SaFamilyT + Family uint16 Data [14]c.Char } - type SockaddrStorage struct { - Family SaFamilyT - pad [118]c.Char - align c.Ulong + Family uint16 + X__SsPadding [118]c.Char + X__SsAlign c.Ulong } // Bits in the FLAGS argument to `send', `recv', et al. const ( - MSG_OOB = 1 - MSG_PEEK = 2 - MSG_DONTROUTE = 4 - MSG_CTRUNC = 8 - MSG_PROXY = 16 - MSG_TRUNC = 32 - MSG_DONTWAIT = 64 - MSG_EOR = 128 - MSG_WAITALL = 256 - MSG_FIN = 512 - MSG_SYN = 1024 - MSG_CONFIRM = 2048 - MSG_RST = 4096 - MSG_ERRQUEUE = 8192 - MSG_NOSIGNAL = 16384 - MSG_MORE = 32768 - MSG_WAITFORONE = 65536 - MSG_BATCH = 262144 - MSG_SOCK_DEVMEM = 33554432 - MSG_ZEROCOPY = 67108864 - MSG_FASTOPEN = 536870912 + MSG_OOB = 1 + MSG_PEEK = 2 + MSG_DONTROUTE = 4 + MSG_CTRUNC = 8 + MSG_PROXY = 16 + MSG_TRUNC = 32 + MSG_DONTWAIT = 64 + MSG_EOR = 128 + MSG_WAITALL = 256 + MSG_FIN = 512 + MSG_SYN = 1024 + MSG_CONFIRM = 2048 + MSG_RST = 4096 + MSG_ERRQUEUE = 8192 + MSG_NOSIGNAL = 16384 + MSG_MORE = 32768 + MSG_WAITFORONE = 65536 + MSG_BATCH = 262144 + MSG_FASTOPEN = 536870912 // Set close_on_exit for file // descriptor received through // SCM_RIGHTS. @@ -252,21 +230,30 @@ const ( type Msghdr struct { MsgName unsafe.Pointer MsgNamelen SocklenT - MsgIov *Iovec + MsgIov *c.Iovec MsgIovlen c.SizeT MsgControl unsafe.Pointer MsgControllen c.SizeT MsgFlags c.Int } +// Structure used for storage of ancillary data object information. +type Cmsghdr struct { + CmsgLen c.SizeT + CmsgLevel c.Int + CmsgType c.Int + X__CmsgData *uint8 +} + // Socket level message types. This must match the definitions in // . -const SCM_RIGHTS = 1 +const +// Transfer file descriptors. +SCM_RIGHTS = 1 // Structure used to manipulate the SO_LINGER option. type Linger struct { LOnoff c.Int LLinger c.Int } - type SocklenT = X__SocklenT diff --git a/c/net/bits-socket_linux_arm64.go b/c/net/bits-socket_linux_arm64.go new file mode 100644 index 00000000..e58624ec --- /dev/null +++ b/c/net/bits-socket_linux_arm64.go @@ -0,0 +1,259 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +// Protocol families. +const ( + PF_UNSPEC = 0 + // Local to host (pipes and file-domain). + PF_LOCAL = 1 + // POSIX name for PF_LOCAL. + PF_UNIX = 1 + // Another non-standard name for PF_LOCAL. + PF_FILE = 1 + // IP protocol family. + PF_INET = 2 + // Amateur Radio AX.25. + PF_AX25 = 3 + // Novell Internet Protocol. + PF_IPX = 4 + // Appletalk DDP. + PF_APPLETALK = 5 + // Amateur radio NetROM. + PF_NETROM = 6 + // Multiprotocol bridge. + PF_BRIDGE = 7 + // ATM PVCs. + PF_ATMPVC = 8 + // Reserved for X.25 project. + PF_X25 = 9 + // IP version 6. + PF_INET6 = 10 + // Amateur Radio X.25 PLP. + PF_ROSE = 11 + // Reserved for DECnet project. + PF_DECnet = 12 + // Reserved for 802.2LLC project. + PF_NETBEUI = 13 + // Security callback pseudo AF. + PF_SECURITY = 14 + // PF_KEY key management API. + PF_KEY = 15 + PF_NETLINK = 16 + // Alias to emulate 4.4BSD. + PF_ROUTE = 16 + // Packet family. + PF_PACKET = 17 + // Ash. + PF_ASH = 18 + // Acorn Econet. + PF_ECONET = 19 + // ATM SVCs. + PF_ATMSVC = 20 + // RDS sockets. + PF_RDS = 21 + // Linux SNA Project + PF_SNA = 22 + // IRDA sockets. + PF_IRDA = 23 + // PPPoX sockets. + PF_PPPOX = 24 + // Wanpipe API sockets. + PF_WANPIPE = 25 + // Linux LLC. + PF_LLC = 26 + // Native InfiniBand address. + PF_IB = 27 + // MPLS. + PF_MPLS = 28 + // Controller Area Network. + PF_CAN = 29 + // TIPC sockets. + PF_TIPC = 30 + // Bluetooth sockets. + PF_BLUETOOTH = 31 + // IUCV sockets. + PF_IUCV = 32 + // RxRPC sockets. + PF_RXRPC = 33 + // mISDN sockets. + PF_ISDN = 34 + // Phonet sockets. + PF_PHONET = 35 + // IEEE 802.15.4 sockets. + PF_IEEE802154 = 36 + // CAIF sockets. + PF_CAIF = 37 + // Algorithm sockets. + PF_ALG = 38 + // NFC sockets. + PF_NFC = 39 + // vSockets. + PF_VSOCK = 40 + // Kernel Connection Multiplexor. + PF_KCM = 41 + // For now.. + PF_MAX = 42 +) + +// Address families. +const ( + AF_UNSPEC = 0 + AF_LOCAL = 1 + AF_UNIX = 1 + AF_FILE = 1 + AF_INET = 2 + AF_AX25 = 3 + AF_IPX = 4 + AF_APPLETALK = 5 + AF_NETROM = 6 + AF_BRIDGE = 7 + AF_ATMPVC = 8 + AF_X25 = 9 + AF_INET6 = 10 + AF_ROSE = 11 + AF_DECnet = 12 + AF_NETBEUI = 13 + AF_SECURITY = 14 + AF_KEY = 15 + AF_NETLINK = 16 + AF_ROUTE = 16 + AF_PACKET = 17 + AF_ASH = 18 + AF_ECONET = 19 + AF_ATMSVC = 20 + AF_RDS = 21 + AF_SNA = 22 + AF_IRDA = 23 + AF_PPPOX = 24 + AF_WANPIPE = 25 + AF_LLC = 26 + AF_IB = 27 + AF_MPLS = 28 + AF_CAN = 29 + AF_TIPC = 30 + AF_BLUETOOTH = 31 + AF_IUCV = 32 + AF_RXRPC = 33 + AF_ISDN = 34 + AF_PHONET = 35 + AF_IEEE802154 = 36 + AF_CAIF = 37 + AF_ALG = 38 + AF_NFC = 39 + AF_VSOCK = 40 + AF_KCM = 41 + AF_MAX = 42 +) + +// Socket level values. Others are defined in the appropriate headers. +// +// XXX These definitions also should go into the appropriate headers as +// far as they are available. +const ( + SOL_RAW = 255 + SOL_DECNET = 261 + SOL_X25 = 262 + SOL_PACKET = 263 + // ATM layer (cell level). + SOL_ATM = 264 + // ATM Adaption Layer (packet level). + SOL_AAL = 265 + SOL_IRDA = 266 + SOL_NETBEUI = 267 + SOL_LLC = 268 + SOL_DCCP = 269 + SOL_NETLINK = 270 + SOL_TIPC = 271 + SOL_RXRPC = 272 + SOL_PPPOL2TP = 273 + SOL_BLUETOOTH = 274 + SOL_PNPIPE = 275 + SOL_RDS = 276 + SOL_IUCV = 277 + SOL_CAIF = 278 + SOL_ALG = 279 + SOL_NFC = 280 + SOL_KCM = 281 +) + +// Maximum queue length specifiable by listen. +const SOMAXCONN = 128 + +// Structure describing a generic socket address. +type SockAddr struct { + Family uint16 + Data [14]c.Char +} +type SockaddrStorage struct { + Family uint16 + X__SsPadding [118]uint8 + X__SsAlign c.Ulong +} + +// Bits in the FLAGS argument to `send', `recv', et al. +const ( + MSG_OOB = 1 + MSG_PEEK = 2 + MSG_DONTROUTE = 4 + MSG_CTRUNC = 8 + MSG_PROXY = 16 + MSG_TRUNC = 32 + MSG_DONTWAIT = 64 + MSG_EOR = 128 + MSG_WAITALL = 256 + MSG_FIN = 512 + MSG_SYN = 1024 + MSG_CONFIRM = 2048 + MSG_RST = 4096 + MSG_ERRQUEUE = 8192 + MSG_NOSIGNAL = 16384 + MSG_MORE = 32768 + MSG_WAITFORONE = 65536 + MSG_BATCH = 262144 + MSG_FASTOPEN = 536870912 + // Set close_on_exit for file + // descriptor received through + // SCM_RIGHTS. + MSG_CMSG_CLOEXEC = 1073741824 +) + +// Structure describing messages sent by +// `sendmsg' and received by `recvmsg'. +type Msghdr struct { + MsgName unsafe.Pointer + MsgNamelen SocklenT + MsgIov *c.Iovec + MsgIovlen c.SizeT + MsgControl unsafe.Pointer + MsgControllen c.SizeT + MsgFlags c.Int +} + +// Structure used for storage of ancillary data object information. +type Cmsghdr struct { + CmsgLen c.SizeT + CmsgLevel c.Int + CmsgType c.Int + X__CmsgData *uint8 +} + +// Socket level message types. This must match the definitions in +// . +const +// Transfer file descriptors. +SCM_RIGHTS = 1 + +// Structure used to manipulate the SO_LINGER option. +type Linger struct { + LOnoff c.Int + LLinger c.Int +} +type SocklenT = X__SocklenT diff --git a/c/net/bits-socket_type_linux_amd64.go b/c/net/bits-socket_type_linux_amd64.go index 67d46b99..bfee4901 100644 --- a/c/net/bits-socket_type_linux_amd64.go +++ b/c/net/bits-socket_type_linux_amd64.go @@ -1,21 +1,23 @@ //go:build linux && amd64 && !android // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net -import ( - "github.com/goplus/lib/c" -) +import "github.com/goplus/lib/c" // Types of sockets. type X__SocketType c.Uint const ( - SOCK_DCCP X__SocketType = 6 - SOCK_PACKET X__SocketType = 10 - SOCK_CLOEXEC X__SocketType = 524288 + _native_SOCK_STREAM X__SocketType = 1 + _native_SOCK_DGRAM X__SocketType = 2 + _native_SOCK_RAW X__SocketType = 3 + _native_SOCK_RDM X__SocketType = 4 + _native_SOCK_SEQPACKET X__SocketType = 5 + SOCK_DCCP X__SocketType = 6 + SOCK_PACKET X__SocketType = 10 + SOCK_CLOEXEC X__SocketType = 524288 // Atomically mark descriptor(s) as // non-blocking. SOCK_NONBLOCK X__SocketType = 2048 diff --git a/c/net/bits-socket_type_linux_arm64.go b/c/net/bits-socket_type_linux_arm64.go new file mode 100644 index 00000000..24f1f505 --- /dev/null +++ b/c/net/bits-socket_type_linux_arm64.go @@ -0,0 +1,24 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import "github.com/goplus/lib/c" + +// Types of sockets. +type X__SocketType c.Uint + +const ( + _native_SOCK_STREAM X__SocketType = 1 + _native_SOCK_DGRAM X__SocketType = 2 + _native_SOCK_RAW X__SocketType = 3 + _native_SOCK_RDM X__SocketType = 4 + _native_SOCK_SEQPACKET X__SocketType = 5 + SOCK_DCCP X__SocketType = 6 + SOCK_PACKET X__SocketType = 10 + SOCK_CLOEXEC X__SocketType = 524288 + // Atomically mark descriptor(s) as + // non-blocking. + SOCK_NONBLOCK X__SocketType = 2048 +) diff --git a/c/net/bits-types_linux_amd64.go b/c/net/bits-types_linux_amd64.go new file mode 100644 index 00000000..cb87213c --- /dev/null +++ b/c/net/bits-types_linux_amd64.go @@ -0,0 +1,133 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import "github.com/goplus/lib/c" + +const X_BITS_TYPES_H = 1 + +type X__FsidT struct { + X__Val [2]c.Int +} + +// Convenience types. +type X__UChar = uint8 +type X__UShort = uint16 +type X__UInt = c.Uint +type X__ULong = c.Ulong + +// Fixed-size types, underlying types depend on word size and compiler. +type X__Int8T = int8 +type X__Uint8T = uint8 +type X__Int16T = int16 +type X__Uint16T = uint16 +type X__Int32T = c.Int +type X__Uint32T = c.Uint +type X__Int64T = c.Long +type X__Uint64T = c.Ulong +type X__QuadT = c.Long +type X__UQuadT = c.Ulong + +// Type of device numbers. +type X__DevT = c.Ulong + +// Type of user identifications. +type X__UidT = c.Uint + +// Type of group identifications. +type X__GidT = c.Uint + +// Type of file serial numbers. +type X__InoT = c.Ulong + +// Type of file serial numbers (LFS). +type X__Ino64T = c.Ulong + +// Type of file attribute bitmasks. +type X__ModeT = c.Uint + +// Type of file link counts. +type X__NlinkT = c.Ulong + +// Type of file sizes and offsets. +type X__OffT = c.Long + +// Type of file sizes and offsets (LFS). +type X__Off64T = c.Long + +// Type of process identifications. +type X__PidT = c.Int + +// Type of CPU usage counts. +type X__ClockT = c.Long + +// Type for resource measurement. +type X__RlimT = c.Ulong + +// Type for resource measurement (LFS). +type X__Rlim64T = c.Ulong + +// General type for IDs. +type X__IdT = c.Uint + +// Seconds since the Epoch. +type X__TimeT = c.Long + +// Count of microseconds. +type X__UsecondsT = c.Uint + +// Signed count of microseconds. +type X__SusecondsT = c.Long + +// The type of a disk address. +type X__DaddrT = c.Int + +// Type of an IPC key. +type X__KeyT = c.Int + +// Clock ID used in clock and timer functions. +type X__ClockidT = c.Int + +// Timer ID returned by `timer_create'. +type X__TimerT uintptr + +// Type to represent block size. +type X__BlksizeT = c.Long + +// Type to count number of disk blocks. +type X__BlkcntT = c.Long +type X__Blkcnt64T = c.Long + +// Type to count file system blocks. +type X__FsblkcntT = c.Ulong +type X__Fsblkcnt64T = c.Ulong + +// Type to count file system nodes. +type X__FsfilcntT = c.Ulong +type X__Fsfilcnt64T = c.Ulong + +// Type of miscellaneous file system fields. +type X__FswordT = c.Long + +// Type of a byte count, or error. +type X__SsizeT = c.Long + +// Signed long type used in system calls. +type X__SyscallSlongT = c.Long + +// Unsigned long type used in system calls. +type X__SyscallUlongT = c.Ulong + +// These few don't really vary by system, they always correspond +// to one of the other defined types. +type X__LoffT = X__Off64T +type X__QaddrT = *X__QuadT +type X__CaddrT = *c.Char + +// Duplicates info from stdint.h but this is used in unistd.h. +type X__IntptrT = c.Long + +// Duplicate info from sys/socket.h. +type X__SocklenT = c.Uint diff --git a/c/net/bits-types_linux_arm64.go b/c/net/bits-types_linux_arm64.go new file mode 100644 index 00000000..ba071294 --- /dev/null +++ b/c/net/bits-types_linux_arm64.go @@ -0,0 +1,133 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import "github.com/goplus/lib/c" + +const X_BITS_TYPES_H = 1 + +type X__FsidT struct { + X__Val [2]c.Int +} + +// Convenience types. +type X__UChar = uint8 +type X__UShort = uint16 +type X__UInt = c.Uint +type X__ULong = c.Ulong + +// Fixed-size types, underlying types depend on word size and compiler. +type X__Int8T = int8 +type X__Uint8T = uint8 +type X__Int16T = int16 +type X__Uint16T = uint16 +type X__Int32T = c.Int +type X__Uint32T = c.Uint +type X__Int64T = c.Long +type X__Uint64T = c.Ulong +type X__QuadT = c.Long +type X__UQuadT = c.Ulong + +// Type of device numbers. +type X__DevT = c.Ulong + +// Type of user identifications. +type X__UidT = c.Uint + +// Type of group identifications. +type X__GidT = c.Uint + +// Type of file serial numbers. +type X__InoT = c.Ulong + +// Type of file serial numbers (LFS). +type X__Ino64T = c.Ulong + +// Type of file attribute bitmasks. +type X__ModeT = c.Uint + +// Type of file link counts. +type X__NlinkT = c.Uint + +// Type of file sizes and offsets. +type X__OffT = c.Long + +// Type of file sizes and offsets (LFS). +type X__Off64T = c.Long + +// Type of process identifications. +type X__PidT = c.Int + +// Type of CPU usage counts. +type X__ClockT = c.Long + +// Type for resource measurement. +type X__RlimT = c.Ulong + +// Type for resource measurement (LFS). +type X__Rlim64T = c.Ulong + +// General type for IDs. +type X__IdT = c.Uint + +// Seconds since the Epoch. +type X__TimeT = c.Long + +// Count of microseconds. +type X__UsecondsT = c.Uint + +// Signed count of microseconds. +type X__SusecondsT = c.Long + +// The type of a disk address. +type X__DaddrT = c.Int + +// Type of an IPC key. +type X__KeyT = c.Int + +// Clock ID used in clock and timer functions. +type X__ClockidT = c.Int + +// Timer ID returned by `timer_create'. +type X__TimerT uintptr + +// Type to represent block size. +type X__BlksizeT = c.Int + +// Type to count number of disk blocks. +type X__BlkcntT = c.Long +type X__Blkcnt64T = c.Long + +// Type to count file system blocks. +type X__FsblkcntT = c.Ulong +type X__Fsblkcnt64T = c.Ulong + +// Type to count file system nodes. +type X__FsfilcntT = c.Ulong +type X__Fsfilcnt64T = c.Ulong + +// Type of miscellaneous file system fields. +type X__FswordT = c.Long + +// Type of a byte count, or error. +type X__SsizeT = c.Long + +// Signed long type used in system calls. +type X__SyscallSlongT = c.Long + +// Unsigned long type used in system calls. +type X__SyscallUlongT = c.Ulong + +// These few don't really vary by system, they always correspond +// to one of the other defined types. +type X__LoffT = X__Off64T +type X__QaddrT = *X__QuadT +type X__CaddrT = *uint8 + +// Duplicates info from stdint.h but this is used in unistd.h. +type X__IntptrT = c.Long + +// Duplicate info from sys/socket.h. +type X__SocklenT = c.Uint diff --git a/c/net/legacy_native.go b/c/net/legacy_native.go index 1bf6b253..22071259 100644 --- a/c/net/legacy_native.go +++ b/c/net/legacy_native.go @@ -1,4 +1,4 @@ -//go:build (darwin && arm64 && !ios) || (linux && amd64 && !android) +//go:build (darwin && arm64 && !ios) || (linux && amd64 && !android) || (linux && arm64 && !android) /* * Copyright (c) 2024 The XGo Authors (xgo.dev). All rights reserved. diff --git a/c/net/llcppg-linux_amd64.cfg b/c/net/llcppg-linux_amd64.cfg new file mode 100644 index 00000000..8287054b --- /dev/null +++ b/c/net/llcppg-linux_amd64.cfg @@ -0,0 +1,96 @@ +{ + "Name": "net", + "Language": "c", + "LLGoPackage": "link: -lc", + "Dir": ".sysroot/include", + "Files": [ + "llcppg.h" + ], + "Stdlib": ".sysroot/stdlib", + "Deps": [ + ".." + ], + "Rename": { + "sockaddr": "SockAddr", + "addrinfo": "AddrInfo", + "sockaddr_in": "SockaddrIn", + "sockaddr_in6": "SockaddrIn6", + "sockaddr_storage": "SockaddrStorage", + "sockaddr_un": "SockaddrUn", + "__sockaddr_header": "X__SockaddrHeader", + "_llcppg_char_ptr": "charPtr", + "_llcppg_char_pp": "charPP", + "_llcppg_sockaddr_ptr": "sockaddrPtr", + "_llcppg_addrinfo_ptr": "addrinfoPtr", + "_llcppg_native_in6_addr": "nativeIn6Addr", + "SOCK_STREAM": "_native_SOCK_STREAM", + "SOCK_DGRAM": "_native_SOCK_DGRAM", + "SOCK_RAW": "_native_SOCK_RAW", + "SOCK_RDM": "_native_SOCK_RDM", + "SOCK_SEQPACKET": "_native_SOCK_SEQPACKET" + }, + "MacroIgnore": [ + "IPPORT_RESERVED" + ], + "FailFast": 0, + "TypeIgnore": [ + "cmsghdr", + "va_list", + "_llcppg_native_in6_addr" + ], + "FuncIgnore": [ + "socket", + "bind", + "connect", + "listen", + "accept", + "gethostbyname", + "inet_ntop", + "inet_addr", + "send", + "recv", + "setsockopt", + "ntohs", + "htons", + "ntohl", + "htonl", + "getaddrinfo", + "freeaddrinfo", + "__cmsg_nxthdr", + "if_nameindex" + ], + "FieldAlias": { + "in6_addr::_": "_ [0]uint32", + "in6_addr::U6Addr": "U6Addr [16]uint8", + "hostent::h_name": "Name .charPtr", + "hostent::h_aliases": "Aliases .charPP", + "hostent::h_addrtype": "AddrType c.Int", + "hostent::h_length": "Length c.Int", + "hostent::h_addr_list": "AddrList .charPP", + "addrinfo::ai_flags": "Flags c.Int", + "addrinfo::ai_family": "Family c.Int", + "addrinfo::ai_socktype": "SockType c.Int", + "addrinfo::ai_protocol": "Protocol c.Int", + "addrinfo::ai_addrlen": "AddrLen .SocklenT", + "addrinfo::ai_addr": "Addr .sockaddrPtr", + "addrinfo::ai_canonname": "CanOnName .charPtr", + "addrinfo::ai_next": "Next .addrinfoPtr", + "sockaddr::sa_len": "Len uint8", + "sockaddr::sa_family": "Family uint16", + "sockaddr::sa_data": "Data [14]c.Char", + "sockaddr_in::sin_len": "Len uint8", + "sockaddr_in::sin_family": "Family uint16", + "sockaddr_in::sin_port": "Port uint16", + "sockaddr_in::sin_addr": "Addr .InAddr", + "sockaddr_in::sin_zero": "Zero [8]uint8", + "sockaddr_in6::sin6_len": "Len uint8", + "sockaddr_in6::sin6_family": "Family uint16", + "sockaddr_in6::sin6_port": "Port uint16", + "sockaddr_in6::sin6_flowinfo": "Flowinfo uint32", + "sockaddr_in6::sin6_addr": "Addr .In6Addr", + "sockaddr_in6::sin6_scope_id": "ScopeId uint32", + "in_addr::s_addr": "Addr uint32", + "sockaddr_storage::ss_len": "Len uint8", + "sockaddr_storage::ss_family": "Family uint16" + } +} diff --git a/c/net/llcppg-linux_arm64.cfg b/c/net/llcppg-linux_arm64.cfg new file mode 100644 index 00000000..b8a759d1 --- /dev/null +++ b/c/net/llcppg-linux_arm64.cfg @@ -0,0 +1,96 @@ +{ + "Name": "net", + "Language": "c", + "LLGoPackage": "link: -lc", + "Dir": ".sysroot/include", + "Files": [ + "llcppg.h" + ], + "Stdlib": ".sysroot/stdlib", + "Deps": [ + ".." + ], + "Rename": { + "sockaddr": "SockAddr", + "addrinfo": "AddrInfo", + "sockaddr_in": "SockaddrIn", + "sockaddr_in6": "SockaddrIn6", + "sockaddr_storage": "SockaddrStorage", + "sockaddr_un": "SockaddrUn", + "__sockaddr_header": "X__SockaddrHeader", + "_llcppg_char_ptr": "charPtr", + "_llcppg_char_pp": "charPP", + "_llcppg_sockaddr_ptr": "sockaddrPtr", + "_llcppg_addrinfo_ptr": "addrinfoPtr", + "_llcppg_native_in6_addr": "nativeIn6Addr", + "SOCK_STREAM": "_native_SOCK_STREAM", + "SOCK_DGRAM": "_native_SOCK_DGRAM", + "SOCK_RAW": "_native_SOCK_RAW", + "SOCK_RDM": "_native_SOCK_RDM", + "SOCK_SEQPACKET": "_native_SOCK_SEQPACKET" + }, + "MacroIgnore": [ + "IPPORT_RESERVED" + ], + "FailFast": 0, + "TypeIgnore": [ + "cmsghdr", + "va_list", + "_llcppg_native_in6_addr" + ], + "FuncIgnore": [ + "socket", + "bind", + "connect", + "listen", + "accept", + "gethostbyname", + "inet_ntop", + "inet_addr", + "send", + "recv", + "setsockopt", + "ntohs", + "htons", + "ntohl", + "htonl", + "getaddrinfo", + "freeaddrinfo", + "__cmsg_nxthdr", + "if_nameindex" + ], + "FieldAlias": { + "in6_addr::_": "_ [0]uint32", + "in6_addr::U6Addr": "U6Addr [16]uint8", + "hostent::h_name": "Name .charPtr", + "hostent::h_aliases": "Aliases .charPP", + "hostent::h_addrtype": "AddrType c.Int", + "hostent::h_length": "Length c.Int", + "hostent::h_addr_list": "AddrList .charPP", + "addrinfo::ai_flags": "Flags c.Int", + "addrinfo::ai_family": "Family c.Int", + "addrinfo::ai_socktype": "SockType c.Int", + "addrinfo::ai_protocol": "Protocol c.Int", + "addrinfo::ai_addrlen": "AddrLen .SocklenT", + "addrinfo::ai_addr": "Addr .sockaddrPtr", + "addrinfo::ai_canonname": "CanOnName .charPtr", + "addrinfo::ai_next": "Next .addrinfoPtr", + "sockaddr::sa_len": "Len uint8", + "sockaddr::sa_family": "Family uint16", + "sockaddr::sa_data": "Data [14]c.Char", + "sockaddr_in::sin_len": "Len uint8", + "sockaddr_in::sin_family": "Family uint16", + "sockaddr_in::sin_port": "Port uint16", + "sockaddr_in::sin_addr": "Addr .InAddr", + "sockaddr_in::sin_zero": "Zero [8]c.Char", + "sockaddr_in6::sin6_len": "Len uint8", + "sockaddr_in6::sin6_family": "Family uint16", + "sockaddr_in6::sin6_port": "Port uint16", + "sockaddr_in6::sin6_flowinfo": "Flowinfo uint32", + "sockaddr_in6::sin6_addr": "Addr .In6Addr", + "sockaddr_in6::sin6_scope_id": "ScopeId uint32", + "in_addr::s_addr": "Addr uint32", + "sockaddr_storage::ss_len": "Len uint8", + "sockaddr_storage::ss_family": "Family uint16" + } +} diff --git a/c/net/llcppg.cfg b/c/net/llcppg.cfg new file mode 100644 index 00000000..6c42c816 --- /dev/null +++ b/c/net/llcppg.cfg @@ -0,0 +1,96 @@ +{ + "Name": "net", + "Language": "c", + "LLGoPackage": "link: -lc", + "Dir": ".sysroot/include", + "Files": [ + "llcppg.h" + ], + "Stdlib": ".sysroot/stdlib", + "Deps": [ + ".." + ], + "Rename": { + "sockaddr": "SockAddr", + "addrinfo": "AddrInfo", + "sockaddr_in": "SockaddrIn", + "sockaddr_in6": "SockaddrIn6", + "sockaddr_storage": "SockaddrStorage", + "sockaddr_un": "SockaddrUn", + "__sockaddr_header": "X__SockaddrHeader", + "_llcppg_char_ptr": "charPtr", + "_llcppg_char_pp": "charPP", + "_llcppg_sockaddr_ptr": "sockaddrPtr", + "_llcppg_addrinfo_ptr": "addrinfoPtr", + "_llcppg_native_in6_addr": "nativeIn6Addr", + "SOCK_STREAM": "_native_SOCK_STREAM", + "SOCK_DGRAM": "_native_SOCK_DGRAM", + "SOCK_RAW": "_native_SOCK_RAW", + "SOCK_RDM": "_native_SOCK_RDM", + "SOCK_SEQPACKET": "_native_SOCK_SEQPACKET" + }, + "MacroIgnore": [ + "IPPORT_RESERVED" + ], + "FailFast": 0, + "TypeIgnore": [ + "cmsghdr", + "va_list", + "_llcppg_native_in6_addr" + ], + "FuncIgnore": [ + "socket", + "bind", + "connect", + "listen", + "accept", + "gethostbyname", + "inet_ntop", + "inet_addr", + "send", + "recv", + "setsockopt", + "ntohs", + "htons", + "ntohl", + "htonl", + "getaddrinfo", + "freeaddrinfo", + "__cmsg_nxthdr", + "if_nameindex" + ], + "FieldAlias": { + "in6_addr::_": "_ [0]uint32", + "in6_addr::U6Addr": "U6Addr [16]uint8", + "hostent::h_name": "Name .charPtr", + "hostent::h_aliases": "Aliases .charPP", + "hostent::h_addrtype": "AddrType c.Int", + "hostent::h_length": "Length c.Int", + "hostent::h_addr_list": "AddrList .charPP", + "addrinfo::ai_flags": "Flags c.Int", + "addrinfo::ai_family": "Family c.Int", + "addrinfo::ai_socktype": "SockType c.Int", + "addrinfo::ai_protocol": "Protocol c.Int", + "addrinfo::ai_addrlen": "AddrLen .SocklenT", + "addrinfo::ai_addr": "Addr .sockaddrPtr", + "addrinfo::ai_canonname": "CanOnName .charPtr", + "addrinfo::ai_next": "Next .addrinfoPtr", + "sockaddr::sa_len": "Len uint8", + "sockaddr::sa_family": "Family uint8", + "sockaddr::sa_data": "Data [14]c.Char", + "sockaddr_in::sin_len": "Len uint8", + "sockaddr_in::sin_family": "Family uint8", + "sockaddr_in::sin_port": "Port uint16", + "sockaddr_in::sin_addr": "Addr .InAddr", + "sockaddr_in::sin_zero": "Zero [8]c.Char", + "sockaddr_in6::sin6_len": "Len uint8", + "sockaddr_in6::sin6_family": "Family uint8", + "sockaddr_in6::sin6_port": "Port uint16", + "sockaddr_in6::sin6_flowinfo": "Flowinfo uint32", + "sockaddr_in6::sin6_addr": "Addr .In6Addr", + "sockaddr_in6::sin6_scope_id": "ScopeId uint32", + "in_addr::s_addr": "Addr uint32", + "sockaddr_storage::ss_len": "Len uint8", + "sockaddr_storage::ss_family": "Family uint8" + } +} diff --git a/c/net/llcppg.i_darwin_arm64.go b/c/net/llcppg.i_darwin_arm64.go index 74ba64e7..2d0d1aca 100644 --- a/c/net/llcppg.i_darwin_arm64.go +++ b/c/net/llcppg.i_darwin_arm64.go @@ -5,4 +5,4 @@ package net const XGoPackage = true -const LLGoPackage = "link: -lSystem" +const LLGoPackage = "link: -lc" diff --git a/c/net/llcppg.i_linux_arm64.go b/c/net/llcppg.i_linux_arm64.go new file mode 100644 index 00000000..214f2d62 --- /dev/null +++ b/c/net/llcppg.i_linux_arm64.go @@ -0,0 +1,8 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +const XGoPackage = true +const LLGoPackage = "link: -lc" diff --git a/c/net/llcppg.pub b/c/net/llcppg.pub index f8350061..fee07a0e 100644 --- a/c/net/llcppg.pub +++ b/c/net/llcppg.pub @@ -1,7 +1,94 @@ -D github.com/goplus/lib/c +T __blkcnt64_t X__Blkcnt64T +T __blkcnt_t X__BlkcntT +T __blksize_t X__BlksizeT +T __caddr_t X__CaddrT +T __clock_t X__ClockT +T __clockid_t X__ClockidT +T __daddr_t X__DaddrT +T __darwin_blkcnt_t X__DarwinBlkcntT +T __darwin_blksize_t X__DarwinBlksizeT +T __darwin_clock_t X__DarwinClockT +T __darwin_ct_rune_t X__DarwinCtRuneT +T __darwin_dev_t X__DarwinDevT +T __darwin_fsblkcnt_t X__DarwinFsblkcntT +T __darwin_fsfilcnt_t X__DarwinFsfilcntT +T __darwin_gid_t X__DarwinGidT +T __darwin_id_t X__DarwinIdT +T __darwin_ino64_t X__DarwinIno64T +T __darwin_ino_t X__DarwinInoT +T __darwin_intptr_t X__DarwinIntptrT +T __darwin_mach_port_name_t X__DarwinMachPortNameT +T __darwin_mach_port_t X__DarwinMachPortT +T __darwin_mbstate_t X__DarwinMbstateT +T __darwin_mode_t X__DarwinModeT +T __darwin_natural_t X__DarwinNaturalT +T __darwin_off_t X__DarwinOffT +T __darwin_pid_t X__DarwinPidT +T __darwin_ptrdiff_t X__DarwinPtrdiffT +T __darwin_rune_t X__DarwinRuneT +T __darwin_sigset_t X__DarwinSigsetT +T __darwin_size_t X__DarwinSizeT +T __darwin_socklen_t X__DarwinSocklenT +T __darwin_ssize_t X__DarwinSsizeT +T __darwin_suseconds_t X__DarwinSusecondsT +T __darwin_time_t X__DarwinTimeT +T __darwin_uid_t X__DarwinUidT +T __darwin_useconds_t X__DarwinUsecondsT +T __darwin_uuid_string_t X__DarwinUuidStringT +T __darwin_uuid_t X__DarwinUuidT +T __darwin_wchar_t X__DarwinWcharT +T __darwin_wint_t X__DarwinWintT +T __dev_t X__DevT +T __fsblkcnt64_t X__Fsblkcnt64T +T __fsblkcnt_t X__FsblkcntT +T __fsfilcnt64_t X__Fsfilcnt64T +T __fsfilcnt_t X__FsfilcntT +T __fsid_t X__FsidT +T __fsword_t X__FswordT +T __gid_t X__GidT +T __id_t X__IdT +T __ino64_t X__Ino64T +T __ino_t X__InoT +T __int16_t X__Int16T +T __int32_t X__Int32T +T __int64_t X__Int64T +T __int8_t X__Int8T +T __intptr_t X__IntptrT +T __key_t X__KeyT +T __loff_t X__LoffT +T __mbstate_t X__MbstateT +T __mode_t X__ModeT +T __msfilterreq X__Msfilterreq +T __nlink_t X__NlinkT +T __off64_t X__Off64T +T __off_t X__OffT +T __pid_t X__PidT +T __qaddr_t X__QaddrT +T __quad_t X__QuadT +T __rlim64_t X__Rlim64T +T __rlim_t X__RlimT T __sockaddr_header X__SockaddrHeader T __socket_type X__SocketType +T __socklen_t X__SocklenT +T __ssize_t X__SsizeT +T __suseconds_t X__SusecondsT +T __syscall_slong_t X__SyscallSlongT +T __syscall_ulong_t X__SyscallUlongT +T __time_t X__TimeT +T __timer_t X__TimerT +T __u_char X__UChar +T __u_int X__UInt +T __u_long X__ULong +T __u_quad_t X__UQuadT +T __u_short X__UShort +T __uid_t X__UidT +T __uint16_t X__Uint16T +T __uint32_t X__Uint32T +T __uint64_t X__Uint64T +T __uint8_t X__Uint8T +T __useconds_t X__UsecondsT T addrinfo AddrInfo +T caddr_t CaddrT T cmsghdr Cmsghdr T group_filter GroupFilter T group_req GroupReq @@ -9,7 +96,9 @@ T group_source_req GroupSourceReq T hostent Hostent T if_clonereq IfClonereq T if_data IfData +T if_data64 IfData64 T if_msghdr IfMsghdr +T if_msghdr2 IfMsghdr2 T if_nameindex IfNameindex T ifa_msghdr IfaMsghdr T iface Iface @@ -17,10 +106,12 @@ T ifaddr Ifaddr T ifaliasreq Ifaliasreq T ifconf Ifconf T ifdevmtu Ifdevmtu +T ifdrv Ifdrv T ifkpi Ifkpi T ifma_msghdr IfmaMsghdr T ifma_msghdr2 IfmaMsghdr2 T ifmap Ifmap +T ifmediareq Ifmediareq T ifnet_interface_advisory IfnetInterfaceAdvisory T ifqueue Ifqueue T ifreq Ifreq @@ -32,6 +123,7 @@ T in_addr InAddr T in_addr_t InAddrT T in_pktinfo InPktinfo T in_port_t InPortT +T iovec Iovec T ip6_mtuinfo Ip6Mtuinfo T ip_mreq IpMreq T ip_mreq_source IpMreqSource @@ -44,6 +136,7 @@ T linger Linger T msghdr Msghdr T net_event_data NetEventData T netent Netent +T osockaddr Osockaddr T protoent Protoent T rpcent Rpcent T rslvmulti_req RslvmultiReq @@ -62,3 +155,8 @@ T sockaddr_storage SockaddrStorage T sockaddr_un SockaddrUn T socklen_t SocklenT T sockproto Sockproto +T timeval32 Timeval32 +T u_char UChar +T u_int32_t UInt32T +T u_int64_t UInt64T +T u_short UShort diff --git a/c/net/llcppg_darwin_arm64.go b/c/net/llcppg_darwin_arm64.go new file mode 100644 index 00000000..322b657c --- /dev/null +++ b/c/net/llcppg_darwin_arm64.go @@ -0,0 +1,17 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import "github.com/goplus/lib/c" + +type In6Addr struct { + _ [0]uint32 + U6Addr [16]uint8 +} +type charPtr = *int8 +type charPP = **int8 +type sockaddrPtr = *SockAddr +type addrinfoPtr = *AddrInfo +type Iovec = c.Iovec diff --git a/c/net/llcppg_linux_amd64.go b/c/net/llcppg_linux_amd64.go new file mode 100644 index 00000000..ac6499a0 --- /dev/null +++ b/c/net/llcppg_linux_amd64.go @@ -0,0 +1,17 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import "github.com/goplus/lib/c" + +type In6Addr struct { + _ [0]uint32 + U6Addr [16]uint8 +} +type charPtr = *int8 +type charPP = **int8 +type sockaddrPtr = *SockAddr +type addrinfoPtr = *AddrInfo +type Iovec = c.Iovec diff --git a/c/net/llcppg_linux_arm64.go b/c/net/llcppg_linux_arm64.go new file mode 100644 index 00000000..2cbc1bf2 --- /dev/null +++ b/c/net/llcppg_linux_arm64.go @@ -0,0 +1,17 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import "github.com/goplus/lib/c" + +type In6Addr struct { + _ [0]uint32 + U6Addr [16]uint8 +} +type charPtr = *int8 +type charPP = **int8 +type sockaddrPtr = *SockAddr +type addrinfoPtr = *AddrInfo +type Iovec = c.Iovec diff --git a/c/net/net-if_darwin_arm64.go b/c/net/net-if_darwin_arm64.go index c91300e8..9e99bc97 100644 --- a/c/net/net-if_darwin_arm64.go +++ b/c/net/net-if_darwin_arm64.go @@ -1,7 +1,6 @@ //go:build darwin && arm64 && !ios // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net @@ -11,7 +10,6 @@ import ( ) const IF_NAMESIZE = 16 - const ( // interface is up IFF_UP = 1 @@ -101,14 +99,11 @@ const ( // can invert 0 to -0 (0xffff) IFCAP_CSUM_ZERO_INVERT = 16384 ) - const ( IFCAP_HWCSUM = 3 IFCAP_TSO = 96 ) - const IFCAP_VALID = 32767 - const ( IFQ_MAXLEN = 128 // granularity is 1 second @@ -117,7 +112,6 @@ const ( // Wake capabilities of a interface const IF_WAKE_ON_MAGIC_PACKET = 1 - const ( IFRTYPE_FUNCTIONAL_UNKNOWN = 0 IFRTYPE_FUNCTIONAL_LOOPBACK = 1 @@ -175,6 +169,22 @@ type IfmaMsghdr struct { IfmamIndex uint16 } +// Message format for use in obtaining information about interfaces +// from sysctl +type IfMsghdr2 struct { + IfmMsglen UShort + IfmVersion UChar + IfmType UChar + IfmAddrs c.Int + IfmFlags c.Int + IfmIndex UShort + IfmSndLen c.Int + IfmSndMaxlen c.Int + IfmSndDrops c.Int + IfmTimer c.Int + IfmData IfData64 +} + // Message format for use in obtaining information about multicast addresses // from sysctl type IfmaMsghdr2 struct { @@ -184,7 +194,7 @@ type IfmaMsghdr2 struct { IfmamAddrs c.Int IfmamFlags c.Int IfmamIndex UShort - IfmamRefcount Int32T + IfmamRefcount c.Int32T } // ifdevmtu: interface device mtu @@ -196,35 +206,44 @@ type Ifdevmtu struct { IfdmMin c.Int IfdmMax c.Int } - type Ifkpi struct { IfkModuleId c.Uint IfkType c.Uint IfkData _llcppg_anon_1 } - type Ifreq struct { IfrName [16]c.Char IfrIfru _llcppg_anon_2 } - type Ifaliasreq struct { IfraName [16]c.Char IfraAddr SockAddr IfraBroadaddr SockAddr IfraMask SockAddr } - type RslvmultiReq struct { Sa *SockAddr Llsa **SockAddr } - +type Ifmediareq struct { + IfmName [16]c.Char + IfmCurrent c.Int + IfmMask c.Int + IfmStatus c.Int + IfmActive c.Int + IfmCount c.Int + IfmUlist *c.Int +} +type Ifdrv struct { + IfdName [16]c.Char + IfdCmd c.Ulong + IfdLen c.SizeT + IfdData unsafe.Pointer +} type Ifstat struct { IfsName [16]c.Char Ascii [801]c.Char } - type Ifconf struct { IfcLen c.Int IfcIfcu _llcppg_anon_3 @@ -236,20 +255,16 @@ type KevDlProtoData struct { ProtoFamily UInt32T ProtoRemainingCount UInt32T } - type IfNameindex struct { IfIndex c.Uint IfName *c.Char } - type _llcppg_anon_1 struct { _xgo_union [2]uint32 } - type _llcppg_anon_2 struct { _xgo_union [2]uint64 } - type _llcppg_anon_3 struct { _xgo_union [2]uint32 } @@ -257,79 +272,60 @@ type _llcppg_anon_3 struct { func (p *_llcppg_anon_1) XGof_ref_ifk_ptr() *unsafe.Pointer { return (*unsafe.Pointer)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_1) XGof_ref_ifk_value() *c.Int { return (*c.Int)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_addr() *SockAddr { return (*SockAddr)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_dstaddr() *SockAddr { return (*SockAddr)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_broadaddr() *SockAddr { return (*SockAddr)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_flags() *int16 { return (*int16)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_metric() *c.Int { return (*c.Int)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_mtu() *c.Int { return (*c.Int)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_phys() *c.Int { return (*c.Int)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_media() *c.Int { return (*c.Int)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_intval() *c.Int { return (*c.Int)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_data() *CaddrT { return (*CaddrT)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_devmtu() *Ifdevmtu { return (*Ifdevmtu)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_kpi() *Ifkpi { return (*Ifkpi)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_wake_flags() *UInt32T { return (*UInt32T)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_route_refcnt() *UInt32T { return (*UInt32T)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_cap() *[2]c.Int { return (*[2]c.Int)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifru_functional_type() *UInt32T { return (*UInt32T)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_3) XGof_ref_ifcu_buf() *CaddrT { return (*CaddrT)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_3) XGof_ref_ifcu_req() **Ifreq { return (**Ifreq)(unsafe.Pointer(p)) } diff --git a/c/net/net-if_linux_amd64.go b/c/net/net-if_linux_amd64.go index acdc878b..590f7cb1 100644 --- a/c/net/net-if_linux_amd64.go +++ b/c/net/net-if_linux_amd64.go @@ -1,7 +1,6 @@ //go:build linux && amd64 && !android // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net @@ -14,7 +13,6 @@ const X_NET_IF_H = 1 // Length of interface name. const IF_NAMESIZE = 16 - const ( IFHWADDRLEN = 6 IFNAMSIZ = 16 @@ -53,7 +51,6 @@ type Ifaddr struct { IfaIfp *Iface IfaNext *Ifaddr } - type Ifmap struct { MemStart c.Ulong MemEnd c.Ulong @@ -62,32 +59,25 @@ type Ifmap struct { Dma uint8 Port uint8 } - type Ifreq struct { IfrIfrn _llcppg_anon_2 IfrIfru _llcppg_anon_3 } - type Ifconf struct { IfcLen c.Int IfcIfcu _llcppg_anon_4 } - type _llcppg_anon_1 struct { _xgo_union [8]uint16 } - type Iface struct { } - type _llcppg_anon_2 struct { _xgo_union [16]uint8 } - type _llcppg_anon_3 struct { _xgo_union [3]uint64 } - type _llcppg_anon_4 struct { _xgo_union [1]uint64 } @@ -95,67 +85,51 @@ type _llcppg_anon_4 struct { func (p *_llcppg_anon_1) XGof_ref_ifu_broadaddr() *SockAddr { return (*SockAddr)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_1) XGof_ref_ifu_dstaddr() *SockAddr { return (*SockAddr)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_2) XGof_ref_ifrn_name() *[16]c.Char { return (*[16]c.Char)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_3) XGof_ref_ifru_addr() *SockAddr { return (*SockAddr)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_3) XGof_ref_ifru_dstaddr() *SockAddr { return (*SockAddr)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_3) XGof_ref_ifru_broadaddr() *SockAddr { return (*SockAddr)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_3) XGof_ref_ifru_netmask() *SockAddr { return (*SockAddr)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_3) XGof_ref_ifru_hwaddr() *SockAddr { return (*SockAddr)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_3) XGof_ref_ifru_flags() *int16 { return (*int16)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_3) XGof_ref_ifru_ivalue() *c.Int { return (*c.Int)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_3) XGof_ref_ifru_mtu() *c.Int { return (*c.Int)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_3) XGof_ref_ifru_map() *Ifmap { return (*Ifmap)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_3) XGof_ref_ifru_slave() *[16]c.Char { return (*[16]c.Char)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_3) XGof_ref_ifru_newname() *[16]c.Char { return (*[16]c.Char)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_3) XGof_ref_ifru_data() *X__CaddrT { return (*X__CaddrT)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_4) XGof_ref_ifcu_buf() *X__CaddrT { return (*X__CaddrT)(unsafe.Pointer(p)) } - func (p *_llcppg_anon_4) XGof_ref_ifcu_req() **Ifreq { return (**Ifreq)(unsafe.Pointer(p)) } diff --git a/c/net/net-if_linux_arm64.go b/c/net/net-if_linux_arm64.go new file mode 100644 index 00000000..557a9206 --- /dev/null +++ b/c/net/net-if_linux_arm64.go @@ -0,0 +1,149 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_NET_IF_H = 1 + +// Length of interface name. +const IF_NAMESIZE = 16 +const ( + IFHWADDRLEN = 6 + IFNAMSIZ = 16 +) + +type IfNameindex struct { + IfIndex c.Uint + IfName *uint8 +} + +// Standard interface flags. +const ( + IFF_UP = 1 + IFF_BROADCAST = 2 + IFF_DEBUG = 4 + IFF_LOOPBACK = 8 + IFF_POINTOPOINT = 16 + IFF_NOTRAILERS = 32 + IFF_RUNNING = 64 + IFF_NOARP = 128 + IFF_PROMISC = 256 + // Not supported + IFF_ALLMULTI = 512 + IFF_MASTER = 1024 + IFF_SLAVE = 2048 + IFF_MULTICAST = 4096 + IFF_PORTSEL = 8192 + IFF_AUTOMEDIA = 16384 + // Dialup device with changing addresses. + IFF_DYNAMIC = 32768 +) + +type Ifaddr struct { + IfaAddr SockAddr + IfaIfu _llcppg_anon_1 + IfaIfp *Iface + IfaNext *Ifaddr +} +type Ifmap struct { + MemStart c.Ulong + MemEnd c.Ulong + BaseAddr uint16 + Irq uint8 + Dma uint8 + Port uint8 +} +type Ifreq struct { + IfrIfrn _llcppg_anon_2 + IfrIfru _llcppg_anon_3 +} +type Ifconf struct { + IfcLen c.Int + IfcIfcu _llcppg_anon_4 +} +type _llcppg_anon_1 struct { + _xgo_union [8]uint16 +} +type Iface struct { +} +type _llcppg_anon_2 struct { + _xgo_union [16]uint8 +} +type _llcppg_anon_3 struct { + _xgo_union [3]uint64 +} +type _llcppg_anon_4 struct { + _xgo_union [1]uint64 +} + +func (p *_llcppg_anon_1) XGof_ref_ifu_broadaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_1) XGof_ref_ifu_dstaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_2) XGof_ref_ifrn_name() *[16]uint8 { + return (*[16]uint8)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref_ifru_addr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref_ifru_dstaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref_ifru_broadaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref_ifru_netmask() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref_ifru_hwaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref_ifru_flags() *int16 { + return (*int16)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref_ifru_ivalue() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref_ifru_mtu() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref_ifru_map() *Ifmap { + return (*Ifmap)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref_ifru_slave() *[16]uint8 { + return (*[16]uint8)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref_ifru_newname() *[16]uint8 { + return (*[16]uint8)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref_ifru_data() *X__CaddrT { + return (*X__CaddrT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_4) XGof_ref_ifcu_buf() *X__CaddrT { + return (*X__CaddrT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_4) XGof_ref_ifcu_req() **Ifreq { + return (**Ifreq)(unsafe.Pointer(p)) +} + +// Convert an interface name to an index, and vice versa. +// +//go:linkname IfNametoindex C.if_nametoindex +func IfNametoindex(__ifname *uint8) c.Uint + +//go:linkname IfIndextoname C.if_indextoname +func IfIndextoname(__ifindex c.Uint, __ifname *uint8) *uint8 + +// Free the data returned from if_nameindex. +// +// llgo:link (*IfNameindex).IfFreenameindex C.if_freenameindex +func (self *IfNameindex) IfFreenameindex() { +} diff --git a/c/net/net-if_var_darwin_arm64.go b/c/net/net-if_var_darwin_arm64.go index 13d2efa1..15cff2a2 100644 --- a/c/net/net-if_var_darwin_arm64.go +++ b/c/net/net-if_var_darwin_arm64.go @@ -1,7 +1,6 @@ //go:build darwin && arm64 && !ios // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net @@ -39,7 +38,6 @@ const ( IF_MINMTU = 72 IF_MAXMTU = 65535 ) - const IFNAMSIZ = 16 type NetEventData struct { @@ -82,6 +80,36 @@ type IfData struct { IfiReserved2 UInt32T } +// Structure describing information about an interface +// which may be of interest to management entities. +type IfData64 struct { + IfiType UChar + IfiTypelen UChar + IfiPhysical UChar + IfiAddrlen UChar + IfiHdrlen UChar + IfiRecvquota UChar + IfiXmitquota UChar + IfiUnused1 UChar + IfiMtu UInt32T + IfiMetric UInt32T + IfiBaudrate UInt64T + IfiIpackets UInt64T + IfiIerrors UInt64T + IfiOpackets UInt64T + IfiOerrors UInt64T + IfiCollisions UInt64T + IfiIbytes UInt64T + IfiObytes UInt64T + IfiImcasts UInt64T + IfiOmcasts UInt64T + IfiIqdrops UInt64T + IfiNoproto UInt64T + IfiRecvtiming UInt32T + IfiXmittiming UInt32T + IfiLastchange Timeval32 +} + // Structure defining a queue for a network interface. type Ifqueue struct { IfqHead unsafe.Pointer @@ -90,6 +118,5 @@ type Ifqueue struct { IfqMaxlen c.Int IfqDrops c.Int } - type IfnetInterfaceAdvisory struct { } diff --git a/c/net/net-net_kev_darwin_arm64.go b/c/net/net-net_kev_darwin_arm64.go index 5cd2a094..1e50c553 100644 --- a/c/net/net-net_kev_darwin_arm64.go +++ b/c/net/net-net_kev_darwin_arm64.go @@ -1,7 +1,6 @@ //go:build darwin && arm64 && !ios // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net @@ -27,7 +26,6 @@ const ( // use ken_in_portinuse const KEV_INET_PORTINUSE = 8 - const ( // ARP resolution failed for router KEV_INET_ARPRTRFAILURE = 9 diff --git a/c/net/net.go b/c/net/net.go index b7d685b6..78005637 100644 --- a/c/net/net.go +++ b/c/net/net.go @@ -1,4 +1,4 @@ -//go:build !windows && !(darwin && arm64 && !ios) && !(linux && amd64 && !android) +//go:build !windows && !(darwin && arm64 && !ios) && !(linux && amd64 && !android) && !(linux && arm64 && !android) /* * Copyright (c) 2024 The XGo Authors (xgo.dev). All rights reserved. diff --git a/c/net/netdb_darwin_arm64.go b/c/net/netdb_darwin_arm64.go index 32bb6e73..b6c3a1ff 100644 --- a/c/net/netdb_darwin_arm64.go +++ b/c/net/netdb_darwin_arm64.go @@ -1,7 +1,6 @@ //go:build darwin && arm64 && !ios // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net @@ -11,21 +10,18 @@ import ( ) const X_PATH_HEQUIV = "/etc/hosts.equiv" - const ( X_PATH_HOSTS = "/etc/hosts" X_PATH_NETWORKS = "/etc/networks" X_PATH_PROTOCOLS = "/etc/protocols" X_PATH_SERVICES = "/etc/services" ) - const ( // see errno NETDB_INTERNAL = -1 // no problem NETDB_SUCCESS = 0 ) - const ( // Authoritative Answer Host not found HOST_NOT_FOUND = 1 @@ -42,7 +38,6 @@ const NO_ADDRESS = 4 // address family for hostname not supported const EAI_ADDRFAMILY = 1 - const ( // temporary failure in name resolution EAI_AGAIN = 2 @@ -58,7 +53,6 @@ const ( // no address associated with hostname const EAI_NODATA = 7 - const ( // hostname nor servname provided, or not known EAI_NONAME = 8 @@ -69,7 +63,6 @@ const ( // system error returned in errno EAI_SYSTEM = 11 ) - const ( // invalid value for hints EAI_BADHINTS = 12 @@ -79,7 +72,6 @@ const ( // argument buffer overflow const EAI_OVERFLOW = 14 - const EAI_MAX = 15 // Flag values for getaddrinfo() @@ -98,7 +90,6 @@ const AI_ALL = 256 // accept IPv4-mapped if kernel supports const AI_V4MAPPED_CFG = 512 - const ( // only if any address is assigned AI_ADDRCONFIG = 1024 @@ -115,7 +106,6 @@ const AI_DEFAULT = 1536 // To override this default behavior, thereby causing unusable addresses to be included in the results, pass any nonzero // value for ai_flags, by setting any desired flag values, or by setting AI_UNUSABLE if no other flags are desired. const AI_UNUSABLE = 268435456 - const ( NI_MAXHOST = 1025 NI_MAXSERV = 32 @@ -130,18 +120,17 @@ const ( NI_NUMERICSCOPE = 256 NI_DGRAM = 16 ) - const NI_WITHSCOPEID = 32 // Structures returned by network data base library. All addresses are // supplied in host order, and returned in network order (suitable for // use in system calls). type Hostent struct { - Name *c.Char - Aliases **c.Char + Name charPtr + Aliases charPP AddrType c.Int Length c.Int - AddrList **c.Char + AddrList charPP } // Assumption here is that a network number @@ -150,33 +139,29 @@ type Netent struct { NName *c.Char NAliases **c.Char NAddrtype c.Int - NNet Uint32T + NNet c.Uint32T } - type Servent struct { SName *c.Char SAliases **c.Char SPort c.Int SProto *c.Char } - type Protoent struct { PName *c.Char PAliases **c.Char PProto c.Int } - type AddrInfo struct { Flags c.Int Family c.Int SockType c.Int Protocol c.Int AddrLen SocklenT - CanOnName *c.Char - Addr *SockAddr - Next *AddrInfo + CanOnName charPtr + Addr sockaddrPtr + Next addrinfoPtr } - type Rpcent struct { RName *c.Char RAliases **c.Char @@ -213,7 +198,7 @@ func (self *SockAddr) Getnameinfo(_llcppg_param2 SocklenT, _llcppg_param3 *c.Cha } //go:linkname Getnetbyaddr C.getnetbyaddr -func Getnetbyaddr(_llcppg_param1 Uint32T, _llcppg_param2 c.Int) *Netent +func Getnetbyaddr(_llcppg_param1 c.Uint32T, _llcppg_param2 c.Int) *Netent //go:linkname Getnetbyname C.getnetbyname func Getnetbyname(_llcppg_param1 *c.Char) *Netent @@ -263,7 +248,7 @@ func (self *Hostent) Free() { func Gethostbyname2(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) *Hostent //go:linkname Getipnodebyaddr C.getipnodebyaddr -func Getipnodebyaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) *Hostent +func Getipnodebyaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) *Hostent //go:linkname Getipnodebyname C.getipnodebyname func Getipnodebyname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) *Hostent diff --git a/c/net/netdb_linux_amd64.go b/c/net/netdb_linux_amd64.go index 32808e8c..1fc2f355 100644 --- a/c/net/netdb_linux_amd64.go +++ b/c/net/netdb_linux_amd64.go @@ -1,7 +1,6 @@ //go:build linux && amd64 && !android // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net @@ -37,7 +36,6 @@ const NO_RECOVERY = 3 // Valid name, no data record of requested // type. const NO_DATA = 4 - const ( // See errno. NETDB_INTERNAL = -1 @@ -88,12 +86,10 @@ const ( // Argument buffer overflow. EAI_OVERFLOW = -12 ) - const ( NI_MAXHOST = 1025 NI_MAXSERV = 32 ) - const ( // Don't try to look up hostname. NI_NUMERICHOST = 1 @@ -109,11 +105,11 @@ const ( // Description of data base entry for a single host. type Hostent struct { - Name *c.Char - Aliases **c.Char + Name charPtr + Aliases charPP AddrType c.Int Length c.Int - AddrList **c.Char + AddrList charPP } // Description of data base entry for a single service. @@ -138,9 +134,9 @@ type AddrInfo struct { SockType c.Int Protocol c.Int AddrLen SocklenT - Addr *SockAddr - CanOnName *c.Char - Next *AddrInfo + Addr sockaddrPtr + CanOnName charPtr + Next addrinfoPtr } // Function to get address of global `h_errno' variable. @@ -218,18 +214,18 @@ func Gethostbyname2(__name *c.Char, __af c.Int) *Hostent // therefore not marked with __THROW. // // llgo:link (*Hostent).GethostentR C.gethostent_r -func (self *Hostent) GethostentR(__buf *c.Char, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int { +func (self *Hostent) GethostentR(__buf *c.Char, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int { return 0 } //go:linkname GethostbyaddrR C.gethostbyaddr_r -func GethostbyaddrR(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int, __result_buf *Hostent, __buf *c.Char, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int +func GethostbyaddrR(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int, __result_buf *Hostent, __buf *c.Char, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int //go:linkname GethostbynameR C.gethostbyname_r -func GethostbynameR(__name *c.Char, __result_buf *Hostent, __buf *c.Char, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int +func GethostbynameR(__name *c.Char, __result_buf *Hostent, __buf *c.Char, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int //go:linkname Gethostbyname2R C.gethostbyname2_r -func Gethostbyname2R(__name *c.Char, __af c.Int, __result_buf *Hostent, __buf *c.Char, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int +func Gethostbyname2R(__name *c.Char, __af c.Int, __result_buf *Hostent, __buf *c.Char, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int // Open network data base files and mark them as staying open even // after a later search if STAY_OPEN is non-zero. @@ -264,7 +260,7 @@ func Getnetent() *Netent // marked with __THROW. // //go:linkname Getnetbyaddr C.getnetbyaddr -func Getnetbyaddr(__net Uint32T, __type c.Int) *Netent +func Getnetbyaddr(__net c.Uint32T, __type c.Int) *Netent // Return entry from network data base for network with NAME. // @@ -286,15 +282,15 @@ func Getnetbyname(__name *c.Char) *Netent // therefore not marked with __THROW. // // llgo:link (*Netent).GetnetentR C.getnetent_r -func (self *Netent) GetnetentR(__buf *c.Char, __buflen SizeT, __result **Netent, __h_errnop *c.Int) c.Int { +func (self *Netent) GetnetentR(__buf *c.Char, __buflen c.SizeT, __result **Netent, __h_errnop *c.Int) c.Int { return 0 } //go:linkname GetnetbyaddrR C.getnetbyaddr_r -func GetnetbyaddrR(__net Uint32T, __type c.Int, __result_buf *Netent, __buf *c.Char, __buflen SizeT, __result **Netent, __h_errnop *c.Int) c.Int +func GetnetbyaddrR(__net c.Uint32T, __type c.Int, __result_buf *Netent, __buf *c.Char, __buflen c.SizeT, __result **Netent, __h_errnop *c.Int) c.Int //go:linkname GetnetbynameR C.getnetbyname_r -func GetnetbynameR(__name *c.Char, __result_buf *Netent, __buf *c.Char, __buflen SizeT, __result **Netent, __h_errnop *c.Int) c.Int +func GetnetbynameR(__name *c.Char, __result_buf *Netent, __buf *c.Char, __buflen c.SizeT, __result **Netent, __h_errnop *c.Int) c.Int // Open service data base files and mark them as staying open even // after a later search if STAY_OPEN is non-zero. @@ -349,15 +345,15 @@ func Getservbyport(__port c.Int, __proto *c.Char) *Servent // therefore not marked with __THROW. // // llgo:link (*Servent).GetserventR C.getservent_r -func (self *Servent) GetserventR(__buf *c.Char, __buflen SizeT, __result **Servent) c.Int { +func (self *Servent) GetserventR(__buf *c.Char, __buflen c.SizeT, __result **Servent) c.Int { return 0 } //go:linkname GetservbynameR C.getservbyname_r -func GetservbynameR(__name *c.Char, __proto *c.Char, __result_buf *Servent, __buf *c.Char, __buflen SizeT, __result **Servent) c.Int +func GetservbynameR(__name *c.Char, __proto *c.Char, __result_buf *Servent, __buf *c.Char, __buflen c.SizeT, __result **Servent) c.Int //go:linkname GetservbyportR C.getservbyport_r -func GetservbyportR(__port c.Int, __proto *c.Char, __result_buf *Servent, __buf *c.Char, __buflen SizeT, __result **Servent) c.Int +func GetservbyportR(__port c.Int, __proto *c.Char, __result_buf *Servent, __buf *c.Char, __buflen c.SizeT, __result **Servent) c.Int // Open protocol data base files and mark them as staying open even // after a later search if STAY_OPEN is non-zero. @@ -410,15 +406,15 @@ func Getprotobynumber(__proto c.Int) *Protoent // therefore not marked with __THROW. // // llgo:link (*Protoent).GetprotoentR C.getprotoent_r -func (self *Protoent) GetprotoentR(__buf *c.Char, __buflen SizeT, __result **Protoent) c.Int { +func (self *Protoent) GetprotoentR(__buf *c.Char, __buflen c.SizeT, __result **Protoent) c.Int { return 0 } //go:linkname GetprotobynameR C.getprotobyname_r -func GetprotobynameR(__name *c.Char, __result_buf *Protoent, __buf *c.Char, __buflen SizeT, __result **Protoent) c.Int +func GetprotobynameR(__name *c.Char, __result_buf *Protoent, __buf *c.Char, __buflen c.SizeT, __result **Protoent) c.Int //go:linkname GetprotobynumberR C.getprotobynumber_r -func GetprotobynumberR(__proto c.Int, __result_buf *Protoent, __buf *c.Char, __buflen SizeT, __result **Protoent) c.Int +func GetprotobynumberR(__proto c.Int, __result_buf *Protoent, __buf *c.Char, __buflen c.SizeT, __result **Protoent) c.Int // Establish network group NETGROUP for enumeration. // @@ -469,7 +465,7 @@ func Innetgr(__netgroup *c.Char, __host *c.Char, __user *c.Char, __domain *c.Cha // therefore not marked with __THROW. // //go:linkname GetnetgrentR C.getnetgrent_r -func GetnetgrentR(__hostp **c.Char, __userp **c.Char, __domainp **c.Char, __buffer *c.Char, __buflen SizeT) c.Int +func GetnetgrentR(__hostp **c.Char, __userp **c.Char, __domainp **c.Char, __buffer *c.Char, __buflen c.SizeT) c.Int // Call `rshd' at port RPORT on remote machine *AHOST to execute CMD. // The local user is LOCUSER, on the remote machine the command is @@ -556,7 +552,7 @@ func RuserokAf(__rhost *c.Char, __suser c.Int, __remuser *c.Char, __locuser *c.C // therefore not marked with __THROW. // //go:linkname Iruserok C.iruserok -func Iruserok(__raddr Uint32T, __suser c.Int, __remuser *c.Char, __locuser *c.Char) c.Int +func Iruserok(__raddr c.Uint32T, __suser c.Int, __remuser *c.Char, __locuser *c.Char) c.Int // This is the equivalent function where the pfamiliy if the address // pointed to by RADDR is determined by the value of AF. It therefore diff --git a/c/net/netdb_linux_arm64.go b/c/net/netdb_linux_arm64.go new file mode 100644 index 00000000..06c56366 --- /dev/null +++ b/c/net/netdb_linux_arm64.go @@ -0,0 +1,605 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_NETDB_H = 1 + +// Absolute file name for network data base files. +const ( + X_PATH_HEQUIV = "/etc/hosts.equiv" + X_PATH_HOSTS = "/etc/hosts" + X_PATH_NETWORKS = "/etc/networks" + X_PATH_NSSWITCH_CONF = "/etc/nsswitch.conf" + X_PATH_PROTOCOLS = "/etc/protocols" + X_PATH_SERVICES = "/etc/services" +) + +// Possible values left in `h_errno'. +const ( + HOST_NOT_FOUND = 1 + // Non-Authoritative Host not found, + // or SERVERFAIL. + TRY_AGAIN = 2 +) + +// Non recoverable errors, FORMERR, REFUSED, +// NOTIMP. +const NO_RECOVERY = 3 + +// Valid name, no data record of requested +// type. +const NO_DATA = 4 +const ( + // See errno. + NETDB_INTERNAL = -1 + // No problem. + NETDB_SUCCESS = 0 + // No address, look for MX record. + NO_ADDRESS = 4 +) + +// Possible values for `ai_flags' field in `addrinfo' structure. +const ( + AI_PASSIVE = 1 + // Request for canonical name. + AI_CANONNAME = 2 + // Don't use name resolution. + AI_NUMERICHOST = 4 + // IPv4 mapped addresses are acceptable. + AI_V4MAPPED = 8 + // Return IPv4 mapped and IPv6 addresses. + AI_ALL = 16 + // Use configuration of this host to choose + // returned address type.. + AI_ADDRCONFIG = 32 +) + +// Don't use name resolution. +const AI_NUMERICSERV = 1024 + +// Error values for `getaddrinfo' function. +const ( + EAI_BADFLAGS = -1 + // NAME or SERVICE is unknown. + EAI_NONAME = -2 + // Temporary failure in name resolution. + EAI_AGAIN = -3 + // Non-recoverable failure in name res. + EAI_FAIL = -4 + // `ai_family' not supported. + EAI_FAMILY = -6 + // `ai_socktype' not supported. + EAI_SOCKTYPE = -7 + // SERVICE not supported for `ai_socktype'. + EAI_SERVICE = -8 + // Memory allocation failure. + EAI_MEMORY = -10 + // System error returned in `errno'. + EAI_SYSTEM = -11 + // Argument buffer overflow. + EAI_OVERFLOW = -12 +) +const ( + NI_MAXHOST = 1025 + NI_MAXSERV = 32 +) +const ( + // Don't try to look up hostname. + NI_NUMERICHOST = 1 + // Don't convert port number to name. + NI_NUMERICSERV = 2 + // Only return nodename portion. + NI_NOFQDN = 4 + // Don't return numeric addresses. + NI_NAMEREQD = 8 + // Look up UDP service rather than TCP. + NI_DGRAM = 16 +) + +// Description of data base entry for a single host. +type Hostent struct { + Name charPtr + Aliases charPP + AddrType c.Int + Length c.Int + AddrList charPP +} + +// Description of data base entry for a single service. +type Servent struct { + SName *uint8 + SAliases **uint8 + SPort c.Int + SProto *uint8 +} + +// Description of data base entry for a single service. +type Protoent struct { + PName *uint8 + PAliases **uint8 + PProto c.Int +} + +// Structure to contain information about address of a service provider. +type AddrInfo struct { + Flags c.Int + Family c.Int + SockType c.Int + Protocol c.Int + AddrLen SocklenT + Addr sockaddrPtr + CanOnName charPtr + Next addrinfoPtr +} + +// Function to get address of global `h_errno' variable. +// +//go:linkname X__HErrnoLocation C.__h_errno_location +func X__HErrnoLocation() *c.Int + +// Print error indicated by `h_errno' variable on standard error. STR +// if non-null is printed before the error string. +// +//go:linkname Herror C.herror +func Herror(__str *uint8) + +// Return string associated with error ERR_NUM. +// +//go:linkname Hstrerror C.hstrerror +func Hstrerror(__err_num c.Int) *uint8 + +// Open host data base files and mark them as staying open even after +// a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Sethostent C.sethostent +func Sethostent(__stay_open c.Int) + +// Close host data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endhostent C.endhostent +func Endhostent() + +// Get next entry from host data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Gethostent C.gethostent +func Gethostent() *Hostent + +// Return entry from host data base which address match ADDR with +// length LEN and type TYPE. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Gethostbyaddr C.gethostbyaddr +func Gethostbyaddr(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int) *Hostent + +// Return entry from host data base for host with NAME. AF must be +// set to the address type which is `AF_INET' for IPv4 or `AF_INET6' +// for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Gethostbyname2 C.gethostbyname2 +func Gethostbyname2(__name *uint8, __af c.Int) *Hostent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. The last +// argument is a pointer to a variable which gets the value which +// would be stored in the global variable `herrno' by the +// non-reentrant functions. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Hostent).GethostentR C.gethostent_r +func (self *Hostent) GethostentR(__buf *uint8, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int { + return 0 +} + +//go:linkname GethostbyaddrR C.gethostbyaddr_r +func GethostbyaddrR(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int, __result_buf *Hostent, __buf *uint8, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int + +//go:linkname GethostbynameR C.gethostbyname_r +func GethostbynameR(__name *uint8, __result_buf *Hostent, __buf *uint8, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int + +//go:linkname Gethostbyname2R C.gethostbyname2_r +func Gethostbyname2R(__name *uint8, __af c.Int, __result_buf *Hostent, __buf *uint8, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int + +// Open network data base files and mark them as staying open even +// after a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setnetent C.setnetent +func Setnetent(__stay_open c.Int) + +// Close network data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endnetent C.endnetent +func Endnetent() + +// Get next entry from network data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getnetent C.getnetent +func Getnetent() *Netent + +// Return entry from network data base which address match NET and +// type TYPE. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getnetbyaddr C.getnetbyaddr +func Getnetbyaddr(__net c.Uint32T, __type c.Int) *Netent + +// Return entry from network data base for network with NAME. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getnetbyname C.getnetbyname +func Getnetbyname(__name *uint8) *Netent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. The last +// argument is a pointer to a variable which gets the value which +// would be stored in the global variable `herrno' by the +// non-reentrant functions. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Netent).GetnetentR C.getnetent_r +func (self *Netent) GetnetentR(__buf *uint8, __buflen c.SizeT, __result **Netent, __h_errnop *c.Int) c.Int { + return 0 +} + +//go:linkname GetnetbyaddrR C.getnetbyaddr_r +func GetnetbyaddrR(__net c.Uint32T, __type c.Int, __result_buf *Netent, __buf *uint8, __buflen c.SizeT, __result **Netent, __h_errnop *c.Int) c.Int + +//go:linkname GetnetbynameR C.getnetbyname_r +func GetnetbynameR(__name *uint8, __result_buf *Netent, __buf *uint8, __buflen c.SizeT, __result **Netent, __h_errnop *c.Int) c.Int + +// Open service data base files and mark them as staying open even +// after a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setservent C.setservent +func Setservent(__stay_open c.Int) + +// Close service data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endservent C.endservent +func Endservent() + +// Get next entry from service data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getservent C.getservent +func Getservent() *Servent + +// Return entry from network data base for network with NAME and +// protocol PROTO. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getservbyname C.getservbyname +func Getservbyname(__name *uint8, __proto *uint8) *Servent + +// Return entry from service data base which matches port PORT and +// protocol PROTO. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getservbyport C.getservbyport +func Getservbyport(__port c.Int, __proto *uint8) *Servent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Servent).GetserventR C.getservent_r +func (self *Servent) GetserventR(__buf *uint8, __buflen c.SizeT, __result **Servent) c.Int { + return 0 +} + +//go:linkname GetservbynameR C.getservbyname_r +func GetservbynameR(__name *uint8, __proto *uint8, __result_buf *Servent, __buf *uint8, __buflen c.SizeT, __result **Servent) c.Int + +//go:linkname GetservbyportR C.getservbyport_r +func GetservbyportR(__port c.Int, __proto *uint8, __result_buf *Servent, __buf *uint8, __buflen c.SizeT, __result **Servent) c.Int + +// Open protocol data base files and mark them as staying open even +// after a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setprotoent C.setprotoent +func Setprotoent(__stay_open c.Int) + +// Close protocol data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endprotoent C.endprotoent +func Endprotoent() + +// Get next entry from protocol data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getprotoent C.getprotoent +func Getprotoent() *Protoent + +// Return entry from protocol data base for network with NAME. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getprotobyname C.getprotobyname +func Getprotobyname(__name *uint8) *Protoent + +// Return entry from protocol data base which number is PROTO. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getprotobynumber C.getprotobynumber +func Getprotobynumber(__proto c.Int) *Protoent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Protoent).GetprotoentR C.getprotoent_r +func (self *Protoent) GetprotoentR(__buf *uint8, __buflen c.SizeT, __result **Protoent) c.Int { + return 0 +} + +//go:linkname GetprotobynameR C.getprotobyname_r +func GetprotobynameR(__name *uint8, __result_buf *Protoent, __buf *uint8, __buflen c.SizeT, __result **Protoent) c.Int + +//go:linkname GetprotobynumberR C.getprotobynumber_r +func GetprotobynumberR(__proto c.Int, __result_buf *Protoent, __buf *uint8, __buflen c.SizeT, __result **Protoent) c.Int + +// Establish network group NETGROUP for enumeration. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Setnetgrent C.setnetgrent +func Setnetgrent(__netgroup *uint8) c.Int + +// Free all space allocated by previous `setnetgrent' call. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Endnetgrent C.endnetgrent +func Endnetgrent() + +// Get next member of netgroup established by last `setnetgrent' call +// and return pointers to elements in HOSTP, USERP, and DOMAINP. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Getnetgrent C.getnetgrent +func Getnetgrent(__hostp **uint8, __userp **uint8, __domainp **uint8) c.Int + +// Test whether NETGROUP contains the triple (HOST,USER,DOMAIN). +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Innetgr C.innetgr +func Innetgr(__netgroup *uint8, __host *uint8, __user *uint8, __domain *uint8) c.Int + +// Reentrant version of `getnetgrent' where result is placed in BUFFER. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname GetnetgrentR C.getnetgrent_r +func GetnetgrentR(__hostp **uint8, __userp **uint8, __domainp **uint8, __buffer *uint8, __buflen c.SizeT) c.Int + +// Call `rshd' at port RPORT on remote machine *AHOST to execute CMD. +// The local user is LOCUSER, on the remote machine the command is +// executed as REMUSER. In *FD2P the descriptor to the socket for the +// connection is returned. The caller must have the right to use a +// reserved port. When the function returns *AHOST contains the +// official host name. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Rcmd C.rcmd +func Rcmd(__ahost **uint8, __rport uint16, __locuser *uint8, __remuser *uint8, __cmd *uint8, __fd2p *c.Int) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RcmdAf C.rcmd_af +func RcmdAf(__ahost **uint8, __rport uint16, __locuser *uint8, __remuser *uint8, __cmd *uint8, __fd2p *c.Int, __af SaFamilyT) c.Int + +// Call `rexecd' at port RPORT on remote machine *AHOST to execute +// CMD. The process runs at the remote machine using the ID of user +// NAME whose cleartext password is PASSWD. In *FD2P the descriptor +// to the socket for the connection is returned. When the function +// returns *AHOST contains the official host name. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Rexec C.rexec +func Rexec(__ahost **uint8, __rport c.Int, __name *uint8, __pass *uint8, __cmd *uint8, __fd2p *c.Int) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RexecAf C.rexec_af +func RexecAf(__ahost **uint8, __rport c.Int, __name *uint8, __pass *uint8, __cmd *uint8, __fd2p *c.Int, __af SaFamilyT) c.Int + +// Check whether user REMUSER on system RHOST is allowed to login as LOCUSER. +// If SUSER is not zero the user tries to become superuser. Return 0 if +// it is possible. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Ruserok C.ruserok +func Ruserok(__rhost *uint8, __suser c.Int, __remuser *uint8, __locuser *uint8) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RuserokAf C.ruserok_af +func RuserokAf(__rhost *uint8, __suser c.Int, __remuser *uint8, __locuser *uint8, __af SaFamilyT) c.Int + +// Check whether user REMUSER on system indicated by IPv4 address +// RADDR is allowed to login as LOCUSER. Non-IPv4 (e.g., IPv6) are +// not supported. If SUSER is not zero the user tries to become +// superuser. Return 0 if it is possible. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Iruserok C.iruserok +func Iruserok(__raddr c.Uint32T, __suser c.Int, __remuser *uint8, __locuser *uint8) c.Int + +// This is the equivalent function where the pfamiliy if the address +// pointed to by RADDR is determined by the value of AF. It therefore +// can be used for IPv6 +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname IruserokAf C.iruserok_af +func IruserokAf(__raddr unsafe.Pointer, __suser c.Int, __remuser *uint8, __locuser *uint8, __af SaFamilyT) c.Int + +// Try to allocate reserved port, returning a descriptor for a socket opened +// at this port or -1 if unsuccessful. The search for an available port +// will start at ALPORT and continues with lower numbers. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Rresvport C.rresvport +func Rresvport(__alport *c.Int) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RresvportAf C.rresvport_af +func RresvportAf(__alport *c.Int, __af SaFamilyT) c.Int + +// Convert error return from getaddrinfo() to a string. +// +//go:linkname GaiStrerror C.gai_strerror +func GaiStrerror(__ecode c.Int) *uint8 + +// Translate a socket address to a location and service name. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +// llgo:link (*SockAddr).Getnameinfo C.getnameinfo +func (self *SockAddr) Getnameinfo(__salen SocklenT, __host *uint8, __hostlen SocklenT, __serv *uint8, __servlen SocklenT, __flags c.Int) c.Int { + return 0 +} diff --git a/c/net/netinet-in_darwin_arm64.go b/c/net/netinet-in_darwin_arm64.go index 31215d48..fb3d03e5 100644 --- a/c/net/netinet-in_darwin_arm64.go +++ b/c/net/netinet-in_darwin_arm64.go @@ -1,7 +1,6 @@ //go:build darwin && arm64 && !ios // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net @@ -18,7 +17,6 @@ const IPPROTO_HOPOPTS = 0 // control message protocol const IPPROTO_ICMP = 1 - const ( // group mgmt protocol IPPROTO_IGMP = 2 @@ -32,7 +30,6 @@ const ( // tcp const IPPROTO_TCP = 6 - const ( // Stream protocol II IPPROTO_ST = 7 @@ -58,7 +55,6 @@ const ( // user datagram protocol const IPPROTO_UDP = 17 - const ( // Multiplexing IPPROTO_MUX = 18 @@ -110,7 +106,6 @@ const ( // IP6 header const IPPROTO_IPV6 = 41 - const ( // Source Demand Routing IPPROTO_SDRP = 42 @@ -245,16 +240,11 @@ const IPPROTO_DIVERT = 254 // raw IP packet const IPPROTO_RAW = 255 - const IPPROTO_MAX = 256 // last return value of *_input(), meaning "all job for this pkt is done". const IPPROTO_DONE = 257 - const X__DARWIN_IPPORT_RESERVED = 1024 - -const IPPORT_RESERVED = 1024 - const IPPORT_USERRESERVED = 5000 // Default local port range to use by setting IP_PORTRANGE_HIGH @@ -268,27 +258,23 @@ const ( // 512, but that conflicts with some well-known-services that firewalls may // have a fit if we use. const IPPORT_RESERVEDSTART = 600 - const ( IN_CLASSA_NET = 4278190080 IN_CLASSA_NSHIFT = 24 IN_CLASSA_HOST = 16777215 IN_CLASSA_MAX = 128 ) - const ( IN_CLASSB_NET = 4294901760 IN_CLASSB_NSHIFT = 16 IN_CLASSB_HOST = 65535 IN_CLASSB_MAX = 65536 ) - const ( IN_CLASSC_NET = 4294967040 IN_CLASSC_NSHIFT = 8 IN_CLASSC_HOST = 255 ) - const ( // These ones aren't really IN_CLASSD_NET = 4026531840 @@ -303,7 +289,6 @@ const INADDR_NONE = 4294967295 // official! const IN_LOOPBACKNET = 127 - const INET_ADDRSTRLEN = 16 // Options for use with [gs]etsockopt at the IP level. @@ -359,7 +344,6 @@ const ( // bool: drop receive of raw IP header const IP_STRIPHDR = 23 - const ( // bool; receive reception TTL w/dgram IP_RECVTTL = 24 @@ -374,7 +358,6 @@ const ( // don't fragment packet IP_DONTFRAG = 28 ) - const ( // add a firewall rule to chain IP_FW_ADD = 40 @@ -406,7 +389,6 @@ const ( // reset logging counters IP_OLD_FW_RESETLOG = 56 ) - const ( // add/configure a dummynet pipe IP_DUMMYNET_CONFIGURE = 60 @@ -417,7 +399,6 @@ const ( // get entire dummynet pipes IP_DUMMYNET_GET = 64 ) - const ( // int*; get background IO flags; set background IO IP_TRAFFIC_MGT_BACKGROUND = 65 @@ -512,7 +493,6 @@ const ( // default TTL IPCTL_DEFTTL = 3 ) - const ( // cloned route expiration time IPCTL_RTEXPIRE = 5 @@ -543,14 +523,14 @@ const ( // Internet address (a structure for historical reasons) type InAddr struct { - Addr InAddrT + Addr uint32 } // Socket address, internet style. type SockaddrIn struct { - Len X__Uint8T - Family SaFamilyT - Port InPortT + Len uint8 + Family uint8 + Port uint16 Addr InAddr Zero [8]c.Char } @@ -587,6 +567,30 @@ type IpMreqSource struct { ImrInterface InAddr } +// Argument structures for Protocol-Independent Multicast Source +// Filter APIs. [RFC3678] +type GroupReq struct { + GrInterface c.Uint32T + GrGroup SockaddrStorage +} +type GroupSourceReq struct { + GsrInterface c.Uint32T + GsrGroup SockaddrStorage + GsrSource SockaddrStorage +} + +// The following structure is private; do not use it from user applications. +// It is used to communicate IP_MSFILTER/IPV6_MSFILTER information between +// the RFC 3678 libc functions and the kernel. +type X__Msfilterreq struct { + MsfrIfindex c.Uint32T + MsfrFmode c.Uint32T + MsfrNsrcs c.Uint32T + X__MsfrAlign c.Uint32T + MsfrGroup SockaddrStorage + MsfrSrcs *SockaddrStorage +} + // IP_PKTINFO: Packet information (equivalent to RFC2292 sec 5 for IPv4) // This structure is used for // @@ -615,16 +619,16 @@ type InPktinfo struct { // We use uint32_t here to be consistent. // //go:linkname Setipv4sourcefilter C.setipv4sourcefilter -func Setipv4sourcefilter(_llcppg_param1 c.Int, _llcppg_param2 InAddr, _llcppg_param3 InAddr, _llcppg_param4 Uint32T, _llcppg_param5 Uint32T, _llcppg_param6 *InAddr) c.Int +func Setipv4sourcefilter(_llcppg_param1 c.Int, _llcppg_param2 InAddr, _llcppg_param3 InAddr, _llcppg_param4 c.Uint32T, _llcppg_param5 c.Uint32T, _llcppg_param6 *InAddr) c.Int //go:linkname Getipv4sourcefilter C.getipv4sourcefilter -func Getipv4sourcefilter(_llcppg_param1 c.Int, _llcppg_param2 InAddr, _llcppg_param3 InAddr, _llcppg_param4 *Uint32T, _llcppg_param5 *Uint32T, _llcppg_param6 *InAddr) c.Int +func Getipv4sourcefilter(_llcppg_param1 c.Int, _llcppg_param2 InAddr, _llcppg_param3 InAddr, _llcppg_param4 *c.Uint32T, _llcppg_param5 *c.Uint32T, _llcppg_param6 *InAddr) c.Int //go:linkname Setsourcefilter C.setsourcefilter -func Setsourcefilter(_llcppg_param1 c.Int, _llcppg_param2 Uint32T, _llcppg_param3 *SockAddr, _llcppg_param4 SocklenT, _llcppg_param5 Uint32T, _llcppg_param6 Uint32T, _llcppg_param7 *SockaddrStorage) c.Int +func Setsourcefilter(_llcppg_param1 c.Int, _llcppg_param2 c.Uint32T, _llcppg_param3 *SockAddr, _llcppg_param4 SocklenT, _llcppg_param5 c.Uint32T, _llcppg_param6 c.Uint32T, _llcppg_param7 *SockaddrStorage) c.Int //go:linkname Getsourcefilter C.getsourcefilter -func Getsourcefilter(_llcppg_param1 c.Int, _llcppg_param2 Uint32T, _llcppg_param3 *SockAddr, _llcppg_param4 SocklenT, _llcppg_param5 *Uint32T, _llcppg_param6 *Uint32T, _llcppg_param7 *SockaddrStorage) c.Int +func Getsourcefilter(_llcppg_param1 c.Int, _llcppg_param2 c.Uint32T, _llcppg_param3 *SockAddr, _llcppg_param4 SocklenT, _llcppg_param5 *c.Uint32T, _llcppg_param6 *c.Uint32T, _llcppg_param7 *SockaddrStorage) c.Int //go:linkname Bindresvport C.bindresvport func Bindresvport(_llcppg_param1 c.Int, _llcppg_param2 *SockaddrIn) c.Int diff --git a/c/net/netinet-in_linux_amd64.go b/c/net/netinet-in_linux_amd64.go index 624bd2a9..aafeed35 100644 --- a/c/net/netinet-in_linux_amd64.go +++ b/c/net/netinet-in_linux_amd64.go @@ -1,31 +1,27 @@ //go:build linux && amd64 && !android // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net import ( "github.com/goplus/lib/c" - _ "unsafe" + "unsafe" ) const X_NETINET_IN_H = 1 - const ( IN_CLASSA_NET = 4278190080 IN_CLASSA_NSHIFT = 24 IN_CLASSA_HOST = 16777215 IN_CLASSA_MAX = 128 ) - const ( IN_CLASSB_NET = 4294901760 IN_CLASSB_NSHIFT = 16 IN_CLASSB_HOST = 65535 IN_CLASSB_MAX = 65536 ) - const ( IN_CLASSC_NET = 4294967040 IN_CLASSC_NSHIFT = 8 @@ -34,51 +30,44 @@ const ( // Network number for local host loopback. const IN_LOOPBACKNET = 127 - const ( INET_ADDRSTRLEN = 16 INET6_ADDRSTRLEN = 46 ) type InAddr struct { - Addr InAddrT + Addr uint32 } // Standard well-defined IP protocols. const ( - IPPROTO_IP = 0 - IPPROTO_ICMP = 1 - IPPROTO_IGMP = 2 - IPPROTO_IPIP = 4 - IPPROTO_TCP = 6 - IPPROTO_EGP = 8 - IPPROTO_PUP = 12 - IPPROTO_UDP = 17 - IPPROTO_IDP = 22 - IPPROTO_TP = 29 - IPPROTO_DCCP = 33 - IPPROTO_IPV6 = 41 - IPPROTO_RSVP = 46 - IPPROTO_GRE = 47 - IPPROTO_ESP = 50 - IPPROTO_AH = 51 - IPPROTO_MTP = 92 - IPPROTO_BEETPH = 94 - IPPROTO_ENCAP = 98 - IPPROTO_PIM = 103 - IPPROTO_COMP = 108 - IPPROTO_L2TP = 115 - IPPROTO_SCTP = 132 - IPPROTO_UDPLITE = 136 - IPPROTO_MPLS = 137 - IPPROTO_ETHERNET = 143 - IPPROTO_AGGFRAG = 144 - IPPROTO_RAW = 255 - IPPROTO_SMC = 256 - IPPROTO_MPTCP = 262 - IPPROTO_MAX = 263 + IPPROTO_IP = 0 + IPPROTO_ICMP = 1 + IPPROTO_IGMP = 2 + IPPROTO_IPIP = 4 + IPPROTO_TCP = 6 + IPPROTO_EGP = 8 + IPPROTO_PUP = 12 + IPPROTO_UDP = 17 + IPPROTO_IDP = 22 + IPPROTO_TP = 29 + IPPROTO_DCCP = 33 + IPPROTO_IPV6 = 41 + IPPROTO_RSVP = 46 + IPPROTO_GRE = 47 + IPPROTO_ESP = 50 + IPPROTO_AH = 51 + IPPROTO_MTP = 92 + IPPROTO_BEETPH = 94 + IPPROTO_ENCAP = 98 + IPPROTO_PIM = 103 + IPPROTO_COMP = 108 + IPPROTO_SCTP = 132 + IPPROTO_UDPLITE = 136 + IPPROTO_MPLS = 137 + IPPROTO_RAW = 255 + IPPROTO_MAX = 256 ) - const ( IPPROTO_HOPOPTS = 0 IPPROTO_ROUTING = 43 @@ -123,27 +112,26 @@ const ( IPPORT_USERRESERVED = 5000 ) -// In6Addr retains the byte array API and the native IPv6 union alignment. -type In6Addr struct { - _ [0]uint32 - U6Addr [16]uint8 +// IPv6 address +type nativeIn6Addr struct { + X__In6U _llcppg_anon_0 } // Structure describing an Internet socket address. type SockaddrIn struct { - Family SaFamilyT - Port InPortT + Family uint16 + Port uint16 Addr InAddr Zero [8]uint8 } // Ditto, for IPv6. type SockaddrIn6 struct { - Family SaFamilyT - Port InPortT - Flowinfo Uint32T + Family uint16 + Port uint16 + Flowinfo uint32 Addr In6Addr - ScopeId Uint32T + ScopeId uint32 } // IPv4 multicast request. @@ -151,14 +139,6 @@ type IpMreq struct { ImrMultiaddr InAddr ImrInterface InAddr } - -// IPv4 multicast request with interface index. -type IpMreqn struct { - ImrMultiaddr InAddr - ImrAddress InAddr - ImrIfindex c.Int -} - type IpMreqSource struct { ImrMultiaddr InAddr ImrInterface InAddr @@ -167,18 +147,17 @@ type IpMreqSource struct { // Likewise, for IPv6. type Ipv6Mreq struct { - Ipv6mrMultiaddr In6Addr + Ipv6mrMultiaddr nativeIn6Addr Ipv6mrInterface c.Uint } // Multicast group request. type GroupReq struct { - GrInterface Uint32T + GrInterface c.Uint32T GrGroup SockaddrStorage } - type GroupSourceReq struct { - GsrInterface Uint32T + GsrInterface c.Uint32T GsrGroup SockaddrStorage GsrSource SockaddrStorage } @@ -187,36 +166,53 @@ type GroupSourceReq struct { type IpMsfilter struct { ImsfMultiaddr InAddr ImsfInterface InAddr - ImsfFmode Uint32T - ImsfNumsrc Uint32T + ImsfFmode c.Uint32T + ImsfNumsrc c.Uint32T ImsfSlist [1]InAddr } - type GroupFilter struct { - GfInterface Uint32T + GfInterface c.Uint32T GfGroup SockaddrStorage - GfFmode Uint32T - GfNumsrc Uint32T + GfFmode c.Uint32T + GfNumsrc c.Uint32T GfSlist [1]SockaddrStorage } // Internet address. -type InAddrT = Uint32T +type InAddrT = c.Uint32T // Type to represent a port. -type InPortT = Uint16T +type InPortT = c.Uint16T +type _llcppg_anon_0 struct { + _xgo_union [4]uint32 +} + +func (p *_llcppg_anon_0) XGof_ref___u6_addr8() *[16]c.Uint8T { + return (*[16]c.Uint8T)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_0) XGof_ref___u6_addr16() *[8]c.Uint16T { + return (*[8]c.Uint16T)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_0) XGof_ref___u6_addr32() *[4]c.Uint32T { + return (*[4]c.Uint32T)(unsafe.Pointer(p)) +} // :: // //go:linkname In6addrAny C.in6addr_any -var In6addrAny In6Addr +var In6addrAny nativeIn6Addr // ::1 // //go:linkname In6addrLoopback C.in6addr_loopback -var In6addrLoopback In6Addr +var In6addrLoopback nativeIn6Addr // Bind socket to a privileged IP port. // //go:linkname Bindresvport C.bindresvport func Bindresvport(__sockfd c.Int, __sock_in *SockaddrIn) c.Int + +// The IPv6 version of this function. +// +//go:linkname Bindresvport6 C.bindresvport6 +func Bindresvport6(__sockfd c.Int, __sock_in *SockaddrIn6) c.Int diff --git a/c/net/netinet-in_linux_arm64.go b/c/net/netinet-in_linux_arm64.go new file mode 100644 index 00000000..c23a3159 --- /dev/null +++ b/c/net/netinet-in_linux_arm64.go @@ -0,0 +1,218 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_NETINET_IN_H = 1 +const ( + IN_CLASSA_NET = 4278190080 + IN_CLASSA_NSHIFT = 24 + IN_CLASSA_HOST = 16777215 + IN_CLASSA_MAX = 128 +) +const ( + IN_CLASSB_NET = 4294901760 + IN_CLASSB_NSHIFT = 16 + IN_CLASSB_HOST = 65535 + IN_CLASSB_MAX = 65536 +) +const ( + IN_CLASSC_NET = 4294967040 + IN_CLASSC_NSHIFT = 8 + IN_CLASSC_HOST = 255 +) + +// Network number for local host loopback. +const IN_LOOPBACKNET = 127 +const ( + INET_ADDRSTRLEN = 16 + INET6_ADDRSTRLEN = 46 +) + +type InAddr struct { + Addr uint32 +} + +// Standard well-defined IP protocols. +const ( + IPPROTO_IP = 0 + IPPROTO_ICMP = 1 + IPPROTO_IGMP = 2 + IPPROTO_IPIP = 4 + IPPROTO_TCP = 6 + IPPROTO_EGP = 8 + IPPROTO_PUP = 12 + IPPROTO_UDP = 17 + IPPROTO_IDP = 22 + IPPROTO_TP = 29 + IPPROTO_DCCP = 33 + IPPROTO_IPV6 = 41 + IPPROTO_RSVP = 46 + IPPROTO_GRE = 47 + IPPROTO_ESP = 50 + IPPROTO_AH = 51 + IPPROTO_MTP = 92 + IPPROTO_BEETPH = 94 + IPPROTO_ENCAP = 98 + IPPROTO_PIM = 103 + IPPROTO_COMP = 108 + IPPROTO_SCTP = 132 + IPPROTO_UDPLITE = 136 + IPPROTO_MPLS = 137 + IPPROTO_RAW = 255 + IPPROTO_MAX = 256 +) +const ( + IPPROTO_HOPOPTS = 0 + IPPROTO_ROUTING = 43 + IPPROTO_FRAGMENT = 44 + IPPROTO_ICMPV6 = 58 + IPPROTO_NONE = 59 + IPPROTO_DSTOPTS = 60 + // IPv6 mobility header. + IPPROTO_MH = 135 +) + +// Standard well-known ports. +const ( + IPPORT_ECHO = 7 + IPPORT_DISCARD = 9 + IPPORT_SYSTAT = 11 + IPPORT_DAYTIME = 13 + IPPORT_NETSTAT = 15 + IPPORT_FTP = 21 + IPPORT_TELNET = 23 + IPPORT_SMTP = 25 + IPPORT_TIMESERVER = 37 + IPPORT_NAMESERVER = 42 + IPPORT_WHOIS = 43 + IPPORT_MTP = 57 + IPPORT_TFTP = 69 + IPPORT_RJE = 77 + IPPORT_FINGER = 79 + IPPORT_TTYLINK = 87 + IPPORT_SUPDUP = 95 + IPPORT_EXECSERVER = 512 + IPPORT_LOGINSERVER = 513 + IPPORT_CMDSERVER = 514 + IPPORT_EFSSERVER = 520 + // UDP ports. + IPPORT_BIFFUDP = 512 + IPPORT_WHOSERVER = 513 + IPPORT_ROUTESERVER = 520 + // Ports less than this value are reserved for privileged processes. + IPPORT_RESERVED = 1024 + // Ports greater this value are reserved for (non-privileged) servers. + IPPORT_USERRESERVED = 5000 +) + +// IPv6 address +type nativeIn6Addr struct { + X__In6U _llcppg_anon_0 +} + +// Structure describing an Internet socket address. +type SockaddrIn struct { + Family uint16 + Port uint16 + Addr InAddr + Zero [8]c.Char +} + +// Ditto, for IPv6. +type SockaddrIn6 struct { + Family uint16 + Port uint16 + Flowinfo uint32 + Addr In6Addr + ScopeId uint32 +} + +// IPv4 multicast request. +type IpMreq struct { + ImrMultiaddr InAddr + ImrInterface InAddr +} +type IpMreqSource struct { + ImrMultiaddr InAddr + ImrInterface InAddr + ImrSourceaddr InAddr +} + +// Likewise, for IPv6. +type Ipv6Mreq struct { + Ipv6mrMultiaddr nativeIn6Addr + Ipv6mrInterface c.Uint +} + +// Multicast group request. +type GroupReq struct { + GrInterface c.Uint32T + GrGroup SockaddrStorage +} +type GroupSourceReq struct { + GsrInterface c.Uint32T + GsrGroup SockaddrStorage + GsrSource SockaddrStorage +} + +// Full-state filter operations. +type IpMsfilter struct { + ImsfMultiaddr InAddr + ImsfInterface InAddr + ImsfFmode c.Uint32T + ImsfNumsrc c.Uint32T + ImsfSlist [1]InAddr +} +type GroupFilter struct { + GfInterface c.Uint32T + GfGroup SockaddrStorage + GfFmode c.Uint32T + GfNumsrc c.Uint32T + GfSlist [1]SockaddrStorage +} + +// Internet address. +type InAddrT = c.Uint32T + +// Type to represent a port. +type InPortT = c.Uint16T +type _llcppg_anon_0 struct { + _xgo_union [4]uint32 +} + +func (p *_llcppg_anon_0) XGof_ref___u6_addr8() *[16]c.Uint8T { + return (*[16]c.Uint8T)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_0) XGof_ref___u6_addr16() *[8]c.Uint16T { + return (*[8]c.Uint16T)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_0) XGof_ref___u6_addr32() *[4]c.Uint32T { + return (*[4]c.Uint32T)(unsafe.Pointer(p)) +} + +// :: +// +//go:linkname In6addrAny C.in6addr_any +var In6addrAny nativeIn6Addr + +// ::1 +// +//go:linkname In6addrLoopback C.in6addr_loopback +var In6addrLoopback nativeIn6Addr + +// Bind socket to a privileged IP port. +// +//go:linkname Bindresvport C.bindresvport +func Bindresvport(__sockfd c.Int, __sock_in *SockaddrIn) c.Int + +// The IPv6 version of this function. +// +//go:linkname Bindresvport6 C.bindresvport6 +func Bindresvport6(__sockfd c.Int, __sock_in *SockaddrIn6) c.Int diff --git a/c/net/netinet6-in6_darwin_arm64.go b/c/net/netinet6-in6_darwin_arm64.go index b3829cde..7e0c848a 100644 --- a/c/net/netinet6-in6_darwin_arm64.go +++ b/c/net/netinet6-in6_darwin_arm64.go @@ -1,7 +1,6 @@ //go:build darwin && arm64 && !ios // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net @@ -14,7 +13,6 @@ import ( // for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE // has the table of implementation/integration differences. const X__KAME_VERSION = "2009/apple-darwin" - const ( IPV6PORT_RESERVED = 1024 IPV6PORT_ANONMIN = 49152 @@ -22,9 +20,7 @@ const ( IPV6PORT_RESERVEDMIN = 600 IPV6PORT_RESERVEDMAX = 1023 ) - const INET6_ADDRSTRLEN = 46 - const ( X__IPV6_ADDR_SCOPE_NODELOCAL = 1 X__IPV6_ADDR_SCOPE_INTFACELOCAL = 1 @@ -34,7 +30,6 @@ const ( X__IPV6_ADDR_SCOPE_ORGLOCAL = 8 X__IPV6_ADDR_SCOPE_GLOBAL = 14 ) - const ( IPV6_ADDR_MC_FLAGS_TRANSIENT = 16 IPV6_ADDR_MC_FLAGS_PREFIX = 32 @@ -43,7 +38,6 @@ const ( // reserved for future use const IPV6_SOCKOPT_RESERVED1 = 3 - const ( // int; IP6 hops IPV6_UNICAST_HOPS = 4 @@ -58,7 +52,6 @@ const ( // ip6_mreq; leave a group membership IPV6_LEAVE_GROUP = 13 ) - const ( // int; range to choose for unspec port IPV6_PORTRANGE = 14 @@ -86,7 +79,6 @@ const IPV6_CHECKSUM = 26 // bool; only bind INET6 at wildcard bind const IPV6_V6ONLY = 27 - const IPV6_BINDV6ONLY = 27 // struct; get/set security policy @@ -94,7 +86,6 @@ const IPV6_IPSEC_POLICY = 28 // deprecated const IPV6_FAITH = 29 - const ( // add a firewall rule to chain IPV6_FW_ADD = 30 @@ -120,7 +111,6 @@ const ( // int; set/get bound interface const IPV6_BOUND_IF = 125 - const ( // this hop need not be a neighbor. IPV6_RTHDR_LOOSE = 0 @@ -177,7 +167,6 @@ const ( // default Hop-Limit IPV6CTL_DEFHLIM = 3 ) - const ( // forward source-routed dgrams IPV6CTL_FORWSRCRT = 5 @@ -209,7 +198,6 @@ const ( // walk timer for router renumbering IPV6CTL_RR_PRUNE = 22 ) - const ( IPV6CTL_V6ONLY = 24 // cloned route expiration time @@ -219,7 +207,6 @@ const ( // trigger level for dynamic expire IPV6CTL_RTMAXCACHE = 27 ) - const ( // use temporary addresses [RFC 4941] IPV6CTL_USETEMPADDR = 32 @@ -238,14 +225,12 @@ const ( // use default scope zone IPV6CTL_USE_DEFAULTZONE = 39 ) - const ( // max fragments IPV6CTL_MAXFRAGS = 41 // enable pMTU discovery for mcast? IPV6CTL_MCAST_PMTU = 44 ) - const ( IPV6CTL_NEIGHBORGCTHRESH = 46 IPV6CTL_MAXIFPREFIXES = 47 @@ -258,59 +243,70 @@ const ( // to define items, should talk with KAME guys first, for *BSD compatibility const IPV6CTL_MAXID = 51 -// In6Addr retains the byte array API and the native IPv6 union alignment. -type In6Addr struct { - _ [0]uint32 - U6Addr [16]uint8 +// IPv6 address +type nativeIn6Addr struct { + X__U6Addr _llcppg_anon_0 } - type SockaddrIn6 struct { - Len X__Uint8T - Family SaFamilyT - Port InPortT - Flowinfo X__Uint32T + Len uint8 + Family uint8 + Port uint16 + Flowinfo uint32 Addr In6Addr - ScopeId X__Uint32T + ScopeId uint32 } // Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP. type Ipv6Mreq struct { - Ipv6mrMultiaddr In6Addr + Ipv6mrMultiaddr nativeIn6Addr Ipv6mrInterface c.Uint } // IPV6_2292PKTINFO: Packet information(RFC2292 sec 5) type In6Pktinfo struct { - Ipi6Addr In6Addr + Ipi6Addr nativeIn6Addr Ipi6Ifindex c.Uint } // Control structure for IPV6_RECVPATHMTU socket option. type Ip6Mtuinfo struct { Ip6mAddr SockaddrIn6 - Ip6mMtu Uint32T + Ip6mMtu c.Uint32T +} +type _llcppg_anon_0 struct { + _xgo_union [4]uint32 } // IPv6 address -type In6AddrT = In6Addr +type In6AddrT = nativeIn6Addr + +func (p *_llcppg_anon_0) XGof_ref___u6_addr8() *[16]X__Uint8T { + return (*[16]X__Uint8T)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_0) XGof_ref___u6_addr16() *[8]X__Uint16T { + return (*[8]X__Uint16T)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_0) XGof_ref___u6_addr32() *[4]X__Uint32T { + return (*[4]X__Uint32T)(unsafe.Pointer(p)) +} //go:linkname In6addrAny C.in6addr_any -var In6addrAny In6Addr +var In6addrAny nativeIn6Addr //go:linkname In6addrLoopback C.in6addr_loopback -var In6addrLoopback In6Addr +var In6addrLoopback nativeIn6Addr //go:linkname In6addrNodelocalAllnodes C.in6addr_nodelocal_allnodes -var In6addrNodelocalAllnodes In6Addr +var In6addrNodelocalAllnodes nativeIn6Addr //go:linkname In6addrLinklocalAllnodes C.in6addr_linklocal_allnodes -var In6addrLinklocalAllnodes In6Addr +var In6addrLinklocalAllnodes nativeIn6Addr //go:linkname In6addrLinklocalAllrouters C.in6addr_linklocal_allrouters -var In6addrLinklocalAllrouters In6Addr +var In6addrLinklocalAllrouters nativeIn6Addr //go:linkname In6addrLinklocalAllv2routers C.in6addr_linklocal_allv2routers -var In6addrLinklocalAllv2routers In6Addr +var In6addrLinklocalAllv2routers nativeIn6Addr //go:linkname Inet6OptionSpace C.inet6_option_space func Inet6OptionSpace(_llcppg_param1 c.Int) c.Int @@ -339,13 +335,13 @@ func (self *Cmsghdr) Inet6OptionFind(_llcppg_param2 **X__Uint8T, _llcppg_param3 } //go:linkname Inet6RthdrSpace C.inet6_rthdr_space -func Inet6RthdrSpace(_llcppg_param1 c.Int, _llcppg_param2 c.Int) SizeT +func Inet6RthdrSpace(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.SizeT //go:linkname Inet6RthdrInit C.inet6_rthdr_init func Inet6RthdrInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int) *Cmsghdr // llgo:link (*Cmsghdr).Inet6RthdrAdd C.inet6_rthdr_add -func (self *Cmsghdr) Inet6RthdrAdd(_llcppg_param2 *In6Addr, _llcppg_param3 c.Uint) c.Int { +func (self *Cmsghdr) Inet6RthdrAdd(_llcppg_param2 *nativeIn6Addr, _llcppg_param3 c.Uint) c.Int { return 0 } @@ -360,7 +356,7 @@ func (self *Cmsghdr) Inet6RthdrSegments() c.Int { } // llgo:link (*Cmsghdr).Inet6RthdrGetaddr C.inet6_rthdr_getaddr -func (self *Cmsghdr) Inet6RthdrGetaddr(_llcppg_param2 c.Int) *In6Addr { +func (self *Cmsghdr) Inet6RthdrGetaddr(_llcppg_param2 c.Int) *nativeIn6Addr { return nil } @@ -397,7 +393,7 @@ func Inet6RthSpace(_llcppg_param1 c.Int, _llcppg_param2 c.Int) SocklenT func Inet6RthInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int, _llcppg_param4 c.Int) unsafe.Pointer //go:linkname Inet6RthAdd C.inet6_rth_add -func Inet6RthAdd(_llcppg_param1 unsafe.Pointer, _llcppg_param2 *In6Addr) c.Int +func Inet6RthAdd(_llcppg_param1 unsafe.Pointer, _llcppg_param2 *nativeIn6Addr) c.Int //go:linkname Inet6RthReverse C.inet6_rth_reverse func Inet6RthReverse(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer) c.Int @@ -406,4 +402,4 @@ func Inet6RthReverse(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointe func Inet6RthSegments(_llcppg_param1 unsafe.Pointer) c.Int //go:linkname Inet6RthGetaddr C.inet6_rth_getaddr -func Inet6RthGetaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int) *In6Addr +func Inet6RthGetaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int) *nativeIn6Addr diff --git a/c/net/rpc-netdb_linux_amd64.go b/c/net/rpc-netdb_linux_amd64.go index 1200523b..3d5ca81f 100644 --- a/c/net/rpc-netdb_linux_amd64.go +++ b/c/net/rpc-netdb_linux_amd64.go @@ -1,7 +1,6 @@ //go:build linux && amd64 && !android // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net @@ -34,12 +33,12 @@ func Getrpcbynumber(__number c.Int) *Rpcent func Getrpcent() *Rpcent //go:linkname GetrpcbynameR C.getrpcbyname_r -func GetrpcbynameR(__name *c.Char, __result_buf *Rpcent, __buffer *c.Char, __buflen SizeT, __result **Rpcent) c.Int +func GetrpcbynameR(__name *c.Char, __result_buf *Rpcent, __buffer *c.Char, __buflen c.SizeT, __result **Rpcent) c.Int //go:linkname GetrpcbynumberR C.getrpcbynumber_r -func GetrpcbynumberR(__number c.Int, __result_buf *Rpcent, __buffer *c.Char, __buflen SizeT, __result **Rpcent) c.Int +func GetrpcbynumberR(__number c.Int, __result_buf *Rpcent, __buffer *c.Char, __buflen c.SizeT, __result **Rpcent) c.Int // llgo:link (*Rpcent).GetrpcentR C.getrpcent_r -func (self *Rpcent) GetrpcentR(__buffer *c.Char, __buflen SizeT, __result **Rpcent) c.Int { +func (self *Rpcent) GetrpcentR(__buffer *c.Char, __buflen c.SizeT, __result **Rpcent) c.Int { return 0 } diff --git a/c/net/rpc-netdb_linux_arm64.go b/c/net/rpc-netdb_linux_arm64.go new file mode 100644 index 00000000..3e4fe1d3 --- /dev/null +++ b/c/net/rpc-netdb_linux_arm64.go @@ -0,0 +1,44 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_RPC_NETDB_H = 1 + +type Rpcent struct { + RName *uint8 + RAliases **uint8 + RNumber c.Int +} + +//go:linkname Setrpcent C.setrpcent +func Setrpcent(__stayopen c.Int) + +//go:linkname Endrpcent C.endrpcent +func Endrpcent() + +//go:linkname Getrpcbyname C.getrpcbyname +func Getrpcbyname(__name *uint8) *Rpcent + +//go:linkname Getrpcbynumber C.getrpcbynumber +func Getrpcbynumber(__number c.Int) *Rpcent + +//go:linkname Getrpcent C.getrpcent +func Getrpcent() *Rpcent + +//go:linkname GetrpcbynameR C.getrpcbyname_r +func GetrpcbynameR(__name *uint8, __result_buf *Rpcent, __buffer *uint8, __buflen c.SizeT, __result **Rpcent) c.Int + +//go:linkname GetrpcbynumberR C.getrpcbynumber_r +func GetrpcbynumberR(__number c.Int, __result_buf *Rpcent, __buffer *uint8, __buflen c.SizeT, __result **Rpcent) c.Int + +// llgo:link (*Rpcent).GetrpcentR C.getrpcent_r +func (self *Rpcent) GetrpcentR(__buffer *uint8, __buflen c.SizeT, __result **Rpcent) c.Int { + return 0 +} diff --git a/c/net/sys-_types-_caddr_t_darwin_arm64.go b/c/net/sys-_types-_caddr_t_darwin_arm64.go new file mode 100644 index 00000000..e57a61a8 --- /dev/null +++ b/c/net/sys-_types-_caddr_t_darwin_arm64.go @@ -0,0 +1,9 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import "github.com/goplus/lib/c" + +type CaddrT = *c.Char diff --git a/c/net/sys-_types-_in_addr_t_darwin_arm64.go b/c/net/sys-_types-_in_addr_t_darwin_arm64.go new file mode 100644 index 00000000..baaac132 --- /dev/null +++ b/c/net/sys-_types-_in_addr_t_darwin_arm64.go @@ -0,0 +1,8 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package net + +// base type for internet address +type InAddrT = X__Uint32T diff --git a/c/net/sys-_types-_in_port_t_darwin_arm64.go b/c/net/sys-_types-_in_port_t_darwin_arm64.go new file mode 100644 index 00000000..20e75c20 --- /dev/null +++ b/c/net/sys-_types-_in_port_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package net + +type InPortT = X__Uint16T diff --git a/c/net/sys-_types-_sa_family_t_darwin_arm64.go b/c/net/sys-_types-_sa_family_t_darwin_arm64.go new file mode 100644 index 00000000..aaaf62c2 --- /dev/null +++ b/c/net/sys-_types-_sa_family_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package net + +type SaFamilyT = X__Uint8T diff --git a/c/net/sys-_types-_socklen_t_darwin_arm64.go b/c/net/sys-_types-_socklen_t_darwin_arm64.go new file mode 100644 index 00000000..2772253b --- /dev/null +++ b/c/net/sys-_types-_socklen_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package net + +type SocklenT = X__DarwinSocklenT diff --git a/c/net/sys-_types-_timeval32_darwin_arm64.go b/c/net/sys-_types-_timeval32_darwin_arm64.go new file mode 100644 index 00000000..49c8978b --- /dev/null +++ b/c/net/sys-_types-_timeval32_darwin_arm64.go @@ -0,0 +1,10 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package net + +type Timeval32 struct { + TvSec X__Int32T + TvUsec X__Int32T +} diff --git a/c/net/sys-_types-_u_char_darwin_arm64.go b/c/net/sys-_types-_u_char_darwin_arm64.go new file mode 100644 index 00000000..e44c2af9 --- /dev/null +++ b/c/net/sys-_types-_u_char_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package net + +type UChar = uint8 diff --git a/c/net/sys-_types-_u_int32_t_darwin_arm64.go b/c/net/sys-_types-_u_int32_t_darwin_arm64.go new file mode 100644 index 00000000..c307a1d7 --- /dev/null +++ b/c/net/sys-_types-_u_int32_t_darwin_arm64.go @@ -0,0 +1,9 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import "github.com/goplus/lib/c" + +type UInt32T = c.Uint diff --git a/c/net/sys-_types-_u_int64_t_darwin_arm64.go b/c/net/sys-_types-_u_int64_t_darwin_arm64.go new file mode 100644 index 00000000..12b3c20a --- /dev/null +++ b/c/net/sys-_types-_u_int64_t_darwin_arm64.go @@ -0,0 +1,9 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import "github.com/goplus/lib/c" + +type UInt64T = c.UlongLong diff --git a/c/net/sys-_types-_u_short_darwin_arm64.go b/c/net/sys-_types-_u_short_darwin_arm64.go new file mode 100644 index 00000000..638bbe62 --- /dev/null +++ b/c/net/sys-_types-_u_short_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package net + +type UShort = uint16 diff --git a/c/net/sys-_types_darwin_arm64.go b/c/net/sys-_types_darwin_arm64.go new file mode 100644 index 00000000..bc995bad --- /dev/null +++ b/c/net/sys-_types_darwin_arm64.go @@ -0,0 +1,63 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import "github.com/goplus/lib/c" + +// total blocks +type X__DarwinBlkcntT = X__Int64T + +// preferred block size +type X__DarwinBlksizeT = X__Int32T + +// dev_t +type X__DarwinDevT = X__Int32T + +// Used by statvfs and fstatvfs +type X__DarwinFsblkcntT = c.Uint + +// Used by statvfs and fstatvfs +type X__DarwinFsfilcntT = c.Uint + +// [???] process and group IDs +type X__DarwinGidT = X__Uint32T + +// [XSI] pid_t, uid_t, or gid_t +type X__DarwinIdT = X__Uint32T + +// [???] Used for 64 bit inodes +type X__DarwinIno64T = X__Uint64T + +// [???] Used for inodes +type X__DarwinInoT = X__DarwinIno64T + +// Used by mach +type X__DarwinMachPortNameT = X__DarwinNaturalT + +// Used by mach +type X__DarwinMachPortT = X__DarwinMachPortNameT + +// [???] Some file attributes +type X__DarwinModeT = X__Uint16T + +// [???] Used for file sizes +type X__DarwinOffT = X__Int64T + +// [???] process and group IDs +type X__DarwinPidT = X__Int32T + +// [???] signal set +type X__DarwinSigsetT = X__Uint32T + +// [???] microseconds +type X__DarwinSusecondsT = X__Int32T + +// [???] user IDs +type X__DarwinUidT = X__Uint32T + +// [???] microseconds +type X__DarwinUsecondsT = X__Uint32T +type X__DarwinUuidT = [16]uint8 +type X__DarwinUuidStringT = [37]c.Char diff --git a/c/net/sys-socket_darwin_arm64.go b/c/net/sys-socket_darwin_arm64.go index 6fc665c1..6facc2dc 100644 --- a/c/net/sys-socket_darwin_arm64.go +++ b/c/net/sys-socket_darwin_arm64.go @@ -1,7 +1,6 @@ //go:build darwin && arm64 && !ios // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net @@ -10,6 +9,21 @@ import ( "unsafe" ) +// Types +const ( + _native_SOCK_STREAM = 1 + // datagram socket + _native_SOCK_DGRAM = 2 + // raw-protocol interface + _native_SOCK_RAW = 3 +) + +// reliably-delivered message +const _native_SOCK_RDM = 4 + +// sequenced packet stream +const _native_SOCK_SEQPACKET = 5 + // Option flags per-socket. const ( SO_DEBUG = 1 @@ -24,7 +38,6 @@ const ( // permit sending of broadcast msgs SO_BROADCAST = 32 ) - const ( // bypass hardware when possible SO_USELOOPBACK = 64 @@ -36,7 +49,6 @@ const ( // leave received OOB data in line const SO_OOBINLINE = 256 - const ( // allow local address & port reuse SO_REUSEPORT = 512 @@ -74,14 +86,12 @@ const ( // get socket type SO_TYPE = 4104 ) - const ( // deprecated SO_LABEL = 4112 // deprecated SO_PEERLABEL = 4113 ) - const ( // APPLE: get 1st-packet byte count SO_NREAD = 4128 @@ -96,21 +106,18 @@ const ( // APPLE: Allow reuse of port/socket by different userids SO_REUSESHAREUID = 4133 ) - const ( // APPLE: send notification if there is a bind on a port which is already in use SO_NOTIFYCONFLICT = 4134 // APPLE: block on close until an upcall returns SO_UPCALLCLOSEWAIT = 4135 ) - const ( // APPLE: request local port randomization SO_RANDOMPORT = 4226 // To turn off some POSIX behavior SO_NP_EXTENSIONS = 4227 ) - const ( // number of datagrams in receive socket buffer SO_NUMRCVPKT = 4370 @@ -123,7 +130,6 @@ const SO_NETSVC_MARKING_LEVEL = 4377 // A signed data blob from the system resolver const SO_RESOLVER_SIGNATURE = 4401 - const ( // Best effort NET_SERVICE_TYPE_BE = 0 @@ -156,9 +162,7 @@ const ( // to background Network Service Types NETSVC_MRKNG_LVL_L3L2_BK = 3 ) - const SAE_ASSOCID_ANY = 0 - const SAE_CONNID_ANY = 0 // connectx() flag parameters @@ -188,7 +192,6 @@ const AF_LOCAL = 1 // internetwork: UDP, TCP, etc. const AF_INET = 2 - const ( // arpanet imp addresses AF_IMPLINK = 3 @@ -249,7 +252,6 @@ const ( // IPv6 const AF_INET6 = 30 - const ( // native ATM access AF_NATM = 31 @@ -263,7 +265,6 @@ const ( // in interface output routine Pseudo_AF_HDRCMPLT = 35 ) - const ( // Reserved for internal usage AF_RESERVED_36 = 36 @@ -328,7 +329,6 @@ const ( PF_VSOCK = 40 PF_MAX = 41 ) - const NET_MAXID = 41 // PF_ROUTE - Routing table @@ -363,7 +363,6 @@ const ( // Maximum queue length specifiable by listen. const SOMAXCONN = 128 - const ( // process out-of-band data MSG_OOB = 1 @@ -380,7 +379,6 @@ const ( // wait for full request or error MSG_WAITALL = 64 ) - const ( // this message should be nonblocking MSG_DONTWAIT = 128 @@ -390,7 +388,6 @@ const ( // wait up to full request.. may return partial const MSG_WAITSTREAM = 512 - const ( // Start of 'hold' seq; dump so_temp, deprecated MSG_FLUSH = 1024 @@ -412,7 +409,6 @@ const MSG_NOSIGNAL = 524288 // "Socket"-level control message types: const SCM_RIGHTS = 1 - const ( // timestamp (struct timeval) SCM_TIMESTAMP = 2 @@ -454,8 +450,8 @@ type SoNpExtensions struct { // [XSI] Structure used by kernel to store most addresses. type SockAddr struct { - Len X__Uint8T - Family SaFamilyT + Len uint8 + Family uint8 Data [14]c.Char } @@ -476,11 +472,11 @@ type Sockproto struct { // [XSI] sockaddr_storage type SockaddrStorage struct { - Len X__Uint8T - Family SaFamilyT - pad1 [6]c.Char - align X__Int64T - pad2 [112]c.Char + Len uint8 + Family uint8 + X__SsPad1 [6]c.Char + X__SsAlign X__Int64T + X__SsPad2 [112]c.Char } // [XSI] Message header for recvmsg and sendmsg calls. @@ -488,7 +484,7 @@ type SockaddrStorage struct { type Msghdr struct { MsgName unsafe.Pointer MsgNamelen SocklenT - MsgIov *Iovec + MsgIov *c.Iovec MsgIovlen c.Int MsgControl unsafe.Pointer MsgControllen SocklenT @@ -507,14 +503,12 @@ type Cmsghdr struct { // sendfile(2) header/trailer struct type SfHdtr struct { - Headers *Iovec + Headers *c.Iovec HdrCnt c.Int - Trailers *Iovec + Trailers *c.Iovec TrlCnt c.Int } - type SaeAssocidT = X__Uint32T - type SaeConnidT = X__Uint32T // sockaddr endpoints @@ -530,16 +524,16 @@ func Getsockname(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 func Getsockopt(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 unsafe.Pointer, _llcppg_param5 *SocklenT) c.Int //go:linkname Recvfrom C.recvfrom -func Recvfrom(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int, _llcppg_param5 *SockAddr, _llcppg_param6 *SocklenT) SsizeT +func Recvfrom(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.SizeT, _llcppg_param4 c.Int, _llcppg_param5 *SockAddr, _llcppg_param6 *SocklenT) c.SsizeT //go:linkname Recvmsg C.recvmsg -func Recvmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) SsizeT +func Recvmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) c.SsizeT //go:linkname Sendmsg C.sendmsg -func Sendmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) SsizeT +func Sendmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) c.SsizeT //go:linkname Sendto C.sendto -func Sendto(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int, _llcppg_param5 *SockAddr, _llcppg_param6 SocklenT) SsizeT +func Sendto(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.SizeT, _llcppg_param4 c.Int, _llcppg_param5 *SockAddr, _llcppg_param6 SocklenT) c.SsizeT //go:linkname Shutdown C.shutdown func Shutdown(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int @@ -550,11 +544,11 @@ func Sockatmark(_llcppg_param1 c.Int) c.Int //go:linkname Socketpair C.socketpair func Socketpair(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) c.Int -//go:linkname Sendfile C.sendfile -func Sendfile(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 OffT, _llcppg_param4 *OffT, _llcppg_param5 *SfHdtr, _llcppg_param6 c.Int) c.Int +//go:linkname Pfctlinput C.pfctlinput +func Pfctlinput(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr) //go:linkname Connectx C.connectx -func Connectx(_llcppg_param1 c.Int, _llcppg_param2 *SaEndpointsT, _llcppg_param3 SaeAssocidT, _llcppg_param4 c.Uint, _llcppg_param5 *Iovec, _llcppg_param6 c.Uint, _llcppg_param7 *SizeT, _llcppg_param8 *SaeConnidT) c.Int +func Connectx(_llcppg_param1 c.Int, _llcppg_param2 *SaEndpointsT, _llcppg_param3 SaeAssocidT, _llcppg_param4 c.Uint, _llcppg_param5 *Iovec, _llcppg_param6 c.Uint, _llcppg_param7 *c.SizeT, _llcppg_param8 *SaeConnidT) c.Int //go:linkname Disconnectx C.disconnectx func Disconnectx(_llcppg_param1 c.Int, _llcppg_param2 SaeAssocidT, _llcppg_param3 SaeConnidT) c.Int diff --git a/c/net/sys-socket_linux_amd64.go b/c/net/sys-socket_linux_amd64.go index 91bd97a5..581baed0 100644 --- a/c/net/sys-socket_linux_amd64.go +++ b/c/net/sys-socket_linux_amd64.go @@ -1,7 +1,6 @@ //go:build linux && amd64 && !android // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net @@ -12,6 +11,13 @@ import ( const X_SYS_SOCKET_H = 1 +// This is the 4.3 BSD `struct sockaddr' format, which is used as wire +// format in the grotty old 4.3 `talk' protocol. +type Osockaddr struct { + SaFamily uint16 + SaData [14]uint8 +} + // The following constants should be used for the second parameter of // `shutdown'. const ( @@ -47,10 +53,10 @@ func Getpeername(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int // __THROW. // //go:linkname Sendto C.sendto -func Sendto(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int, __addr *SockAddr, __addr_len SocklenT) SsizeT +func Sendto(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __flags c.Int, __addr *SockAddr, __addr_len SocklenT) c.SsizeT // Read N bytes into BUF through socket FD. -// If ADDR is not NULL, fill in *ADDR_LEN bytes of it with the address of +// If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of // the sender, and store the actual size of the address in *ADDR_LEN. // Returns the number of bytes read or -1 for errors. // @@ -58,14 +64,30 @@ func Sendto(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int, __addr * // __THROW. // //go:linkname Recvfrom C.recvfrom -func Recvfrom(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int, __addr *SockAddr, __addr_len *SocklenT) SsizeT +func Recvfrom(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __flags c.Int, __addr *SockAddr, __addr_len *SocklenT) c.SsizeT +// Send a message described MESSAGE on socket FD. +// Returns the number of bytes sent, or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// //go:linkname Sendmsg C.sendmsg -func Sendmsg(__fd c.Int, __message *Msghdr, __flags c.Int) SsizeT +func Sendmsg(__fd c.Int, __message *Msghdr, __flags c.Int) c.SsizeT +// Receive a message as described by MESSAGE from socket FD. +// Returns the number of bytes read or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// //go:linkname Recvmsg C.recvmsg -func Recvmsg(__fd c.Int, __message *Msghdr, __flags c.Int) SsizeT +func Recvmsg(__fd c.Int, __message *Msghdr, __flags c.Int) c.SsizeT +// Put the current value for socket FD's option OPTNAME at protocol level LEVEL +// into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's +// actual length. Returns 0 on success, -1 for errors. +// //go:linkname Getsockopt C.getsockopt func Getsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen *SocklenT) c.Int @@ -79,7 +101,7 @@ func Getsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Poin //go:linkname Shutdown C.shutdown func Shutdown(__fd c.Int, __how c.Int) c.Int -// Determine whether socket is at a out-of-band mark. +// Determine wheter socket is at a out-of-band mark. // //go:linkname Sockatmark C.sockatmark func Sockatmark(__fd c.Int) c.Int diff --git a/c/net/sys-socket_linux_arm64.go b/c/net/sys-socket_linux_arm64.go new file mode 100644 index 00000000..350830f8 --- /dev/null +++ b/c/net/sys-socket_linux_arm64.go @@ -0,0 +1,114 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_SYS_SOCKET_H = 1 + +// This is the 4.3 BSD `struct sockaddr' format, which is used as wire +// format in the grotty old 4.3 `talk' protocol. +type Osockaddr struct { + SaFamily uint16 + SaData [14]uint8 +} + +// The following constants should be used for the second parameter of +// `shutdown'. +const ( + SHUT_RD = 0 + SHUT_WR = 1 + // No more receptions or transmissions. + SHUT_RDWR = 2 +) + +// Create two new sockets, of type TYPE in domain DOMAIN and using +// protocol PROTOCOL, which are connected to each other, and put file +// descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero, +// one will be chosen automatically. Returns 0 on success, -1 for errors. +// +//go:linkname Socketpair C.socketpair +func Socketpair(__domain c.Int, __type c.Int, __protocol c.Int, __fds *c.Int) c.Int + +// Put the local address of FD into *ADDR and its length in *LEN. +// +//go:linkname Getsockname C.getsockname +func Getsockname(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int + +// Put the address of the peer connected to socket FD into *ADDR +// (which is *LEN bytes long), and its actual length into *LEN. +// +//go:linkname Getpeername C.getpeername +func Getpeername(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int + +// Send N bytes of BUF on socket FD to peer at address ADDR (which is +// ADDR_LEN bytes long). Returns the number sent, or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Sendto C.sendto +func Sendto(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __flags c.Int, __addr *SockAddr, __addr_len SocklenT) c.SsizeT + +// Read N bytes into BUF through socket FD. +// If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of +// the sender, and store the actual size of the address in *ADDR_LEN. +// Returns the number of bytes read or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Recvfrom C.recvfrom +func Recvfrom(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __flags c.Int, __addr *SockAddr, __addr_len *SocklenT) c.SsizeT + +// Send a message described MESSAGE on socket FD. +// Returns the number of bytes sent, or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Sendmsg C.sendmsg +func Sendmsg(__fd c.Int, __message *Msghdr, __flags c.Int) c.SsizeT + +// Receive a message as described by MESSAGE from socket FD. +// Returns the number of bytes read or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Recvmsg C.recvmsg +func Recvmsg(__fd c.Int, __message *Msghdr, __flags c.Int) c.SsizeT + +// Put the current value for socket FD's option OPTNAME at protocol level LEVEL +// into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's +// actual length. Returns 0 on success, -1 for errors. +// +//go:linkname Getsockopt C.getsockopt +func Getsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen *SocklenT) c.Int + +// Shut down all or part of the connection open on socket FD. +// HOW determines what to shut down: +// SHUT_RD = No more receptions; +// SHUT_WR = No more transmissions; +// SHUT_RDWR = No more receptions or transmissions. +// Returns 0 on success, -1 for errors. +// +//go:linkname Shutdown C.shutdown +func Shutdown(__fd c.Int, __how c.Int) c.Int + +// Determine wheter socket is at a out-of-band mark. +// +//go:linkname Sockatmark C.sockatmark +func Sockatmark(__fd c.Int) c.Int + +// FDTYPE is S_IFSOCK or another S_IF* macro defined in ; +// returns 1 if FD is open on an object of the indicated type, 0 if not, +// or -1 for errors (setting errno). +// +//go:linkname Isfdtype C.isfdtype +func Isfdtype(__fd c.Int, __fdtype c.Int) c.Int diff --git a/c/net/sys-un_darwin_arm64.go b/c/net/sys-un_darwin_arm64.go index c8f39e3c..867fda33 100644 --- a/c/net/sys-un_darwin_arm64.go +++ b/c/net/sys-un_darwin_arm64.go @@ -1,13 +1,10 @@ //go:build darwin && arm64 && !ios // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net -import ( - "github.com/goplus/lib/c" -) +import "github.com/goplus/lib/c" // Level number of get/setsockopt for local domain sockets const SOL_LOCAL = 0 diff --git a/c/net/sys-un_linux_amd64.go b/c/net/sys-un_linux_amd64.go index f36af8c9..1c3b0ab1 100644 --- a/c/net/sys-un_linux_amd64.go +++ b/c/net/sys-un_linux_amd64.go @@ -1,13 +1,10 @@ //go:build linux && amd64 && !android // Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. package net -import ( - "github.com/goplus/lib/c" -) +import "github.com/goplus/lib/c" const X_SYS_UN_H = 1 diff --git a/c/net/sys-un_linux_arm64.go b/c/net/sys-un_linux_arm64.go new file mode 100644 index 00000000..7f6d4adb --- /dev/null +++ b/c/net/sys-un_linux_arm64.go @@ -0,0 +1,13 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package net + +const X_SYS_UN_H = 1 + +// Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. +type SockaddrUn struct { + SunFamily SaFamilyT + SunPath [108]uint8 +} diff --git a/c/net/types_darwin_arm64.go b/c/net/types_darwin_arm64.go deleted file mode 100644 index 925f617c..00000000 --- a/c/net/types_darwin_arm64.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. - -package net - -import ( - "github.com/goplus/lib/c" -) - -type X__Uint8T = uint8 - -type X__Uint16T = uint16 - -type X__Int32T = c.Int - -type X__Uint32T = c.Uint - -type X__Int64T = c.LongLong - -// sizeof() -type X__DarwinSizeT = c.Ulong - -// socklen_t (duh) -type X__DarwinSocklenT = X__Uint32T - -// byte count or error -type X__DarwinSsizeT = c.Long - -type CaddrT = *c.Char - -// base type for internet address -type InAddrT = X__Uint32T - -type InPortT = X__Uint16T - -type Int32T = c.Int - -type Iovec = c.Iovec - -type OffT = X__DarwinOffT - -type SaFamilyT = X__Uint8T - -type SizeT = X__DarwinSizeT - -type SocklenT = X__DarwinSocklenT - -type SsizeT = X__DarwinSsizeT - -type Timeval32 struct { - TvSec X__Int32T - TvUsec X__Int32T -} - -type UChar = uint8 - -type UInt32T = c.Uint - -type UShort = uint16 - -// [???] Used for file sizes -type X__DarwinOffT = X__Int64T - -type Uint32T = c.Uint diff --git a/c/net/types_linux_amd64.go b/c/net/types_linux_amd64.go deleted file mode 100644 index 2adb1d68..00000000 --- a/c/net/types_linux_amd64.go +++ /dev/null @@ -1,33 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. -// Extracted from the libc binding; existing c/net names are retained. - -package net - -import ( - "github.com/goplus/lib/c" -) - -type Uint16T = X__Uint16T - -type Uint32T = X__Uint32T - -// Structure for scatter/gather I/O. -type Iovec = c.Iovec - -type X__Uint16T = uint16 - -type X__Uint32T = c.Uint - -// Type of a byte count, or error. -type X__SsizeT = c.Long - -type X__CaddrT = *c.Char - -// Duplicate info from sys/socket.h. -type X__SocklenT = c.Uint - -type SizeT = c.Ulong - -type SsizeT = X__SsizeT From f271e18fdc06fa6bea8c76f1492e27c05d421adf Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Mon, 19 Oct 2026 19:56:46 +0800 Subject: [PATCH 3/8] Classify unified libc output and skip unsupported layouts --- c/net/README.md | 6 +- c/net/arm-_types_darwin_arm64.go | 64 - c/net/arpa-inet_darwin_arm64.go | 58 - c/net/arpa-inet_linux_amd64.go | 92 - c/net/arpa-inet_linux_arm64.go | 92 - c/net/asm-generic-socket_linux_amd64.go | 82 - c/net/asm-generic-socket_linux_arm64.go | 82 - c/net/asm-generic-sockios_linux_amd64.go | 18 - c/net/asm-generic-sockios_linux_arm64.go | 18 - c/net/bits-in_linux_amd64.go | 252 -- c/net/bits-in_linux_arm64.go | 252 -- c/net/bits-netdb_linux_amd64.go | 17 - c/net/bits-netdb_linux_arm64.go | 17 - c/net/bits-sockaddr_linux_amd64.go | 13 - c/net/bits-sockaddr_linux_arm64.go | 13 - c/net/bits-socket_linux_amd64.go | 259 -- c/net/bits-socket_linux_arm64.go | 259 -- c/net/bits-socket_type_linux_amd64.go | 24 - c/net/bits-socket_type_linux_arm64.go | 24 - c/net/bits-types_linux_amd64.go | 133 - c/net/bits-types_linux_arm64.go | 133 - c/net/libc_darwin_arm64.go | 2269 +++++++++++++++++ c/net/libc_linux_amd64.go | 1803 +++++++++++++ c/net/libc_linux_arm64.go | 1803 +++++++++++++ c/net/llcppg.i_darwin_arm64.go | 8 - c/net/llcppg.i_linux_amd64.go | 8 - c/net/llcppg.i_linux_arm64.go | 8 - c/net/llcppg.pub | 90 - c/net/llcppg_darwin_arm64.go | 17 - c/net/llcppg_linux_amd64.go | 17 - c/net/llcppg_linux_arm64.go | 17 - c/net/net-if_darwin_arm64.go | 341 --- c/net/net-if_linux_amd64.go | 149 -- c/net/net-if_linux_arm64.go | 149 -- c/net/net-if_var_darwin_arm64.go | 122 - c/net/net-net_kev_darwin_arm64.go | 92 - c/net/netdb_darwin_arm64.go | 287 --- c/net/netdb_linux_amd64.go | 605 ----- c/net/netdb_linux_arm64.go | 605 ----- c/net/netinet-in_darwin_arm64.go | 637 ----- c/net/netinet-in_linux_amd64.go | 218 -- c/net/netinet-in_linux_arm64.go | 218 -- c/net/netinet6-in6_darwin_arm64.go | 405 --- c/net/rpc-netdb_linux_amd64.go | 44 - c/net/rpc-netdb_linux_arm64.go | 44 - c/net/sys-_types-_caddr_t_darwin_arm64.go | 9 - c/net/sys-_types-_in_addr_t_darwin_arm64.go | 8 - c/net/sys-_types-_in_port_t_darwin_arm64.go | 7 - c/net/sys-_types-_sa_family_t_darwin_arm64.go | 7 - c/net/sys-_types-_socklen_t_darwin_arm64.go | 7 - c/net/sys-_types-_timeval32_darwin_arm64.go | 10 - c/net/sys-_types-_u_char_darwin_arm64.go | 7 - c/net/sys-_types-_u_int32_t_darwin_arm64.go | 9 - c/net/sys-_types-_u_int64_t_darwin_arm64.go | 9 - c/net/sys-_types-_u_short_darwin_arm64.go | 7 - c/net/sys-_types_darwin_arm64.go | 63 - c/net/sys-socket_darwin_arm64.go | 554 ---- c/net/sys-socket_linux_amd64.go | 114 - c/net/sys-socket_linux_arm64.go | 114 - c/net/sys-un_darwin_arm64.go | 32 - c/net/sys-un_linux_amd64.go | 15 - c/net/sys-un_linux_arm64.go | 13 - 62 files changed, 5878 insertions(+), 6971 deletions(-) delete mode 100644 c/net/arm-_types_darwin_arm64.go delete mode 100644 c/net/arpa-inet_darwin_arm64.go delete mode 100644 c/net/arpa-inet_linux_amd64.go delete mode 100644 c/net/arpa-inet_linux_arm64.go delete mode 100644 c/net/asm-generic-socket_linux_amd64.go delete mode 100644 c/net/asm-generic-socket_linux_arm64.go delete mode 100644 c/net/asm-generic-sockios_linux_amd64.go delete mode 100644 c/net/asm-generic-sockios_linux_arm64.go delete mode 100644 c/net/bits-in_linux_amd64.go delete mode 100644 c/net/bits-in_linux_arm64.go delete mode 100644 c/net/bits-netdb_linux_amd64.go delete mode 100644 c/net/bits-netdb_linux_arm64.go delete mode 100644 c/net/bits-sockaddr_linux_amd64.go delete mode 100644 c/net/bits-sockaddr_linux_arm64.go delete mode 100644 c/net/bits-socket_linux_amd64.go delete mode 100644 c/net/bits-socket_linux_arm64.go delete mode 100644 c/net/bits-socket_type_linux_amd64.go delete mode 100644 c/net/bits-socket_type_linux_arm64.go delete mode 100644 c/net/bits-types_linux_amd64.go delete mode 100644 c/net/bits-types_linux_arm64.go create mode 100644 c/net/libc_darwin_arm64.go create mode 100644 c/net/libc_linux_amd64.go create mode 100644 c/net/libc_linux_arm64.go delete mode 100644 c/net/llcppg.i_darwin_arm64.go delete mode 100644 c/net/llcppg.i_linux_amd64.go delete mode 100644 c/net/llcppg.i_linux_arm64.go delete mode 100644 c/net/llcppg_darwin_arm64.go delete mode 100644 c/net/llcppg_linux_amd64.go delete mode 100644 c/net/llcppg_linux_arm64.go delete mode 100644 c/net/net-if_darwin_arm64.go delete mode 100644 c/net/net-if_linux_amd64.go delete mode 100644 c/net/net-if_linux_arm64.go delete mode 100644 c/net/net-if_var_darwin_arm64.go delete mode 100644 c/net/net-net_kev_darwin_arm64.go delete mode 100644 c/net/netdb_darwin_arm64.go delete mode 100644 c/net/netdb_linux_amd64.go delete mode 100644 c/net/netdb_linux_arm64.go delete mode 100644 c/net/netinet-in_darwin_arm64.go delete mode 100644 c/net/netinet-in_linux_amd64.go delete mode 100644 c/net/netinet-in_linux_arm64.go delete mode 100644 c/net/netinet6-in6_darwin_arm64.go delete mode 100644 c/net/rpc-netdb_linux_amd64.go delete mode 100644 c/net/rpc-netdb_linux_arm64.go delete mode 100644 c/net/sys-_types-_caddr_t_darwin_arm64.go delete mode 100644 c/net/sys-_types-_in_addr_t_darwin_arm64.go delete mode 100644 c/net/sys-_types-_in_port_t_darwin_arm64.go delete mode 100644 c/net/sys-_types-_sa_family_t_darwin_arm64.go delete mode 100644 c/net/sys-_types-_socklen_t_darwin_arm64.go delete mode 100644 c/net/sys-_types-_timeval32_darwin_arm64.go delete mode 100644 c/net/sys-_types-_u_char_darwin_arm64.go delete mode 100644 c/net/sys-_types-_u_int32_t_darwin_arm64.go delete mode 100644 c/net/sys-_types-_u_int64_t_darwin_arm64.go delete mode 100644 c/net/sys-_types-_u_short_darwin_arm64.go delete mode 100644 c/net/sys-_types_darwin_arm64.go delete mode 100644 c/net/sys-socket_darwin_arm64.go delete mode 100644 c/net/sys-socket_linux_amd64.go delete mode 100644 c/net/sys-socket_linux_arm64.go delete mode 100644 c/net/sys-un_darwin_arm64.go delete mode 100644 c/net/sys-un_linux_amd64.go delete mode 100644 c/net/sys-un_linux_arm64.go diff --git a/c/net/README.md b/c/net/README.md index 22092169..9b3cc9e2 100644 --- a/c/net/README.md +++ b/c/net/README.md @@ -1,6 +1,6 @@ # C networking bindings -This package binds `arpa/inet.h`, `net/if.h`, `netdb.h`, `netinet/in.h`, `sys/socket.h`, and `sys/un.h`, together with the C types those headers require. Each target is generated independently for this directory with unmodified llcppg commit `4724a68a99e7f8872ae0ba41bce2a5938acd7f9c`. +This package binds `arpa/inet.h`, `net/if.h`, `netdb.h`, `netinet/in.h`, `sys/socket.h`, and `sys/un.h`, together with the C types those headers require. Each target is generated as one common libc translation unit, then classified into the existing C packages, with unmodified llcppg commit `4724a68a99e7f8872ae0ba41bce2a5938acd7f9c`. | Target | Header source | Build constraint | | --- | --- | --- | @@ -12,8 +12,8 @@ Linux support assumes glibc. Existing implementations remain selected for other `legacy_native.go` retains the existing Unix function names and signatures, including `Bind`, `Accept`, `GetHostByName`, `SetSockOpt`, and `Freeaddrinfo`, along with the five untyped socket constants. Address types retain the existing field names for corresponding C fields. Linux address families use a 16-bit field without the BSD length byte, and Linux `AddrInfo` places `Addr` before `CanOnName`. `In6Addr.U6Addr` remains a byte array with native IPv6 alignment. `Iovec` aliases the shared `c.Iovec` definition. -`llcppg.cfg` selects macOS arm64; `llcppg-linux_amd64.cfg` and `llcppg-linux_arm64.cfg` record the Linux inputs. `Dir` and `Stdlib` refer to locally prepared headers under ignored `.sysroot` directories. `Deps` contains directories such as `..`. Local generation resolves these directories through the existing `Config.IncludeDir` callback before calling `Config.NewPackage`; the llcppg command itself is unchanged. Generated Go files receive target build constraints. `llcppg.pub` combines the available platform type mappings for dependent bindings. +`llcppg.cfg` and its Linux variants retain local header ownership and dependency metadata for downstream bindings. The current snapshots come from unified generation followed by classification, rather than running these directory configurations independently. `Dir` and `Stdlib` refer to locally prepared headers under ignored `.sysroot` directories. `Deps` contains directories such as `..`; the local caller resolves them through the existing `Config.IncludeDir` callback. Each target is kept in one `libc__.go` file. Generation inputs, scripts, and header caches are kept locally and are not included in these package changes. `llcppg.pub` lists only types retained in the available target outputs. -The input configuration preserves existing handwritten functions and skips unsupported declarations, including the flexible array in Linux `cmsghdr` and the `if_nameindex` name collision. macOS declarations requiring unsupported dependency types are also omitted. This is a selection of common native APIs, rather than a complete libc binding. +The input preserves existing handwritten functions and skips unsupported declarations. `cmsghdr` is excluded on every target. Records requiring packing, explicit alignment, bit fields, flexible arrays, unsupported scalar types, or unresolved callback-field layouts are excluded together with declarations that depend on them. The existing `if_nameindex` name collision is also skipped. This is a selection of common native APIs, rather than a complete libc binding. Validation compares C and Go sizes, alignments, field offsets, and field widths using the original target headers. LLGo runtime checks exercise sockets, address resolution, IPv6 conversion, and interface names in both GC and nogc modes on all three targets. Linux runtime checks ran on newer glibc installations; the generation baseline is glibc 2.24. diff --git a/c/net/arm-_types_darwin_arm64.go b/c/net/arm-_types_darwin_arm64.go deleted file mode 100644 index 0a5f357a..00000000 --- a/c/net/arm-_types_darwin_arm64.go +++ /dev/null @@ -1,64 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -type X__MbstateT struct { - _xgo_union [16]uint64 -} -type X__Int8T = int8 -type X__Uint8T = uint8 -type X__Int16T = int16 -type X__Uint16T = uint16 -type X__Int32T = c.Int -type X__Uint32T = c.Uint -type X__Int64T = c.LongLong -type X__Uint64T = c.UlongLong -type X__DarwinIntptrT = c.Long -type X__DarwinNaturalT = c.Uint - -// ct_rune_t -type X__DarwinCtRuneT = c.Int - -// mbstate_t -type X__DarwinMbstateT = X__MbstateT - -// ptr1 - ptr2 -type X__DarwinPtrdiffT = c.Long - -// sizeof() -type X__DarwinSizeT = c.Ulong - -// wchar_t -type X__DarwinWcharT = c.Int - -// rune_t -type X__DarwinRuneT = X__DarwinWcharT - -// wint_t -type X__DarwinWintT = c.Int - -// clock() -type X__DarwinClockT = c.Ulong - -// socklen_t (duh) -type X__DarwinSocklenT = X__Uint32T - -// byte count or error -type X__DarwinSsizeT = c.Long - -// time() -type X__DarwinTimeT = c.Long - -func (p *X__MbstateT) XGof_ref___mbstate8() *[128]c.Char { - return (*[128]c.Char)(unsafe.Pointer(p)) -} -func (p *X__MbstateT) XGof_ref__mbstateL() *c.LongLong { - return (*c.LongLong)(unsafe.Pointer(p)) -} diff --git a/c/net/arpa-inet_darwin_arm64.go b/c/net/arpa-inet_darwin_arm64.go deleted file mode 100644 index 17375b88..00000000 --- a/c/net/arpa-inet_darwin_arm64.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -// llgo:link InAddr.InetNtoa C.inet_ntoa -func (self InAddr) InetNtoa() *c.Char { - return nil -} - -//go:linkname InetPton C.inet_pton -func InetPton(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 unsafe.Pointer) c.Int - -//go:linkname Ascii2addr C.ascii2addr -func Ascii2addr(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 unsafe.Pointer) c.Int - -//go:linkname Addr2ascii C.addr2ascii -func Addr2ascii(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.Int, _llcppg_param4 *c.Char) *c.Char - -//go:linkname InetAton C.inet_aton -func InetAton(_llcppg_param1 *c.Char, _llcppg_param2 *InAddr) c.Int - -// llgo:link InAddr.InetLnaof C.inet_lnaof -func (self InAddr) InetLnaof() InAddrT { - return 0 -} - -//go:linkname InetMakeaddr C.inet_makeaddr -func InetMakeaddr(_llcppg_param1 InAddrT, _llcppg_param2 InAddrT) InAddr - -// llgo:link InAddr.InetNetof C.inet_netof -func (self InAddr) InetNetof() InAddrT { - return 0 -} - -//go:linkname InetNetwork C.inet_network -func InetNetwork(_llcppg_param1 *c.Char) InAddrT - -//go:linkname InetNetNtop C.inet_net_ntop -func InetNetNtop(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.Int, _llcppg_param4 *c.Char, _llcppg_param5 X__DarwinSizeT) *c.Char - -//go:linkname InetNetPton C.inet_net_pton -func InetNetPton(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 unsafe.Pointer, _llcppg_param4 X__DarwinSizeT) c.Int - -//go:linkname InetNeta C.inet_neta -func InetNeta(_llcppg_param1 InAddrT, _llcppg_param2 *c.Char, _llcppg_param3 X__DarwinSizeT) *c.Char - -//go:linkname InetNsapAddr C.inet_nsap_addr -func InetNsapAddr(_llcppg_param1 *c.Char, _llcppg_param2 *uint8, _llcppg_param3 c.Int) c.Uint - -//go:linkname InetNsapNtoa C.inet_nsap_ntoa -func InetNsapNtoa(_llcppg_param1 c.Int, _llcppg_param2 *uint8, _llcppg_param3 *c.Char) *c.Char diff --git a/c/net/arpa-inet_linux_amd64.go b/c/net/arpa-inet_linux_amd64.go deleted file mode 100644 index fe21eae8..00000000 --- a/c/net/arpa-inet_linux_amd64.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_ARPA_INET_H = 1 - -// Return the local host address part of the Internet address in IN. -// -// llgo:link InAddr.InetLnaof C.inet_lnaof -func (self InAddr) InetLnaof() InAddrT { - return 0 -} - -// Make Internet host address in network byte order by combining the -// network number NET with the local address HOST. -// -//go:linkname InetMakeaddr C.inet_makeaddr -func InetMakeaddr(__net InAddrT, __host InAddrT) InAddr - -// Return network number part of the Internet address IN. -// -// llgo:link InAddr.InetNetof C.inet_netof -func (self InAddr) InetNetof() InAddrT { - return 0 -} - -// Extract the network number in network byte order from the address -// in numbers-and-dots natation starting at CP. -// -//go:linkname InetNetwork C.inet_network -func InetNetwork(__cp *c.Char) InAddrT - -// Convert Internet number in IN to ASCII representation. The return value -// is a pointer to an internal array containing the string. -// -// llgo:link InAddr.InetNtoa C.inet_ntoa -func (self InAddr) InetNtoa() *c.Char { - return nil -} - -// Convert from presentation format of an Internet number in buffer -// starting at CP to the binary network format and store result for -// interface type AF in buffer starting at BUF. -// -//go:linkname InetPton C.inet_pton -func InetPton(__af c.Int, __cp *c.Char, __buf unsafe.Pointer) c.Int - -// Convert Internet host address from numbers-and-dots notation in CP -// into binary data and store the result in the structure INP. -// -//go:linkname InetAton C.inet_aton -func InetAton(__cp *c.Char, __inp *InAddr) c.Int - -// Format a network number NET into presentation format and place result -// in buffer starting at BUF with length of LEN bytes. -// -//go:linkname InetNeta C.inet_neta -func InetNeta(__net InAddrT, __buf *c.Char, __len c.SizeT) *c.Char - -// Convert network number for interface type AF in buffer starting at -// CP to presentation format. The result will specifiy BITS bits of -// the number. -// -//go:linkname InetNetNtop C.inet_net_ntop -func InetNetNtop(__af c.Int, __cp unsafe.Pointer, __bits c.Int, __buf *c.Char, __len c.SizeT) *c.Char - -// Convert network number for interface type AF from presentation in -// buffer starting at CP to network format and store result int -// buffer starting at BUF of size LEN. -// -//go:linkname InetNetPton C.inet_net_pton -func InetNetPton(__af c.Int, __cp *c.Char, __buf unsafe.Pointer, __len c.SizeT) c.Int - -// Convert ASCII representation in hexadecimal form of the Internet -// address to binary form and place result in buffer of length LEN -// starting at BUF. -// -//go:linkname InetNsapAddr C.inet_nsap_addr -func InetNsapAddr(__cp *c.Char, __buf *uint8, __len c.Int) c.Uint - -// Convert internet address in binary form in LEN bytes starting at CP -// a presentation form and place result in BUF. -// -//go:linkname InetNsapNtoa C.inet_nsap_ntoa -func InetNsapNtoa(__len c.Int, __cp *uint8, __buf *c.Char) *c.Char diff --git a/c/net/arpa-inet_linux_arm64.go b/c/net/arpa-inet_linux_arm64.go deleted file mode 100644 index 7594b46e..00000000 --- a/c/net/arpa-inet_linux_arm64.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_ARPA_INET_H = 1 - -// Return the local host address part of the Internet address in IN. -// -// llgo:link InAddr.InetLnaof C.inet_lnaof -func (self InAddr) InetLnaof() InAddrT { - return 0 -} - -// Make Internet host address in network byte order by combining the -// network number NET with the local address HOST. -// -//go:linkname InetMakeaddr C.inet_makeaddr -func InetMakeaddr(__net InAddrT, __host InAddrT) InAddr - -// Return network number part of the Internet address IN. -// -// llgo:link InAddr.InetNetof C.inet_netof -func (self InAddr) InetNetof() InAddrT { - return 0 -} - -// Extract the network number in network byte order from the address -// in numbers-and-dots natation starting at CP. -// -//go:linkname InetNetwork C.inet_network -func InetNetwork(__cp *uint8) InAddrT - -// Convert Internet number in IN to ASCII representation. The return value -// is a pointer to an internal array containing the string. -// -// llgo:link InAddr.InetNtoa C.inet_ntoa -func (self InAddr) InetNtoa() *uint8 { - return nil -} - -// Convert from presentation format of an Internet number in buffer -// starting at CP to the binary network format and store result for -// interface type AF in buffer starting at BUF. -// -//go:linkname InetPton C.inet_pton -func InetPton(__af c.Int, __cp *uint8, __buf unsafe.Pointer) c.Int - -// Convert Internet host address from numbers-and-dots notation in CP -// into binary data and store the result in the structure INP. -// -//go:linkname InetAton C.inet_aton -func InetAton(__cp *uint8, __inp *InAddr) c.Int - -// Format a network number NET into presentation format and place result -// in buffer starting at BUF with length of LEN bytes. -// -//go:linkname InetNeta C.inet_neta -func InetNeta(__net InAddrT, __buf *uint8, __len c.SizeT) *uint8 - -// Convert network number for interface type AF in buffer starting at -// CP to presentation format. The result will specifiy BITS bits of -// the number. -// -//go:linkname InetNetNtop C.inet_net_ntop -func InetNetNtop(__af c.Int, __cp unsafe.Pointer, __bits c.Int, __buf *uint8, __len c.SizeT) *uint8 - -// Convert network number for interface type AF from presentation in -// buffer starting at CP to network format and store result int -// buffer starting at BUF of size LEN. -// -//go:linkname InetNetPton C.inet_net_pton -func InetNetPton(__af c.Int, __cp *uint8, __buf unsafe.Pointer, __len c.SizeT) c.Int - -// Convert ASCII representation in hexadecimal form of the Internet -// address to binary form and place result in buffer of length LEN -// starting at BUF. -// -//go:linkname InetNsapAddr C.inet_nsap_addr -func InetNsapAddr(__cp *uint8, __buf *uint8, __len c.Int) c.Uint - -// Convert internet address in binary form in LEN bytes starting at CP -// a presentation form and place result in BUF. -// -//go:linkname InetNsapNtoa C.inet_nsap_ntoa -func InetNsapNtoa(__len c.Int, __cp *uint8, __buf *uint8) *uint8 diff --git a/c/net/asm-generic-socket_linux_amd64.go b/c/net/asm-generic-socket_linux_amd64.go deleted file mode 100644 index ad78eb32..00000000 --- a/c/net/asm-generic-socket_linux_amd64.go +++ /dev/null @@ -1,82 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -// For setsockopt(2) -const SOL_SOCKET = 1 -const ( - SO_DEBUG = 1 - SO_REUSEADDR = 2 - SO_TYPE = 3 - SO_ERROR = 4 - SO_DONTROUTE = 5 - SO_BROADCAST = 6 - SO_SNDBUF = 7 - SO_RCVBUF = 8 - SO_SNDBUFFORCE = 32 - SO_RCVBUFFORCE = 33 - SO_KEEPALIVE = 9 - SO_OOBINLINE = 10 - SO_NO_CHECK = 11 - SO_PRIORITY = 12 - SO_LINGER = 13 - SO_BSDCOMPAT = 14 - SO_REUSEPORT = 15 -) -const ( - SO_PASSCRED = 16 - SO_PEERCRED = 17 - SO_RCVLOWAT = 18 - SO_SNDLOWAT = 19 - SO_RCVTIMEO = 20 - SO_SNDTIMEO = 21 -) - -// Security levels - as per NRL IPv6 - don't actually do anything -const ( - SO_SECURITY_AUTHENTICATION = 22 - SO_SECURITY_ENCRYPTION_TRANSPORT = 23 - SO_SECURITY_ENCRYPTION_NETWORK = 24 -) -const SO_BINDTODEVICE = 25 - -// Socket filtering -const ( - SO_ATTACH_FILTER = 26 - SO_DETACH_FILTER = 27 - SO_GET_FILTER = 26 -) -const ( - SO_PEERNAME = 28 - SO_TIMESTAMP = 29 - SCM_TIMESTAMP = 29 -) -const SO_ACCEPTCONN = 30 -const ( - SO_PEERSEC = 31 - SO_PASSSEC = 34 - SO_TIMESTAMPNS = 35 - SCM_TIMESTAMPNS = 35 -) -const SO_MARK = 36 -const ( - SO_TIMESTAMPING = 37 - SCM_TIMESTAMPING = 37 -) -const ( - SO_PROTOCOL = 38 - SO_DOMAIN = 39 -) -const SO_RXQ_OVFL = 40 -const ( - SO_WIFI_STATUS = 41 - SCM_WIFI_STATUS = 41 - SO_PEEK_OFF = 42 -) - -// Instruct lower device to use last 4-bytes of skb data as FCS -const SO_NOFCS = 43 -const SO_LOCK_FILTER = 44 -const SO_SELECT_ERR_QUEUE = 45 diff --git a/c/net/asm-generic-socket_linux_arm64.go b/c/net/asm-generic-socket_linux_arm64.go deleted file mode 100644 index 2f204f10..00000000 --- a/c/net/asm-generic-socket_linux_arm64.go +++ /dev/null @@ -1,82 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -// For setsockopt(2) -const SOL_SOCKET = 1 -const ( - SO_DEBUG = 1 - SO_REUSEADDR = 2 - SO_TYPE = 3 - SO_ERROR = 4 - SO_DONTROUTE = 5 - SO_BROADCAST = 6 - SO_SNDBUF = 7 - SO_RCVBUF = 8 - SO_SNDBUFFORCE = 32 - SO_RCVBUFFORCE = 33 - SO_KEEPALIVE = 9 - SO_OOBINLINE = 10 - SO_NO_CHECK = 11 - SO_PRIORITY = 12 - SO_LINGER = 13 - SO_BSDCOMPAT = 14 - SO_REUSEPORT = 15 -) -const ( - SO_PASSCRED = 16 - SO_PEERCRED = 17 - SO_RCVLOWAT = 18 - SO_SNDLOWAT = 19 - SO_RCVTIMEO = 20 - SO_SNDTIMEO = 21 -) - -// Security levels - as per NRL IPv6 - don't actually do anything -const ( - SO_SECURITY_AUTHENTICATION = 22 - SO_SECURITY_ENCRYPTION_TRANSPORT = 23 - SO_SECURITY_ENCRYPTION_NETWORK = 24 -) -const SO_BINDTODEVICE = 25 - -// Socket filtering -const ( - SO_ATTACH_FILTER = 26 - SO_DETACH_FILTER = 27 - SO_GET_FILTER = 26 -) -const ( - SO_PEERNAME = 28 - SO_TIMESTAMP = 29 - SCM_TIMESTAMP = 29 -) -const SO_ACCEPTCONN = 30 -const ( - SO_PEERSEC = 31 - SO_PASSSEC = 34 - SO_TIMESTAMPNS = 35 - SCM_TIMESTAMPNS = 35 -) -const SO_MARK = 36 -const ( - SO_TIMESTAMPING = 37 - SCM_TIMESTAMPING = 37 -) -const ( - SO_PROTOCOL = 38 - SO_DOMAIN = 39 -) -const SO_RXQ_OVFL = 40 -const ( - SO_WIFI_STATUS = 41 - SCM_WIFI_STATUS = 41 - SO_PEEK_OFF = 42 -) - -// Instruct lower device to use last 4-bytes of skb data as FCS -const SO_NOFCS = 43 -const SO_LOCK_FILTER = 44 -const SO_SELECT_ERR_QUEUE = 45 diff --git a/c/net/asm-generic-sockios_linux_amd64.go b/c/net/asm-generic-sockios_linux_amd64.go deleted file mode 100644 index ff37efa5..00000000 --- a/c/net/asm-generic-sockios_linux_amd64.go +++ /dev/null @@ -1,18 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -// Socket-level I/O control calls. -const ( - FIOSETOWN = 35073 - SIOCSPGRP = 35074 - FIOGETOWN = 35075 - SIOCGPGRP = 35076 - SIOCATMARK = 35077 - // Get stamp (timeval) - SIOCGSTAMP = 35078 - // Get stamp (timespec) - SIOCGSTAMPNS = 35079 -) diff --git a/c/net/asm-generic-sockios_linux_arm64.go b/c/net/asm-generic-sockios_linux_arm64.go deleted file mode 100644 index f175e5d9..00000000 --- a/c/net/asm-generic-sockios_linux_arm64.go +++ /dev/null @@ -1,18 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -// Socket-level I/O control calls. -const ( - FIOSETOWN = 35073 - SIOCSPGRP = 35074 - FIOGETOWN = 35075 - SIOCGPGRP = 35076 - SIOCATMARK = 35077 - // Get stamp (timeval) - SIOCGSTAMP = 35078 - // Get stamp (timespec) - SIOCGSTAMPNS = 35079 -) diff --git a/c/net/bits-in_linux_amd64.go b/c/net/bits-in_linux_amd64.go deleted file mode 100644 index 75728be4..00000000 --- a/c/net/bits-in_linux_amd64.go +++ /dev/null @@ -1,252 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -const X__USE_KERNEL_IPV6_DEFS = 0 - -// Options for use with `getsockopt' and `setsockopt' at the IP level. -// The first word in the comment at the right is the data type used; -// "bool" means a boolean value stored in an `int'. -const ( - IP_OPTIONS = 4 - // int; Header is included with data. - IP_HDRINCL = 3 - // int; IP type of service and precedence. - IP_TOS = 1 - // int; IP time to live. - IP_TTL = 2 - // bool; Receive all IP options w/datagram. - IP_RECVOPTS = 6 -) - -// For BSD compatibility. -const ( - // ip_opts; Set/get IP per-packet options. - IP_RETOPTS = 7 - // in_addr; set/get IP multicast i/f - IP_MULTICAST_IF = 32 - // u_char; set/get IP multicast ttl - IP_MULTICAST_TTL = 33 - // i_char; set/get IP multicast loopback - IP_MULTICAST_LOOP = 34 - // ip_mreq; add an IP group membership - IP_ADD_MEMBERSHIP = 35 - // ip_mreq; drop an IP group membership - IP_DROP_MEMBERSHIP = 36 - // ip_mreq_source: unblock data from source - IP_UNBLOCK_SOURCE = 37 - // ip_mreq_source: block data from source - IP_BLOCK_SOURCE = 38 - // ip_mreq_source: join source group - IP_ADD_SOURCE_MEMBERSHIP = 39 - // ip_mreq_source: leave source group - IP_DROP_SOURCE_MEMBERSHIP = 40 - IP_MSFILTER = 41 -) -const ( - // group_req: join any-source group - MCAST_JOIN_GROUP = 42 - // group_source_req: block from given group - MCAST_BLOCK_SOURCE = 43 - // group_source_req: unblock from given group - MCAST_UNBLOCK_SOURCE = 44 - // group_req: leave any-source group - MCAST_LEAVE_GROUP = 45 - // group_source_req: join source-spec gr - MCAST_JOIN_SOURCE_GROUP = 46 - // group_source_req: leave source-spec gr - MCAST_LEAVE_SOURCE_GROUP = 47 - MCAST_MSFILTER = 48 - IP_MULTICAST_ALL = 49 - IP_UNICAST_IF = 50 -) -const ( - MCAST_EXCLUDE = 0 - MCAST_INCLUDE = 1 -) -const ( - // bool - IP_ROUTER_ALERT = 5 - // bool - IP_PKTINFO = 8 - IP_PKTOPTIONS = 9 - // obsolete name? - IP_PMTUDISC = 10 - // int; see below - IP_MTU_DISCOVER = 10 - // bool - IP_RECVERR = 11 - // bool - IP_RECVTTL = 12 - // bool - IP_RECVTOS = 13 - // int - IP_MTU = 14 - IP_FREEBIND = 15 - IP_IPSEC_POLICY = 16 - IP_XFRM_POLICY = 17 - IP_PASSSEC = 18 - IP_TRANSPARENT = 19 -) - -// TProxy original addresses -const ( - IP_ORIGDSTADDR = 20 - IP_RECVORIGDSTADDR = 20 -) -const ( - IP_MINTTL = 21 - IP_NODEFRAG = 22 - IP_CHECKSUM = 23 - IP_BIND_ADDRESS_NO_PORT = 24 -) - -// IP_MTU_DISCOVER arguments. -const ( - IP_PMTUDISC_DONT = 0 - // Use per route hints. - IP_PMTUDISC_WANT = 1 - // Always DF. - IP_PMTUDISC_DO = 2 - // Ignore dst pmtu. - IP_PMTUDISC_PROBE = 3 -) - -// Always use interface mtu (ignores dst pmtu) but don't set DF flag. -// Also incoming ICMP frag_needed notifications will be ignored on -// this socket to prevent accepting spoofed ones. -const IP_PMTUDISC_INTERFACE = 4 - -// Like IP_PMTUDISC_INTERFACE but allow packets to be fragmented. -const IP_PMTUDISC_OMIT = 5 - -// To select the IP level. -const SOL_IP = 0 -const ( - IP_DEFAULT_MULTICAST_TTL = 1 - IP_DEFAULT_MULTICAST_LOOP = 1 - IP_MAX_MEMBERSHIPS = 20 -) - -// Options for use with `getsockopt' and `setsockopt' at the IPv6 level. -// The first word in the comment at the right is the data type used; -// "bool" means a boolean value stored in an `int'. -const ( - IPV6_ADDRFORM = 1 - IPV6_2292PKTINFO = 2 - IPV6_2292HOPOPTS = 3 - IPV6_2292DSTOPTS = 4 - IPV6_2292RTHDR = 5 - IPV6_2292PKTOPTIONS = 6 - IPV6_CHECKSUM = 7 - IPV6_2292HOPLIMIT = 8 -) -const ( - IPV6_NEXTHOP = 9 - IPV6_AUTHHDR = 10 - IPV6_UNICAST_HOPS = 16 - IPV6_MULTICAST_IF = 17 - IPV6_MULTICAST_HOPS = 18 - IPV6_MULTICAST_LOOP = 19 - IPV6_JOIN_GROUP = 20 - IPV6_LEAVE_GROUP = 21 - IPV6_ROUTER_ALERT = 22 - IPV6_MTU_DISCOVER = 23 - IPV6_MTU = 24 - IPV6_RECVERR = 25 - IPV6_V6ONLY = 26 - IPV6_JOIN_ANYCAST = 27 - IPV6_LEAVE_ANYCAST = 28 - IPV6_IPSEC_POLICY = 34 - IPV6_XFRM_POLICY = 35 - IPV6_HDRINCL = 36 -) - -// Advanced API (RFC3542) (1). -const ( - IPV6_RECVPKTINFO = 49 - IPV6_PKTINFO = 50 - IPV6_RECVHOPLIMIT = 51 - IPV6_HOPLIMIT = 52 - IPV6_RECVHOPOPTS = 53 - IPV6_HOPOPTS = 54 - IPV6_RTHDRDSTOPTS = 55 - IPV6_RECVRTHDR = 56 - IPV6_RTHDR = 57 - IPV6_RECVDSTOPTS = 58 - IPV6_DSTOPTS = 59 - IPV6_RECVPATHMTU = 60 - IPV6_PATHMTU = 61 - IPV6_DONTFRAG = 62 -) - -// Advanced API (RFC3542) (2). -const ( - IPV6_RECVTCLASS = 66 - IPV6_TCLASS = 67 -) -const ( - IPV6_ADD_MEMBERSHIP = 20 - IPV6_DROP_MEMBERSHIP = 21 -) -const ( - IPV6_RXHOPOPTS = 54 - IPV6_RXDSTOPTS = 59 -) - -// IPV6_MTU_DISCOVER values. -const ( - IPV6_PMTUDISC_DONT = 0 - // Use per route hints. - IPV6_PMTUDISC_WANT = 1 - // Always DF. - IPV6_PMTUDISC_DO = 2 - // Ignore dst pmtu. - IPV6_PMTUDISC_PROBE = 3 - // See IP_PMTUDISC_INTERFACE. - IPV6_PMTUDISC_INTERFACE = 4 - // See IP_PMTUDISC_OMIT. - IPV6_PMTUDISC_OMIT = 5 -) - -// Socket level values for IPv6. -const ( - SOL_IPV6 = 41 - SOL_ICMPV6 = 58 -) - -// Routing header options for IPv6. -const ( - IPV6_RTHDR_LOOSE = 0 - // Hop must be a neighbour. - IPV6_RTHDR_STRICT = 1 -) - -// IPv6 Routing header type 0. -const IPV6_RTHDR_TYPE_0 = 0 - -// Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. -// The `ip_dst' field is used for the first-hop gateway when using a -// source route (this gets put into the header proper). -type IpOpts struct { - IpDst InAddr - IpOpts [40]c.Char -} - -// Like `struct ip_mreq' but including interface specification by index. -type IpMreqn struct { - ImrMultiaddr InAddr - ImrAddress InAddr - ImrIfindex c.Int -} - -// Structure used for IP_PKTINFO. -type InPktinfo struct { - IpiIfindex c.Int - IpiSpecDst InAddr - IpiAddr InAddr -} diff --git a/c/net/bits-in_linux_arm64.go b/c/net/bits-in_linux_arm64.go deleted file mode 100644 index 3a7c2e4a..00000000 --- a/c/net/bits-in_linux_arm64.go +++ /dev/null @@ -1,252 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -const X__USE_KERNEL_IPV6_DEFS = 0 - -// Options for use with `getsockopt' and `setsockopt' at the IP level. -// The first word in the comment at the right is the data type used; -// "bool" means a boolean value stored in an `int'. -const ( - IP_OPTIONS = 4 - // int; Header is included with data. - IP_HDRINCL = 3 - // int; IP type of service and precedence. - IP_TOS = 1 - // int; IP time to live. - IP_TTL = 2 - // bool; Receive all IP options w/datagram. - IP_RECVOPTS = 6 -) - -// For BSD compatibility. -const ( - // ip_opts; Set/get IP per-packet options. - IP_RETOPTS = 7 - // in_addr; set/get IP multicast i/f - IP_MULTICAST_IF = 32 - // u_char; set/get IP multicast ttl - IP_MULTICAST_TTL = 33 - // i_char; set/get IP multicast loopback - IP_MULTICAST_LOOP = 34 - // ip_mreq; add an IP group membership - IP_ADD_MEMBERSHIP = 35 - // ip_mreq; drop an IP group membership - IP_DROP_MEMBERSHIP = 36 - // ip_mreq_source: unblock data from source - IP_UNBLOCK_SOURCE = 37 - // ip_mreq_source: block data from source - IP_BLOCK_SOURCE = 38 - // ip_mreq_source: join source group - IP_ADD_SOURCE_MEMBERSHIP = 39 - // ip_mreq_source: leave source group - IP_DROP_SOURCE_MEMBERSHIP = 40 - IP_MSFILTER = 41 -) -const ( - // group_req: join any-source group - MCAST_JOIN_GROUP = 42 - // group_source_req: block from given group - MCAST_BLOCK_SOURCE = 43 - // group_source_req: unblock from given group - MCAST_UNBLOCK_SOURCE = 44 - // group_req: leave any-source group - MCAST_LEAVE_GROUP = 45 - // group_source_req: join source-spec gr - MCAST_JOIN_SOURCE_GROUP = 46 - // group_source_req: leave source-spec gr - MCAST_LEAVE_SOURCE_GROUP = 47 - MCAST_MSFILTER = 48 - IP_MULTICAST_ALL = 49 - IP_UNICAST_IF = 50 -) -const ( - MCAST_EXCLUDE = 0 - MCAST_INCLUDE = 1 -) -const ( - // bool - IP_ROUTER_ALERT = 5 - // bool - IP_PKTINFO = 8 - IP_PKTOPTIONS = 9 - // obsolete name? - IP_PMTUDISC = 10 - // int; see below - IP_MTU_DISCOVER = 10 - // bool - IP_RECVERR = 11 - // bool - IP_RECVTTL = 12 - // bool - IP_RECVTOS = 13 - // int - IP_MTU = 14 - IP_FREEBIND = 15 - IP_IPSEC_POLICY = 16 - IP_XFRM_POLICY = 17 - IP_PASSSEC = 18 - IP_TRANSPARENT = 19 -) - -// TProxy original addresses -const ( - IP_ORIGDSTADDR = 20 - IP_RECVORIGDSTADDR = 20 -) -const ( - IP_MINTTL = 21 - IP_NODEFRAG = 22 - IP_CHECKSUM = 23 - IP_BIND_ADDRESS_NO_PORT = 24 -) - -// IP_MTU_DISCOVER arguments. -const ( - IP_PMTUDISC_DONT = 0 - // Use per route hints. - IP_PMTUDISC_WANT = 1 - // Always DF. - IP_PMTUDISC_DO = 2 - // Ignore dst pmtu. - IP_PMTUDISC_PROBE = 3 -) - -// Always use interface mtu (ignores dst pmtu) but don't set DF flag. -// Also incoming ICMP frag_needed notifications will be ignored on -// this socket to prevent accepting spoofed ones. -const IP_PMTUDISC_INTERFACE = 4 - -// Like IP_PMTUDISC_INTERFACE but allow packets to be fragmented. -const IP_PMTUDISC_OMIT = 5 - -// To select the IP level. -const SOL_IP = 0 -const ( - IP_DEFAULT_MULTICAST_TTL = 1 - IP_DEFAULT_MULTICAST_LOOP = 1 - IP_MAX_MEMBERSHIPS = 20 -) - -// Options for use with `getsockopt' and `setsockopt' at the IPv6 level. -// The first word in the comment at the right is the data type used; -// "bool" means a boolean value stored in an `int'. -const ( - IPV6_ADDRFORM = 1 - IPV6_2292PKTINFO = 2 - IPV6_2292HOPOPTS = 3 - IPV6_2292DSTOPTS = 4 - IPV6_2292RTHDR = 5 - IPV6_2292PKTOPTIONS = 6 - IPV6_CHECKSUM = 7 - IPV6_2292HOPLIMIT = 8 -) -const ( - IPV6_NEXTHOP = 9 - IPV6_AUTHHDR = 10 - IPV6_UNICAST_HOPS = 16 - IPV6_MULTICAST_IF = 17 - IPV6_MULTICAST_HOPS = 18 - IPV6_MULTICAST_LOOP = 19 - IPV6_JOIN_GROUP = 20 - IPV6_LEAVE_GROUP = 21 - IPV6_ROUTER_ALERT = 22 - IPV6_MTU_DISCOVER = 23 - IPV6_MTU = 24 - IPV6_RECVERR = 25 - IPV6_V6ONLY = 26 - IPV6_JOIN_ANYCAST = 27 - IPV6_LEAVE_ANYCAST = 28 - IPV6_IPSEC_POLICY = 34 - IPV6_XFRM_POLICY = 35 - IPV6_HDRINCL = 36 -) - -// Advanced API (RFC3542) (1). -const ( - IPV6_RECVPKTINFO = 49 - IPV6_PKTINFO = 50 - IPV6_RECVHOPLIMIT = 51 - IPV6_HOPLIMIT = 52 - IPV6_RECVHOPOPTS = 53 - IPV6_HOPOPTS = 54 - IPV6_RTHDRDSTOPTS = 55 - IPV6_RECVRTHDR = 56 - IPV6_RTHDR = 57 - IPV6_RECVDSTOPTS = 58 - IPV6_DSTOPTS = 59 - IPV6_RECVPATHMTU = 60 - IPV6_PATHMTU = 61 - IPV6_DONTFRAG = 62 -) - -// Advanced API (RFC3542) (2). -const ( - IPV6_RECVTCLASS = 66 - IPV6_TCLASS = 67 -) -const ( - IPV6_ADD_MEMBERSHIP = 20 - IPV6_DROP_MEMBERSHIP = 21 -) -const ( - IPV6_RXHOPOPTS = 54 - IPV6_RXDSTOPTS = 59 -) - -// IPV6_MTU_DISCOVER values. -const ( - IPV6_PMTUDISC_DONT = 0 - // Use per route hints. - IPV6_PMTUDISC_WANT = 1 - // Always DF. - IPV6_PMTUDISC_DO = 2 - // Ignore dst pmtu. - IPV6_PMTUDISC_PROBE = 3 - // See IP_PMTUDISC_INTERFACE. - IPV6_PMTUDISC_INTERFACE = 4 - // See IP_PMTUDISC_OMIT. - IPV6_PMTUDISC_OMIT = 5 -) - -// Socket level values for IPv6. -const ( - SOL_IPV6 = 41 - SOL_ICMPV6 = 58 -) - -// Routing header options for IPv6. -const ( - IPV6_RTHDR_LOOSE = 0 - // Hop must be a neighbour. - IPV6_RTHDR_STRICT = 1 -) - -// IPv6 Routing header type 0. -const IPV6_RTHDR_TYPE_0 = 0 - -// Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. -// The `ip_dst' field is used for the first-hop gateway when using a -// source route (this gets put into the header proper). -type IpOpts struct { - IpDst InAddr - IpOpts [40]uint8 -} - -// Like `struct ip_mreq' but including interface specification by index. -type IpMreqn struct { - ImrMultiaddr InAddr - ImrAddress InAddr - ImrIfindex c.Int -} - -// Structure used for IP_PKTINFO. -type InPktinfo struct { - IpiIfindex c.Int - IpiSpecDst InAddr - IpiAddr InAddr -} diff --git a/c/net/bits-netdb_linux_amd64.go b/c/net/bits-netdb_linux_amd64.go deleted file mode 100644 index 987658c8..00000000 --- a/c/net/bits-netdb_linux_amd64.go +++ /dev/null @@ -1,17 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -// Description of data base entry for a single network. NOTE: here a -// poor assumption is made. The network number is expected to fit -// into an unsigned long int variable. -type Netent struct { - NName *c.Char - NAliases **c.Char - NAddrtype c.Int - NNet c.Uint32T -} diff --git a/c/net/bits-netdb_linux_arm64.go b/c/net/bits-netdb_linux_arm64.go deleted file mode 100644 index b122bd76..00000000 --- a/c/net/bits-netdb_linux_arm64.go +++ /dev/null @@ -1,17 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -// Description of data base entry for a single network. NOTE: here a -// poor assumption is made. The network number is expected to fit -// into an unsigned long int variable. -type Netent struct { - NName *uint8 - NAliases **uint8 - NAddrtype c.Int - NNet c.Uint32T -} diff --git a/c/net/bits-sockaddr_linux_amd64.go b/c/net/bits-sockaddr_linux_amd64.go deleted file mode 100644 index a4551a5d..00000000 --- a/c/net/bits-sockaddr_linux_amd64.go +++ /dev/null @@ -1,13 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -const X_BITS_SOCKADDR_H = 1 - -// Size of struct sockaddr_storage. -const X_SS_SIZE = 128 - -// POSIX.1g specifies this type name for the `sa_family' member. -type SaFamilyT = uint16 diff --git a/c/net/bits-sockaddr_linux_arm64.go b/c/net/bits-sockaddr_linux_arm64.go deleted file mode 100644 index 0be98026..00000000 --- a/c/net/bits-sockaddr_linux_arm64.go +++ /dev/null @@ -1,13 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -const X_BITS_SOCKADDR_H = 1 - -// Size of struct sockaddr_storage. -const X_SS_SIZE = 128 - -// POSIX.1g specifies this type name for the `sa_family' member. -type SaFamilyT = uint16 diff --git a/c/net/bits-socket_linux_amd64.go b/c/net/bits-socket_linux_amd64.go deleted file mode 100644 index dbecf5d4..00000000 --- a/c/net/bits-socket_linux_amd64.go +++ /dev/null @@ -1,259 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -// Protocol families. -const ( - PF_UNSPEC = 0 - // Local to host (pipes and file-domain). - PF_LOCAL = 1 - // POSIX name for PF_LOCAL. - PF_UNIX = 1 - // Another non-standard name for PF_LOCAL. - PF_FILE = 1 - // IP protocol family. - PF_INET = 2 - // Amateur Radio AX.25. - PF_AX25 = 3 - // Novell Internet Protocol. - PF_IPX = 4 - // Appletalk DDP. - PF_APPLETALK = 5 - // Amateur radio NetROM. - PF_NETROM = 6 - // Multiprotocol bridge. - PF_BRIDGE = 7 - // ATM PVCs. - PF_ATMPVC = 8 - // Reserved for X.25 project. - PF_X25 = 9 - // IP version 6. - PF_INET6 = 10 - // Amateur Radio X.25 PLP. - PF_ROSE = 11 - // Reserved for DECnet project. - PF_DECnet = 12 - // Reserved for 802.2LLC project. - PF_NETBEUI = 13 - // Security callback pseudo AF. - PF_SECURITY = 14 - // PF_KEY key management API. - PF_KEY = 15 - PF_NETLINK = 16 - // Alias to emulate 4.4BSD. - PF_ROUTE = 16 - // Packet family. - PF_PACKET = 17 - // Ash. - PF_ASH = 18 - // Acorn Econet. - PF_ECONET = 19 - // ATM SVCs. - PF_ATMSVC = 20 - // RDS sockets. - PF_RDS = 21 - // Linux SNA Project - PF_SNA = 22 - // IRDA sockets. - PF_IRDA = 23 - // PPPoX sockets. - PF_PPPOX = 24 - // Wanpipe API sockets. - PF_WANPIPE = 25 - // Linux LLC. - PF_LLC = 26 - // Native InfiniBand address. - PF_IB = 27 - // MPLS. - PF_MPLS = 28 - // Controller Area Network. - PF_CAN = 29 - // TIPC sockets. - PF_TIPC = 30 - // Bluetooth sockets. - PF_BLUETOOTH = 31 - // IUCV sockets. - PF_IUCV = 32 - // RxRPC sockets. - PF_RXRPC = 33 - // mISDN sockets. - PF_ISDN = 34 - // Phonet sockets. - PF_PHONET = 35 - // IEEE 802.15.4 sockets. - PF_IEEE802154 = 36 - // CAIF sockets. - PF_CAIF = 37 - // Algorithm sockets. - PF_ALG = 38 - // NFC sockets. - PF_NFC = 39 - // vSockets. - PF_VSOCK = 40 - // Kernel Connection Multiplexor. - PF_KCM = 41 - // For now.. - PF_MAX = 42 -) - -// Address families. -const ( - AF_UNSPEC = 0 - AF_LOCAL = 1 - AF_UNIX = 1 - AF_FILE = 1 - AF_INET = 2 - AF_AX25 = 3 - AF_IPX = 4 - AF_APPLETALK = 5 - AF_NETROM = 6 - AF_BRIDGE = 7 - AF_ATMPVC = 8 - AF_X25 = 9 - AF_INET6 = 10 - AF_ROSE = 11 - AF_DECnet = 12 - AF_NETBEUI = 13 - AF_SECURITY = 14 - AF_KEY = 15 - AF_NETLINK = 16 - AF_ROUTE = 16 - AF_PACKET = 17 - AF_ASH = 18 - AF_ECONET = 19 - AF_ATMSVC = 20 - AF_RDS = 21 - AF_SNA = 22 - AF_IRDA = 23 - AF_PPPOX = 24 - AF_WANPIPE = 25 - AF_LLC = 26 - AF_IB = 27 - AF_MPLS = 28 - AF_CAN = 29 - AF_TIPC = 30 - AF_BLUETOOTH = 31 - AF_IUCV = 32 - AF_RXRPC = 33 - AF_ISDN = 34 - AF_PHONET = 35 - AF_IEEE802154 = 36 - AF_CAIF = 37 - AF_ALG = 38 - AF_NFC = 39 - AF_VSOCK = 40 - AF_KCM = 41 - AF_MAX = 42 -) - -// Socket level values. Others are defined in the appropriate headers. -// -// XXX These definitions also should go into the appropriate headers as -// far as they are available. -const ( - SOL_RAW = 255 - SOL_DECNET = 261 - SOL_X25 = 262 - SOL_PACKET = 263 - // ATM layer (cell level). - SOL_ATM = 264 - // ATM Adaption Layer (packet level). - SOL_AAL = 265 - SOL_IRDA = 266 - SOL_NETBEUI = 267 - SOL_LLC = 268 - SOL_DCCP = 269 - SOL_NETLINK = 270 - SOL_TIPC = 271 - SOL_RXRPC = 272 - SOL_PPPOL2TP = 273 - SOL_BLUETOOTH = 274 - SOL_PNPIPE = 275 - SOL_RDS = 276 - SOL_IUCV = 277 - SOL_CAIF = 278 - SOL_ALG = 279 - SOL_NFC = 280 - SOL_KCM = 281 -) - -// Maximum queue length specifiable by listen. -const SOMAXCONN = 128 - -// Structure describing a generic socket address. -type SockAddr struct { - Family uint16 - Data [14]c.Char -} -type SockaddrStorage struct { - Family uint16 - X__SsPadding [118]c.Char - X__SsAlign c.Ulong -} - -// Bits in the FLAGS argument to `send', `recv', et al. -const ( - MSG_OOB = 1 - MSG_PEEK = 2 - MSG_DONTROUTE = 4 - MSG_CTRUNC = 8 - MSG_PROXY = 16 - MSG_TRUNC = 32 - MSG_DONTWAIT = 64 - MSG_EOR = 128 - MSG_WAITALL = 256 - MSG_FIN = 512 - MSG_SYN = 1024 - MSG_CONFIRM = 2048 - MSG_RST = 4096 - MSG_ERRQUEUE = 8192 - MSG_NOSIGNAL = 16384 - MSG_MORE = 32768 - MSG_WAITFORONE = 65536 - MSG_BATCH = 262144 - MSG_FASTOPEN = 536870912 - // Set close_on_exit for file - // descriptor received through - // SCM_RIGHTS. - MSG_CMSG_CLOEXEC = 1073741824 -) - -// Structure describing messages sent by -// `sendmsg' and received by `recvmsg'. -type Msghdr struct { - MsgName unsafe.Pointer - MsgNamelen SocklenT - MsgIov *c.Iovec - MsgIovlen c.SizeT - MsgControl unsafe.Pointer - MsgControllen c.SizeT - MsgFlags c.Int -} - -// Structure used for storage of ancillary data object information. -type Cmsghdr struct { - CmsgLen c.SizeT - CmsgLevel c.Int - CmsgType c.Int - X__CmsgData *uint8 -} - -// Socket level message types. This must match the definitions in -// . -const -// Transfer file descriptors. -SCM_RIGHTS = 1 - -// Structure used to manipulate the SO_LINGER option. -type Linger struct { - LOnoff c.Int - LLinger c.Int -} -type SocklenT = X__SocklenT diff --git a/c/net/bits-socket_linux_arm64.go b/c/net/bits-socket_linux_arm64.go deleted file mode 100644 index e58624ec..00000000 --- a/c/net/bits-socket_linux_arm64.go +++ /dev/null @@ -1,259 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -// Protocol families. -const ( - PF_UNSPEC = 0 - // Local to host (pipes and file-domain). - PF_LOCAL = 1 - // POSIX name for PF_LOCAL. - PF_UNIX = 1 - // Another non-standard name for PF_LOCAL. - PF_FILE = 1 - // IP protocol family. - PF_INET = 2 - // Amateur Radio AX.25. - PF_AX25 = 3 - // Novell Internet Protocol. - PF_IPX = 4 - // Appletalk DDP. - PF_APPLETALK = 5 - // Amateur radio NetROM. - PF_NETROM = 6 - // Multiprotocol bridge. - PF_BRIDGE = 7 - // ATM PVCs. - PF_ATMPVC = 8 - // Reserved for X.25 project. - PF_X25 = 9 - // IP version 6. - PF_INET6 = 10 - // Amateur Radio X.25 PLP. - PF_ROSE = 11 - // Reserved for DECnet project. - PF_DECnet = 12 - // Reserved for 802.2LLC project. - PF_NETBEUI = 13 - // Security callback pseudo AF. - PF_SECURITY = 14 - // PF_KEY key management API. - PF_KEY = 15 - PF_NETLINK = 16 - // Alias to emulate 4.4BSD. - PF_ROUTE = 16 - // Packet family. - PF_PACKET = 17 - // Ash. - PF_ASH = 18 - // Acorn Econet. - PF_ECONET = 19 - // ATM SVCs. - PF_ATMSVC = 20 - // RDS sockets. - PF_RDS = 21 - // Linux SNA Project - PF_SNA = 22 - // IRDA sockets. - PF_IRDA = 23 - // PPPoX sockets. - PF_PPPOX = 24 - // Wanpipe API sockets. - PF_WANPIPE = 25 - // Linux LLC. - PF_LLC = 26 - // Native InfiniBand address. - PF_IB = 27 - // MPLS. - PF_MPLS = 28 - // Controller Area Network. - PF_CAN = 29 - // TIPC sockets. - PF_TIPC = 30 - // Bluetooth sockets. - PF_BLUETOOTH = 31 - // IUCV sockets. - PF_IUCV = 32 - // RxRPC sockets. - PF_RXRPC = 33 - // mISDN sockets. - PF_ISDN = 34 - // Phonet sockets. - PF_PHONET = 35 - // IEEE 802.15.4 sockets. - PF_IEEE802154 = 36 - // CAIF sockets. - PF_CAIF = 37 - // Algorithm sockets. - PF_ALG = 38 - // NFC sockets. - PF_NFC = 39 - // vSockets. - PF_VSOCK = 40 - // Kernel Connection Multiplexor. - PF_KCM = 41 - // For now.. - PF_MAX = 42 -) - -// Address families. -const ( - AF_UNSPEC = 0 - AF_LOCAL = 1 - AF_UNIX = 1 - AF_FILE = 1 - AF_INET = 2 - AF_AX25 = 3 - AF_IPX = 4 - AF_APPLETALK = 5 - AF_NETROM = 6 - AF_BRIDGE = 7 - AF_ATMPVC = 8 - AF_X25 = 9 - AF_INET6 = 10 - AF_ROSE = 11 - AF_DECnet = 12 - AF_NETBEUI = 13 - AF_SECURITY = 14 - AF_KEY = 15 - AF_NETLINK = 16 - AF_ROUTE = 16 - AF_PACKET = 17 - AF_ASH = 18 - AF_ECONET = 19 - AF_ATMSVC = 20 - AF_RDS = 21 - AF_SNA = 22 - AF_IRDA = 23 - AF_PPPOX = 24 - AF_WANPIPE = 25 - AF_LLC = 26 - AF_IB = 27 - AF_MPLS = 28 - AF_CAN = 29 - AF_TIPC = 30 - AF_BLUETOOTH = 31 - AF_IUCV = 32 - AF_RXRPC = 33 - AF_ISDN = 34 - AF_PHONET = 35 - AF_IEEE802154 = 36 - AF_CAIF = 37 - AF_ALG = 38 - AF_NFC = 39 - AF_VSOCK = 40 - AF_KCM = 41 - AF_MAX = 42 -) - -// Socket level values. Others are defined in the appropriate headers. -// -// XXX These definitions also should go into the appropriate headers as -// far as they are available. -const ( - SOL_RAW = 255 - SOL_DECNET = 261 - SOL_X25 = 262 - SOL_PACKET = 263 - // ATM layer (cell level). - SOL_ATM = 264 - // ATM Adaption Layer (packet level). - SOL_AAL = 265 - SOL_IRDA = 266 - SOL_NETBEUI = 267 - SOL_LLC = 268 - SOL_DCCP = 269 - SOL_NETLINK = 270 - SOL_TIPC = 271 - SOL_RXRPC = 272 - SOL_PPPOL2TP = 273 - SOL_BLUETOOTH = 274 - SOL_PNPIPE = 275 - SOL_RDS = 276 - SOL_IUCV = 277 - SOL_CAIF = 278 - SOL_ALG = 279 - SOL_NFC = 280 - SOL_KCM = 281 -) - -// Maximum queue length specifiable by listen. -const SOMAXCONN = 128 - -// Structure describing a generic socket address. -type SockAddr struct { - Family uint16 - Data [14]c.Char -} -type SockaddrStorage struct { - Family uint16 - X__SsPadding [118]uint8 - X__SsAlign c.Ulong -} - -// Bits in the FLAGS argument to `send', `recv', et al. -const ( - MSG_OOB = 1 - MSG_PEEK = 2 - MSG_DONTROUTE = 4 - MSG_CTRUNC = 8 - MSG_PROXY = 16 - MSG_TRUNC = 32 - MSG_DONTWAIT = 64 - MSG_EOR = 128 - MSG_WAITALL = 256 - MSG_FIN = 512 - MSG_SYN = 1024 - MSG_CONFIRM = 2048 - MSG_RST = 4096 - MSG_ERRQUEUE = 8192 - MSG_NOSIGNAL = 16384 - MSG_MORE = 32768 - MSG_WAITFORONE = 65536 - MSG_BATCH = 262144 - MSG_FASTOPEN = 536870912 - // Set close_on_exit for file - // descriptor received through - // SCM_RIGHTS. - MSG_CMSG_CLOEXEC = 1073741824 -) - -// Structure describing messages sent by -// `sendmsg' and received by `recvmsg'. -type Msghdr struct { - MsgName unsafe.Pointer - MsgNamelen SocklenT - MsgIov *c.Iovec - MsgIovlen c.SizeT - MsgControl unsafe.Pointer - MsgControllen c.SizeT - MsgFlags c.Int -} - -// Structure used for storage of ancillary data object information. -type Cmsghdr struct { - CmsgLen c.SizeT - CmsgLevel c.Int - CmsgType c.Int - X__CmsgData *uint8 -} - -// Socket level message types. This must match the definitions in -// . -const -// Transfer file descriptors. -SCM_RIGHTS = 1 - -// Structure used to manipulate the SO_LINGER option. -type Linger struct { - LOnoff c.Int - LLinger c.Int -} -type SocklenT = X__SocklenT diff --git a/c/net/bits-socket_type_linux_amd64.go b/c/net/bits-socket_type_linux_amd64.go deleted file mode 100644 index bfee4901..00000000 --- a/c/net/bits-socket_type_linux_amd64.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -// Types of sockets. -type X__SocketType c.Uint - -const ( - _native_SOCK_STREAM X__SocketType = 1 - _native_SOCK_DGRAM X__SocketType = 2 - _native_SOCK_RAW X__SocketType = 3 - _native_SOCK_RDM X__SocketType = 4 - _native_SOCK_SEQPACKET X__SocketType = 5 - SOCK_DCCP X__SocketType = 6 - SOCK_PACKET X__SocketType = 10 - SOCK_CLOEXEC X__SocketType = 524288 - // Atomically mark descriptor(s) as - // non-blocking. - SOCK_NONBLOCK X__SocketType = 2048 -) diff --git a/c/net/bits-socket_type_linux_arm64.go b/c/net/bits-socket_type_linux_arm64.go deleted file mode 100644 index 24f1f505..00000000 --- a/c/net/bits-socket_type_linux_arm64.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -// Types of sockets. -type X__SocketType c.Uint - -const ( - _native_SOCK_STREAM X__SocketType = 1 - _native_SOCK_DGRAM X__SocketType = 2 - _native_SOCK_RAW X__SocketType = 3 - _native_SOCK_RDM X__SocketType = 4 - _native_SOCK_SEQPACKET X__SocketType = 5 - SOCK_DCCP X__SocketType = 6 - SOCK_PACKET X__SocketType = 10 - SOCK_CLOEXEC X__SocketType = 524288 - // Atomically mark descriptor(s) as - // non-blocking. - SOCK_NONBLOCK X__SocketType = 2048 -) diff --git a/c/net/bits-types_linux_amd64.go b/c/net/bits-types_linux_amd64.go deleted file mode 100644 index cb87213c..00000000 --- a/c/net/bits-types_linux_amd64.go +++ /dev/null @@ -1,133 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -const X_BITS_TYPES_H = 1 - -type X__FsidT struct { - X__Val [2]c.Int -} - -// Convenience types. -type X__UChar = uint8 -type X__UShort = uint16 -type X__UInt = c.Uint -type X__ULong = c.Ulong - -// Fixed-size types, underlying types depend on word size and compiler. -type X__Int8T = int8 -type X__Uint8T = uint8 -type X__Int16T = int16 -type X__Uint16T = uint16 -type X__Int32T = c.Int -type X__Uint32T = c.Uint -type X__Int64T = c.Long -type X__Uint64T = c.Ulong -type X__QuadT = c.Long -type X__UQuadT = c.Ulong - -// Type of device numbers. -type X__DevT = c.Ulong - -// Type of user identifications. -type X__UidT = c.Uint - -// Type of group identifications. -type X__GidT = c.Uint - -// Type of file serial numbers. -type X__InoT = c.Ulong - -// Type of file serial numbers (LFS). -type X__Ino64T = c.Ulong - -// Type of file attribute bitmasks. -type X__ModeT = c.Uint - -// Type of file link counts. -type X__NlinkT = c.Ulong - -// Type of file sizes and offsets. -type X__OffT = c.Long - -// Type of file sizes and offsets (LFS). -type X__Off64T = c.Long - -// Type of process identifications. -type X__PidT = c.Int - -// Type of CPU usage counts. -type X__ClockT = c.Long - -// Type for resource measurement. -type X__RlimT = c.Ulong - -// Type for resource measurement (LFS). -type X__Rlim64T = c.Ulong - -// General type for IDs. -type X__IdT = c.Uint - -// Seconds since the Epoch. -type X__TimeT = c.Long - -// Count of microseconds. -type X__UsecondsT = c.Uint - -// Signed count of microseconds. -type X__SusecondsT = c.Long - -// The type of a disk address. -type X__DaddrT = c.Int - -// Type of an IPC key. -type X__KeyT = c.Int - -// Clock ID used in clock and timer functions. -type X__ClockidT = c.Int - -// Timer ID returned by `timer_create'. -type X__TimerT uintptr - -// Type to represent block size. -type X__BlksizeT = c.Long - -// Type to count number of disk blocks. -type X__BlkcntT = c.Long -type X__Blkcnt64T = c.Long - -// Type to count file system blocks. -type X__FsblkcntT = c.Ulong -type X__Fsblkcnt64T = c.Ulong - -// Type to count file system nodes. -type X__FsfilcntT = c.Ulong -type X__Fsfilcnt64T = c.Ulong - -// Type of miscellaneous file system fields. -type X__FswordT = c.Long - -// Type of a byte count, or error. -type X__SsizeT = c.Long - -// Signed long type used in system calls. -type X__SyscallSlongT = c.Long - -// Unsigned long type used in system calls. -type X__SyscallUlongT = c.Ulong - -// These few don't really vary by system, they always correspond -// to one of the other defined types. -type X__LoffT = X__Off64T -type X__QaddrT = *X__QuadT -type X__CaddrT = *c.Char - -// Duplicates info from stdint.h but this is used in unistd.h. -type X__IntptrT = c.Long - -// Duplicate info from sys/socket.h. -type X__SocklenT = c.Uint diff --git a/c/net/bits-types_linux_arm64.go b/c/net/bits-types_linux_arm64.go deleted file mode 100644 index ba071294..00000000 --- a/c/net/bits-types_linux_arm64.go +++ /dev/null @@ -1,133 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -const X_BITS_TYPES_H = 1 - -type X__FsidT struct { - X__Val [2]c.Int -} - -// Convenience types. -type X__UChar = uint8 -type X__UShort = uint16 -type X__UInt = c.Uint -type X__ULong = c.Ulong - -// Fixed-size types, underlying types depend on word size and compiler. -type X__Int8T = int8 -type X__Uint8T = uint8 -type X__Int16T = int16 -type X__Uint16T = uint16 -type X__Int32T = c.Int -type X__Uint32T = c.Uint -type X__Int64T = c.Long -type X__Uint64T = c.Ulong -type X__QuadT = c.Long -type X__UQuadT = c.Ulong - -// Type of device numbers. -type X__DevT = c.Ulong - -// Type of user identifications. -type X__UidT = c.Uint - -// Type of group identifications. -type X__GidT = c.Uint - -// Type of file serial numbers. -type X__InoT = c.Ulong - -// Type of file serial numbers (LFS). -type X__Ino64T = c.Ulong - -// Type of file attribute bitmasks. -type X__ModeT = c.Uint - -// Type of file link counts. -type X__NlinkT = c.Uint - -// Type of file sizes and offsets. -type X__OffT = c.Long - -// Type of file sizes and offsets (LFS). -type X__Off64T = c.Long - -// Type of process identifications. -type X__PidT = c.Int - -// Type of CPU usage counts. -type X__ClockT = c.Long - -// Type for resource measurement. -type X__RlimT = c.Ulong - -// Type for resource measurement (LFS). -type X__Rlim64T = c.Ulong - -// General type for IDs. -type X__IdT = c.Uint - -// Seconds since the Epoch. -type X__TimeT = c.Long - -// Count of microseconds. -type X__UsecondsT = c.Uint - -// Signed count of microseconds. -type X__SusecondsT = c.Long - -// The type of a disk address. -type X__DaddrT = c.Int - -// Type of an IPC key. -type X__KeyT = c.Int - -// Clock ID used in clock and timer functions. -type X__ClockidT = c.Int - -// Timer ID returned by `timer_create'. -type X__TimerT uintptr - -// Type to represent block size. -type X__BlksizeT = c.Int - -// Type to count number of disk blocks. -type X__BlkcntT = c.Long -type X__Blkcnt64T = c.Long - -// Type to count file system blocks. -type X__FsblkcntT = c.Ulong -type X__Fsblkcnt64T = c.Ulong - -// Type to count file system nodes. -type X__FsfilcntT = c.Ulong -type X__Fsfilcnt64T = c.Ulong - -// Type of miscellaneous file system fields. -type X__FswordT = c.Long - -// Type of a byte count, or error. -type X__SsizeT = c.Long - -// Signed long type used in system calls. -type X__SyscallSlongT = c.Long - -// Unsigned long type used in system calls. -type X__SyscallUlongT = c.Ulong - -// These few don't really vary by system, they always correspond -// to one of the other defined types. -type X__LoffT = X__Off64T -type X__QaddrT = *X__QuadT -type X__CaddrT = *uint8 - -// Duplicates info from stdint.h but this is used in unistd.h. -type X__IntptrT = c.Long - -// Duplicate info from sys/socket.h. -type X__SocklenT = c.Uint diff --git a/c/net/libc_darwin_arm64.go b/c/net/libc_darwin_arm64.go new file mode 100644 index 00000000..73bc42e1 --- /dev/null +++ b/c/net/libc_darwin_arm64.go @@ -0,0 +1,2269 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +type X__Uint8T = uint8 + +type X__Uint16T = uint16 + +type X__Uint32T = c.Uint + +type X__Int64T = c.LongLong + +// sizeof() +type X__DarwinSizeT = c.Ulong + +// socklen_t (duh) +type X__DarwinSocklenT = X__Uint32T + +// byte count or error +type X__DarwinSsizeT = c.Long + +// llgo:link InAddr.InetNtoa C.inet_ntoa +func (self InAddr) InetNtoa() *c.Char { + return nil +} + +//go:linkname InetPton C.inet_pton +func InetPton(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 unsafe.Pointer) c.Int + +//go:linkname Ascii2addr C.ascii2addr +func Ascii2addr(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 unsafe.Pointer) c.Int + +//go:linkname Addr2ascii C.addr2ascii +func Addr2ascii(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.Int, _llcppg_param4 *c.Char) *c.Char + +//go:linkname InetAton C.inet_aton +func InetAton(_llcppg_param1 *c.Char, _llcppg_param2 *InAddr) c.Int + +// llgo:link InAddr.InetLnaof C.inet_lnaof +func (self InAddr) InetLnaof() InAddrT { + return 0 +} + +//go:linkname InetMakeaddr C.inet_makeaddr +func InetMakeaddr(_llcppg_param1 InAddrT, _llcppg_param2 InAddrT) InAddr + +// llgo:link InAddr.InetNetof C.inet_netof +func (self InAddr) InetNetof() InAddrT { + return 0 +} + +//go:linkname InetNetwork C.inet_network +func InetNetwork(_llcppg_param1 *c.Char) InAddrT + +//go:linkname InetNetNtop C.inet_net_ntop +func InetNetNtop(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.Int, _llcppg_param4 *c.Char, _llcppg_param5 X__DarwinSizeT) *c.Char + +//go:linkname InetNetPton C.inet_net_pton +func InetNetPton(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 unsafe.Pointer, _llcppg_param4 X__DarwinSizeT) c.Int + +//go:linkname InetNeta C.inet_neta +func InetNeta(_llcppg_param1 InAddrT, _llcppg_param2 *c.Char, _llcppg_param3 X__DarwinSizeT) *c.Char + +//go:linkname InetNsapAddr C.inet_nsap_addr +func InetNsapAddr(_llcppg_param1 *c.Char, _llcppg_param2 *uint8, _llcppg_param3 c.Int) c.Uint + +//go:linkname InetNsapNtoa C.inet_nsap_ntoa +func InetNsapNtoa(_llcppg_param1 c.Int, _llcppg_param2 *uint8, _llcppg_param3 *c.Char) *c.Char + +const IF_NAMESIZE = 16 + +const ( + // interface is up + IFF_UP = 1 + // broadcast address valid + IFF_BROADCAST = 2 + // turn on debugging + IFF_DEBUG = 4 + // is a loopback net + IFF_LOOPBACK = 8 + // interface is point-to-point link + IFF_POINTOPOINT = 16 + // obsolete: avoid use of trailers + IFF_NOTRAILERS = 32 + // resources allocated + IFF_RUNNING = 64 + // no address resolution protocol + IFF_NOARP = 128 + // receive all packets + IFF_PROMISC = 256 + // receive all multicast packets + IFF_ALLMULTI = 512 + // transmission in progress + IFF_OACTIVE = 1024 + // can't hear own transmissions + IFF_SIMPLEX = 2048 + // per link layer defined bit + IFF_LINK0 = 4096 + // per link layer defined bit + IFF_LINK1 = 8192 + // per link layer defined bit + IFF_LINK2 = 16384 + // use alternate physical connection + IFF_ALTPHYS = 16384 + // supports multicast + IFF_MULTICAST = 32768 +) + +// Capabilities that interfaces can advertise. +// +// struct ifnet.if_capabilities +// +// contains the optional features & capabilities a particular interface +// supports (not only the driver but also the detected hw revision). +// Capabilities are defined by IFCAP_* below. +// +// struct ifnet.if_capenable +// +// contains the enabled (either by default or through ifconfig) optional +// features & capabilities on this interface. +// Capabilities are defined by IFCAP_* below. +// +// struct if_data.ifi_hwassist in IFNET_* form, defined in net/kpi_interface.h, +// +// contains the enabled optional features & capabilites that can be used +// individually per packet and are specified in the mbuf pkthdr.csum_flags +// field. IFCAP_* and IFNET_* do not match one to one and IFNET_* may be +// more detailed or differentiated than IFCAP_*. +// IFNET_* hwassist flags have corresponding CSUM_* in sys/mbuf.h +const ( + IFCAP_RXCSUM = 1 + // can offload checksum on TX + IFCAP_TXCSUM = 2 + // VLAN-compatible MTU + IFCAP_VLAN_MTU = 4 + // hardware VLAN tag support + IFCAP_VLAN_HWTAGGING = 8 + // 9000 byte MTU supported + IFCAP_JUMBO_MTU = 16 + // can do TCP Segmentation Offload + IFCAP_TSO4 = 32 + // can do TCP6 Segmentation Offload + IFCAP_TSO6 = 64 + // can do Large Receive Offload + IFCAP_LRO = 128 + // can do 802.1 AV Bridging + IFCAP_AV = 256 + // can return linklevel xmit status + IFCAP_TXSTATUS = 512 + // Skywalk mode supported/enabled + IFCAP_SKYWALK = 1024 + // Time stamping in hardware + IFCAP_HW_TIMESTAMP = 2048 + // Time stamping in software + IFCAP_SW_TIMESTAMP = 4096 + // can offload partial checksum + IFCAP_CSUM_PARTIAL = 8192 + // can invert 0 to -0 (0xffff) + IFCAP_CSUM_ZERO_INVERT = 16384 +) + +const ( + IFCAP_HWCSUM = 3 + IFCAP_TSO = 96 +) + +const IFCAP_VALID = 32767 + +const ( + IFQ_MAXLEN = 128 + // granularity is 1 second + IFNET_SLOWHZ = 1 +) + +// Wake capabilities of a interface +const IF_WAKE_ON_MAGIC_PACKET = 1 + +// 10 lines of text +const IFSTATMAX = 800 + +type IfClonereq struct { + IfcrTotal c.Int + IfcrCount c.Int + IfcrBuffer *c.Char +} + +// Message format for use in obtaining information about interface addresses +// from sysctl and the routing socket +type IfaMsghdr struct { + IfamMsglen uint16 + IfamVersion uint8 + IfamType uint8 + IfamAddrs c.Int + IfamFlags c.Int + IfamIndex uint16 + IfamMetric c.Int +} + +// Message format for use in obtaining information about multicast addresses +// from the routing socket +type IfmaMsghdr struct { + IfmamMsglen uint16 + IfmamVersion uint8 + IfmamType uint8 + IfmamAddrs c.Int + IfmamFlags c.Int + IfmamIndex uint16 +} + +// Message format for use in obtaining information about multicast addresses +// from sysctl +type IfmaMsghdr2 struct { + IfmamMsglen UShort + IfmamVersion UChar + IfmamType UChar + IfmamAddrs c.Int + IfmamFlags c.Int + IfmamIndex UShort + IfmamRefcount Int32T +} + +// ifdevmtu: interface device mtu +// +// Used with SIOCGIFDEVMTU to get the current mtu in use by the device, +// as well as the minimum and maximum mtu allowed by the device. +type Ifdevmtu struct { + IfdmCurrent c.Int + IfdmMin c.Int + IfdmMax c.Int +} + +type Ifaliasreq struct { + IfraName [16]c.Char + IfraAddr SockAddr + IfraBroadaddr SockAddr + IfraMask SockAddr +} + +type RslvmultiReq struct { + Sa *SockAddr + Llsa **SockAddr +} + +type Ifstat struct { + IfsName [16]c.Char + Ascii [801]c.Char +} + +// DLIL KEV_DL_PROTO_ATTACHED/DETACHED structure +type KevDlProtoData struct { + LinkData NetEventData + ProtoFamily UInt32T + ProtoRemainingCount UInt32T +} + +type IfNameindex struct { + IfIndex c.Uint + IfName *c.Char +} + +//go:linkname IfNametoindex C.if_nametoindex +func IfNametoindex(_llcppg_param1 *c.Char) c.Uint + +//go:linkname IfIndextoname C.if_indextoname +func IfIndextoname(_llcppg_param1 c.Uint, _llcppg_param2 *c.Char) *c.Char + +// llgo:link (*IfNameindex).IfFreenameindex C.if_freenameindex +func (self *IfNameindex) IfFreenameindex() { +} + +const ( + APPLE_IF_FAM_LOOPBACK = 1 + APPLE_IF_FAM_ETHERNET = 2 + APPLE_IF_FAM_SLIP = 3 + APPLE_IF_FAM_TUN = 4 + APPLE_IF_FAM_VLAN = 5 + APPLE_IF_FAM_PPP = 6 + APPLE_IF_FAM_PVC = 7 + APPLE_IF_FAM_DISC = 8 + APPLE_IF_FAM_MDECAP = 9 + APPLE_IF_FAM_GIF = 10 + // deprecated + APPLE_IF_FAM_FAITH = 11 + APPLE_IF_FAM_STF = 12 + APPLE_IF_FAM_FIREWIRE = 13 + APPLE_IF_FAM_BOND = 14 + APPLE_IF_FAM_CELLULAR = 15 + // Un-used + APPLE_IF_FAM_UNUSED_16 = 16 + APPLE_IF_FAM_UTUN = 17 + APPLE_IF_FAM_IPSEC = 18 +) + +// 72 was chosen below because it is the size of a TCP/IP +// header (40) + the minimum mss (32). +const ( + IF_MINMTU = 72 + IF_MAXMTU = 65535 +) + +const IFNAMSIZ = 16 + +type NetEventData struct { + IfFamily UInt32T + IfUnit UInt32T + IfName [16]c.Char +} + +// Structure defining a queue for a network interface. +type Ifqueue struct { + IfqHead unsafe.Pointer + IfqTail unsafe.Pointer + IfqLen c.Int + IfqMaxlen c.Int + IfqDrops c.Int +} + +// Kernel event subclass identifiers for KEV_NETWORK_CLASS +const KEV_INET_SUBCLASS = 1 + +// KEV_INET_SUBCLASS event codes +const ( + KEV_INET_NEW_ADDR = 1 + // Address changed event + KEV_INET_CHANGED_ADDR = 2 + // IPv6 address was deleted + KEV_INET_ADDR_DELETED = 3 + // Dest. address was set + KEV_INET_SIFDSTADDR = 4 + // Broadcast address was set + KEV_INET_SIFBRDADDR = 5 + // Netmask was set + KEV_INET_SIFNETMASK = 6 + // ARP collision detected + KEV_INET_ARPCOLLISION = 7 +) + +// use ken_in_portinuse +const KEV_INET_PORTINUSE = 8 + +const ( + // ARP resolution failed for router + KEV_INET_ARPRTRFAILURE = 9 + // ARP resolution succeeded for router + KEV_INET_ARPRTRALIVE = 10 +) + +// Data Link subclass +const KEV_DL_SUBCLASS = 2 + +// Define Data-Link event subclass, and associated +// events. +const ( + KEV_DL_SIFFLAGS = 1 + KEV_DL_SIFMETRICS = 2 + KEV_DL_SIFMTU = 3 + KEV_DL_SIFPHYS = 4 + KEV_DL_SIFMEDIA = 5 + KEV_DL_SIFGENERIC = 6 + KEV_DL_ADDMULTI = 7 + KEV_DL_DELMULTI = 8 + KEV_DL_IF_ATTACHED = 9 + KEV_DL_IF_DETACHING = 10 + KEV_DL_IF_DETACHED = 11 + KEV_DL_LINK_OFF = 12 + KEV_DL_LINK_ON = 13 + KEV_DL_PROTO_ATTACHED = 14 + KEV_DL_PROTO_DETACHED = 15 + KEV_DL_LINK_ADDRESS_CHANGED = 16 + KEV_DL_WAKEFLAGS_CHANGED = 17 + KEV_DL_IF_IDLE_ROUTE_REFCNT = 18 + KEV_DL_IFCAP_CHANGED = 19 + KEV_DL_LINK_QUALITY_METRIC_CHANGED = 20 + KEV_DL_NODE_PRESENCE = 21 + KEV_DL_NODE_ABSENCE = 22 + KEV_DL_PRIMARY_ELECTED = 23 + KEV_DL_ISSUES = 24 + KEV_DL_IFDELEGATE_CHANGED = 25 + KEV_DL_AWDL_RESTRICTED = 26 + KEV_DL_AWDL_UNRESTRICTED = 27 + KEV_DL_RRC_STATE_CHANGED = 28 + KEV_DL_QOS_MODE_CHANGED = 29 + KEV_DL_LOW_POWER_MODE_CHANGED = 30 +) + +// inet6 subclass +const KEV_INET6_SUBCLASS = 6 + +// KEV_INET6_SUBCLASS event codes +const ( + KEV_INET6_NEW_USER_ADDR = 1 + // Address changed event (future) + KEV_INET6_CHANGED_ADDR = 2 + // IPv6 address was deleted + KEV_INET6_ADDR_DELETED = 3 + // Autoconf LL address appeared + KEV_INET6_NEW_LL_ADDR = 4 + // Autoconf address has appeared + KEV_INET6_NEW_RTADV_ADDR = 5 + // Default router detected + KEV_INET6_DEFROUTER = 6 + // Asking for the NAT64-prefix + KEV_INET6_REQUEST_NAT64_PREFIX = 7 +) + +const X_PATH_HEQUIV = "/etc/hosts.equiv" + +const ( + X_PATH_HOSTS = "/etc/hosts" + X_PATH_NETWORKS = "/etc/networks" + X_PATH_PROTOCOLS = "/etc/protocols" + X_PATH_SERVICES = "/etc/services" +) + +const ( + // see errno + NETDB_INTERNAL = -1 + // no problem + NETDB_SUCCESS = 0 +) + +const ( + // Authoritative Answer Host not found + HOST_NOT_FOUND = 1 + // Non-Authoritative Host not found, or SERVERFAIL + TRY_AGAIN = 2 + // Non recoverable errors, FORMERR, REFUSED, NOTIMP + NO_RECOVERY = 3 + // Valid name, no data record of requested type + NO_DATA = 4 +) + +// no address, look for MX record +const NO_ADDRESS = 4 + +// address family for hostname not supported +const EAI_ADDRFAMILY = 1 + +const ( + // temporary failure in name resolution + EAI_AGAIN = 2 + // invalid value for ai_flags + EAI_BADFLAGS = 3 + // non-recoverable failure in name resolution + EAI_FAIL = 4 + // ai_family not supported + EAI_FAMILY = 5 + // memory allocation failure + EAI_MEMORY = 6 +) + +// no address associated with hostname +const EAI_NODATA = 7 + +const ( + // hostname nor servname provided, or not known + EAI_NONAME = 8 + // servname not supported for ai_socktype + EAI_SERVICE = 9 + // ai_socktype not supported + EAI_SOCKTYPE = 10 + // system error returned in errno + EAI_SYSTEM = 11 +) + +const ( + // invalid value for hints + EAI_BADHINTS = 12 + // resolved protocol is unknown + EAI_PROTOCOL = 13 +) + +// argument buffer overflow +const EAI_OVERFLOW = 14 + +const EAI_MAX = 15 + +// Flag values for getaddrinfo() +const ( + AI_PASSIVE = 1 + // fill ai_canonname + AI_CANONNAME = 2 + // prevent host name resolution + AI_NUMERICHOST = 4 + // prevent service name resolution + AI_NUMERICSERV = 4096 +) + +// IPv6 and IPv4-mapped (with AI_V4MAPPED) +const AI_ALL = 256 + +// accept IPv4-mapped if kernel supports +const AI_V4MAPPED_CFG = 512 + +const ( + // only if any address is assigned + AI_ADDRCONFIG = 1024 + // accept IPv4-mapped IPv6 address + AI_V4MAPPED = 2048 +) + +// If the hints pointer is null or ai_flags is zero, getaddrinfo() automatically defaults to the AI_DEFAULT behavior. +// To override this default behavior, thereby causing unusable addresses to be included in the results, pass any nonzero +// value for ai_flags, by setting any desired flag values, or by setting AI_UNUSABLE if no other flags are desired. +const AI_DEFAULT = 1536 + +// If the hints pointer is null or ai_flags is zero, getaddrinfo() automatically defaults to the AI_DEFAULT behavior. +// To override this default behavior, thereby causing unusable addresses to be included in the results, pass any nonzero +// value for ai_flags, by setting any desired flag values, or by setting AI_UNUSABLE if no other flags are desired. +const AI_UNUSABLE = 268435456 + +const ( + NI_MAXHOST = 1025 + NI_MAXSERV = 32 +) + +// Flag values for getnameinfo() +const ( + NI_NOFQDN = 1 + NI_NUMERICHOST = 2 + NI_NAMEREQD = 4 + NI_NUMERICSERV = 8 + NI_NUMERICSCOPE = 256 + NI_DGRAM = 16 +) + +const NI_WITHSCOPEID = 32 + +// Structures returned by network data base library. All addresses are +// supplied in host order, and returned in network order (suitable for +// use in system calls). +type Hostent struct { + Name *c.Char + Aliases **c.Char + AddrType c.Int + Length c.Int + AddrList **c.Char +} + +// Assumption here is that a network number +// fits in an unsigned long -- probably a poor one. +type Netent struct { + NName *c.Char + NAliases **c.Char + NAddrtype c.Int + NNet Uint32T +} + +type Servent struct { + SName *c.Char + SAliases **c.Char + SPort c.Int + SProto *c.Char +} + +type Protoent struct { + PName *c.Char + PAliases **c.Char + PProto c.Int +} + +type AddrInfo struct { + Flags c.Int + Family c.Int + SockType c.Int + Protocol c.Int + AddrLen SocklenT + CanOnName *c.Char + Addr *SockAddr + Next *AddrInfo +} + +type Rpcent struct { + RName *c.Char + RAliases **c.Char + RNumber c.Int +} + +//go:linkname HErrno C.h_errno +var HErrno c.Int + +//go:linkname Endhostent C.endhostent +func Endhostent() + +//go:linkname Endnetent C.endnetent +func Endnetent() + +//go:linkname Endprotoent C.endprotoent +func Endprotoent() + +//go:linkname Endservent C.endservent +func Endservent() + +//go:linkname GaiStrerror C.gai_strerror +func GaiStrerror(_llcppg_param1 c.Int) *c.Char + +//go:linkname Gethostbyaddr C.gethostbyaddr +func Gethostbyaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int) *Hostent + +//go:linkname Gethostent C.gethostent +func Gethostent() *Hostent + +// llgo:link (*SockAddr).Getnameinfo C.getnameinfo +func (self *SockAddr) Getnameinfo(_llcppg_param2 SocklenT, _llcppg_param3 *c.Char, _llcppg_param4 SocklenT, _llcppg_param5 *c.Char, _llcppg_param6 SocklenT, _llcppg_param7 c.Int) c.Int { + return 0 +} + +//go:linkname Getnetbyaddr C.getnetbyaddr +func Getnetbyaddr(_llcppg_param1 Uint32T, _llcppg_param2 c.Int) *Netent + +//go:linkname Getnetbyname C.getnetbyname +func Getnetbyname(_llcppg_param1 *c.Char) *Netent + +//go:linkname Getnetent C.getnetent +func Getnetent() *Netent + +//go:linkname Getprotobyname C.getprotobyname +func Getprotobyname(_llcppg_param1 *c.Char) *Protoent + +//go:linkname Getprotobynumber C.getprotobynumber +func Getprotobynumber(_llcppg_param1 c.Int) *Protoent + +//go:linkname Getprotoent C.getprotoent +func Getprotoent() *Protoent + +//go:linkname Getservbyname C.getservbyname +func Getservbyname(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) *Servent + +//go:linkname Getservbyport C.getservbyport +func Getservbyport(_llcppg_param1 c.Int, _llcppg_param2 *c.Char) *Servent + +//go:linkname Getservent C.getservent +func Getservent() *Servent + +// void sethostfile(const char *); +// +//go:linkname Sethostent C.sethostent +func Sethostent(_llcppg_param1 c.Int) + +// void sethostfile(const char *); +// +//go:linkname Setnetent C.setnetent +func Setnetent(_llcppg_param1 c.Int) + +//go:linkname Setprotoent C.setprotoent +func Setprotoent(_llcppg_param1 c.Int) + +//go:linkname Setservent C.setservent +func Setservent(_llcppg_param1 c.Int) + +// llgo:link (*Hostent).Free C.freehostent +func (self *Hostent) Free() { +} + +//go:linkname Gethostbyname2 C.gethostbyname2 +func Gethostbyname2(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) *Hostent + +//go:linkname Getipnodebyaddr C.getipnodebyaddr +func Getipnodebyaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) *Hostent + +//go:linkname Getipnodebyname C.getipnodebyname +func Getipnodebyname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) *Hostent + +//go:linkname Getrpcbyname C.getrpcbyname +func Getrpcbyname(name *c.Char) *Rpcent + +//go:linkname Getrpcbynumber C.getrpcbynumber +func Getrpcbynumber(number c.Int) *Rpcent + +//go:linkname Getrpcent C.getrpcent +func Getrpcent() *Rpcent + +//go:linkname Setrpcent C.setrpcent +func Setrpcent(stayopen c.Int) + +//go:linkname Endrpcent C.endrpcent +func Endrpcent() + +//go:linkname Herror C.herror +func Herror(_llcppg_param1 *c.Char) + +//go:linkname Hstrerror C.hstrerror +func Hstrerror(_llcppg_param1 c.Int) *c.Char + +//go:linkname Innetgr C.innetgr +func Innetgr(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char) c.Int + +//go:linkname Getnetgrent C.getnetgrent +func Getnetgrent(_llcppg_param1 **c.Char, _llcppg_param2 **c.Char, _llcppg_param3 **c.Char) c.Int + +//go:linkname Endnetgrent C.endnetgrent +func Endnetgrent() + +//go:linkname Setnetgrent C.setnetgrent +func Setnetgrent(_llcppg_param1 *c.Char) + +// Protocols (RFC 1700) +const IPPROTO_IP = 0 + +// IP6 hop-by-hop options +const IPPROTO_HOPOPTS = 0 + +// control message protocol +const IPPROTO_ICMP = 1 + +const ( + // group mgmt protocol + IPPROTO_IGMP = 2 + // gateway^2 (deprecated) + IPPROTO_GGP = 3 + // IPv4 encapsulation + IPPROTO_IPV4 = 4 + // for compatibility + IPPROTO_IPIP = 4 +) + +// tcp +const IPPROTO_TCP = 6 + +const ( + // Stream protocol II + IPPROTO_ST = 7 + // exterior gateway protocol + IPPROTO_EGP = 8 + // private interior gateway + IPPROTO_PIGP = 9 + // BBN RCC Monitoring + IPPROTO_RCCMON = 10 + // network voice protocol + IPPROTO_NVPII = 11 + // pup + IPPROTO_PUP = 12 + // Argus + IPPROTO_ARGUS = 13 + // EMCON + IPPROTO_EMCON = 14 + // Cross Net Debugger + IPPROTO_XNET = 15 + // Chaos + IPPROTO_CHAOS = 16 +) + +// user datagram protocol +const IPPROTO_UDP = 17 + +const ( + // Multiplexing + IPPROTO_MUX = 18 + // DCN Measurement Subsystems + IPPROTO_MEAS = 19 + // Host Monitoring + IPPROTO_HMP = 20 + // Packet Radio Measurement + IPPROTO_PRM = 21 + // xns idp + IPPROTO_IDP = 22 + // Trunk-1 + IPPROTO_TRUNK1 = 23 + // Trunk-2 + IPPROTO_TRUNK2 = 24 + // Leaf-1 + IPPROTO_LEAF1 = 25 + // Leaf-2 + IPPROTO_LEAF2 = 26 + // Reliable Data + IPPROTO_RDP = 27 + // Reliable Transaction + IPPROTO_IRTP = 28 + // tp-4 w/ class negotiation + IPPROTO_TP = 29 + // Bulk Data Transfer + IPPROTO_BLT = 30 + // Network Services + IPPROTO_NSP = 31 + // Merit Internodal + IPPROTO_INP = 32 + // Sequential Exchange + IPPROTO_SEP = 33 + // Third Party Connect + IPPROTO_3PC = 34 + // InterDomain Policy Routing + IPPROTO_IDPR = 35 + // XTP + IPPROTO_XTP = 36 + // Datagram Delivery + IPPROTO_DDP = 37 + // Control Message Transport + IPPROTO_CMTP = 38 + // TP++ Transport + IPPROTO_TPXX = 39 + // IL transport protocol + IPPROTO_IL = 40 +) + +// IP6 header +const IPPROTO_IPV6 = 41 + +const ( + // Source Demand Routing + IPPROTO_SDRP = 42 + // IP6 routing header + IPPROTO_ROUTING = 43 + // IP6 fragmentation header + IPPROTO_FRAGMENT = 44 + // InterDomain Routing + IPPROTO_IDRP = 45 + // resource reservation + IPPROTO_RSVP = 46 + // General Routing Encap. + IPPROTO_GRE = 47 + // Mobile Host Routing + IPPROTO_MHRP = 48 + // BHA + IPPROTO_BHA = 49 + // IP6 Encap Sec. Payload + IPPROTO_ESP = 50 + // IP6 Auth Header + IPPROTO_AH = 51 + // Integ. Net Layer Security + IPPROTO_INLSP = 52 + // IP with encryption + IPPROTO_SWIPE = 53 + // Next Hop Resolution + IPPROTO_NHRP = 54 +) + +// 55-57: Unassigned +const ( + IPPROTO_ICMPV6 = 58 + // IP6 no next header + IPPROTO_NONE = 59 + // IP6 destination option + IPPROTO_DSTOPTS = 60 + // any host internal protocol + IPPROTO_AHIP = 61 + // CFTP + IPPROTO_CFTP = 62 + // "hello" routing protocol + IPPROTO_HELLO = 63 + // SATNET/Backroom EXPAK + IPPROTO_SATEXPAK = 64 + // Kryptolan + IPPROTO_KRYPTOLAN = 65 + // Remote Virtual Disk + IPPROTO_RVD = 66 + // Pluribus Packet Core + IPPROTO_IPPC = 67 + // Any distributed FS + IPPROTO_ADFS = 68 + // Satnet Monitoring + IPPROTO_SATMON = 69 + // VISA Protocol + IPPROTO_VISA = 70 + // Packet Core Utility + IPPROTO_IPCV = 71 + // Comp. Prot. Net. Executive + IPPROTO_CPNX = 72 + // Comp. Prot. HeartBeat + IPPROTO_CPHB = 73 + // Wang Span Network + IPPROTO_WSN = 74 + // Packet Video Protocol + IPPROTO_PVP = 75 + // BackRoom SATNET Monitoring + IPPROTO_BRSATMON = 76 + // Sun net disk proto (temp.) + IPPROTO_ND = 77 + // WIDEBAND Monitoring + IPPROTO_WBMON = 78 + // WIDEBAND EXPAK + IPPROTO_WBEXPAK = 79 + // ISO cnlp + IPPROTO_EON = 80 + // VMTP + IPPROTO_VMTP = 81 + // Secure VMTP + IPPROTO_SVMTP = 82 + // Banyon VINES + IPPROTO_VINES = 83 + // TTP + IPPROTO_TTP = 84 + // NSFNET-IGP + IPPROTO_IGP = 85 + // dissimilar gateway prot. + IPPROTO_DGP = 86 + // TCF + IPPROTO_TCF = 87 + // Cisco/GXS IGRP + IPPROTO_IGRP = 88 + // OSPFIGP + IPPROTO_OSPFIGP = 89 + // Strite RPC protocol + IPPROTO_SRPC = 90 + // Locus Address Resoloution + IPPROTO_LARP = 91 + // Multicast Transport + IPPROTO_MTP = 92 + // AX.25 Frames + IPPROTO_AX25 = 93 + // IP encapsulated in IP + IPPROTO_IPEIP = 94 + // Mobile Int.ing control + IPPROTO_MICP = 95 + // Semaphore Comm. security + IPPROTO_SCCSP = 96 + // Ethernet IP encapsulation + IPPROTO_ETHERIP = 97 + // encapsulation header + IPPROTO_ENCAP = 98 + // any private encr. scheme + IPPROTO_APES = 99 + // GMTP + IPPROTO_GMTP = 100 +) + +// 101-252: Partly Unassigned +const ( + IPPROTO_PIM = 103 + // payload compression (IPComp) + IPPROTO_IPCOMP = 108 + // PGM + IPPROTO_PGM = 113 + // SCTP + IPPROTO_SCTP = 132 +) + +// BSD Private, local use, namespace incursion +const IPPROTO_DIVERT = 254 + +// raw IP packet +const IPPROTO_RAW = 255 + +const IPPROTO_MAX = 256 + +// last return value of *_input(), meaning "all job for this pkt is done". +const IPPROTO_DONE = 257 + +const X__DARWIN_IPPORT_RESERVED = 1024 + +const IPPORT_RESERVED = 1024 + +const IPPORT_USERRESERVED = 5000 + +// Default local port range to use by setting IP_PORTRANGE_HIGH +const ( + IPPORT_HIFIRSTAUTO = 49152 + IPPORT_HILASTAUTO = 65535 +) + +// Scanning for a free reserved port return a value below IPPORT_RESERVED, +// but higher than IPPORT_RESERVEDSTART. Traditionally the start value was +// 512, but that conflicts with some well-known-services that firewalls may +// have a fit if we use. +const IPPORT_RESERVEDSTART = 600 + +const ( + IN_CLASSA_NET = 4278190080 + IN_CLASSA_NSHIFT = 24 + IN_CLASSA_HOST = 16777215 + IN_CLASSA_MAX = 128 +) + +const ( + IN_CLASSB_NET = 4294901760 + IN_CLASSB_NSHIFT = 16 + IN_CLASSB_HOST = 65535 + IN_CLASSB_MAX = 65536 +) + +const ( + IN_CLASSC_NET = 4294967040 + IN_CLASSC_NSHIFT = 8 + IN_CLASSC_HOST = 255 +) + +const ( + // These ones aren't really + IN_CLASSD_NET = 4026531840 + // net and host fields, but + IN_CLASSD_NSHIFT = 28 + // routing needn't know. + IN_CLASSD_HOST = 268435455 +) + +// -1 return +const INADDR_NONE = 4294967295 + +// official! +const IN_LOOPBACKNET = 127 + +const INET_ADDRSTRLEN = 16 + +// Options for use with [gs]etsockopt at the IP level. +// First word of comment is data type; bool is stored in int. +const ( + IP_OPTIONS = 1 + // int; header is included with data + IP_HDRINCL = 2 + // int; IP type of service and preced. + IP_TOS = 3 + // int; IP time to live + IP_TTL = 4 + // bool; receive all IP opts w/dgram + IP_RECVOPTS = 5 + // bool; receive IP opts for response + IP_RECVRETOPTS = 6 + // bool; receive IP dst addr w/dgram + IP_RECVDSTADDR = 7 + // ip_opts; set/get IP options + IP_RETOPTS = 8 + // u_char; set/get IP multicast i/f + IP_MULTICAST_IF = 9 + // u_char; set/get IP multicast ttl + IP_MULTICAST_TTL = 10 + // u_char; set/get IP multicast loopback + IP_MULTICAST_LOOP = 11 + // ip_mreq; add an IP group membership + IP_ADD_MEMBERSHIP = 12 + // ip_mreq; drop an IP group membership + IP_DROP_MEMBERSHIP = 13 + // set/get IP mcast virt. iface + IP_MULTICAST_VIF = 14 + // enable RSVP in kernel + IP_RSVP_ON = 15 + // disable RSVP in kernel + IP_RSVP_OFF = 16 + // set RSVP per-vif socket + IP_RSVP_VIF_ON = 17 + // unset RSVP per-vif socket + IP_RSVP_VIF_OFF = 18 + // int; range to choose for unspec port + IP_PORTRANGE = 19 + // bool; receive reception if w/dgram + IP_RECVIF = 20 +) + +// for IPSEC +const ( + IP_IPSEC_POLICY = 21 + // deprecated + IP_FAITH = 22 +) + +// bool: drop receive of raw IP header +const IP_STRIPHDR = 23 + +const ( + // bool; receive reception TTL w/dgram + IP_RECVTTL = 24 + // int; set/get bound interface + IP_BOUND_IF = 25 + // get pktinfo on recv socket, set src on sent dgram + IP_PKTINFO = 26 + // receive pktinfo w/dgram + IP_RECVPKTINFO = 26 + // bool; receive IP TOS w/dgram + IP_RECVTOS = 27 + // don't fragment packet + IP_DONTFRAG = 28 +) + +const ( + // add a firewall rule to chain + IP_FW_ADD = 40 + // delete a firewall rule from chain + IP_FW_DEL = 41 + // flush firewall rule chain + IP_FW_FLUSH = 42 + // clear single/all firewall counter(s) + IP_FW_ZERO = 43 + // get entire firewall rule chain + IP_FW_GET = 44 + // reset logging counters + IP_FW_RESETLOG = 45 +) + +// These older firewall socket option codes are maintained for backward compatibility. +const ( + IP_OLD_FW_ADD = 50 + // delete a firewall rule from chain + IP_OLD_FW_DEL = 51 + // flush firewall rule chain + IP_OLD_FW_FLUSH = 52 + // clear single/all firewall counter(s) + IP_OLD_FW_ZERO = 53 + // get entire firewall rule chain + IP_OLD_FW_GET = 54 + // set/get NAT opts XXX Deprecated, do not use + IP_NAT__XXX = 55 + // reset logging counters + IP_OLD_FW_RESETLOG = 56 +) + +const ( + // add/configure a dummynet pipe + IP_DUMMYNET_CONFIGURE = 60 + // delete a dummynet pipe from chain + IP_DUMMYNET_DEL = 61 + // flush dummynet + IP_DUMMYNET_FLUSH = 62 + // get entire dummynet pipes + IP_DUMMYNET_GET = 64 +) + +const ( + // int*; get background IO flags; set background IO + IP_TRAFFIC_MGT_BACKGROUND = 65 + // int*; set/get IP multicast i/f index + IP_MULTICAST_IFINDEX = 66 +) + +// IPv4 Source Filter Multicast API [RFC3678] +const ( + IP_ADD_SOURCE_MEMBERSHIP = 70 + // drop a single source + IP_DROP_SOURCE_MEMBERSHIP = 71 + // block a source + IP_BLOCK_SOURCE = 72 + // unblock a source + IP_UNBLOCK_SOURCE = 73 +) + +// The following option is private; do not use it from user applications. +const IP_MSFILTER = 74 + +// Protocol Independent Multicast API [RFC3678] +const ( + MCAST_JOIN_GROUP = 80 + // leave all sources for group + MCAST_LEAVE_GROUP = 81 + // join a source-specific group + MCAST_JOIN_SOURCE_GROUP = 82 + // leave a single source + MCAST_LEAVE_SOURCE_GROUP = 83 + // block a source + MCAST_BLOCK_SOURCE = 84 + // unblock a source + MCAST_UNBLOCK_SOURCE = 85 +) + +// Defaults and limits for options +const ( + IP_DEFAULT_MULTICAST_TTL = 1 + // normally hear sends if a member + IP_DEFAULT_MULTICAST_LOOP = 1 +) + +// The imo_membership vector for each socket is now dynamically allocated at +// run-time, bounded by USHRT_MAX, and is reallocated when needed, sized +// according to a power-of-two increment. +const ( + IP_MIN_MEMBERSHIPS = 31 + IP_MAX_MEMBERSHIPS = 4095 +) + +// Default resource limits for IPv4 multicast source filtering. +// These may be modified by sysctl. +const ( + IP_MAX_GROUP_SRC_FILTER = 512 + // sources per socket/group + IP_MAX_SOCK_SRC_FILTER = 128 + // XXX no longer used + IP_MAX_SOCK_MUTE_FILTER = 128 +) + +// Filter modes; also used to represent per-socket filter mode internally. +const ( + MCAST_UNDEFINED = 0 + // fmode: include these source(s) + MCAST_INCLUDE = 1 + // fmode: exclude these source(s) + MCAST_EXCLUDE = 2 +) + +// Argument for IP_PORTRANGE: +// - which range to search when port is unspecified at bind() or connect() +const ( + IP_PORTRANGE_DEFAULT = 0 + // "high" - request firewall bypass + IP_PORTRANGE_HIGH = 1 + // "low" - vouchsafe security + IP_PORTRANGE_LOW = 2 +) + +// Definitions for inet sysctl operations. +// +// Third level is protocol number. +// Fourth level is desired variable within that protocol. +const IPPROTO_MAXID = 52 + +// Names for IP sysctl objects +const ( + IPCTL_FORWARDING = 1 + // may send redirects when forwarding + IPCTL_SENDREDIRECTS = 2 + // default TTL + IPCTL_DEFTTL = 3 +) + +const ( + // cloned route expiration time + IPCTL_RTEXPIRE = 5 + // min value for expiration time + IPCTL_RTMINEXPIRE = 6 + // trigger level for dynamic expire + IPCTL_RTMAXCACHE = 7 + // may perform source routes + IPCTL_SOURCEROUTE = 8 + // may re-broadcast received packets + IPCTL_DIRECTEDBROADCAST = 9 + // max length of netisr queue + IPCTL_INTRQMAXLEN = 10 + // number of netisr q drops + IPCTL_INTRQDROPS = 11 + // ipstat structure + IPCTL_STATS = 12 + // may accept source routed packets + IPCTL_ACCEPTSOURCEROUTE = 13 + // use fast IP forwarding code + IPCTL_FASTFORWARDING = 14 + // deprecated + IPCTL_KEEPFAITH = 15 + // default TTL for gif encap packet + IPCTL_GIF_TTL = 16 + IPCTL_MAXID = 17 +) + +// Internet address (a structure for historical reasons) +type InAddr struct { + Addr InAddrT +} + +// Socket address, internet style. +type SockaddrIn struct { + Len X__Uint8T + Family SaFamilyT + Port InPortT + Addr InAddr + Zero [8]c.Char +} + +// Structure used to describe IP options. +// Used to store options internally, to pass them to a process, +// or to restore options retrieved earlier. +// The ip_dst is used for the first-hop gateway when using a source route +// (this gets put into the header proper). +type IpOpts struct { + IpDst InAddr + IpOpts [40]c.Char +} + +// Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. +type IpMreq struct { + ImrMultiaddr InAddr + ImrInterface InAddr +} + +// Modified argument structure for IP_MULTICAST_IF, obtained from Linux. +// This is used to specify an interface index for multicast sends, as +// the IPv4 legacy APIs do not support this (unless IP_SENDIF is available). +type IpMreqn struct { + ImrMultiaddr InAddr + ImrAddress InAddr + ImrIfindex c.Int +} + +// IP_PKTINFO: Packet information (equivalent to RFC2292 sec 5 for IPv4) +// This structure is used for +// +// 1. Receiving ancilliary data about the datagram if IP_PKTINFO sockopt is +// set on the socket. In this case ipi_ifindex will contain the interface +// index the datagram was received on, ipi_addr is the IP address the +// datagram was received to. +// +// 2. Sending a datagram using a specific interface or IP source address. +// if ipi_ifindex is set to non-zero when in_pktinfo is passed as +// ancilliary data of type IP_PKTINFO, this will be used as the source +// interface to send the datagram from. If ipi_ifindex is null, ip_spec_dst +// will be used for the source address. +// +// Note: if IP_BOUND_IF is set on the socket, ipi_ifindex in the ancillary +// IP_PKTINFO option silently overrides the bound interface when it is +// specified during send time. +type InPktinfo struct { + IpiIfindex c.Uint + IpiSpecDst InAddr + IpiAddr InAddr +} + +// Advanced (Full-state) APIs [RFC3678] +// The RFC specifies uint_t for the 6th argument to [sg]etsourcefilter(). +// We use uint32_t here to be consistent. +// +//go:linkname Setipv4sourcefilter C.setipv4sourcefilter +func Setipv4sourcefilter(_llcppg_param1 c.Int, _llcppg_param2 InAddr, _llcppg_param3 InAddr, _llcppg_param4 Uint32T, _llcppg_param5 Uint32T, _llcppg_param6 *InAddr) c.Int + +//go:linkname Getipv4sourcefilter C.getipv4sourcefilter +func Getipv4sourcefilter(_llcppg_param1 c.Int, _llcppg_param2 InAddr, _llcppg_param3 InAddr, _llcppg_param4 *Uint32T, _llcppg_param5 *Uint32T, _llcppg_param6 *InAddr) c.Int + +//go:linkname Setsourcefilter C.setsourcefilter +func Setsourcefilter(_llcppg_param1 c.Int, _llcppg_param2 Uint32T, _llcppg_param3 *SockAddr, _llcppg_param4 SocklenT, _llcppg_param5 Uint32T, _llcppg_param6 Uint32T, _llcppg_param7 *SockaddrStorage) c.Int + +//go:linkname Getsourcefilter C.getsourcefilter +func Getsourcefilter(_llcppg_param1 c.Int, _llcppg_param2 Uint32T, _llcppg_param3 *SockAddr, _llcppg_param4 SocklenT, _llcppg_param5 *Uint32T, _llcppg_param6 *Uint32T, _llcppg_param7 *SockaddrStorage) c.Int + +//go:linkname Bindresvport C.bindresvport +func Bindresvport(_llcppg_param1 c.Int, _llcppg_param2 *SockaddrIn) c.Int + +//go:linkname BindresvportSa C.bindresvport_sa +func BindresvportSa(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr) c.Int + +// Identification of the network protocol stack +// for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE +// has the table of implementation/integration differences. +const X__KAME_VERSION = "2009/apple-darwin" + +const ( + IPV6PORT_RESERVED = 1024 + IPV6PORT_ANONMIN = 49152 + IPV6PORT_ANONMAX = 65535 + IPV6PORT_RESERVEDMIN = 600 + IPV6PORT_RESERVEDMAX = 1023 +) + +const INET6_ADDRSTRLEN = 46 + +const ( + X__IPV6_ADDR_SCOPE_NODELOCAL = 1 + X__IPV6_ADDR_SCOPE_INTFACELOCAL = 1 + X__IPV6_ADDR_SCOPE_LINKLOCAL = 2 + X__IPV6_ADDR_SCOPE_SITELOCAL = 5 + // just used in this file + X__IPV6_ADDR_SCOPE_ORGLOCAL = 8 + X__IPV6_ADDR_SCOPE_GLOBAL = 14 +) + +const ( + IPV6_ADDR_MC_FLAGS_TRANSIENT = 16 + IPV6_ADDR_MC_FLAGS_PREFIX = 32 + IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 48 +) + +// reserved for future use +const IPV6_SOCKOPT_RESERVED1 = 3 + +const ( + // int; IP6 hops + IPV6_UNICAST_HOPS = 4 + // u_int; set/get IP6 multicast i/f + IPV6_MULTICAST_IF = 9 + // int; set/get IP6 multicast hops + IPV6_MULTICAST_HOPS = 10 + // u_int; set/get IP6 mcast loopback + IPV6_MULTICAST_LOOP = 11 + // ip6_mreq; join a group membership + IPV6_JOIN_GROUP = 12 + // ip6_mreq; leave a group membership + IPV6_LEAVE_GROUP = 13 +) + +const ( + // int; range to choose for unspec port + IPV6_PORTRANGE = 14 + // icmp6_filter; icmp6 filter + ICMP6_FILTER = 18 + // bool; send/recv if, src/dst addr + IPV6_2292PKTINFO = 19 + // bool; hop limit + IPV6_2292HOPLIMIT = 20 + // bool; next hop addr + IPV6_2292NEXTHOP = 21 + // bool; hop-by-hop option + IPV6_2292HOPOPTS = 22 + // bool; destinaion option + IPV6_2292DSTOPTS = 23 + // ip6_rthdr: routing header + IPV6_2292RTHDR = 24 +) + +// buf/cmsghdr; set/get IPv6 options [obsoleted by RFC3542] +const IPV6_2292PKTOPTIONS = 25 + +// int; checksum offset for raw socket +const IPV6_CHECKSUM = 26 + +// bool; only bind INET6 at wildcard bind +const IPV6_V6ONLY = 27 + +const IPV6_BINDV6ONLY = 27 + +// struct; get/set security policy +const IPV6_IPSEC_POLICY = 28 + +// deprecated +const IPV6_FAITH = 29 + +const ( + // add a firewall rule to chain + IPV6_FW_ADD = 30 + // delete a firewall rule from chain + IPV6_FW_DEL = 31 + // flush firewall rule chain + IPV6_FW_FLUSH = 32 + // clear single/all firewall counter(s) + IPV6_FW_ZERO = 33 + // get entire firewall rule chain + IPV6_FW_GET = 34 +) + +// APPLE: NOTE the value of those 2 options is kept unchanged from +// +// previous version of darwin/OS X for binary compatibility reasons +// and differ from FreeBSD (values 57 and 61). See below. +const ( + IPV6_RECVTCLASS = 35 + // int; send traffic class value + IPV6_TCLASS = 36 +) + +// int; set/get bound interface +const IPV6_BOUND_IF = 125 + +const ( + // this hop need not be a neighbor. + IPV6_RTHDR_LOOSE = 0 + // this hop must be a neighbor. + IPV6_RTHDR_STRICT = 1 + // IPv6 routing header type 0 + IPV6_RTHDR_TYPE_0 = 0 +) + +// Defaults and limits for options +const ( + IPV6_DEFAULT_MULTICAST_HOPS = 1 + // normally hear sends if a member + IPV6_DEFAULT_MULTICAST_LOOP = 1 +) + +// The im6o_membership vector for each socket is now dynamically allocated at +// run-time, bounded by USHRT_MAX, and is reallocated when needed, sized +// according to a power-of-two increment. +const ( + IPV6_MIN_MEMBERSHIPS = 31 + IPV6_MAX_MEMBERSHIPS = 4095 +) + +// Default resource limits for IPv6 multicast source filtering. +// These may be modified by sysctl. +const ( + IPV6_MAX_GROUP_SRC_FILTER = 512 + // sources per socket/group + IPV6_MAX_SOCK_SRC_FILTER = 128 +) + +// Argument for IPV6_PORTRANGE: +// - which range to search when port is unspecified at bind() or connect() +const ( + IPV6_PORTRANGE_DEFAULT = 0 + // "high" - request firewall bypass + IPV6_PORTRANGE_HIGH = 1 + // "low" - vouchsafe security + IPV6_PORTRANGE_LOW = 2 +) + +// Definitions for inet6 sysctl operations. +// +// Third level is protocol number. +// Fourth level is desired variable within that protocol. +const IPV6PROTO_MAXID = 104 + +// Names for IP sysctl objects +const ( + IPV6CTL_FORWARDING = 1 + // may send redirects when forwarding + IPV6CTL_SENDREDIRECTS = 2 + // default Hop-Limit + IPV6CTL_DEFHLIM = 3 +) + +const ( + // forward source-routed dgrams + IPV6CTL_FORWSRCRT = 5 + // stats + IPV6CTL_STATS = 6 + // multicast forwarding stats + IPV6CTL_MRTSTATS = 7 + // multicast routing protocol + IPV6CTL_MRTPROTO = 8 + // max packets reassembly queue + IPV6CTL_MAXFRAGPACKETS = 9 + // verify source route and intf + IPV6CTL_SOURCECHECK = 10 + // minimume logging interval + IPV6CTL_SOURCECHECK_LOGINT = 11 + IPV6CTL_ACCEPT_RTADV = 12 + // deprecated + IPV6CTL_KEEPFAITH = 13 + IPV6CTL_LOG_INTERVAL = 14 + IPV6CTL_HDRNESTLIMIT = 15 + IPV6CTL_DAD_COUNT = 16 + IPV6CTL_AUTO_FLOWLABEL = 17 + IPV6CTL_DEFMCASTHLIM = 18 + // default HLIM for gif encap packet + IPV6CTL_GIF_HLIM = 19 + IPV6CTL_KAME_VERSION = 20 + // use deprec addr (RFC2462 5.5.4) + IPV6CTL_USE_DEPRECATED = 21 + // walk timer for router renumbering + IPV6CTL_RR_PRUNE = 22 +) + +const ( + IPV6CTL_V6ONLY = 24 + // cloned route expiration time + IPV6CTL_RTEXPIRE = 25 + // min value for expiration time + IPV6CTL_RTMINEXPIRE = 26 + // trigger level for dynamic expire + IPV6CTL_RTMAXCACHE = 27 +) + +const ( + // use temporary addresses [RFC 4941] + IPV6CTL_USETEMPADDR = 32 + // preferred lifetime for tmpaddrs + IPV6CTL_TEMPPLTIME = 33 + // valid lifetime for tmpaddrs + IPV6CTL_TEMPVLTIME = 34 + // automatic link-local addr assign + IPV6CTL_AUTO_LINKLOCAL = 35 + // raw_ip6 stats + IPV6CTL_RIP6STATS = 36 + // prefer temporary addr as src + IPV6CTL_PREFER_TEMPADDR = 37 + // get/set address selection policy + IPV6CTL_ADDRCTLPOLICY = 38 + // use default scope zone + IPV6CTL_USE_DEFAULTZONE = 39 +) + +const ( + // max fragments + IPV6CTL_MAXFRAGS = 41 + // enable pMTU discovery for mcast? + IPV6CTL_MCAST_PMTU = 44 +) + +const ( + IPV6CTL_NEIGHBORGCTHRESH = 46 + IPV6CTL_MAXIFPREFIXES = 47 + IPV6CTL_MAXIFDEFROUTERS = 48 + IPV6CTL_MAXDYNROUTES = 49 + ICMPV6CTL_ND6_ONLINKNSRFC4861 = 50 + IPV6CTL_ULA_USETEMPADDR = 51 +) + +// to define items, should talk with KAME guys first, for *BSD compatibility +const IPV6CTL_MAXID = 51 + +// In6Addr retains the byte array API and the native IPv6 union alignment. +type In6Addr struct { + _ [0]uint32 + U6Addr [16]uint8 +} + +type SockaddrIn6 struct { + Len X__Uint8T + Family SaFamilyT + Port InPortT + Flowinfo X__Uint32T + Addr In6Addr + ScopeId X__Uint32T +} + +// Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP. +type Ipv6Mreq struct { + Ipv6mrMultiaddr In6Addr + Ipv6mrInterface c.Uint +} + +// IPV6_2292PKTINFO: Packet information(RFC2292 sec 5) +type In6Pktinfo struct { + Ipi6Addr In6Addr + Ipi6Ifindex c.Uint +} + +// Control structure for IPV6_RECVPATHMTU socket option. +type Ip6Mtuinfo struct { + Ip6mAddr SockaddrIn6 + Ip6mMtu Uint32T +} + +// IPv6 address +type In6AddrT = In6Addr + +//go:linkname In6addrAny C.in6addr_any +var In6addrAny In6Addr + +//go:linkname In6addrLoopback C.in6addr_loopback +var In6addrLoopback In6Addr + +//go:linkname In6addrNodelocalAllnodes C.in6addr_nodelocal_allnodes +var In6addrNodelocalAllnodes In6Addr + +//go:linkname In6addrLinklocalAllnodes C.in6addr_linklocal_allnodes +var In6addrLinklocalAllnodes In6Addr + +//go:linkname In6addrLinklocalAllrouters C.in6addr_linklocal_allrouters +var In6addrLinklocalAllrouters In6Addr + +//go:linkname In6addrLinklocalAllv2routers C.in6addr_linklocal_allv2routers +var In6addrLinklocalAllv2routers In6Addr + +//go:linkname Inet6OptionSpace C.inet6_option_space +func Inet6OptionSpace(_llcppg_param1 c.Int) c.Int + +//go:linkname Inet6RthdrSpace C.inet6_rthdr_space +func Inet6RthdrSpace(_llcppg_param1 c.Int, _llcppg_param2 c.Int) SizeT + +//go:linkname Inet6OptInit C.inet6_opt_init +func Inet6OptInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT) c.Int + +//go:linkname Inet6OptAppend C.inet6_opt_append +func Inet6OptAppend(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int, _llcppg_param4 X__Uint8T, _llcppg_param5 SocklenT, _llcppg_param6 X__Uint8T, _llcppg_param7 *unsafe.Pointer) c.Int + +//go:linkname Inet6OptFinish C.inet6_opt_finish +func Inet6OptFinish(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int) c.Int + +//go:linkname Inet6OptSetVal C.inet6_opt_set_val +func Inet6OptSetVal(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SocklenT) c.Int + +//go:linkname Inet6OptNext C.inet6_opt_next +func Inet6OptNext(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int, _llcppg_param4 *X__Uint8T, _llcppg_param5 *SocklenT, _llcppg_param6 *unsafe.Pointer) c.Int + +//go:linkname Inet6OptFind C.inet6_opt_find +func Inet6OptFind(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int, _llcppg_param4 X__Uint8T, _llcppg_param5 *SocklenT, _llcppg_param6 *unsafe.Pointer) c.Int + +//go:linkname Inet6OptGetVal C.inet6_opt_get_val +func Inet6OptGetVal(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SocklenT) c.Int + +//go:linkname Inet6RthSpace C.inet6_rth_space +func Inet6RthSpace(_llcppg_param1 c.Int, _llcppg_param2 c.Int) SocklenT + +//go:linkname Inet6RthInit C.inet6_rth_init +func Inet6RthInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int, _llcppg_param4 c.Int) unsafe.Pointer + +//go:linkname Inet6RthAdd C.inet6_rth_add +func Inet6RthAdd(_llcppg_param1 unsafe.Pointer, _llcppg_param2 *In6Addr) c.Int + +//go:linkname Inet6RthReverse C.inet6_rth_reverse +func Inet6RthReverse(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer) c.Int + +//go:linkname Inet6RthSegments C.inet6_rth_segments +func Inet6RthSegments(_llcppg_param1 unsafe.Pointer) c.Int + +//go:linkname Inet6RthGetaddr C.inet6_rth_getaddr +func Inet6RthGetaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int) *In6Addr + +// base type for internet address +type InAddrT = X__Uint32T + +type InPortT = X__Uint16T + +type Int32T = c.Int + +type Iovec = c.Iovec + +type OffT = X__DarwinOffT + +type SaFamilyT = X__Uint8T + +type SizeT = X__DarwinSizeT + +type SocklenT = X__DarwinSocklenT + +type SsizeT = X__DarwinSsizeT + +type UChar = uint8 + +type UInt32T = c.Uint + +type UShort = uint16 + +// [???] Used for file sizes +type X__DarwinOffT = X__Int64T + +// Types +const ( +// datagram socket +// raw-protocol interface +) + +// reliably-delivered message + +// sequenced packet stream + +// Option flags per-socket. +const ( + SO_DEBUG = 1 + // socket has had listen() + SO_ACCEPTCONN = 2 + // allow local address reuse + SO_REUSEADDR = 4 + // keep connections alive + SO_KEEPALIVE = 8 + // just use interface addresses + SO_DONTROUTE = 16 + // permit sending of broadcast msgs + SO_BROADCAST = 32 +) + +const ( + // bypass hardware when possible + SO_USELOOPBACK = 64 + // linger on close if data present (in ticks) + SO_LINGER = 128 + // linger on close if data present (in seconds) + SO_LINGER_SEC = 4224 +) + +// leave received OOB data in line +const SO_OOBINLINE = 256 + +const ( + // allow local address & port reuse + SO_REUSEPORT = 512 + // timestamp received dgram traffic + SO_TIMESTAMP = 1024 + // Monotonically increasing timestamp on rcvd dgram + SO_TIMESTAMP_MONOTONIC = 2048 +) + +// APPLE: Retain unread data +const SO_DONTTRUNC = 8192 + +// (ATOMIC proto) +const ( + SO_WANTMORE = 16384 + // APPLE: Want OOB in MSG_FLAG on receive + SO_WANTOOBFLAG = 32768 +) + +// Additional options, not kept in so_options. +const ( + SO_SNDBUF = 4097 + // receive buffer size + SO_RCVBUF = 4098 + // send low-water mark + SO_SNDLOWAT = 4099 + // receive low-water mark + SO_RCVLOWAT = 4100 + // send timeout + SO_SNDTIMEO = 4101 + // receive timeout + SO_RCVTIMEO = 4102 + // get error status and clear + SO_ERROR = 4103 + // get socket type + SO_TYPE = 4104 +) + +const ( + // deprecated + SO_LABEL = 4112 + // deprecated + SO_PEERLABEL = 4113 +) + +const ( + // APPLE: get 1st-packet byte count + SO_NREAD = 4128 + // APPLE: Install socket-level NKE + SO_NKE = 4129 + // APPLE: No SIGPIPE on EPIPE + SO_NOSIGPIPE = 4130 + // APPLE: Returns EADDRNOTAVAIL when src is not available anymore + SO_NOADDRERR = 4131 + // APPLE: Get number of bytes currently in send socket buffer + SO_NWRITE = 4132 + // APPLE: Allow reuse of port/socket by different userids + SO_REUSESHAREUID = 4133 +) + +const ( + // APPLE: send notification if there is a bind on a port which is already in use + SO_NOTIFYCONFLICT = 4134 + // APPLE: block on close until an upcall returns + SO_UPCALLCLOSEWAIT = 4135 +) + +const ( + // APPLE: request local port randomization + SO_RANDOMPORT = 4226 + // To turn off some POSIX behavior + SO_NP_EXTENSIONS = 4227 +) + +const ( + // number of datagrams in receive socket buffer + SO_NUMRCVPKT = 4370 + // Network service type + SO_NET_SERVICE_TYPE = 4374 +) + +// Get QoS marking in effect for socket +const SO_NETSVC_MARKING_LEVEL = 4377 + +// A signed data blob from the system resolver +const SO_RESOLVER_SIGNATURE = 4401 + +const ( + // Best effort + NET_SERVICE_TYPE_BE = 0 + // Background system initiated + NET_SERVICE_TYPE_BK = 1 + // Signaling + NET_SERVICE_TYPE_SIG = 2 + // Interactive Video + NET_SERVICE_TYPE_VI = 3 + // Interactive Voice + NET_SERVICE_TYPE_VO = 4 + // Responsive Multimedia Audio/Video + NET_SERVICE_TYPE_RV = 5 + // Multimedia Audio/Video Streaming + NET_SERVICE_TYPE_AV = 6 + // Operations, Administration, and Management + NET_SERVICE_TYPE_OAM = 7 + // Responsive Data + NET_SERVICE_TYPE_RD = 8 +) + +// These are supported values for SO_NETSVC_MARKING_LEVEL +const ( + NETSVC_MRKNG_UNKNOWN = 0 + // Default marking at layer 2 (for example Wi-Fi WMM) + NETSVC_MRKNG_LVL_L2 = 1 + // Layer 3 DSCP marking and layer 2 marking for all Network Service Types + NETSVC_MRKNG_LVL_L3L2_ALL = 2 + // The system policy limits layer 3 DSCP marking and layer 2 marking + // to background Network Service Types + NETSVC_MRKNG_LVL_L3L2_BK = 3 +) + +const SAE_ASSOCID_ANY = 0 + +const SAE_CONNID_ANY = 0 + +// connectx() flag parameters +const ( + CONNECT_RESUME_ON_READ_WRITE = 1 + // data is idempotent + CONNECT_DATA_IDEMPOTENT = 2 + // data includes security that replaces the TFO-cookie + CONNECT_DATA_AUTHENTICATED = 4 +) + +// flag for allowing setsockopt after shutdown +const SONPX_SETOPTSHUT = 1 + +// Level number for (get/set)sockopt() to apply to socket itself. +const SOL_SOCKET = 65535 + +// Address families. +const ( + AF_UNSPEC = 0 + // local to host (pipes) + AF_UNIX = 1 +) + +// backward compatibility +const AF_LOCAL = 1 + +// internetwork: UDP, TCP, etc. +const AF_INET = 2 + +const ( + // arpanet imp addresses + AF_IMPLINK = 3 + // pup protocols: e.g. BSP + AF_PUP = 4 + // mit CHAOS protocols + AF_CHAOS = 5 + // XEROX NS protocols + AF_NS = 6 + // ISO protocols + AF_ISO = 7 + AF_OSI = 7 + // European computer manufacturers + AF_ECMA = 8 + // datakit protocols + AF_DATAKIT = 9 + // CCITT protocols, X.25 etc + AF_CCITT = 10 + // IBM SNA + AF_SNA = 11 + // DECnet + AF_DECnet = 12 + // DEC Direct data link interface + AF_DLI = 13 + // LAT + AF_LAT = 14 + // NSC Hyperchannel + AF_HYLINK = 15 + // Apple Talk + AF_APPLETALK = 16 + // Internal Routing Protocol + AF_ROUTE = 17 + // Link layer interface + AF_LINK = 18 + // eXpress Transfer Protocol (no AF) + Pseudo_AF_XTP = 19 + // connection-oriented IP, aka ST II + AF_COIP = 20 + // Computer Network Technology + AF_CNT = 21 + // Help Identify RTIP packets + Pseudo_AF_RTIP = 22 + // Novell Internet Protocol + AF_IPX = 23 + // Simple Internet Protocol + AF_SIP = 24 + // Help Identify PIP packets + Pseudo_AF_PIP = 25 + // Network Driver 'raw' access + AF_NDRV = 27 + // Integrated Services Digital Network + AF_ISDN = 28 + // CCITT E.164 recommendation + AF_E164 = 28 + // Internal key-management function + Pseudo_AF_KEY = 29 +) + +// IPv6 +const AF_INET6 = 30 + +const ( + // native ATM access + AF_NATM = 31 + // Kernel event messages + AF_SYSTEM = 32 + // NetBIOS + AF_NETBIOS = 33 + // PPP communication protocol + AF_PPP = 34 + // Used by BPF to not rewrite headers + // in interface output routine + Pseudo_AF_HDRCMPLT = 35 +) + +const ( + // Reserved for internal usage + AF_RESERVED_36 = 36 + // IEEE 802.11 protocol + AF_IEEE80211 = 37 + AF_UTUN = 38 + // VM Sockets + AF_VSOCK = 40 + AF_MAX = 41 +) + +// longest possible addresses +const SOCK_MAXADDRLEN = 255 + +// RFC 2553: protocol-independent placeholder for socket addresses +const X_SS_MAXSIZE = 128 + +// Protocol families, same as address families for now. +const ( + PF_UNSPEC = 0 + PF_LOCAL = 1 + // backward compatibility + PF_UNIX = 1 + PF_INET = 2 + PF_IMPLINK = 3 + PF_PUP = 4 + PF_CHAOS = 5 + PF_NS = 6 + PF_ISO = 7 + PF_OSI = 7 + PF_ECMA = 8 + PF_DATAKIT = 9 + PF_CCITT = 10 + PF_SNA = 11 + PF_DECnet = 12 + PF_DLI = 13 + PF_LAT = 14 + PF_HYLINK = 15 + PF_APPLETALK = 16 + PF_ROUTE = 17 + PF_LINK = 18 + // really just proto family, no AF + PF_XTP = 19 + PF_COIP = 20 + PF_CNT = 21 + PF_SIP = 24 + // same format as AF_NS + PF_IPX = 23 + // same format as AF_INET + PF_RTIP = 22 + PF_PIP = 25 + PF_NDRV = 27 + PF_ISDN = 28 + PF_KEY = 29 + PF_INET6 = 30 + PF_NATM = 31 + PF_SYSTEM = 32 + PF_NETBIOS = 33 + PF_PPP = 34 + PF_RESERVED_36 = 36 + PF_UTUN = 38 + PF_VSOCK = 40 + PF_MAX = 41 +) + +const NET_MAXID = 41 + +// PF_ROUTE - Routing table +// +// Three additional levels are defined: +// +// Fourth: address family, 0 is wildcard +// Fifth: type of info, defined below +// Sixth: flag(s) to mask with for NET_RT_FLAGS +const ( + NET_RT_DUMP = 1 + // by flags, e.g. RESOLVING + NET_RT_FLAGS = 2 + // survey interface list + NET_RT_IFLIST = 3 + // routing statistics + NET_RT_STAT = 4 + // routes not in table but not freed + NET_RT_TRASH = 5 + // interface list with addresses + NET_RT_IFLIST2 = 6 + // dump; may limit to a.f. + NET_RT_DUMP2 = 7 +) + +// Allows read access non-local host's MAC address +// if the process has neighbor cache entitlement. +const ( + NET_RT_FLAGS_PRIV = 10 + NET_RT_MAXID = 11 +) + +// Maximum queue length specifiable by listen. +const SOMAXCONN = 128 + +const ( + // process out-of-band data + MSG_OOB = 1 + // peek at incoming message + MSG_PEEK = 2 + // send without using routing tables + MSG_DONTROUTE = 4 + // data completes record + MSG_EOR = 8 + // data discarded before delivery + MSG_TRUNC = 16 + // control data lost before delivery + MSG_CTRUNC = 32 + // wait for full request or error + MSG_WAITALL = 64 +) + +const ( + // this message should be nonblocking + MSG_DONTWAIT = 128 + // data completes connection + MSG_EOF = 256 +) + +// wait up to full request.. may return partial +const MSG_WAITSTREAM = 512 + +const ( + // Start of 'hold' seq; dump so_temp, deprecated + MSG_FLUSH = 1024 + // Hold frag in so_temp, deprecated + MSG_HOLD = 2048 + // Send the packet in so_temp, deprecated + MSG_SEND = 4096 + // Data ready to be read + MSG_HAVEMORE = 8192 + // Data remains in current pkt + MSG_RCVMORE = 16384 +) + +// Fail receive if socket address cannot be allocated +const MSG_NEEDSA = 65536 + +// do not generate SIGPIPE on EOF +const MSG_NOSIGNAL = 524288 + +// "Socket"-level control message types: +const SCM_RIGHTS = 1 + +const ( + // timestamp (struct timeval) + SCM_TIMESTAMP = 2 + // process creds (struct cmsgcred) + SCM_CREDS = 3 + // timestamp (uint64_t) + SCM_TIMESTAMP_MONOTONIC = 4 +) + +// howto arguments for shutdown(2), specified by Posix.1g. +const ( + SHUT_RD = 0 + // shut down the writing side + SHUT_WR = 1 + // shut down both sides + SHUT_RDWR = 2 +) + +// sockaddr endpoints +type SaEndpoints struct { + SaeSrcif c.Uint + SaeSrcaddr *SockAddr + SaeSrcaddrlen SocklenT + SaeDstaddr *SockAddr + SaeDstaddrlen SocklenT +} + +// Structure used for manipulating linger option. +type Linger struct { + LOnoff c.Int + LLinger c.Int +} + +// Structure to control non-portable Sockets extension to POSIX +type SoNpExtensions struct { + NpxFlags UInt32T + NpxMask UInt32T +} + +// [XSI] Structure used by kernel to store most addresses. +type SockAddr struct { + Len X__Uint8T + Family SaFamilyT + Data [14]c.Char +} + +// Least amount of information that a sockaddr requires. +// Sockaddr_header is a compatible prefix structure of +// all sockaddr objects. +type X__SockaddrHeader struct { + SaLen X__Uint8T + SaFamily SaFamilyT +} + +// Structure used by kernel to pass protocol +// information in raw sockets. +type Sockproto struct { + SpFamily X__Uint16T + SpProtocol X__Uint16T +} + +// [XSI] sockaddr_storage +type SockaddrStorage struct { + Len X__Uint8T + Family SaFamilyT + pad1 [6]c.Char + align X__Int64T + pad2 [112]c.Char +} + +// [XSI] Message header for recvmsg and sendmsg calls. +// Used value-result for recvmsg, value only for sendmsg. +type Msghdr struct { + MsgName unsafe.Pointer + MsgNamelen SocklenT + MsgIov *Iovec + MsgIovlen c.Int + MsgControl unsafe.Pointer + MsgControllen SocklenT + MsgFlags c.Int +} + +// sendfile(2) header/trailer struct +type SfHdtr struct { + Headers *Iovec + HdrCnt c.Int + Trailers *Iovec + TrlCnt c.Int +} + +type SaeAssocidT = X__Uint32T + +type SaeConnidT = X__Uint32T + +// sockaddr endpoints +type SaEndpointsT = SaEndpoints + +//go:linkname Getpeername C.getpeername +func Getpeername(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 *SocklenT) c.Int + +//go:linkname Getsockname C.getsockname +func Getsockname(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 *SocklenT) c.Int + +//go:linkname Getsockopt C.getsockopt +func Getsockopt(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 unsafe.Pointer, _llcppg_param5 *SocklenT) c.Int + +//go:linkname Recvfrom C.recvfrom +func Recvfrom(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int, _llcppg_param5 *SockAddr, _llcppg_param6 *SocklenT) SsizeT + +//go:linkname Recvmsg C.recvmsg +func Recvmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) SsizeT + +//go:linkname Sendmsg C.sendmsg +func Sendmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) SsizeT + +//go:linkname Sendto C.sendto +func Sendto(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int, _llcppg_param5 *SockAddr, _llcppg_param6 SocklenT) SsizeT + +//go:linkname Shutdown C.shutdown +func Shutdown(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Sockatmark C.sockatmark +func Sockatmark(_llcppg_param1 c.Int) c.Int + +//go:linkname Socketpair C.socketpair +func Socketpair(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) c.Int + +//go:linkname Sendfile C.sendfile +func Sendfile(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 OffT, _llcppg_param4 *OffT, _llcppg_param5 *SfHdtr, _llcppg_param6 c.Int) c.Int + +//go:linkname Connectx C.connectx +func Connectx(_llcppg_param1 c.Int, _llcppg_param2 *SaEndpointsT, _llcppg_param3 SaeAssocidT, _llcppg_param4 c.Uint, _llcppg_param5 *Iovec, _llcppg_param6 c.Uint, _llcppg_param7 *SizeT, _llcppg_param8 *SaeConnidT) c.Int + +//go:linkname Disconnectx C.disconnectx +func Disconnectx(_llcppg_param1 c.Int, _llcppg_param2 SaeAssocidT, _llcppg_param3 SaeConnidT) c.Int + +// Level number of get/setsockopt for local domain sockets +const SOL_LOCAL = 0 + +// Socket options. +const ( + LOCAL_PEERCRED = 1 + // retrieve peer pid + LOCAL_PEERPID = 2 + // retrieve eff. peer pid + LOCAL_PEEREPID = 3 + // retrieve peer UUID + LOCAL_PEERUUID = 4 + // retrieve eff. peer UUID + LOCAL_PEEREUUID = 5 + // retrieve peer audit token + LOCAL_PEERTOKEN = 6 +) + +// [XSI] Definitions for UNIX IPC domain. +type SockaddrUn struct { + SunLen uint8 + SunFamily SaFamilyT + SunPath [104]c.Char +} + +type Uint32T = c.Uint diff --git a/c/net/libc_linux_amd64.go b/c/net/libc_linux_amd64.go new file mode 100644 index 00000000..2aa537fc --- /dev/null +++ b/c/net/libc_linux_amd64.go @@ -0,0 +1,1803 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_ARPA_INET_H = 1 + +// Return the local host address part of the Internet address in IN. +// +// llgo:link InAddr.InetLnaof C.inet_lnaof +func (self InAddr) InetLnaof() InAddrT { + return 0 +} + +// Make Internet host address in network byte order by combining the +// network number NET with the local address HOST. +// +//go:linkname InetMakeaddr C.inet_makeaddr +func InetMakeaddr(__net InAddrT, __host InAddrT) InAddr + +// Return network number part of the Internet address IN. +// +// llgo:link InAddr.InetNetof C.inet_netof +func (self InAddr) InetNetof() InAddrT { + return 0 +} + +// Extract the network number in network byte order from the address +// in numbers-and-dots natation starting at CP. +// +//go:linkname InetNetwork C.inet_network +func InetNetwork(__cp *c.Char) InAddrT + +// Convert Internet number in IN to ASCII representation. The return value +// is a pointer to an internal array containing the string. +// +// llgo:link InAddr.InetNtoa C.inet_ntoa +func (self InAddr) InetNtoa() *c.Char { + return nil +} + +// Convert from presentation format of an Internet number in buffer +// starting at CP to the binary network format and store result for +// interface type AF in buffer starting at BUF. +// +//go:linkname InetPton C.inet_pton +func InetPton(__af c.Int, __cp *c.Char, __buf unsafe.Pointer) c.Int + +// Convert Internet host address from numbers-and-dots notation in CP +// into binary data and store the result in the structure INP. +// +//go:linkname InetAton C.inet_aton +func InetAton(__cp *c.Char, __inp *InAddr) c.Int + +// Convert ASCII representation in hexadecimal form of the Internet +// address to binary form and place result in buffer of length LEN +// starting at BUF. +// +//go:linkname InetNsapAddr C.inet_nsap_addr +func InetNsapAddr(__cp *c.Char, __buf *uint8, __len c.Int) c.Uint + +// Convert internet address in binary form in LEN bytes starting at CP +// a presentation form and place result in BUF. +// +//go:linkname InetNsapNtoa C.inet_nsap_ntoa +func InetNsapNtoa(__len c.Int, __cp *uint8, __buf *c.Char) *c.Char + +// For setsockopt(2) +const SOL_SOCKET = 1 + +const ( + SO_DEBUG = 1 + SO_REUSEADDR = 2 + SO_TYPE = 3 + SO_ERROR = 4 + SO_DONTROUTE = 5 + SO_BROADCAST = 6 + SO_SNDBUF = 7 + SO_RCVBUF = 8 + SO_SNDBUFFORCE = 32 + SO_RCVBUFFORCE = 33 + SO_KEEPALIVE = 9 + SO_OOBINLINE = 10 + SO_NO_CHECK = 11 + SO_PRIORITY = 12 + SO_LINGER = 13 + SO_BSDCOMPAT = 14 + SO_REUSEPORT = 15 +) + +const ( + SO_PASSCRED = 16 + SO_PEERCRED = 17 + SO_RCVLOWAT = 18 + SO_SNDLOWAT = 19 + SO_RCVTIMEO = 20 + SO_SNDTIMEO = 21 +) + +// Security levels - as per NRL IPv6 - don't actually do anything +const ( + SO_SECURITY_AUTHENTICATION = 22 + SO_SECURITY_ENCRYPTION_TRANSPORT = 23 + SO_SECURITY_ENCRYPTION_NETWORK = 24 +) + +const SO_BINDTODEVICE = 25 + +// Socket filtering +const ( + SO_ATTACH_FILTER = 26 + SO_DETACH_FILTER = 27 + SO_GET_FILTER = 26 +) + +const ( + SO_PEERNAME = 28 + SO_TIMESTAMP = 29 + SCM_TIMESTAMP = 29 +) + +const SO_ACCEPTCONN = 30 + +const ( + SO_PEERSEC = 31 + SO_PASSSEC = 34 + SO_TIMESTAMPNS = 35 + SCM_TIMESTAMPNS = 35 +) + +const SO_MARK = 36 + +const ( + SO_TIMESTAMPING = 37 + SCM_TIMESTAMPING = 37 +) + +const ( + SO_PROTOCOL = 38 + SO_DOMAIN = 39 +) + +const SO_RXQ_OVFL = 40 + +const ( + SO_WIFI_STATUS = 41 + SCM_WIFI_STATUS = 41 + SO_PEEK_OFF = 42 +) + +// Instruct lower device to use last 4-bytes of skb data as FCS +const SO_NOFCS = 43 + +const SO_LOCK_FILTER = 44 + +const SO_SELECT_ERR_QUEUE = 45 + +// Socket-level I/O control calls. +const ( + FIOSETOWN = 35073 + SIOCSPGRP = 35074 + FIOGETOWN = 35075 + SIOCGPGRP = 35076 + SIOCATMARK = 35077 + // Get stamp (timeval) + SIOCGSTAMP = 35078 + // Get stamp (timespec) + SIOCGSTAMPNS = 35079 +) + +const X__USE_KERNEL_IPV6_DEFS = 0 + +// Options for use with `getsockopt' and `setsockopt' at the IP level. +// The first word in the comment at the right is the data type used; +// "bool" means a boolean value stored in an `int'. +const ( + IP_OPTIONS = 4 + // int; Header is included with data. + IP_HDRINCL = 3 + // int; IP type of service and precedence. + IP_TOS = 1 + // int; IP time to live. + IP_TTL = 2 + // bool; Receive all IP options w/datagram. + IP_RECVOPTS = 6 +) + +// For BSD compatibility. +const ( + // ip_opts; Set/get IP per-packet options. + IP_RETOPTS = 7 + // in_addr; set/get IP multicast i/f + IP_MULTICAST_IF = 32 + // u_char; set/get IP multicast ttl + IP_MULTICAST_TTL = 33 + // i_char; set/get IP multicast loopback + IP_MULTICAST_LOOP = 34 + // ip_mreq; add an IP group membership + IP_ADD_MEMBERSHIP = 35 + // ip_mreq; drop an IP group membership + IP_DROP_MEMBERSHIP = 36 + // ip_mreq_source: unblock data from source + IP_UNBLOCK_SOURCE = 37 + // ip_mreq_source: block data from source + IP_BLOCK_SOURCE = 38 + // ip_mreq_source: join source group + IP_ADD_SOURCE_MEMBERSHIP = 39 + // ip_mreq_source: leave source group + IP_DROP_SOURCE_MEMBERSHIP = 40 + IP_MSFILTER = 41 +) + +const ( + // group_req: join any-source group + MCAST_JOIN_GROUP = 42 + // group_source_req: block from given group + MCAST_BLOCK_SOURCE = 43 + // group_source_req: unblock from given group + MCAST_UNBLOCK_SOURCE = 44 + // group_req: leave any-source group + MCAST_LEAVE_GROUP = 45 + // group_source_req: join source-spec gr + MCAST_JOIN_SOURCE_GROUP = 46 + // group_source_req: leave source-spec gr + MCAST_LEAVE_SOURCE_GROUP = 47 + MCAST_MSFILTER = 48 + IP_MULTICAST_ALL = 49 + IP_UNICAST_IF = 50 +) + +const ( + MCAST_EXCLUDE = 0 + MCAST_INCLUDE = 1 +) + +const ( + // bool + IP_ROUTER_ALERT = 5 + // bool + IP_PKTINFO = 8 + IP_PKTOPTIONS = 9 + // obsolete name? + IP_PMTUDISC = 10 + // int; see below + IP_MTU_DISCOVER = 10 + // bool + IP_RECVERR = 11 + // bool + IP_RECVTTL = 12 + // bool + IP_RECVTOS = 13 + // int + IP_MTU = 14 + IP_FREEBIND = 15 + IP_IPSEC_POLICY = 16 + IP_XFRM_POLICY = 17 + IP_PASSSEC = 18 + IP_TRANSPARENT = 19 +) + +// TProxy original addresses +const ( + IP_ORIGDSTADDR = 20 + IP_RECVORIGDSTADDR = 20 +) + +const ( + IP_MINTTL = 21 + IP_NODEFRAG = 22 + IP_CHECKSUM = 23 + IP_BIND_ADDRESS_NO_PORT = 24 +) + +// IP_MTU_DISCOVER arguments. +const ( + IP_PMTUDISC_DONT = 0 + // Use per route hints. + IP_PMTUDISC_WANT = 1 + // Always DF. + IP_PMTUDISC_DO = 2 + // Ignore dst pmtu. + IP_PMTUDISC_PROBE = 3 +) + +// Always use interface mtu (ignores dst pmtu) but don't set DF flag. +// Also incoming ICMP frag_needed notifications will be ignored on +// this socket to prevent accepting spoofed ones. +const IP_PMTUDISC_INTERFACE = 4 + +// Like IP_PMTUDISC_INTERFACE but allow packets to be fragmented. +const IP_PMTUDISC_OMIT = 5 + +// To select the IP level. +const SOL_IP = 0 + +const ( + IP_DEFAULT_MULTICAST_TTL = 1 + IP_DEFAULT_MULTICAST_LOOP = 1 + IP_MAX_MEMBERSHIPS = 20 +) + +// Options for use with `getsockopt' and `setsockopt' at the IPv6 level. +// The first word in the comment at the right is the data type used; +// "bool" means a boolean value stored in an `int'. +const ( + IPV6_ADDRFORM = 1 + IPV6_2292PKTINFO = 2 + IPV6_2292HOPOPTS = 3 + IPV6_2292DSTOPTS = 4 + IPV6_2292RTHDR = 5 + IPV6_2292PKTOPTIONS = 6 + IPV6_CHECKSUM = 7 + IPV6_2292HOPLIMIT = 8 +) + +const ( + IPV6_NEXTHOP = 9 + IPV6_AUTHHDR = 10 + IPV6_UNICAST_HOPS = 16 + IPV6_MULTICAST_IF = 17 + IPV6_MULTICAST_HOPS = 18 + IPV6_MULTICAST_LOOP = 19 + IPV6_JOIN_GROUP = 20 + IPV6_LEAVE_GROUP = 21 + IPV6_ROUTER_ALERT = 22 + IPV6_MTU_DISCOVER = 23 + IPV6_MTU = 24 + IPV6_RECVERR = 25 + IPV6_V6ONLY = 26 + IPV6_JOIN_ANYCAST = 27 + IPV6_LEAVE_ANYCAST = 28 + IPV6_IPSEC_POLICY = 34 + IPV6_XFRM_POLICY = 35 + IPV6_HDRINCL = 36 +) + +// Advanced API (RFC3542) (1). +const ( + IPV6_RECVPKTINFO = 49 + IPV6_PKTINFO = 50 + IPV6_RECVHOPLIMIT = 51 + IPV6_HOPLIMIT = 52 + IPV6_RECVHOPOPTS = 53 + IPV6_HOPOPTS = 54 + IPV6_RTHDRDSTOPTS = 55 + IPV6_RECVRTHDR = 56 + IPV6_RTHDR = 57 + IPV6_RECVDSTOPTS = 58 + IPV6_DSTOPTS = 59 + IPV6_RECVPATHMTU = 60 + IPV6_PATHMTU = 61 + IPV6_DONTFRAG = 62 +) + +// Advanced API (RFC3542) (2). +const ( + IPV6_RECVTCLASS = 66 + IPV6_TCLASS = 67 +) + +const ( + IPV6_ADD_MEMBERSHIP = 20 + IPV6_DROP_MEMBERSHIP = 21 +) + +const ( + IPV6_RXHOPOPTS = 54 + IPV6_RXDSTOPTS = 59 +) + +// IPV6_MTU_DISCOVER values. +const ( + IPV6_PMTUDISC_DONT = 0 + // Use per route hints. + IPV6_PMTUDISC_WANT = 1 + // Always DF. + IPV6_PMTUDISC_DO = 2 + // Ignore dst pmtu. + IPV6_PMTUDISC_PROBE = 3 + // See IP_PMTUDISC_INTERFACE. + IPV6_PMTUDISC_INTERFACE = 4 + // See IP_PMTUDISC_OMIT. + IPV6_PMTUDISC_OMIT = 5 +) + +// Socket level values for IPv6. +const ( + SOL_IPV6 = 41 + SOL_ICMPV6 = 58 +) + +// Routing header options for IPv6. +const ( + IPV6_RTHDR_LOOSE = 0 + // Hop must be a neighbour. + IPV6_RTHDR_STRICT = 1 +) + +// IPv6 Routing header type 0. +const IPV6_RTHDR_TYPE_0 = 0 + +// Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. +// The `ip_dst' field is used for the first-hop gateway when using a +// source route (this gets put into the header proper). +type IpOpts struct { + IpDst InAddr + IpOpts [40]c.Char +} + +// Like `struct ip_mreq' but including interface specification by index. +type IpMreqn struct { + ImrMultiaddr InAddr + ImrAddress InAddr + ImrIfindex c.Int +} + +// Structure used for IP_PKTINFO. +type InPktinfo struct { + IpiIfindex c.Int + IpiSpecDst InAddr + IpiAddr InAddr +} + +// Description of data base entry for a single network. NOTE: here a +// poor assumption is made. The network number is expected to fit +// into an unsigned long int variable. +type Netent struct { + NName *c.Char + NAliases **c.Char + NAddrtype c.Int + NNet Uint32T +} + +const X_BITS_SOCKADDR_H = 1 + +// Size of struct sockaddr_storage. +const X_SS_SIZE = 128 + +// POSIX.1g specifies this type name for the `sa_family' member. +type SaFamilyT = uint16 + +// Protocol families. +const ( + PF_UNSPEC = 0 + // Local to host (pipes and file-domain). + PF_LOCAL = 1 + // POSIX name for PF_LOCAL. + PF_UNIX = 1 + // Another non-standard name for PF_LOCAL. + PF_FILE = 1 + // IP protocol family. + PF_INET = 2 + // Amateur Radio AX.25. + PF_AX25 = 3 + // Novell Internet Protocol. + PF_IPX = 4 + // Appletalk DDP. + PF_APPLETALK = 5 + // Amateur radio NetROM. + PF_NETROM = 6 + // Multiprotocol bridge. + PF_BRIDGE = 7 + // ATM PVCs. + PF_ATMPVC = 8 + // Reserved for X.25 project. + PF_X25 = 9 + // IP version 6. + PF_INET6 = 10 + // Amateur Radio X.25 PLP. + PF_ROSE = 11 + // Reserved for DECnet project. + PF_DECnet = 12 + // Reserved for 802.2LLC project. + PF_NETBEUI = 13 + // Security callback pseudo AF. + PF_SECURITY = 14 + // PF_KEY key management API. + PF_KEY = 15 + PF_NETLINK = 16 + // Alias to emulate 4.4BSD. + PF_ROUTE = 16 + // Packet family. + PF_PACKET = 17 + // Ash. + PF_ASH = 18 + // Acorn Econet. + PF_ECONET = 19 + // ATM SVCs. + PF_ATMSVC = 20 + // RDS sockets. + PF_RDS = 21 + // Linux SNA Project + PF_SNA = 22 + // IRDA sockets. + PF_IRDA = 23 + // PPPoX sockets. + PF_PPPOX = 24 + // Wanpipe API sockets. + PF_WANPIPE = 25 + // Linux LLC. + PF_LLC = 26 + // Native InfiniBand address. + PF_IB = 27 + // MPLS. + PF_MPLS = 28 + // Controller Area Network. + PF_CAN = 29 + // TIPC sockets. + PF_TIPC = 30 + // Bluetooth sockets. + PF_BLUETOOTH = 31 + // IUCV sockets. + PF_IUCV = 32 + // RxRPC sockets. + PF_RXRPC = 33 + // mISDN sockets. + PF_ISDN = 34 + // Phonet sockets. + PF_PHONET = 35 + // IEEE 802.15.4 sockets. + PF_IEEE802154 = 36 + // CAIF sockets. + PF_CAIF = 37 + // Algorithm sockets. + PF_ALG = 38 + // NFC sockets. + PF_NFC = 39 + // vSockets. + PF_VSOCK = 40 + // Kernel Connection Multiplexor. + PF_KCM = 41 + // For now.. + PF_MAX = 42 +) + +// Address families. +const ( + AF_UNSPEC = 0 + AF_LOCAL = 1 + AF_UNIX = 1 + AF_FILE = 1 + AF_INET = 2 + AF_AX25 = 3 + AF_IPX = 4 + AF_APPLETALK = 5 + AF_NETROM = 6 + AF_BRIDGE = 7 + AF_ATMPVC = 8 + AF_X25 = 9 + AF_INET6 = 10 + AF_ROSE = 11 + AF_DECnet = 12 + AF_NETBEUI = 13 + AF_SECURITY = 14 + AF_KEY = 15 + AF_NETLINK = 16 + AF_ROUTE = 16 + AF_PACKET = 17 + AF_ASH = 18 + AF_ECONET = 19 + AF_ATMSVC = 20 + AF_RDS = 21 + AF_SNA = 22 + AF_IRDA = 23 + AF_PPPOX = 24 + AF_WANPIPE = 25 + AF_LLC = 26 + AF_IB = 27 + AF_MPLS = 28 + AF_CAN = 29 + AF_TIPC = 30 + AF_BLUETOOTH = 31 + AF_IUCV = 32 + AF_RXRPC = 33 + AF_ISDN = 34 + AF_PHONET = 35 + AF_IEEE802154 = 36 + AF_CAIF = 37 + AF_ALG = 38 + AF_NFC = 39 + AF_VSOCK = 40 + AF_KCM = 41 + AF_MAX = 42 +) + +// Socket level values. Others are defined in the appropriate headers. +// +// XXX These definitions also should go into the appropriate headers as +// far as they are available. +const ( + SOL_RAW = 255 + SOL_DECNET = 261 + SOL_X25 = 262 + SOL_PACKET = 263 + // ATM layer (cell level). + SOL_ATM = 264 + // ATM Adaption Layer (packet level). + SOL_AAL = 265 + SOL_IRDA = 266 + SOL_NETBEUI = 267 + SOL_LLC = 268 + SOL_DCCP = 269 + SOL_NETLINK = 270 + SOL_TIPC = 271 + SOL_RXRPC = 272 + SOL_PPPOL2TP = 273 + SOL_BLUETOOTH = 274 + SOL_PNPIPE = 275 + SOL_RDS = 276 + SOL_IUCV = 277 + SOL_CAIF = 278 + SOL_ALG = 279 + SOL_NFC = 280 + SOL_KCM = 281 +) + +// Maximum queue length specifiable by listen. +const SOMAXCONN = 128 + +// Structure describing a generic socket address. +type SockAddr struct { + Family SaFamilyT + Data [14]c.Char +} + +type SockaddrStorage struct { + Family SaFamilyT + pad [118]c.Char + align c.Ulong +} + +// Bits in the FLAGS argument to `send', `recv', et al. +const ( + MSG_OOB = 1 + MSG_PEEK = 2 + MSG_DONTROUTE = 4 + MSG_CTRUNC = 8 + MSG_PROXY = 16 + MSG_TRUNC = 32 + MSG_DONTWAIT = 64 + MSG_EOR = 128 + MSG_WAITALL = 256 + MSG_FIN = 512 + MSG_SYN = 1024 + MSG_CONFIRM = 2048 + MSG_RST = 4096 + MSG_ERRQUEUE = 8192 + MSG_NOSIGNAL = 16384 + MSG_MORE = 32768 + MSG_WAITFORONE = 65536 + MSG_BATCH = 262144 + MSG_FASTOPEN = 536870912 + // Set close_on_exit for file + // descriptor received through + // SCM_RIGHTS. + MSG_CMSG_CLOEXEC = 1073741824 +) + +// Structure describing messages sent by +// `sendmsg' and received by `recvmsg'. +type Msghdr struct { + MsgName unsafe.Pointer + MsgNamelen SocklenT + MsgIov *Iovec + MsgIovlen c.SizeT + MsgControl unsafe.Pointer + MsgControllen c.SizeT + MsgFlags c.Int +} + +// Socket level message types. This must match the definitions in +// . +const SCM_RIGHTS = 1 + +// Structure used to manipulate the SO_LINGER option. +type Linger struct { + LOnoff c.Int + LLinger c.Int +} + +type SocklenT = X__SocklenT + +// Types of sockets. +type X__SocketType c.Uint + +const ( + SOCK_DCCP X__SocketType = 6 + SOCK_PACKET X__SocketType = 10 + SOCK_CLOEXEC X__SocketType = 524288 + // Atomically mark descriptor(s) as + // non-blocking. + SOCK_NONBLOCK X__SocketType = 2048 +) + +// Type of a byte count, or error. +type X__SsizeT = c.Long + +type X__CaddrT = *c.Char + +// Duplicate info from sys/socket.h. +type X__SocklenT = c.Uint + +type Iovec = c.Iovec + +type SizeT = c.Ulong + +const X_NET_IF_H = 1 + +// Length of interface name. +const IF_NAMESIZE = 16 + +const ( + IFHWADDRLEN = 6 + IFNAMSIZ = 16 +) + +type IfNameindex struct { + IfIndex c.Uint + IfName *c.Char +} + +// Standard interface flags. +const ( + IFF_UP = 1 + IFF_BROADCAST = 2 + IFF_DEBUG = 4 + IFF_LOOPBACK = 8 + IFF_POINTOPOINT = 16 + IFF_NOTRAILERS = 32 + IFF_RUNNING = 64 + IFF_NOARP = 128 + IFF_PROMISC = 256 + // Not supported + IFF_ALLMULTI = 512 + IFF_MASTER = 1024 + IFF_SLAVE = 2048 + IFF_MULTICAST = 4096 + IFF_PORTSEL = 8192 + IFF_AUTOMEDIA = 16384 + // Dialup device with changing addresses. + IFF_DYNAMIC = 32768 +) + +type Ifmap struct { + MemStart c.Ulong + MemEnd c.Ulong + BaseAddr uint16 + Irq uint8 + Dma uint8 + Port uint8 +} + +type Ifreq struct { + IfrIfrn _llcppg_anon_2 + IfrIfru _llcppg_anon_3 +} + +type Ifconf struct { + IfcLen c.Int + IfcIfcu _llcppg_anon_4 +} + +type _llcppg_anon_2 struct { + _xgo_union [16]uint8 +} + +type _llcppg_anon_3 struct { + _xgo_union [3]uint64 +} + +type _llcppg_anon_4 struct { + _xgo_union [1]uint64 +} + +func (p *_llcppg_anon_2) XGof_ref_ifrn_name() *[16]c.Char { + return (*[16]c.Char)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_addr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_dstaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_broadaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_netmask() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_hwaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_flags() *int16 { + return (*int16)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_ivalue() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_mtu() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_map() *Ifmap { + return (*Ifmap)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_slave() *[16]c.Char { + return (*[16]c.Char)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_newname() *[16]c.Char { + return (*[16]c.Char)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_data() *X__CaddrT { + return (*X__CaddrT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_4) XGof_ref_ifcu_buf() *X__CaddrT { + return (*X__CaddrT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_4) XGof_ref_ifcu_req() **Ifreq { + return (**Ifreq)(unsafe.Pointer(p)) +} + +// Convert an interface name to an index, and vice versa. +// +//go:linkname IfNametoindex C.if_nametoindex +func IfNametoindex(__ifname *c.Char) c.Uint + +//go:linkname IfIndextoname C.if_indextoname +func IfIndextoname(__ifindex c.Uint, __ifname *c.Char) *c.Char + +// Free the data returned from if_nameindex. +// +// llgo:link (*IfNameindex).IfFreenameindex C.if_freenameindex +func (self *IfNameindex) IfFreenameindex() { +} + +const X_NETDB_H = 1 + +// Absolute file name for network data base files. +const ( + X_PATH_HEQUIV = "/etc/hosts.equiv" + X_PATH_HOSTS = "/etc/hosts" + X_PATH_NETWORKS = "/etc/networks" + X_PATH_NSSWITCH_CONF = "/etc/nsswitch.conf" + X_PATH_PROTOCOLS = "/etc/protocols" + X_PATH_SERVICES = "/etc/services" +) + +// Possible values left in `h_errno'. +const ( + HOST_NOT_FOUND = 1 + // Non-Authoritative Host not found, + // or SERVERFAIL. + TRY_AGAIN = 2 +) + +// Non recoverable errors, FORMERR, REFUSED, +// NOTIMP. +const NO_RECOVERY = 3 + +// Valid name, no data record of requested +// type. +const NO_DATA = 4 + +const ( + // See errno. + NETDB_INTERNAL = -1 + // No problem. + NETDB_SUCCESS = 0 + // No address, look for MX record. + NO_ADDRESS = 4 +) + +// Possible values for `ai_flags' field in `addrinfo' structure. +const ( + AI_PASSIVE = 1 + // Request for canonical name. + AI_CANONNAME = 2 + // Don't use name resolution. + AI_NUMERICHOST = 4 + // IPv4 mapped addresses are acceptable. + AI_V4MAPPED = 8 + // Return IPv4 mapped and IPv6 addresses. + AI_ALL = 16 + // Use configuration of this host to choose + // returned address type.. + AI_ADDRCONFIG = 32 +) + +// Don't use name resolution. +const AI_NUMERICSERV = 1024 + +// Error values for `getaddrinfo' function. +const ( + EAI_BADFLAGS = -1 + // NAME or SERVICE is unknown. + EAI_NONAME = -2 + // Temporary failure in name resolution. + EAI_AGAIN = -3 + // Non-recoverable failure in name res. + EAI_FAIL = -4 + // `ai_family' not supported. + EAI_FAMILY = -6 + // `ai_socktype' not supported. + EAI_SOCKTYPE = -7 + // SERVICE not supported for `ai_socktype'. + EAI_SERVICE = -8 + // Memory allocation failure. + EAI_MEMORY = -10 + // System error returned in `errno'. + EAI_SYSTEM = -11 + // Argument buffer overflow. + EAI_OVERFLOW = -12 +) + +const ( + NI_MAXHOST = 1025 + NI_MAXSERV = 32 +) + +const ( + // Don't try to look up hostname. + NI_NUMERICHOST = 1 + // Don't convert port number to name. + NI_NUMERICSERV = 2 + // Only return nodename portion. + NI_NOFQDN = 4 + // Don't return numeric addresses. + NI_NAMEREQD = 8 + // Look up UDP service rather than TCP. + NI_DGRAM = 16 +) + +// Description of data base entry for a single host. +type Hostent struct { + Name *c.Char + Aliases **c.Char + AddrType c.Int + Length c.Int + AddrList **c.Char +} + +// Description of data base entry for a single service. +type Servent struct { + SName *c.Char + SAliases **c.Char + SPort c.Int + SProto *c.Char +} + +// Description of data base entry for a single service. +type Protoent struct { + PName *c.Char + PAliases **c.Char + PProto c.Int +} + +// Structure to contain information about address of a service provider. +type AddrInfo struct { + Flags c.Int + Family c.Int + SockType c.Int + Protocol c.Int + AddrLen SocklenT + Addr *SockAddr + CanOnName *c.Char + Next *AddrInfo +} + +// Function to get address of global `h_errno' variable. +// +//go:linkname X__HErrnoLocation C.__h_errno_location +func X__HErrnoLocation() *c.Int + +// Print error indicated by `h_errno' variable on standard error. STR +// if non-null is printed before the error string. +// +//go:linkname Herror C.herror +func Herror(__str *c.Char) + +// Return string associated with error ERR_NUM. +// +//go:linkname Hstrerror C.hstrerror +func Hstrerror(__err_num c.Int) *c.Char + +// Open host data base files and mark them as staying open even after +// a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Sethostent C.sethostent +func Sethostent(__stay_open c.Int) + +// Close host data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endhostent C.endhostent +func Endhostent() + +// Get next entry from host data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Gethostent C.gethostent +func Gethostent() *Hostent + +// Return entry from host data base which address match ADDR with +// length LEN and type TYPE. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Gethostbyaddr C.gethostbyaddr +func Gethostbyaddr(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int) *Hostent + +// Return entry from host data base for host with NAME. AF must be +// set to the address type which is `AF_INET' for IPv4 or `AF_INET6' +// for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Gethostbyname2 C.gethostbyname2 +func Gethostbyname2(__name *c.Char, __af c.Int) *Hostent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. The last +// argument is a pointer to a variable which gets the value which +// would be stored in the global variable `herrno' by the +// non-reentrant functions. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Hostent).GethostentR C.gethostent_r +func (self *Hostent) GethostentR(__buf *c.Char, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int { + return 0 +} + +//go:linkname GethostbyaddrR C.gethostbyaddr_r +func GethostbyaddrR(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int, __result_buf *Hostent, __buf *c.Char, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int + +//go:linkname GethostbynameR C.gethostbyname_r +func GethostbynameR(__name *c.Char, __result_buf *Hostent, __buf *c.Char, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int + +//go:linkname Gethostbyname2R C.gethostbyname2_r +func Gethostbyname2R(__name *c.Char, __af c.Int, __result_buf *Hostent, __buf *c.Char, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int + +// Open network data base files and mark them as staying open even +// after a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setnetent C.setnetent +func Setnetent(__stay_open c.Int) + +// Close network data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endnetent C.endnetent +func Endnetent() + +// Get next entry from network data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getnetent C.getnetent +func Getnetent() *Netent + +// Return entry from network data base which address match NET and +// type TYPE. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getnetbyaddr C.getnetbyaddr +func Getnetbyaddr(__net Uint32T, __type c.Int) *Netent + +// Return entry from network data base for network with NAME. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getnetbyname C.getnetbyname +func Getnetbyname(__name *c.Char) *Netent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. The last +// argument is a pointer to a variable which gets the value which +// would be stored in the global variable `herrno' by the +// non-reentrant functions. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Netent).GetnetentR C.getnetent_r +func (self *Netent) GetnetentR(__buf *c.Char, __buflen SizeT, __result **Netent, __h_errnop *c.Int) c.Int { + return 0 +} + +//go:linkname GetnetbyaddrR C.getnetbyaddr_r +func GetnetbyaddrR(__net Uint32T, __type c.Int, __result_buf *Netent, __buf *c.Char, __buflen SizeT, __result **Netent, __h_errnop *c.Int) c.Int + +//go:linkname GetnetbynameR C.getnetbyname_r +func GetnetbynameR(__name *c.Char, __result_buf *Netent, __buf *c.Char, __buflen SizeT, __result **Netent, __h_errnop *c.Int) c.Int + +// Open service data base files and mark them as staying open even +// after a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setservent C.setservent +func Setservent(__stay_open c.Int) + +// Close service data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endservent C.endservent +func Endservent() + +// Get next entry from service data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getservent C.getservent +func Getservent() *Servent + +// Return entry from network data base for network with NAME and +// protocol PROTO. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getservbyname C.getservbyname +func Getservbyname(__name *c.Char, __proto *c.Char) *Servent + +// Return entry from service data base which matches port PORT and +// protocol PROTO. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getservbyport C.getservbyport +func Getservbyport(__port c.Int, __proto *c.Char) *Servent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Servent).GetserventR C.getservent_r +func (self *Servent) GetserventR(__buf *c.Char, __buflen SizeT, __result **Servent) c.Int { + return 0 +} + +//go:linkname GetservbynameR C.getservbyname_r +func GetservbynameR(__name *c.Char, __proto *c.Char, __result_buf *Servent, __buf *c.Char, __buflen SizeT, __result **Servent) c.Int + +//go:linkname GetservbyportR C.getservbyport_r +func GetservbyportR(__port c.Int, __proto *c.Char, __result_buf *Servent, __buf *c.Char, __buflen SizeT, __result **Servent) c.Int + +// Open protocol data base files and mark them as staying open even +// after a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setprotoent C.setprotoent +func Setprotoent(__stay_open c.Int) + +// Close protocol data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endprotoent C.endprotoent +func Endprotoent() + +// Get next entry from protocol data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getprotoent C.getprotoent +func Getprotoent() *Protoent + +// Return entry from protocol data base for network with NAME. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getprotobyname C.getprotobyname +func Getprotobyname(__name *c.Char) *Protoent + +// Return entry from protocol data base which number is PROTO. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getprotobynumber C.getprotobynumber +func Getprotobynumber(__proto c.Int) *Protoent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Protoent).GetprotoentR C.getprotoent_r +func (self *Protoent) GetprotoentR(__buf *c.Char, __buflen SizeT, __result **Protoent) c.Int { + return 0 +} + +//go:linkname GetprotobynameR C.getprotobyname_r +func GetprotobynameR(__name *c.Char, __result_buf *Protoent, __buf *c.Char, __buflen SizeT, __result **Protoent) c.Int + +//go:linkname GetprotobynumberR C.getprotobynumber_r +func GetprotobynumberR(__proto c.Int, __result_buf *Protoent, __buf *c.Char, __buflen SizeT, __result **Protoent) c.Int + +// Establish network group NETGROUP for enumeration. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Setnetgrent C.setnetgrent +func Setnetgrent(__netgroup *c.Char) c.Int + +// Free all space allocated by previous `setnetgrent' call. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Endnetgrent C.endnetgrent +func Endnetgrent() + +// Get next member of netgroup established by last `setnetgrent' call +// and return pointers to elements in HOSTP, USERP, and DOMAINP. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Getnetgrent C.getnetgrent +func Getnetgrent(__hostp **c.Char, __userp **c.Char, __domainp **c.Char) c.Int + +// Test whether NETGROUP contains the triple (HOST,USER,DOMAIN). +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Innetgr C.innetgr +func Innetgr(__netgroup *c.Char, __host *c.Char, __user *c.Char, __domain *c.Char) c.Int + +// Reentrant version of `getnetgrent' where result is placed in BUFFER. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname GetnetgrentR C.getnetgrent_r +func GetnetgrentR(__hostp **c.Char, __userp **c.Char, __domainp **c.Char, __buffer *c.Char, __buflen SizeT) c.Int + +// Call `rshd' at port RPORT on remote machine *AHOST to execute CMD. +// The local user is LOCUSER, on the remote machine the command is +// executed as REMUSER. In *FD2P the descriptor to the socket for the +// connection is returned. The caller must have the right to use a +// reserved port. When the function returns *AHOST contains the +// official host name. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Rcmd C.rcmd +func Rcmd(__ahost **c.Char, __rport uint16, __locuser *c.Char, __remuser *c.Char, __cmd *c.Char, __fd2p *c.Int) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RcmdAf C.rcmd_af +func RcmdAf(__ahost **c.Char, __rport uint16, __locuser *c.Char, __remuser *c.Char, __cmd *c.Char, __fd2p *c.Int, __af SaFamilyT) c.Int + +// Call `rexecd' at port RPORT on remote machine *AHOST to execute +// CMD. The process runs at the remote machine using the ID of user +// NAME whose cleartext password is PASSWD. In *FD2P the descriptor +// to the socket for the connection is returned. When the function +// returns *AHOST contains the official host name. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Rexec C.rexec +func Rexec(__ahost **c.Char, __rport c.Int, __name *c.Char, __pass *c.Char, __cmd *c.Char, __fd2p *c.Int) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RexecAf C.rexec_af +func RexecAf(__ahost **c.Char, __rport c.Int, __name *c.Char, __pass *c.Char, __cmd *c.Char, __fd2p *c.Int, __af SaFamilyT) c.Int + +// Check whether user REMUSER on system RHOST is allowed to login as LOCUSER. +// If SUSER is not zero the user tries to become superuser. Return 0 if +// it is possible. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Ruserok C.ruserok +func Ruserok(__rhost *c.Char, __suser c.Int, __remuser *c.Char, __locuser *c.Char) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RuserokAf C.ruserok_af +func RuserokAf(__rhost *c.Char, __suser c.Int, __remuser *c.Char, __locuser *c.Char, __af SaFamilyT) c.Int + +// Check whether user REMUSER on system indicated by IPv4 address +// RADDR is allowed to login as LOCUSER. Non-IPv4 (e.g., IPv6) are +// not supported. If SUSER is not zero the user tries to become +// superuser. Return 0 if it is possible. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Iruserok C.iruserok +func Iruserok(__raddr Uint32T, __suser c.Int, __remuser *c.Char, __locuser *c.Char) c.Int + +// This is the equivalent function where the pfamiliy if the address +// pointed to by RADDR is determined by the value of AF. It therefore +// can be used for IPv6 +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname IruserokAf C.iruserok_af +func IruserokAf(__raddr unsafe.Pointer, __suser c.Int, __remuser *c.Char, __locuser *c.Char, __af SaFamilyT) c.Int + +// Try to allocate reserved port, returning a descriptor for a socket opened +// at this port or -1 if unsuccessful. The search for an available port +// will start at ALPORT and continues with lower numbers. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Rresvport C.rresvport +func Rresvport(__alport *c.Int) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RresvportAf C.rresvport_af +func RresvportAf(__alport *c.Int, __af SaFamilyT) c.Int + +// Convert error return from getaddrinfo() to a string. +// +//go:linkname GaiStrerror C.gai_strerror +func GaiStrerror(__ecode c.Int) *c.Char + +// Translate a socket address to a location and service name. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +// llgo:link (*SockAddr).Getnameinfo C.getnameinfo +func (self *SockAddr) Getnameinfo(__salen SocklenT, __host *c.Char, __hostlen SocklenT, __serv *c.Char, __servlen SocklenT, __flags c.Int) c.Int { + return 0 +} + +const X_NETINET_IN_H = 1 + +const ( + IN_CLASSA_NET = 4278190080 + IN_CLASSA_NSHIFT = 24 + IN_CLASSA_HOST = 16777215 + IN_CLASSA_MAX = 128 +) + +const ( + IN_CLASSB_NET = 4294901760 + IN_CLASSB_NSHIFT = 16 + IN_CLASSB_HOST = 65535 + IN_CLASSB_MAX = 65536 +) + +const ( + IN_CLASSC_NET = 4294967040 + IN_CLASSC_NSHIFT = 8 + IN_CLASSC_HOST = 255 +) + +// Network number for local host loopback. +const IN_LOOPBACKNET = 127 + +const ( + INET_ADDRSTRLEN = 16 + INET6_ADDRSTRLEN = 46 +) + +type InAddr struct { + Addr InAddrT +} + +// Standard well-defined IP protocols. +const ( + IPPROTO_IP = 0 + IPPROTO_ICMP = 1 + IPPROTO_IGMP = 2 + IPPROTO_IPIP = 4 + IPPROTO_TCP = 6 + IPPROTO_EGP = 8 + IPPROTO_PUP = 12 + IPPROTO_UDP = 17 + IPPROTO_IDP = 22 + IPPROTO_TP = 29 + IPPROTO_DCCP = 33 + IPPROTO_IPV6 = 41 + IPPROTO_RSVP = 46 + IPPROTO_GRE = 47 + IPPROTO_ESP = 50 + IPPROTO_AH = 51 + IPPROTO_MTP = 92 + IPPROTO_BEETPH = 94 + IPPROTO_ENCAP = 98 + IPPROTO_PIM = 103 + IPPROTO_COMP = 108 + IPPROTO_SCTP = 132 + IPPROTO_UDPLITE = 136 + IPPROTO_MPLS = 137 + IPPROTO_RAW = 255 + IPPROTO_MAX = 256 +) + +const ( + IPPROTO_HOPOPTS = 0 + IPPROTO_ROUTING = 43 + IPPROTO_FRAGMENT = 44 + IPPROTO_ICMPV6 = 58 + IPPROTO_NONE = 59 + IPPROTO_DSTOPTS = 60 + // IPv6 mobility header. + IPPROTO_MH = 135 +) + +// Standard well-known ports. +const ( + IPPORT_ECHO = 7 + IPPORT_DISCARD = 9 + IPPORT_SYSTAT = 11 + IPPORT_DAYTIME = 13 + IPPORT_NETSTAT = 15 + IPPORT_FTP = 21 + IPPORT_TELNET = 23 + IPPORT_SMTP = 25 + IPPORT_TIMESERVER = 37 + IPPORT_NAMESERVER = 42 + IPPORT_WHOIS = 43 + IPPORT_MTP = 57 + IPPORT_TFTP = 69 + IPPORT_RJE = 77 + IPPORT_FINGER = 79 + IPPORT_TTYLINK = 87 + IPPORT_SUPDUP = 95 + IPPORT_EXECSERVER = 512 + IPPORT_LOGINSERVER = 513 + IPPORT_CMDSERVER = 514 + IPPORT_EFSSERVER = 520 + // UDP ports. + IPPORT_BIFFUDP = 512 + IPPORT_WHOSERVER = 513 + IPPORT_ROUTESERVER = 520 + // Ports less than this value are reserved for privileged processes. + IPPORT_RESERVED = 1024 + // Ports greater this value are reserved for (non-privileged) servers. + IPPORT_USERRESERVED = 5000 +) + +// In6Addr retains the byte array API and the native IPv6 union alignment. +type In6Addr struct { + _ [0]uint32 + U6Addr [16]uint8 +} + +// Structure describing an Internet socket address. +type SockaddrIn struct { + Family SaFamilyT + Port InPortT + Addr InAddr + Zero [8]uint8 +} + +// Ditto, for IPv6. +type SockaddrIn6 struct { + Family SaFamilyT + Port InPortT + Flowinfo Uint32T + Addr In6Addr + ScopeId Uint32T +} + +// IPv4 multicast request. +type IpMreq struct { + ImrMultiaddr InAddr + ImrInterface InAddr +} + +type IpMreqSource struct { + ImrMultiaddr InAddr + ImrInterface InAddr + ImrSourceaddr InAddr +} + +// Likewise, for IPv6. +type Ipv6Mreq struct { + Ipv6mrMultiaddr In6Addr + Ipv6mrInterface c.Uint +} + +// Multicast group request. +type GroupReq struct { + GrInterface Uint32T + GrGroup SockaddrStorage +} + +type GroupSourceReq struct { + GsrInterface Uint32T + GsrGroup SockaddrStorage + GsrSource SockaddrStorage +} + +// Full-state filter operations. +type IpMsfilter struct { + ImsfMultiaddr InAddr + ImsfInterface InAddr + ImsfFmode Uint32T + ImsfNumsrc Uint32T + ImsfSlist [1]InAddr +} + +type GroupFilter struct { + GfInterface Uint32T + GfGroup SockaddrStorage + GfFmode Uint32T + GfNumsrc Uint32T + GfSlist [1]SockaddrStorage +} + +// Internet address. +type InAddrT = Uint32T + +// Type to represent a port. +type InPortT = Uint16T + +// :: +// +//go:linkname In6addrAny C.in6addr_any +var In6addrAny In6Addr + +// ::1 +// +//go:linkname In6addrLoopback C.in6addr_loopback +var In6addrLoopback In6Addr + +// Bind socket to a privileged IP port. +// +//go:linkname Bindresvport C.bindresvport +func Bindresvport(__sockfd c.Int, __sock_in *SockaddrIn) c.Int + +const X_RPC_NETDB_H = 1 + +type Rpcent struct { + RName *c.Char + RAliases **c.Char + RNumber c.Int +} + +//go:linkname Setrpcent C.setrpcent +func Setrpcent(__stayopen c.Int) + +//go:linkname Endrpcent C.endrpcent +func Endrpcent() + +//go:linkname Getrpcbyname C.getrpcbyname +func Getrpcbyname(__name *c.Char) *Rpcent + +//go:linkname Getrpcbynumber C.getrpcbynumber +func Getrpcbynumber(__number c.Int) *Rpcent + +//go:linkname Getrpcent C.getrpcent +func Getrpcent() *Rpcent + +//go:linkname GetrpcbynameR C.getrpcbyname_r +func GetrpcbynameR(__name *c.Char, __result_buf *Rpcent, __buffer *c.Char, __buflen SizeT, __result **Rpcent) c.Int + +//go:linkname GetrpcbynumberR C.getrpcbynumber_r +func GetrpcbynumberR(__number c.Int, __result_buf *Rpcent, __buffer *c.Char, __buflen SizeT, __result **Rpcent) c.Int + +// llgo:link (*Rpcent).GetrpcentR C.getrpcent_r +func (self *Rpcent) GetrpcentR(__buffer *c.Char, __buflen SizeT, __result **Rpcent) c.Int { + return 0 +} + +type Uint16T = uint16 + +type Uint32T = c.Uint + +const X_SYS_SOCKET_H = 1 + +// This is the 4.3 BSD `struct sockaddr' format, which is used as wire +// format in the grotty old 4.3 `talk' protocol. +type Osockaddr struct { + SaFamily uint16 + SaData [14]uint8 +} + +// The following constants should be used for the second parameter of +// `shutdown'. +const ( + SHUT_RD = 0 + SHUT_WR = 1 + // No more receptions or transmissions. + SHUT_RDWR = 2 +) + +// Create two new sockets, of type TYPE in domain DOMAIN and using +// protocol PROTOCOL, which are connected to each other, and put file +// descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero, +// one will be chosen automatically. Returns 0 on success, -1 for errors. +// +//go:linkname Socketpair C.socketpair +func Socketpair(__domain c.Int, __type c.Int, __protocol c.Int, __fds *c.Int) c.Int + +// Put the local address of FD into *ADDR and its length in *LEN. +// +//go:linkname Getsockname C.getsockname +func Getsockname(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int + +// Put the address of the peer connected to socket FD into *ADDR +// (which is *LEN bytes long), and its actual length into *LEN. +// +//go:linkname Getpeername C.getpeername +func Getpeername(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int + +// Send N bytes of BUF on socket FD to peer at address ADDR (which is +// ADDR_LEN bytes long). Returns the number sent, or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Sendto C.sendto +func Sendto(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int, __addr *SockAddr, __addr_len SocklenT) SsizeT + +// Read N bytes into BUF through socket FD. +// If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of +// the sender, and store the actual size of the address in *ADDR_LEN. +// Returns the number of bytes read or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Recvfrom C.recvfrom +func Recvfrom(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int, __addr *SockAddr, __addr_len *SocklenT) SsizeT + +// Send a message described MESSAGE on socket FD. +// Returns the number of bytes sent, or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Sendmsg C.sendmsg +func Sendmsg(__fd c.Int, __message *Msghdr, __flags c.Int) SsizeT + +// Receive a message as described by MESSAGE from socket FD. +// Returns the number of bytes read or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Recvmsg C.recvmsg +func Recvmsg(__fd c.Int, __message *Msghdr, __flags c.Int) SsizeT + +// Put the current value for socket FD's option OPTNAME at protocol level LEVEL +// into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's +// actual length. Returns 0 on success, -1 for errors. +// +//go:linkname Getsockopt C.getsockopt +func Getsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen *SocklenT) c.Int + +// Shut down all or part of the connection open on socket FD. +// HOW determines what to shut down: +// SHUT_RD = No more receptions; +// SHUT_WR = No more transmissions; +// SHUT_RDWR = No more receptions or transmissions. +// Returns 0 on success, -1 for errors. +// +//go:linkname Shutdown C.shutdown +func Shutdown(__fd c.Int, __how c.Int) c.Int + +// Determine wheter socket is at a out-of-band mark. +// +//go:linkname Sockatmark C.sockatmark +func Sockatmark(__fd c.Int) c.Int + +// FDTYPE is S_IFSOCK or another S_IF* macro defined in ; +// returns 1 if FD is open on an object of the indicated type, 0 if not, +// or -1 for errors (setting errno). +// +//go:linkname Isfdtype C.isfdtype +func Isfdtype(__fd c.Int, __fdtype c.Int) c.Int + +type SsizeT = X__SsizeT + +const X_SYS_UN_H = 1 + +// Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. +type SockaddrUn struct { + SunFamily SaFamilyT + SunPath [108]c.Char +} diff --git a/c/net/libc_linux_arm64.go b/c/net/libc_linux_arm64.go new file mode 100644 index 00000000..28de474d --- /dev/null +++ b/c/net/libc_linux_arm64.go @@ -0,0 +1,1803 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the libc binding; existing c/net names are retained. + +package net + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_ARPA_INET_H = 1 + +// Return the local host address part of the Internet address in IN. +// +// llgo:link InAddr.InetLnaof C.inet_lnaof +func (self InAddr) InetLnaof() InAddrT { + return 0 +} + +// Make Internet host address in network byte order by combining the +// network number NET with the local address HOST. +// +//go:linkname InetMakeaddr C.inet_makeaddr +func InetMakeaddr(__net InAddrT, __host InAddrT) InAddr + +// Return network number part of the Internet address IN. +// +// llgo:link InAddr.InetNetof C.inet_netof +func (self InAddr) InetNetof() InAddrT { + return 0 +} + +// Extract the network number in network byte order from the address +// in numbers-and-dots natation starting at CP. +// +//go:linkname InetNetwork C.inet_network +func InetNetwork(__cp *uint8) InAddrT + +// Convert Internet number in IN to ASCII representation. The return value +// is a pointer to an internal array containing the string. +// +// llgo:link InAddr.InetNtoa C.inet_ntoa +func (self InAddr) InetNtoa() *uint8 { + return nil +} + +// Convert from presentation format of an Internet number in buffer +// starting at CP to the binary network format and store result for +// interface type AF in buffer starting at BUF. +// +//go:linkname InetPton C.inet_pton +func InetPton(__af c.Int, __cp *uint8, __buf unsafe.Pointer) c.Int + +// Convert Internet host address from numbers-and-dots notation in CP +// into binary data and store the result in the structure INP. +// +//go:linkname InetAton C.inet_aton +func InetAton(__cp *uint8, __inp *InAddr) c.Int + +// Convert ASCII representation in hexadecimal form of the Internet +// address to binary form and place result in buffer of length LEN +// starting at BUF. +// +//go:linkname InetNsapAddr C.inet_nsap_addr +func InetNsapAddr(__cp *uint8, __buf *uint8, __len c.Int) c.Uint + +// Convert internet address in binary form in LEN bytes starting at CP +// a presentation form and place result in BUF. +// +//go:linkname InetNsapNtoa C.inet_nsap_ntoa +func InetNsapNtoa(__len c.Int, __cp *uint8, __buf *uint8) *uint8 + +// For setsockopt(2) +const SOL_SOCKET = 1 + +const ( + SO_DEBUG = 1 + SO_REUSEADDR = 2 + SO_TYPE = 3 + SO_ERROR = 4 + SO_DONTROUTE = 5 + SO_BROADCAST = 6 + SO_SNDBUF = 7 + SO_RCVBUF = 8 + SO_SNDBUFFORCE = 32 + SO_RCVBUFFORCE = 33 + SO_KEEPALIVE = 9 + SO_OOBINLINE = 10 + SO_NO_CHECK = 11 + SO_PRIORITY = 12 + SO_LINGER = 13 + SO_BSDCOMPAT = 14 + SO_REUSEPORT = 15 +) + +const ( + SO_PASSCRED = 16 + SO_PEERCRED = 17 + SO_RCVLOWAT = 18 + SO_SNDLOWAT = 19 + SO_RCVTIMEO = 20 + SO_SNDTIMEO = 21 +) + +// Security levels - as per NRL IPv6 - don't actually do anything +const ( + SO_SECURITY_AUTHENTICATION = 22 + SO_SECURITY_ENCRYPTION_TRANSPORT = 23 + SO_SECURITY_ENCRYPTION_NETWORK = 24 +) + +const SO_BINDTODEVICE = 25 + +// Socket filtering +const ( + SO_ATTACH_FILTER = 26 + SO_DETACH_FILTER = 27 + SO_GET_FILTER = 26 +) + +const ( + SO_PEERNAME = 28 + SO_TIMESTAMP = 29 + SCM_TIMESTAMP = 29 +) + +const SO_ACCEPTCONN = 30 + +const ( + SO_PEERSEC = 31 + SO_PASSSEC = 34 + SO_TIMESTAMPNS = 35 + SCM_TIMESTAMPNS = 35 +) + +const SO_MARK = 36 + +const ( + SO_TIMESTAMPING = 37 + SCM_TIMESTAMPING = 37 +) + +const ( + SO_PROTOCOL = 38 + SO_DOMAIN = 39 +) + +const SO_RXQ_OVFL = 40 + +const ( + SO_WIFI_STATUS = 41 + SCM_WIFI_STATUS = 41 + SO_PEEK_OFF = 42 +) + +// Instruct lower device to use last 4-bytes of skb data as FCS +const SO_NOFCS = 43 + +const SO_LOCK_FILTER = 44 + +const SO_SELECT_ERR_QUEUE = 45 + +// Socket-level I/O control calls. +const ( + FIOSETOWN = 35073 + SIOCSPGRP = 35074 + FIOGETOWN = 35075 + SIOCGPGRP = 35076 + SIOCATMARK = 35077 + // Get stamp (timeval) + SIOCGSTAMP = 35078 + // Get stamp (timespec) + SIOCGSTAMPNS = 35079 +) + +const X__USE_KERNEL_IPV6_DEFS = 0 + +// Options for use with `getsockopt' and `setsockopt' at the IP level. +// The first word in the comment at the right is the data type used; +// "bool" means a boolean value stored in an `int'. +const ( + IP_OPTIONS = 4 + // int; Header is included with data. + IP_HDRINCL = 3 + // int; IP type of service and precedence. + IP_TOS = 1 + // int; IP time to live. + IP_TTL = 2 + // bool; Receive all IP options w/datagram. + IP_RECVOPTS = 6 +) + +// For BSD compatibility. +const ( + // ip_opts; Set/get IP per-packet options. + IP_RETOPTS = 7 + // in_addr; set/get IP multicast i/f + IP_MULTICAST_IF = 32 + // u_char; set/get IP multicast ttl + IP_MULTICAST_TTL = 33 + // i_char; set/get IP multicast loopback + IP_MULTICAST_LOOP = 34 + // ip_mreq; add an IP group membership + IP_ADD_MEMBERSHIP = 35 + // ip_mreq; drop an IP group membership + IP_DROP_MEMBERSHIP = 36 + // ip_mreq_source: unblock data from source + IP_UNBLOCK_SOURCE = 37 + // ip_mreq_source: block data from source + IP_BLOCK_SOURCE = 38 + // ip_mreq_source: join source group + IP_ADD_SOURCE_MEMBERSHIP = 39 + // ip_mreq_source: leave source group + IP_DROP_SOURCE_MEMBERSHIP = 40 + IP_MSFILTER = 41 +) + +const ( + // group_req: join any-source group + MCAST_JOIN_GROUP = 42 + // group_source_req: block from given group + MCAST_BLOCK_SOURCE = 43 + // group_source_req: unblock from given group + MCAST_UNBLOCK_SOURCE = 44 + // group_req: leave any-source group + MCAST_LEAVE_GROUP = 45 + // group_source_req: join source-spec gr + MCAST_JOIN_SOURCE_GROUP = 46 + // group_source_req: leave source-spec gr + MCAST_LEAVE_SOURCE_GROUP = 47 + MCAST_MSFILTER = 48 + IP_MULTICAST_ALL = 49 + IP_UNICAST_IF = 50 +) + +const ( + MCAST_EXCLUDE = 0 + MCAST_INCLUDE = 1 +) + +const ( + // bool + IP_ROUTER_ALERT = 5 + // bool + IP_PKTINFO = 8 + IP_PKTOPTIONS = 9 + // obsolete name? + IP_PMTUDISC = 10 + // int; see below + IP_MTU_DISCOVER = 10 + // bool + IP_RECVERR = 11 + // bool + IP_RECVTTL = 12 + // bool + IP_RECVTOS = 13 + // int + IP_MTU = 14 + IP_FREEBIND = 15 + IP_IPSEC_POLICY = 16 + IP_XFRM_POLICY = 17 + IP_PASSSEC = 18 + IP_TRANSPARENT = 19 +) + +// TProxy original addresses +const ( + IP_ORIGDSTADDR = 20 + IP_RECVORIGDSTADDR = 20 +) + +const ( + IP_MINTTL = 21 + IP_NODEFRAG = 22 + IP_CHECKSUM = 23 + IP_BIND_ADDRESS_NO_PORT = 24 +) + +// IP_MTU_DISCOVER arguments. +const ( + IP_PMTUDISC_DONT = 0 + // Use per route hints. + IP_PMTUDISC_WANT = 1 + // Always DF. + IP_PMTUDISC_DO = 2 + // Ignore dst pmtu. + IP_PMTUDISC_PROBE = 3 +) + +// Always use interface mtu (ignores dst pmtu) but don't set DF flag. +// Also incoming ICMP frag_needed notifications will be ignored on +// this socket to prevent accepting spoofed ones. +const IP_PMTUDISC_INTERFACE = 4 + +// Like IP_PMTUDISC_INTERFACE but allow packets to be fragmented. +const IP_PMTUDISC_OMIT = 5 + +// To select the IP level. +const SOL_IP = 0 + +const ( + IP_DEFAULT_MULTICAST_TTL = 1 + IP_DEFAULT_MULTICAST_LOOP = 1 + IP_MAX_MEMBERSHIPS = 20 +) + +// Options for use with `getsockopt' and `setsockopt' at the IPv6 level. +// The first word in the comment at the right is the data type used; +// "bool" means a boolean value stored in an `int'. +const ( + IPV6_ADDRFORM = 1 + IPV6_2292PKTINFO = 2 + IPV6_2292HOPOPTS = 3 + IPV6_2292DSTOPTS = 4 + IPV6_2292RTHDR = 5 + IPV6_2292PKTOPTIONS = 6 + IPV6_CHECKSUM = 7 + IPV6_2292HOPLIMIT = 8 +) + +const ( + IPV6_NEXTHOP = 9 + IPV6_AUTHHDR = 10 + IPV6_UNICAST_HOPS = 16 + IPV6_MULTICAST_IF = 17 + IPV6_MULTICAST_HOPS = 18 + IPV6_MULTICAST_LOOP = 19 + IPV6_JOIN_GROUP = 20 + IPV6_LEAVE_GROUP = 21 + IPV6_ROUTER_ALERT = 22 + IPV6_MTU_DISCOVER = 23 + IPV6_MTU = 24 + IPV6_RECVERR = 25 + IPV6_V6ONLY = 26 + IPV6_JOIN_ANYCAST = 27 + IPV6_LEAVE_ANYCAST = 28 + IPV6_IPSEC_POLICY = 34 + IPV6_XFRM_POLICY = 35 + IPV6_HDRINCL = 36 +) + +// Advanced API (RFC3542) (1). +const ( + IPV6_RECVPKTINFO = 49 + IPV6_PKTINFO = 50 + IPV6_RECVHOPLIMIT = 51 + IPV6_HOPLIMIT = 52 + IPV6_RECVHOPOPTS = 53 + IPV6_HOPOPTS = 54 + IPV6_RTHDRDSTOPTS = 55 + IPV6_RECVRTHDR = 56 + IPV6_RTHDR = 57 + IPV6_RECVDSTOPTS = 58 + IPV6_DSTOPTS = 59 + IPV6_RECVPATHMTU = 60 + IPV6_PATHMTU = 61 + IPV6_DONTFRAG = 62 +) + +// Advanced API (RFC3542) (2). +const ( + IPV6_RECVTCLASS = 66 + IPV6_TCLASS = 67 +) + +const ( + IPV6_ADD_MEMBERSHIP = 20 + IPV6_DROP_MEMBERSHIP = 21 +) + +const ( + IPV6_RXHOPOPTS = 54 + IPV6_RXDSTOPTS = 59 +) + +// IPV6_MTU_DISCOVER values. +const ( + IPV6_PMTUDISC_DONT = 0 + // Use per route hints. + IPV6_PMTUDISC_WANT = 1 + // Always DF. + IPV6_PMTUDISC_DO = 2 + // Ignore dst pmtu. + IPV6_PMTUDISC_PROBE = 3 + // See IP_PMTUDISC_INTERFACE. + IPV6_PMTUDISC_INTERFACE = 4 + // See IP_PMTUDISC_OMIT. + IPV6_PMTUDISC_OMIT = 5 +) + +// Socket level values for IPv6. +const ( + SOL_IPV6 = 41 + SOL_ICMPV6 = 58 +) + +// Routing header options for IPv6. +const ( + IPV6_RTHDR_LOOSE = 0 + // Hop must be a neighbour. + IPV6_RTHDR_STRICT = 1 +) + +// IPv6 Routing header type 0. +const IPV6_RTHDR_TYPE_0 = 0 + +// Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. +// The `ip_dst' field is used for the first-hop gateway when using a +// source route (this gets put into the header proper). +type IpOpts struct { + IpDst InAddr + IpOpts [40]uint8 +} + +// Like `struct ip_mreq' but including interface specification by index. +type IpMreqn struct { + ImrMultiaddr InAddr + ImrAddress InAddr + ImrIfindex c.Int +} + +// Structure used for IP_PKTINFO. +type InPktinfo struct { + IpiIfindex c.Int + IpiSpecDst InAddr + IpiAddr InAddr +} + +// Description of data base entry for a single network. NOTE: here a +// poor assumption is made. The network number is expected to fit +// into an unsigned long int variable. +type Netent struct { + NName *uint8 + NAliases **uint8 + NAddrtype c.Int + NNet Uint32T +} + +const X_BITS_SOCKADDR_H = 1 + +// Size of struct sockaddr_storage. +const X_SS_SIZE = 128 + +// POSIX.1g specifies this type name for the `sa_family' member. +type SaFamilyT = uint16 + +// Protocol families. +const ( + PF_UNSPEC = 0 + // Local to host (pipes and file-domain). + PF_LOCAL = 1 + // POSIX name for PF_LOCAL. + PF_UNIX = 1 + // Another non-standard name for PF_LOCAL. + PF_FILE = 1 + // IP protocol family. + PF_INET = 2 + // Amateur Radio AX.25. + PF_AX25 = 3 + // Novell Internet Protocol. + PF_IPX = 4 + // Appletalk DDP. + PF_APPLETALK = 5 + // Amateur radio NetROM. + PF_NETROM = 6 + // Multiprotocol bridge. + PF_BRIDGE = 7 + // ATM PVCs. + PF_ATMPVC = 8 + // Reserved for X.25 project. + PF_X25 = 9 + // IP version 6. + PF_INET6 = 10 + // Amateur Radio X.25 PLP. + PF_ROSE = 11 + // Reserved for DECnet project. + PF_DECnet = 12 + // Reserved for 802.2LLC project. + PF_NETBEUI = 13 + // Security callback pseudo AF. + PF_SECURITY = 14 + // PF_KEY key management API. + PF_KEY = 15 + PF_NETLINK = 16 + // Alias to emulate 4.4BSD. + PF_ROUTE = 16 + // Packet family. + PF_PACKET = 17 + // Ash. + PF_ASH = 18 + // Acorn Econet. + PF_ECONET = 19 + // ATM SVCs. + PF_ATMSVC = 20 + // RDS sockets. + PF_RDS = 21 + // Linux SNA Project + PF_SNA = 22 + // IRDA sockets. + PF_IRDA = 23 + // PPPoX sockets. + PF_PPPOX = 24 + // Wanpipe API sockets. + PF_WANPIPE = 25 + // Linux LLC. + PF_LLC = 26 + // Native InfiniBand address. + PF_IB = 27 + // MPLS. + PF_MPLS = 28 + // Controller Area Network. + PF_CAN = 29 + // TIPC sockets. + PF_TIPC = 30 + // Bluetooth sockets. + PF_BLUETOOTH = 31 + // IUCV sockets. + PF_IUCV = 32 + // RxRPC sockets. + PF_RXRPC = 33 + // mISDN sockets. + PF_ISDN = 34 + // Phonet sockets. + PF_PHONET = 35 + // IEEE 802.15.4 sockets. + PF_IEEE802154 = 36 + // CAIF sockets. + PF_CAIF = 37 + // Algorithm sockets. + PF_ALG = 38 + // NFC sockets. + PF_NFC = 39 + // vSockets. + PF_VSOCK = 40 + // Kernel Connection Multiplexor. + PF_KCM = 41 + // For now.. + PF_MAX = 42 +) + +// Address families. +const ( + AF_UNSPEC = 0 + AF_LOCAL = 1 + AF_UNIX = 1 + AF_FILE = 1 + AF_INET = 2 + AF_AX25 = 3 + AF_IPX = 4 + AF_APPLETALK = 5 + AF_NETROM = 6 + AF_BRIDGE = 7 + AF_ATMPVC = 8 + AF_X25 = 9 + AF_INET6 = 10 + AF_ROSE = 11 + AF_DECnet = 12 + AF_NETBEUI = 13 + AF_SECURITY = 14 + AF_KEY = 15 + AF_NETLINK = 16 + AF_ROUTE = 16 + AF_PACKET = 17 + AF_ASH = 18 + AF_ECONET = 19 + AF_ATMSVC = 20 + AF_RDS = 21 + AF_SNA = 22 + AF_IRDA = 23 + AF_PPPOX = 24 + AF_WANPIPE = 25 + AF_LLC = 26 + AF_IB = 27 + AF_MPLS = 28 + AF_CAN = 29 + AF_TIPC = 30 + AF_BLUETOOTH = 31 + AF_IUCV = 32 + AF_RXRPC = 33 + AF_ISDN = 34 + AF_PHONET = 35 + AF_IEEE802154 = 36 + AF_CAIF = 37 + AF_ALG = 38 + AF_NFC = 39 + AF_VSOCK = 40 + AF_KCM = 41 + AF_MAX = 42 +) + +// Socket level values. Others are defined in the appropriate headers. +// +// XXX These definitions also should go into the appropriate headers as +// far as they are available. +const ( + SOL_RAW = 255 + SOL_DECNET = 261 + SOL_X25 = 262 + SOL_PACKET = 263 + // ATM layer (cell level). + SOL_ATM = 264 + // ATM Adaption Layer (packet level). + SOL_AAL = 265 + SOL_IRDA = 266 + SOL_NETBEUI = 267 + SOL_LLC = 268 + SOL_DCCP = 269 + SOL_NETLINK = 270 + SOL_TIPC = 271 + SOL_RXRPC = 272 + SOL_PPPOL2TP = 273 + SOL_BLUETOOTH = 274 + SOL_PNPIPE = 275 + SOL_RDS = 276 + SOL_IUCV = 277 + SOL_CAIF = 278 + SOL_ALG = 279 + SOL_NFC = 280 + SOL_KCM = 281 +) + +// Maximum queue length specifiable by listen. +const SOMAXCONN = 128 + +// Structure describing a generic socket address. +type SockAddr struct { + Family SaFamilyT + Data [14]uint8 +} + +type SockaddrStorage struct { + Family SaFamilyT + pad [118]uint8 + align c.Ulong +} + +// Bits in the FLAGS argument to `send', `recv', et al. +const ( + MSG_OOB = 1 + MSG_PEEK = 2 + MSG_DONTROUTE = 4 + MSG_CTRUNC = 8 + MSG_PROXY = 16 + MSG_TRUNC = 32 + MSG_DONTWAIT = 64 + MSG_EOR = 128 + MSG_WAITALL = 256 + MSG_FIN = 512 + MSG_SYN = 1024 + MSG_CONFIRM = 2048 + MSG_RST = 4096 + MSG_ERRQUEUE = 8192 + MSG_NOSIGNAL = 16384 + MSG_MORE = 32768 + MSG_WAITFORONE = 65536 + MSG_BATCH = 262144 + MSG_FASTOPEN = 536870912 + // Set close_on_exit for file + // descriptor received through + // SCM_RIGHTS. + MSG_CMSG_CLOEXEC = 1073741824 +) + +// Structure describing messages sent by +// `sendmsg' and received by `recvmsg'. +type Msghdr struct { + MsgName unsafe.Pointer + MsgNamelen SocklenT + MsgIov *Iovec + MsgIovlen c.SizeT + MsgControl unsafe.Pointer + MsgControllen c.SizeT + MsgFlags c.Int +} + +// Socket level message types. This must match the definitions in +// . +const SCM_RIGHTS = 1 + +// Structure used to manipulate the SO_LINGER option. +type Linger struct { + LOnoff c.Int + LLinger c.Int +} + +type SocklenT = X__SocklenT + +// Types of sockets. +type X__SocketType c.Uint + +const ( + SOCK_DCCP X__SocketType = 6 + SOCK_PACKET X__SocketType = 10 + SOCK_CLOEXEC X__SocketType = 524288 + // Atomically mark descriptor(s) as + // non-blocking. + SOCK_NONBLOCK X__SocketType = 2048 +) + +// Type of a byte count, or error. +type X__SsizeT = c.Long + +type X__CaddrT = *uint8 + +// Duplicate info from sys/socket.h. +type X__SocklenT = c.Uint + +type Iovec = c.Iovec + +type SizeT = c.Ulong + +const X_NET_IF_H = 1 + +// Length of interface name. +const IF_NAMESIZE = 16 + +const ( + IFHWADDRLEN = 6 + IFNAMSIZ = 16 +) + +type IfNameindex struct { + IfIndex c.Uint + IfName *uint8 +} + +// Standard interface flags. +const ( + IFF_UP = 1 + IFF_BROADCAST = 2 + IFF_DEBUG = 4 + IFF_LOOPBACK = 8 + IFF_POINTOPOINT = 16 + IFF_NOTRAILERS = 32 + IFF_RUNNING = 64 + IFF_NOARP = 128 + IFF_PROMISC = 256 + // Not supported + IFF_ALLMULTI = 512 + IFF_MASTER = 1024 + IFF_SLAVE = 2048 + IFF_MULTICAST = 4096 + IFF_PORTSEL = 8192 + IFF_AUTOMEDIA = 16384 + // Dialup device with changing addresses. + IFF_DYNAMIC = 32768 +) + +type Ifmap struct { + MemStart c.Ulong + MemEnd c.Ulong + BaseAddr uint16 + Irq uint8 + Dma uint8 + Port uint8 +} + +type Ifreq struct { + IfrIfrn _llcppg_anon_2 + IfrIfru _llcppg_anon_3 +} + +type Ifconf struct { + IfcLen c.Int + IfcIfcu _llcppg_anon_4 +} + +type _llcppg_anon_2 struct { + _xgo_union [16]uint8 +} + +type _llcppg_anon_3 struct { + _xgo_union [3]uint64 +} + +type _llcppg_anon_4 struct { + _xgo_union [1]uint64 +} + +func (p *_llcppg_anon_2) XGof_ref_ifrn_name() *[16]uint8 { + return (*[16]uint8)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_addr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_dstaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_broadaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_netmask() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_hwaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_flags() *int16 { + return (*int16)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_ivalue() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_mtu() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_map() *Ifmap { + return (*Ifmap)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_slave() *[16]uint8 { + return (*[16]uint8)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_newname() *[16]uint8 { + return (*[16]uint8)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_3) XGof_ref_ifru_data() *X__CaddrT { + return (*X__CaddrT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_4) XGof_ref_ifcu_buf() *X__CaddrT { + return (*X__CaddrT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_4) XGof_ref_ifcu_req() **Ifreq { + return (**Ifreq)(unsafe.Pointer(p)) +} + +// Convert an interface name to an index, and vice versa. +// +//go:linkname IfNametoindex C.if_nametoindex +func IfNametoindex(__ifname *uint8) c.Uint + +//go:linkname IfIndextoname C.if_indextoname +func IfIndextoname(__ifindex c.Uint, __ifname *uint8) *uint8 + +// Free the data returned from if_nameindex. +// +// llgo:link (*IfNameindex).IfFreenameindex C.if_freenameindex +func (self *IfNameindex) IfFreenameindex() { +} + +const X_NETDB_H = 1 + +// Absolute file name for network data base files. +const ( + X_PATH_HEQUIV = "/etc/hosts.equiv" + X_PATH_HOSTS = "/etc/hosts" + X_PATH_NETWORKS = "/etc/networks" + X_PATH_NSSWITCH_CONF = "/etc/nsswitch.conf" + X_PATH_PROTOCOLS = "/etc/protocols" + X_PATH_SERVICES = "/etc/services" +) + +// Possible values left in `h_errno'. +const ( + HOST_NOT_FOUND = 1 + // Non-Authoritative Host not found, + // or SERVERFAIL. + TRY_AGAIN = 2 +) + +// Non recoverable errors, FORMERR, REFUSED, +// NOTIMP. +const NO_RECOVERY = 3 + +// Valid name, no data record of requested +// type. +const NO_DATA = 4 + +const ( + // See errno. + NETDB_INTERNAL = -1 + // No problem. + NETDB_SUCCESS = 0 + // No address, look for MX record. + NO_ADDRESS = 4 +) + +// Possible values for `ai_flags' field in `addrinfo' structure. +const ( + AI_PASSIVE = 1 + // Request for canonical name. + AI_CANONNAME = 2 + // Don't use name resolution. + AI_NUMERICHOST = 4 + // IPv4 mapped addresses are acceptable. + AI_V4MAPPED = 8 + // Return IPv4 mapped and IPv6 addresses. + AI_ALL = 16 + // Use configuration of this host to choose + // returned address type.. + AI_ADDRCONFIG = 32 +) + +// Don't use name resolution. +const AI_NUMERICSERV = 1024 + +// Error values for `getaddrinfo' function. +const ( + EAI_BADFLAGS = -1 + // NAME or SERVICE is unknown. + EAI_NONAME = -2 + // Temporary failure in name resolution. + EAI_AGAIN = -3 + // Non-recoverable failure in name res. + EAI_FAIL = -4 + // `ai_family' not supported. + EAI_FAMILY = -6 + // `ai_socktype' not supported. + EAI_SOCKTYPE = -7 + // SERVICE not supported for `ai_socktype'. + EAI_SERVICE = -8 + // Memory allocation failure. + EAI_MEMORY = -10 + // System error returned in `errno'. + EAI_SYSTEM = -11 + // Argument buffer overflow. + EAI_OVERFLOW = -12 +) + +const ( + NI_MAXHOST = 1025 + NI_MAXSERV = 32 +) + +const ( + // Don't try to look up hostname. + NI_NUMERICHOST = 1 + // Don't convert port number to name. + NI_NUMERICSERV = 2 + // Only return nodename portion. + NI_NOFQDN = 4 + // Don't return numeric addresses. + NI_NAMEREQD = 8 + // Look up UDP service rather than TCP. + NI_DGRAM = 16 +) + +// Description of data base entry for a single host. +type Hostent struct { + Name *uint8 + Aliases **uint8 + AddrType c.Int + Length c.Int + AddrList **uint8 +} + +// Description of data base entry for a single service. +type Servent struct { + SName *uint8 + SAliases **uint8 + SPort c.Int + SProto *uint8 +} + +// Description of data base entry for a single service. +type Protoent struct { + PName *uint8 + PAliases **uint8 + PProto c.Int +} + +// Structure to contain information about address of a service provider. +type AddrInfo struct { + Flags c.Int + Family c.Int + SockType c.Int + Protocol c.Int + AddrLen SocklenT + Addr *SockAddr + CanOnName *uint8 + Next *AddrInfo +} + +// Function to get address of global `h_errno' variable. +// +//go:linkname X__HErrnoLocation C.__h_errno_location +func X__HErrnoLocation() *c.Int + +// Print error indicated by `h_errno' variable on standard error. STR +// if non-null is printed before the error string. +// +//go:linkname Herror C.herror +func Herror(__str *uint8) + +// Return string associated with error ERR_NUM. +// +//go:linkname Hstrerror C.hstrerror +func Hstrerror(__err_num c.Int) *uint8 + +// Open host data base files and mark them as staying open even after +// a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Sethostent C.sethostent +func Sethostent(__stay_open c.Int) + +// Close host data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endhostent C.endhostent +func Endhostent() + +// Get next entry from host data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Gethostent C.gethostent +func Gethostent() *Hostent + +// Return entry from host data base which address match ADDR with +// length LEN and type TYPE. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Gethostbyaddr C.gethostbyaddr +func Gethostbyaddr(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int) *Hostent + +// Return entry from host data base for host with NAME. AF must be +// set to the address type which is `AF_INET' for IPv4 or `AF_INET6' +// for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Gethostbyname2 C.gethostbyname2 +func Gethostbyname2(__name *uint8, __af c.Int) *Hostent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. The last +// argument is a pointer to a variable which gets the value which +// would be stored in the global variable `herrno' by the +// non-reentrant functions. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Hostent).GethostentR C.gethostent_r +func (self *Hostent) GethostentR(__buf *uint8, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int { + return 0 +} + +//go:linkname GethostbyaddrR C.gethostbyaddr_r +func GethostbyaddrR(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int, __result_buf *Hostent, __buf *uint8, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int + +//go:linkname GethostbynameR C.gethostbyname_r +func GethostbynameR(__name *uint8, __result_buf *Hostent, __buf *uint8, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int + +//go:linkname Gethostbyname2R C.gethostbyname2_r +func Gethostbyname2R(__name *uint8, __af c.Int, __result_buf *Hostent, __buf *uint8, __buflen SizeT, __result **Hostent, __h_errnop *c.Int) c.Int + +// Open network data base files and mark them as staying open even +// after a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setnetent C.setnetent +func Setnetent(__stay_open c.Int) + +// Close network data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endnetent C.endnetent +func Endnetent() + +// Get next entry from network data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getnetent C.getnetent +func Getnetent() *Netent + +// Return entry from network data base which address match NET and +// type TYPE. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getnetbyaddr C.getnetbyaddr +func Getnetbyaddr(__net Uint32T, __type c.Int) *Netent + +// Return entry from network data base for network with NAME. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getnetbyname C.getnetbyname +func Getnetbyname(__name *uint8) *Netent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. The last +// argument is a pointer to a variable which gets the value which +// would be stored in the global variable `herrno' by the +// non-reentrant functions. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Netent).GetnetentR C.getnetent_r +func (self *Netent) GetnetentR(__buf *uint8, __buflen SizeT, __result **Netent, __h_errnop *c.Int) c.Int { + return 0 +} + +//go:linkname GetnetbyaddrR C.getnetbyaddr_r +func GetnetbyaddrR(__net Uint32T, __type c.Int, __result_buf *Netent, __buf *uint8, __buflen SizeT, __result **Netent, __h_errnop *c.Int) c.Int + +//go:linkname GetnetbynameR C.getnetbyname_r +func GetnetbynameR(__name *uint8, __result_buf *Netent, __buf *uint8, __buflen SizeT, __result **Netent, __h_errnop *c.Int) c.Int + +// Open service data base files and mark them as staying open even +// after a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setservent C.setservent +func Setservent(__stay_open c.Int) + +// Close service data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endservent C.endservent +func Endservent() + +// Get next entry from service data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getservent C.getservent +func Getservent() *Servent + +// Return entry from network data base for network with NAME and +// protocol PROTO. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getservbyname C.getservbyname +func Getservbyname(__name *uint8, __proto *uint8) *Servent + +// Return entry from service data base which matches port PORT and +// protocol PROTO. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getservbyport C.getservbyport +func Getservbyport(__port c.Int, __proto *uint8) *Servent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Servent).GetserventR C.getservent_r +func (self *Servent) GetserventR(__buf *uint8, __buflen SizeT, __result **Servent) c.Int { + return 0 +} + +//go:linkname GetservbynameR C.getservbyname_r +func GetservbynameR(__name *uint8, __proto *uint8, __result_buf *Servent, __buf *uint8, __buflen SizeT, __result **Servent) c.Int + +//go:linkname GetservbyportR C.getservbyport_r +func GetservbyportR(__port c.Int, __proto *uint8, __result_buf *Servent, __buf *uint8, __buflen SizeT, __result **Servent) c.Int + +// Open protocol data base files and mark them as staying open even +// after a later search if STAY_OPEN is non-zero. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setprotoent C.setprotoent +func Setprotoent(__stay_open c.Int) + +// Close protocol data base files and clear `stay open' flag. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endprotoent C.endprotoent +func Endprotoent() + +// Get next entry from protocol data base file. Open data base if +// necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getprotoent C.getprotoent +func Getprotoent() *Protoent + +// Return entry from protocol data base for network with NAME. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getprotobyname C.getprotobyname +func Getprotobyname(__name *uint8) *Protoent + +// Return entry from protocol data base which number is PROTO. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getprotobynumber C.getprotobynumber +func Getprotobynumber(__proto c.Int) *Protoent + +// Reentrant versions of the functions above. The additional +// arguments specify a buffer of BUFLEN starting at BUF. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +// llgo:link (*Protoent).GetprotoentR C.getprotoent_r +func (self *Protoent) GetprotoentR(__buf *uint8, __buflen SizeT, __result **Protoent) c.Int { + return 0 +} + +//go:linkname GetprotobynameR C.getprotobyname_r +func GetprotobynameR(__name *uint8, __result_buf *Protoent, __buf *uint8, __buflen SizeT, __result **Protoent) c.Int + +//go:linkname GetprotobynumberR C.getprotobynumber_r +func GetprotobynumberR(__proto c.Int, __result_buf *Protoent, __buf *uint8, __buflen SizeT, __result **Protoent) c.Int + +// Establish network group NETGROUP for enumeration. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Setnetgrent C.setnetgrent +func Setnetgrent(__netgroup *uint8) c.Int + +// Free all space allocated by previous `setnetgrent' call. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Endnetgrent C.endnetgrent +func Endnetgrent() + +// Get next member of netgroup established by last `setnetgrent' call +// and return pointers to elements in HOSTP, USERP, and DOMAINP. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Getnetgrent C.getnetgrent +func Getnetgrent(__hostp **uint8, __userp **uint8, __domainp **uint8) c.Int + +// Test whether NETGROUP contains the triple (HOST,USER,DOMAIN). +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Innetgr C.innetgr +func Innetgr(__netgroup *uint8, __host *uint8, __user *uint8, __domain *uint8) c.Int + +// Reentrant version of `getnetgrent' where result is placed in BUFFER. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname GetnetgrentR C.getnetgrent_r +func GetnetgrentR(__hostp **uint8, __userp **uint8, __domainp **uint8, __buffer *uint8, __buflen SizeT) c.Int + +// Call `rshd' at port RPORT on remote machine *AHOST to execute CMD. +// The local user is LOCUSER, on the remote machine the command is +// executed as REMUSER. In *FD2P the descriptor to the socket for the +// connection is returned. The caller must have the right to use a +// reserved port. When the function returns *AHOST contains the +// official host name. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Rcmd C.rcmd +func Rcmd(__ahost **uint8, __rport uint16, __locuser *uint8, __remuser *uint8, __cmd *uint8, __fd2p *c.Int) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RcmdAf C.rcmd_af +func RcmdAf(__ahost **uint8, __rport uint16, __locuser *uint8, __remuser *uint8, __cmd *uint8, __fd2p *c.Int, __af SaFamilyT) c.Int + +// Call `rexecd' at port RPORT on remote machine *AHOST to execute +// CMD. The process runs at the remote machine using the ID of user +// NAME whose cleartext password is PASSWD. In *FD2P the descriptor +// to the socket for the connection is returned. When the function +// returns *AHOST contains the official host name. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Rexec C.rexec +func Rexec(__ahost **uint8, __rport c.Int, __name *uint8, __pass *uint8, __cmd *uint8, __fd2p *c.Int) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RexecAf C.rexec_af +func RexecAf(__ahost **uint8, __rport c.Int, __name *uint8, __pass *uint8, __cmd *uint8, __fd2p *c.Int, __af SaFamilyT) c.Int + +// Check whether user REMUSER on system RHOST is allowed to login as LOCUSER. +// If SUSER is not zero the user tries to become superuser. Return 0 if +// it is possible. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Ruserok C.ruserok +func Ruserok(__rhost *uint8, __suser c.Int, __remuser *uint8, __locuser *uint8) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RuserokAf C.ruserok_af +func RuserokAf(__rhost *uint8, __suser c.Int, __remuser *uint8, __locuser *uint8, __af SaFamilyT) c.Int + +// Check whether user REMUSER on system indicated by IPv4 address +// RADDR is allowed to login as LOCUSER. Non-IPv4 (e.g., IPv6) are +// not supported. If SUSER is not zero the user tries to become +// superuser. Return 0 if it is possible. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Iruserok C.iruserok +func Iruserok(__raddr Uint32T, __suser c.Int, __remuser *uint8, __locuser *uint8) c.Int + +// This is the equivalent function where the pfamiliy if the address +// pointed to by RADDR is determined by the value of AF. It therefore +// can be used for IPv6 +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname IruserokAf C.iruserok_af +func IruserokAf(__raddr unsafe.Pointer, __suser c.Int, __remuser *uint8, __locuser *uint8, __af SaFamilyT) c.Int + +// Try to allocate reserved port, returning a descriptor for a socket opened +// at this port or -1 if unsuccessful. The search for an available port +// will start at ALPORT and continues with lower numbers. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Rresvport C.rresvport +func Rresvport(__alport *c.Int) c.Int + +// This is the equivalent function where the protocol can be selected +// and which therefore can be used for IPv6. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname RresvportAf C.rresvport_af +func RresvportAf(__alport *c.Int, __af SaFamilyT) c.Int + +// Convert error return from getaddrinfo() to a string. +// +//go:linkname GaiStrerror C.gai_strerror +func GaiStrerror(__ecode c.Int) *uint8 + +// Translate a socket address to a location and service name. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +// llgo:link (*SockAddr).Getnameinfo C.getnameinfo +func (self *SockAddr) Getnameinfo(__salen SocklenT, __host *uint8, __hostlen SocklenT, __serv *uint8, __servlen SocklenT, __flags c.Int) c.Int { + return 0 +} + +const X_NETINET_IN_H = 1 + +const ( + IN_CLASSA_NET = 4278190080 + IN_CLASSA_NSHIFT = 24 + IN_CLASSA_HOST = 16777215 + IN_CLASSA_MAX = 128 +) + +const ( + IN_CLASSB_NET = 4294901760 + IN_CLASSB_NSHIFT = 16 + IN_CLASSB_HOST = 65535 + IN_CLASSB_MAX = 65536 +) + +const ( + IN_CLASSC_NET = 4294967040 + IN_CLASSC_NSHIFT = 8 + IN_CLASSC_HOST = 255 +) + +// Network number for local host loopback. +const IN_LOOPBACKNET = 127 + +const ( + INET_ADDRSTRLEN = 16 + INET6_ADDRSTRLEN = 46 +) + +type InAddr struct { + Addr InAddrT +} + +// Standard well-defined IP protocols. +const ( + IPPROTO_IP = 0 + IPPROTO_ICMP = 1 + IPPROTO_IGMP = 2 + IPPROTO_IPIP = 4 + IPPROTO_TCP = 6 + IPPROTO_EGP = 8 + IPPROTO_PUP = 12 + IPPROTO_UDP = 17 + IPPROTO_IDP = 22 + IPPROTO_TP = 29 + IPPROTO_DCCP = 33 + IPPROTO_IPV6 = 41 + IPPROTO_RSVP = 46 + IPPROTO_GRE = 47 + IPPROTO_ESP = 50 + IPPROTO_AH = 51 + IPPROTO_MTP = 92 + IPPROTO_BEETPH = 94 + IPPROTO_ENCAP = 98 + IPPROTO_PIM = 103 + IPPROTO_COMP = 108 + IPPROTO_SCTP = 132 + IPPROTO_UDPLITE = 136 + IPPROTO_MPLS = 137 + IPPROTO_RAW = 255 + IPPROTO_MAX = 256 +) + +const ( + IPPROTO_HOPOPTS = 0 + IPPROTO_ROUTING = 43 + IPPROTO_FRAGMENT = 44 + IPPROTO_ICMPV6 = 58 + IPPROTO_NONE = 59 + IPPROTO_DSTOPTS = 60 + // IPv6 mobility header. + IPPROTO_MH = 135 +) + +// Standard well-known ports. +const ( + IPPORT_ECHO = 7 + IPPORT_DISCARD = 9 + IPPORT_SYSTAT = 11 + IPPORT_DAYTIME = 13 + IPPORT_NETSTAT = 15 + IPPORT_FTP = 21 + IPPORT_TELNET = 23 + IPPORT_SMTP = 25 + IPPORT_TIMESERVER = 37 + IPPORT_NAMESERVER = 42 + IPPORT_WHOIS = 43 + IPPORT_MTP = 57 + IPPORT_TFTP = 69 + IPPORT_RJE = 77 + IPPORT_FINGER = 79 + IPPORT_TTYLINK = 87 + IPPORT_SUPDUP = 95 + IPPORT_EXECSERVER = 512 + IPPORT_LOGINSERVER = 513 + IPPORT_CMDSERVER = 514 + IPPORT_EFSSERVER = 520 + // UDP ports. + IPPORT_BIFFUDP = 512 + IPPORT_WHOSERVER = 513 + IPPORT_ROUTESERVER = 520 + // Ports less than this value are reserved for privileged processes. + IPPORT_RESERVED = 1024 + // Ports greater this value are reserved for (non-privileged) servers. + IPPORT_USERRESERVED = 5000 +) + +// In6Addr retains the byte array API and the native IPv6 union alignment. +type In6Addr struct { + _ [0]uint32 + U6Addr [16]uint8 +} + +// Structure describing an Internet socket address. +type SockaddrIn struct { + Family SaFamilyT + Port InPortT + Addr InAddr + Zero [8]uint8 +} + +// Ditto, for IPv6. +type SockaddrIn6 struct { + Family SaFamilyT + Port InPortT + Flowinfo Uint32T + Addr In6Addr + ScopeId Uint32T +} + +// IPv4 multicast request. +type IpMreq struct { + ImrMultiaddr InAddr + ImrInterface InAddr +} + +type IpMreqSource struct { + ImrMultiaddr InAddr + ImrInterface InAddr + ImrSourceaddr InAddr +} + +// Likewise, for IPv6. +type Ipv6Mreq struct { + Ipv6mrMultiaddr In6Addr + Ipv6mrInterface c.Uint +} + +// Multicast group request. +type GroupReq struct { + GrInterface Uint32T + GrGroup SockaddrStorage +} + +type GroupSourceReq struct { + GsrInterface Uint32T + GsrGroup SockaddrStorage + GsrSource SockaddrStorage +} + +// Full-state filter operations. +type IpMsfilter struct { + ImsfMultiaddr InAddr + ImsfInterface InAddr + ImsfFmode Uint32T + ImsfNumsrc Uint32T + ImsfSlist [1]InAddr +} + +type GroupFilter struct { + GfInterface Uint32T + GfGroup SockaddrStorage + GfFmode Uint32T + GfNumsrc Uint32T + GfSlist [1]SockaddrStorage +} + +// Internet address. +type InAddrT = Uint32T + +// Type to represent a port. +type InPortT = Uint16T + +// :: +// +//go:linkname In6addrAny C.in6addr_any +var In6addrAny In6Addr + +// ::1 +// +//go:linkname In6addrLoopback C.in6addr_loopback +var In6addrLoopback In6Addr + +// Bind socket to a privileged IP port. +// +//go:linkname Bindresvport C.bindresvport +func Bindresvport(__sockfd c.Int, __sock_in *SockaddrIn) c.Int + +const X_RPC_NETDB_H = 1 + +type Rpcent struct { + RName *uint8 + RAliases **uint8 + RNumber c.Int +} + +//go:linkname Setrpcent C.setrpcent +func Setrpcent(__stayopen c.Int) + +//go:linkname Endrpcent C.endrpcent +func Endrpcent() + +//go:linkname Getrpcbyname C.getrpcbyname +func Getrpcbyname(__name *uint8) *Rpcent + +//go:linkname Getrpcbynumber C.getrpcbynumber +func Getrpcbynumber(__number c.Int) *Rpcent + +//go:linkname Getrpcent C.getrpcent +func Getrpcent() *Rpcent + +//go:linkname GetrpcbynameR C.getrpcbyname_r +func GetrpcbynameR(__name *uint8, __result_buf *Rpcent, __buffer *uint8, __buflen SizeT, __result **Rpcent) c.Int + +//go:linkname GetrpcbynumberR C.getrpcbynumber_r +func GetrpcbynumberR(__number c.Int, __result_buf *Rpcent, __buffer *uint8, __buflen SizeT, __result **Rpcent) c.Int + +// llgo:link (*Rpcent).GetrpcentR C.getrpcent_r +func (self *Rpcent) GetrpcentR(__buffer *uint8, __buflen SizeT, __result **Rpcent) c.Int { + return 0 +} + +type Uint16T = uint16 + +type Uint32T = c.Uint + +const X_SYS_SOCKET_H = 1 + +// This is the 4.3 BSD `struct sockaddr' format, which is used as wire +// format in the grotty old 4.3 `talk' protocol. +type Osockaddr struct { + SaFamily uint16 + SaData [14]uint8 +} + +// The following constants should be used for the second parameter of +// `shutdown'. +const ( + SHUT_RD = 0 + SHUT_WR = 1 + // No more receptions or transmissions. + SHUT_RDWR = 2 +) + +// Create two new sockets, of type TYPE in domain DOMAIN and using +// protocol PROTOCOL, which are connected to each other, and put file +// descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero, +// one will be chosen automatically. Returns 0 on success, -1 for errors. +// +//go:linkname Socketpair C.socketpair +func Socketpair(__domain c.Int, __type c.Int, __protocol c.Int, __fds *c.Int) c.Int + +// Put the local address of FD into *ADDR and its length in *LEN. +// +//go:linkname Getsockname C.getsockname +func Getsockname(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int + +// Put the address of the peer connected to socket FD into *ADDR +// (which is *LEN bytes long), and its actual length into *LEN. +// +//go:linkname Getpeername C.getpeername +func Getpeername(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int + +// Send N bytes of BUF on socket FD to peer at address ADDR (which is +// ADDR_LEN bytes long). Returns the number sent, or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Sendto C.sendto +func Sendto(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int, __addr *SockAddr, __addr_len SocklenT) SsizeT + +// Read N bytes into BUF through socket FD. +// If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of +// the sender, and store the actual size of the address in *ADDR_LEN. +// Returns the number of bytes read or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Recvfrom C.recvfrom +func Recvfrom(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int, __addr *SockAddr, __addr_len *SocklenT) SsizeT + +// Send a message described MESSAGE on socket FD. +// Returns the number of bytes sent, or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Sendmsg C.sendmsg +func Sendmsg(__fd c.Int, __message *Msghdr, __flags c.Int) SsizeT + +// Receive a message as described by MESSAGE from socket FD. +// Returns the number of bytes read or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Recvmsg C.recvmsg +func Recvmsg(__fd c.Int, __message *Msghdr, __flags c.Int) SsizeT + +// Put the current value for socket FD's option OPTNAME at protocol level LEVEL +// into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's +// actual length. Returns 0 on success, -1 for errors. +// +//go:linkname Getsockopt C.getsockopt +func Getsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen *SocklenT) c.Int + +// Shut down all or part of the connection open on socket FD. +// HOW determines what to shut down: +// SHUT_RD = No more receptions; +// SHUT_WR = No more transmissions; +// SHUT_RDWR = No more receptions or transmissions. +// Returns 0 on success, -1 for errors. +// +//go:linkname Shutdown C.shutdown +func Shutdown(__fd c.Int, __how c.Int) c.Int + +// Determine wheter socket is at a out-of-band mark. +// +//go:linkname Sockatmark C.sockatmark +func Sockatmark(__fd c.Int) c.Int + +// FDTYPE is S_IFSOCK or another S_IF* macro defined in ; +// returns 1 if FD is open on an object of the indicated type, 0 if not, +// or -1 for errors (setting errno). +// +//go:linkname Isfdtype C.isfdtype +func Isfdtype(__fd c.Int, __fdtype c.Int) c.Int + +type SsizeT = X__SsizeT + +const X_SYS_UN_H = 1 + +// Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. +type SockaddrUn struct { + SunFamily SaFamilyT + SunPath [108]uint8 +} diff --git a/c/net/llcppg.i_darwin_arm64.go b/c/net/llcppg.i_darwin_arm64.go deleted file mode 100644 index 2d0d1aca..00000000 --- a/c/net/llcppg.i_darwin_arm64.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -const XGoPackage = true -const LLGoPackage = "link: -lc" diff --git a/c/net/llcppg.i_linux_amd64.go b/c/net/llcppg.i_linux_amd64.go deleted file mode 100644 index a9e57d9d..00000000 --- a/c/net/llcppg.i_linux_amd64.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -const XGoPackage = true -const LLGoPackage = "link: -lc" diff --git a/c/net/llcppg.i_linux_arm64.go b/c/net/llcppg.i_linux_arm64.go deleted file mode 100644 index 214f2d62..00000000 --- a/c/net/llcppg.i_linux_arm64.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -const XGoPackage = true -const LLGoPackage = "link: -lc" diff --git a/c/net/llcppg.pub b/c/net/llcppg.pub index fee07a0e..28dc0851 100644 --- a/c/net/llcppg.pub +++ b/c/net/llcppg.pub @@ -1,118 +1,30 @@ -T __blkcnt64_t X__Blkcnt64T -T __blkcnt_t X__BlkcntT -T __blksize_t X__BlksizeT T __caddr_t X__CaddrT -T __clock_t X__ClockT -T __clockid_t X__ClockidT -T __daddr_t X__DaddrT -T __darwin_blkcnt_t X__DarwinBlkcntT -T __darwin_blksize_t X__DarwinBlksizeT -T __darwin_clock_t X__DarwinClockT -T __darwin_ct_rune_t X__DarwinCtRuneT -T __darwin_dev_t X__DarwinDevT -T __darwin_fsblkcnt_t X__DarwinFsblkcntT -T __darwin_fsfilcnt_t X__DarwinFsfilcntT -T __darwin_gid_t X__DarwinGidT -T __darwin_id_t X__DarwinIdT -T __darwin_ino64_t X__DarwinIno64T -T __darwin_ino_t X__DarwinInoT -T __darwin_intptr_t X__DarwinIntptrT -T __darwin_mach_port_name_t X__DarwinMachPortNameT -T __darwin_mach_port_t X__DarwinMachPortT -T __darwin_mbstate_t X__DarwinMbstateT -T __darwin_mode_t X__DarwinModeT -T __darwin_natural_t X__DarwinNaturalT T __darwin_off_t X__DarwinOffT -T __darwin_pid_t X__DarwinPidT -T __darwin_ptrdiff_t X__DarwinPtrdiffT -T __darwin_rune_t X__DarwinRuneT -T __darwin_sigset_t X__DarwinSigsetT T __darwin_size_t X__DarwinSizeT T __darwin_socklen_t X__DarwinSocklenT T __darwin_ssize_t X__DarwinSsizeT -T __darwin_suseconds_t X__DarwinSusecondsT -T __darwin_time_t X__DarwinTimeT -T __darwin_uid_t X__DarwinUidT -T __darwin_useconds_t X__DarwinUsecondsT -T __darwin_uuid_string_t X__DarwinUuidStringT -T __darwin_uuid_t X__DarwinUuidT -T __darwin_wchar_t X__DarwinWcharT -T __darwin_wint_t X__DarwinWintT -T __dev_t X__DevT -T __fsblkcnt64_t X__Fsblkcnt64T -T __fsblkcnt_t X__FsblkcntT -T __fsfilcnt64_t X__Fsfilcnt64T -T __fsfilcnt_t X__FsfilcntT -T __fsid_t X__FsidT -T __fsword_t X__FswordT -T __gid_t X__GidT -T __id_t X__IdT -T __ino64_t X__Ino64T -T __ino_t X__InoT -T __int16_t X__Int16T -T __int32_t X__Int32T T __int64_t X__Int64T -T __int8_t X__Int8T -T __intptr_t X__IntptrT -T __key_t X__KeyT -T __loff_t X__LoffT -T __mbstate_t X__MbstateT -T __mode_t X__ModeT -T __msfilterreq X__Msfilterreq -T __nlink_t X__NlinkT -T __off64_t X__Off64T -T __off_t X__OffT -T __pid_t X__PidT -T __qaddr_t X__QaddrT -T __quad_t X__QuadT -T __rlim64_t X__Rlim64T -T __rlim_t X__RlimT T __sockaddr_header X__SockaddrHeader T __socket_type X__SocketType T __socklen_t X__SocklenT T __ssize_t X__SsizeT -T __suseconds_t X__SusecondsT -T __syscall_slong_t X__SyscallSlongT -T __syscall_ulong_t X__SyscallUlongT -T __time_t X__TimeT -T __timer_t X__TimerT -T __u_char X__UChar -T __u_int X__UInt -T __u_long X__ULong -T __u_quad_t X__UQuadT -T __u_short X__UShort -T __uid_t X__UidT T __uint16_t X__Uint16T T __uint32_t X__Uint32T -T __uint64_t X__Uint64T T __uint8_t X__Uint8T -T __useconds_t X__UsecondsT T addrinfo AddrInfo -T caddr_t CaddrT -T cmsghdr Cmsghdr T group_filter GroupFilter T group_req GroupReq T group_source_req GroupSourceReq T hostent Hostent T if_clonereq IfClonereq -T if_data IfData -T if_data64 IfData64 -T if_msghdr IfMsghdr -T if_msghdr2 IfMsghdr2 T if_nameindex IfNameindex T ifa_msghdr IfaMsghdr -T iface Iface -T ifaddr Ifaddr T ifaliasreq Ifaliasreq T ifconf Ifconf T ifdevmtu Ifdevmtu -T ifdrv Ifdrv -T ifkpi Ifkpi T ifma_msghdr IfmaMsghdr T ifma_msghdr2 IfmaMsghdr2 T ifmap Ifmap -T ifmediareq Ifmediareq -T ifnet_interface_advisory IfnetInterfaceAdvisory T ifqueue Ifqueue T ifreq Ifreq T ifstat Ifstat @@ -155,8 +67,6 @@ T sockaddr_storage SockaddrStorage T sockaddr_un SockaddrUn T socklen_t SocklenT T sockproto Sockproto -T timeval32 Timeval32 T u_char UChar T u_int32_t UInt32T -T u_int64_t UInt64T T u_short UShort diff --git a/c/net/llcppg_darwin_arm64.go b/c/net/llcppg_darwin_arm64.go deleted file mode 100644 index 322b657c..00000000 --- a/c/net/llcppg_darwin_arm64.go +++ /dev/null @@ -1,17 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -type In6Addr struct { - _ [0]uint32 - U6Addr [16]uint8 -} -type charPtr = *int8 -type charPP = **int8 -type sockaddrPtr = *SockAddr -type addrinfoPtr = *AddrInfo -type Iovec = c.Iovec diff --git a/c/net/llcppg_linux_amd64.go b/c/net/llcppg_linux_amd64.go deleted file mode 100644 index ac6499a0..00000000 --- a/c/net/llcppg_linux_amd64.go +++ /dev/null @@ -1,17 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -type In6Addr struct { - _ [0]uint32 - U6Addr [16]uint8 -} -type charPtr = *int8 -type charPP = **int8 -type sockaddrPtr = *SockAddr -type addrinfoPtr = *AddrInfo -type Iovec = c.Iovec diff --git a/c/net/llcppg_linux_arm64.go b/c/net/llcppg_linux_arm64.go deleted file mode 100644 index 2cbc1bf2..00000000 --- a/c/net/llcppg_linux_arm64.go +++ /dev/null @@ -1,17 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -type In6Addr struct { - _ [0]uint32 - U6Addr [16]uint8 -} -type charPtr = *int8 -type charPP = **int8 -type sockaddrPtr = *SockAddr -type addrinfoPtr = *AddrInfo -type Iovec = c.Iovec diff --git a/c/net/net-if_darwin_arm64.go b/c/net/net-if_darwin_arm64.go deleted file mode 100644 index 9e99bc97..00000000 --- a/c/net/net-if_darwin_arm64.go +++ /dev/null @@ -1,341 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const IF_NAMESIZE = 16 -const ( - // interface is up - IFF_UP = 1 - // broadcast address valid - IFF_BROADCAST = 2 - // turn on debugging - IFF_DEBUG = 4 - // is a loopback net - IFF_LOOPBACK = 8 - // interface is point-to-point link - IFF_POINTOPOINT = 16 - // obsolete: avoid use of trailers - IFF_NOTRAILERS = 32 - // resources allocated - IFF_RUNNING = 64 - // no address resolution protocol - IFF_NOARP = 128 - // receive all packets - IFF_PROMISC = 256 - // receive all multicast packets - IFF_ALLMULTI = 512 - // transmission in progress - IFF_OACTIVE = 1024 - // can't hear own transmissions - IFF_SIMPLEX = 2048 - // per link layer defined bit - IFF_LINK0 = 4096 - // per link layer defined bit - IFF_LINK1 = 8192 - // per link layer defined bit - IFF_LINK2 = 16384 - // use alternate physical connection - IFF_ALTPHYS = 16384 - // supports multicast - IFF_MULTICAST = 32768 -) - -// Capabilities that interfaces can advertise. -// -// struct ifnet.if_capabilities -// -// contains the optional features & capabilities a particular interface -// supports (not only the driver but also the detected hw revision). -// Capabilities are defined by IFCAP_* below. -// -// struct ifnet.if_capenable -// -// contains the enabled (either by default or through ifconfig) optional -// features & capabilities on this interface. -// Capabilities are defined by IFCAP_* below. -// -// struct if_data.ifi_hwassist in IFNET_* form, defined in net/kpi_interface.h, -// -// contains the enabled optional features & capabilites that can be used -// individually per packet and are specified in the mbuf pkthdr.csum_flags -// field. IFCAP_* and IFNET_* do not match one to one and IFNET_* may be -// more detailed or differentiated than IFCAP_*. -// IFNET_* hwassist flags have corresponding CSUM_* in sys/mbuf.h -const ( - IFCAP_RXCSUM = 1 - // can offload checksum on TX - IFCAP_TXCSUM = 2 - // VLAN-compatible MTU - IFCAP_VLAN_MTU = 4 - // hardware VLAN tag support - IFCAP_VLAN_HWTAGGING = 8 - // 9000 byte MTU supported - IFCAP_JUMBO_MTU = 16 - // can do TCP Segmentation Offload - IFCAP_TSO4 = 32 - // can do TCP6 Segmentation Offload - IFCAP_TSO6 = 64 - // can do Large Receive Offload - IFCAP_LRO = 128 - // can do 802.1 AV Bridging - IFCAP_AV = 256 - // can return linklevel xmit status - IFCAP_TXSTATUS = 512 - // Skywalk mode supported/enabled - IFCAP_SKYWALK = 1024 - // Time stamping in hardware - IFCAP_HW_TIMESTAMP = 2048 - // Time stamping in software - IFCAP_SW_TIMESTAMP = 4096 - // can offload partial checksum - IFCAP_CSUM_PARTIAL = 8192 - // can invert 0 to -0 (0xffff) - IFCAP_CSUM_ZERO_INVERT = 16384 -) -const ( - IFCAP_HWCSUM = 3 - IFCAP_TSO = 96 -) -const IFCAP_VALID = 32767 -const ( - IFQ_MAXLEN = 128 - // granularity is 1 second - IFNET_SLOWHZ = 1 -) - -// Wake capabilities of a interface -const IF_WAKE_ON_MAGIC_PACKET = 1 -const ( - IFRTYPE_FUNCTIONAL_UNKNOWN = 0 - IFRTYPE_FUNCTIONAL_LOOPBACK = 1 - IFRTYPE_FUNCTIONAL_WIRED = 2 - IFRTYPE_FUNCTIONAL_WIFI_INFRA = 3 - IFRTYPE_FUNCTIONAL_WIFI_AWDL = 4 - IFRTYPE_FUNCTIONAL_CELLULAR = 5 - IFRTYPE_FUNCTIONAL_INTCOPROC = 6 - IFRTYPE_FUNCTIONAL_COMPANIONLINK = 7 - IFRTYPE_FUNCTIONAL_MANAGEMENT = 8 - IFRTYPE_FUNCTIONAL_LAST = 8 -) - -// 10 lines of text -const IFSTATMAX = 800 - -type IfClonereq struct { - IfcrTotal c.Int - IfcrCount c.Int - IfcrBuffer *c.Char -} - -// Message format for use in obtaining information about interfaces -// from sysctl and the routing socket -type IfMsghdr struct { - IfmMsglen uint16 - IfmVersion uint8 - IfmType uint8 - IfmAddrs c.Int - IfmFlags c.Int - IfmIndex uint16 - IfmData IfData -} - -// Message format for use in obtaining information about interface addresses -// from sysctl and the routing socket -type IfaMsghdr struct { - IfamMsglen uint16 - IfamVersion uint8 - IfamType uint8 - IfamAddrs c.Int - IfamFlags c.Int - IfamIndex uint16 - IfamMetric c.Int -} - -// Message format for use in obtaining information about multicast addresses -// from the routing socket -type IfmaMsghdr struct { - IfmamMsglen uint16 - IfmamVersion uint8 - IfmamType uint8 - IfmamAddrs c.Int - IfmamFlags c.Int - IfmamIndex uint16 -} - -// Message format for use in obtaining information about interfaces -// from sysctl -type IfMsghdr2 struct { - IfmMsglen UShort - IfmVersion UChar - IfmType UChar - IfmAddrs c.Int - IfmFlags c.Int - IfmIndex UShort - IfmSndLen c.Int - IfmSndMaxlen c.Int - IfmSndDrops c.Int - IfmTimer c.Int - IfmData IfData64 -} - -// Message format for use in obtaining information about multicast addresses -// from sysctl -type IfmaMsghdr2 struct { - IfmamMsglen UShort - IfmamVersion UChar - IfmamType UChar - IfmamAddrs c.Int - IfmamFlags c.Int - IfmamIndex UShort - IfmamRefcount c.Int32T -} - -// ifdevmtu: interface device mtu -// -// Used with SIOCGIFDEVMTU to get the current mtu in use by the device, -// as well as the minimum and maximum mtu allowed by the device. -type Ifdevmtu struct { - IfdmCurrent c.Int - IfdmMin c.Int - IfdmMax c.Int -} -type Ifkpi struct { - IfkModuleId c.Uint - IfkType c.Uint - IfkData _llcppg_anon_1 -} -type Ifreq struct { - IfrName [16]c.Char - IfrIfru _llcppg_anon_2 -} -type Ifaliasreq struct { - IfraName [16]c.Char - IfraAddr SockAddr - IfraBroadaddr SockAddr - IfraMask SockAddr -} -type RslvmultiReq struct { - Sa *SockAddr - Llsa **SockAddr -} -type Ifmediareq struct { - IfmName [16]c.Char - IfmCurrent c.Int - IfmMask c.Int - IfmStatus c.Int - IfmActive c.Int - IfmCount c.Int - IfmUlist *c.Int -} -type Ifdrv struct { - IfdName [16]c.Char - IfdCmd c.Ulong - IfdLen c.SizeT - IfdData unsafe.Pointer -} -type Ifstat struct { - IfsName [16]c.Char - Ascii [801]c.Char -} -type Ifconf struct { - IfcLen c.Int - IfcIfcu _llcppg_anon_3 -} - -// DLIL KEV_DL_PROTO_ATTACHED/DETACHED structure -type KevDlProtoData struct { - LinkData NetEventData - ProtoFamily UInt32T - ProtoRemainingCount UInt32T -} -type IfNameindex struct { - IfIndex c.Uint - IfName *c.Char -} -type _llcppg_anon_1 struct { - _xgo_union [2]uint32 -} -type _llcppg_anon_2 struct { - _xgo_union [2]uint64 -} -type _llcppg_anon_3 struct { - _xgo_union [2]uint32 -} - -func (p *_llcppg_anon_1) XGof_ref_ifk_ptr() *unsafe.Pointer { - return (*unsafe.Pointer)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_1) XGof_ref_ifk_value() *c.Int { - return (*c.Int)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_addr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_dstaddr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_broadaddr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_flags() *int16 { - return (*int16)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_metric() *c.Int { - return (*c.Int)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_mtu() *c.Int { - return (*c.Int)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_phys() *c.Int { - return (*c.Int)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_media() *c.Int { - return (*c.Int)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_intval() *c.Int { - return (*c.Int)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_data() *CaddrT { - return (*CaddrT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_devmtu() *Ifdevmtu { - return (*Ifdevmtu)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_kpi() *Ifkpi { - return (*Ifkpi)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_wake_flags() *UInt32T { - return (*UInt32T)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_route_refcnt() *UInt32T { - return (*UInt32T)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_cap() *[2]c.Int { - return (*[2]c.Int)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifru_functional_type() *UInt32T { - return (*UInt32T)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifcu_buf() *CaddrT { - return (*CaddrT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifcu_req() **Ifreq { - return (**Ifreq)(unsafe.Pointer(p)) -} - -//go:linkname IfNametoindex C.if_nametoindex -func IfNametoindex(_llcppg_param1 *c.Char) c.Uint - -//go:linkname IfIndextoname C.if_indextoname -func IfIndextoname(_llcppg_param1 c.Uint, _llcppg_param2 *c.Char) *c.Char - -// llgo:link (*IfNameindex).IfFreenameindex C.if_freenameindex -func (self *IfNameindex) IfFreenameindex() { -} diff --git a/c/net/net-if_linux_amd64.go b/c/net/net-if_linux_amd64.go deleted file mode 100644 index 590f7cb1..00000000 --- a/c/net/net-if_linux_amd64.go +++ /dev/null @@ -1,149 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_NET_IF_H = 1 - -// Length of interface name. -const IF_NAMESIZE = 16 -const ( - IFHWADDRLEN = 6 - IFNAMSIZ = 16 -) - -type IfNameindex struct { - IfIndex c.Uint - IfName *c.Char -} - -// Standard interface flags. -const ( - IFF_UP = 1 - IFF_BROADCAST = 2 - IFF_DEBUG = 4 - IFF_LOOPBACK = 8 - IFF_POINTOPOINT = 16 - IFF_NOTRAILERS = 32 - IFF_RUNNING = 64 - IFF_NOARP = 128 - IFF_PROMISC = 256 - // Not supported - IFF_ALLMULTI = 512 - IFF_MASTER = 1024 - IFF_SLAVE = 2048 - IFF_MULTICAST = 4096 - IFF_PORTSEL = 8192 - IFF_AUTOMEDIA = 16384 - // Dialup device with changing addresses. - IFF_DYNAMIC = 32768 -) - -type Ifaddr struct { - IfaAddr SockAddr - IfaIfu _llcppg_anon_1 - IfaIfp *Iface - IfaNext *Ifaddr -} -type Ifmap struct { - MemStart c.Ulong - MemEnd c.Ulong - BaseAddr uint16 - Irq uint8 - Dma uint8 - Port uint8 -} -type Ifreq struct { - IfrIfrn _llcppg_anon_2 - IfrIfru _llcppg_anon_3 -} -type Ifconf struct { - IfcLen c.Int - IfcIfcu _llcppg_anon_4 -} -type _llcppg_anon_1 struct { - _xgo_union [8]uint16 -} -type Iface struct { -} -type _llcppg_anon_2 struct { - _xgo_union [16]uint8 -} -type _llcppg_anon_3 struct { - _xgo_union [3]uint64 -} -type _llcppg_anon_4 struct { - _xgo_union [1]uint64 -} - -func (p *_llcppg_anon_1) XGof_ref_ifu_broadaddr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_1) XGof_ref_ifu_dstaddr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifrn_name() *[16]c.Char { - return (*[16]c.Char)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_addr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_dstaddr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_broadaddr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_netmask() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_hwaddr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_flags() *int16 { - return (*int16)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_ivalue() *c.Int { - return (*c.Int)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_mtu() *c.Int { - return (*c.Int)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_map() *Ifmap { - return (*Ifmap)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_slave() *[16]c.Char { - return (*[16]c.Char)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_newname() *[16]c.Char { - return (*[16]c.Char)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_data() *X__CaddrT { - return (*X__CaddrT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_4) XGof_ref_ifcu_buf() *X__CaddrT { - return (*X__CaddrT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_4) XGof_ref_ifcu_req() **Ifreq { - return (**Ifreq)(unsafe.Pointer(p)) -} - -// Convert an interface name to an index, and vice versa. -// -//go:linkname IfNametoindex C.if_nametoindex -func IfNametoindex(__ifname *c.Char) c.Uint - -//go:linkname IfIndextoname C.if_indextoname -func IfIndextoname(__ifindex c.Uint, __ifname *c.Char) *c.Char - -// Free the data returned from if_nameindex. -// -// llgo:link (*IfNameindex).IfFreenameindex C.if_freenameindex -func (self *IfNameindex) IfFreenameindex() { -} diff --git a/c/net/net-if_linux_arm64.go b/c/net/net-if_linux_arm64.go deleted file mode 100644 index 557a9206..00000000 --- a/c/net/net-if_linux_arm64.go +++ /dev/null @@ -1,149 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_NET_IF_H = 1 - -// Length of interface name. -const IF_NAMESIZE = 16 -const ( - IFHWADDRLEN = 6 - IFNAMSIZ = 16 -) - -type IfNameindex struct { - IfIndex c.Uint - IfName *uint8 -} - -// Standard interface flags. -const ( - IFF_UP = 1 - IFF_BROADCAST = 2 - IFF_DEBUG = 4 - IFF_LOOPBACK = 8 - IFF_POINTOPOINT = 16 - IFF_NOTRAILERS = 32 - IFF_RUNNING = 64 - IFF_NOARP = 128 - IFF_PROMISC = 256 - // Not supported - IFF_ALLMULTI = 512 - IFF_MASTER = 1024 - IFF_SLAVE = 2048 - IFF_MULTICAST = 4096 - IFF_PORTSEL = 8192 - IFF_AUTOMEDIA = 16384 - // Dialup device with changing addresses. - IFF_DYNAMIC = 32768 -) - -type Ifaddr struct { - IfaAddr SockAddr - IfaIfu _llcppg_anon_1 - IfaIfp *Iface - IfaNext *Ifaddr -} -type Ifmap struct { - MemStart c.Ulong - MemEnd c.Ulong - BaseAddr uint16 - Irq uint8 - Dma uint8 - Port uint8 -} -type Ifreq struct { - IfrIfrn _llcppg_anon_2 - IfrIfru _llcppg_anon_3 -} -type Ifconf struct { - IfcLen c.Int - IfcIfcu _llcppg_anon_4 -} -type _llcppg_anon_1 struct { - _xgo_union [8]uint16 -} -type Iface struct { -} -type _llcppg_anon_2 struct { - _xgo_union [16]uint8 -} -type _llcppg_anon_3 struct { - _xgo_union [3]uint64 -} -type _llcppg_anon_4 struct { - _xgo_union [1]uint64 -} - -func (p *_llcppg_anon_1) XGof_ref_ifu_broadaddr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_1) XGof_ref_ifu_dstaddr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ifrn_name() *[16]uint8 { - return (*[16]uint8)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_addr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_dstaddr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_broadaddr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_netmask() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_hwaddr() *SockAddr { - return (*SockAddr)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_flags() *int16 { - return (*int16)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_ivalue() *c.Int { - return (*c.Int)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_mtu() *c.Int { - return (*c.Int)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_map() *Ifmap { - return (*Ifmap)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_slave() *[16]uint8 { - return (*[16]uint8)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_newname() *[16]uint8 { - return (*[16]uint8)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ifru_data() *X__CaddrT { - return (*X__CaddrT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_4) XGof_ref_ifcu_buf() *X__CaddrT { - return (*X__CaddrT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_4) XGof_ref_ifcu_req() **Ifreq { - return (**Ifreq)(unsafe.Pointer(p)) -} - -// Convert an interface name to an index, and vice versa. -// -//go:linkname IfNametoindex C.if_nametoindex -func IfNametoindex(__ifname *uint8) c.Uint - -//go:linkname IfIndextoname C.if_indextoname -func IfIndextoname(__ifindex c.Uint, __ifname *uint8) *uint8 - -// Free the data returned from if_nameindex. -// -// llgo:link (*IfNameindex).IfFreenameindex C.if_freenameindex -func (self *IfNameindex) IfFreenameindex() { -} diff --git a/c/net/net-if_var_darwin_arm64.go b/c/net/net-if_var_darwin_arm64.go deleted file mode 100644 index 15cff2a2..00000000 --- a/c/net/net-if_var_darwin_arm64.go +++ /dev/null @@ -1,122 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const ( - APPLE_IF_FAM_LOOPBACK = 1 - APPLE_IF_FAM_ETHERNET = 2 - APPLE_IF_FAM_SLIP = 3 - APPLE_IF_FAM_TUN = 4 - APPLE_IF_FAM_VLAN = 5 - APPLE_IF_FAM_PPP = 6 - APPLE_IF_FAM_PVC = 7 - APPLE_IF_FAM_DISC = 8 - APPLE_IF_FAM_MDECAP = 9 - APPLE_IF_FAM_GIF = 10 - // deprecated - APPLE_IF_FAM_FAITH = 11 - APPLE_IF_FAM_STF = 12 - APPLE_IF_FAM_FIREWIRE = 13 - APPLE_IF_FAM_BOND = 14 - APPLE_IF_FAM_CELLULAR = 15 - // Un-used - APPLE_IF_FAM_UNUSED_16 = 16 - APPLE_IF_FAM_UTUN = 17 - APPLE_IF_FAM_IPSEC = 18 -) - -// 72 was chosen below because it is the size of a TCP/IP -// header (40) + the minimum mss (32). -const ( - IF_MINMTU = 72 - IF_MAXMTU = 65535 -) -const IFNAMSIZ = 16 - -type NetEventData struct { - IfFamily UInt32T - IfUnit UInt32T - IfName [16]c.Char -} - -// Structure describing information about an interface -// which may be of interest to management entities. -type IfData struct { - IfiType UChar - IfiTypelen UChar - IfiPhysical UChar - IfiAddrlen UChar - IfiHdrlen UChar - IfiRecvquota UChar - IfiXmitquota UChar - IfiUnused1 UChar - IfiMtu UInt32T - IfiMetric UInt32T - IfiBaudrate UInt32T - IfiIpackets UInt32T - IfiIerrors UInt32T - IfiOpackets UInt32T - IfiOerrors UInt32T - IfiCollisions UInt32T - IfiIbytes UInt32T - IfiObytes UInt32T - IfiImcasts UInt32T - IfiOmcasts UInt32T - IfiIqdrops UInt32T - IfiNoproto UInt32T - IfiRecvtiming UInt32T - IfiXmittiming UInt32T - IfiLastchange Timeval32 - IfiUnused2 UInt32T - IfiHwassist UInt32T - IfiReserved1 UInt32T - IfiReserved2 UInt32T -} - -// Structure describing information about an interface -// which may be of interest to management entities. -type IfData64 struct { - IfiType UChar - IfiTypelen UChar - IfiPhysical UChar - IfiAddrlen UChar - IfiHdrlen UChar - IfiRecvquota UChar - IfiXmitquota UChar - IfiUnused1 UChar - IfiMtu UInt32T - IfiMetric UInt32T - IfiBaudrate UInt64T - IfiIpackets UInt64T - IfiIerrors UInt64T - IfiOpackets UInt64T - IfiOerrors UInt64T - IfiCollisions UInt64T - IfiIbytes UInt64T - IfiObytes UInt64T - IfiImcasts UInt64T - IfiOmcasts UInt64T - IfiIqdrops UInt64T - IfiNoproto UInt64T - IfiRecvtiming UInt32T - IfiXmittiming UInt32T - IfiLastchange Timeval32 -} - -// Structure defining a queue for a network interface. -type Ifqueue struct { - IfqHead unsafe.Pointer - IfqTail unsafe.Pointer - IfqLen c.Int - IfqMaxlen c.Int - IfqDrops c.Int -} -type IfnetInterfaceAdvisory struct { -} diff --git a/c/net/net-net_kev_darwin_arm64.go b/c/net/net-net_kev_darwin_arm64.go deleted file mode 100644 index 1e50c553..00000000 --- a/c/net/net-net_kev_darwin_arm64.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -// Kernel event subclass identifiers for KEV_NETWORK_CLASS -const KEV_INET_SUBCLASS = 1 - -// KEV_INET_SUBCLASS event codes -const ( - KEV_INET_NEW_ADDR = 1 - // Address changed event - KEV_INET_CHANGED_ADDR = 2 - // IPv6 address was deleted - KEV_INET_ADDR_DELETED = 3 - // Dest. address was set - KEV_INET_SIFDSTADDR = 4 - // Broadcast address was set - KEV_INET_SIFBRDADDR = 5 - // Netmask was set - KEV_INET_SIFNETMASK = 6 - // ARP collision detected - KEV_INET_ARPCOLLISION = 7 -) - -// use ken_in_portinuse -const KEV_INET_PORTINUSE = 8 -const ( - // ARP resolution failed for router - KEV_INET_ARPRTRFAILURE = 9 - // ARP resolution succeeded for router - KEV_INET_ARPRTRALIVE = 10 -) - -// Data Link subclass -const KEV_DL_SUBCLASS = 2 - -// Define Data-Link event subclass, and associated -// events. -const ( - KEV_DL_SIFFLAGS = 1 - KEV_DL_SIFMETRICS = 2 - KEV_DL_SIFMTU = 3 - KEV_DL_SIFPHYS = 4 - KEV_DL_SIFMEDIA = 5 - KEV_DL_SIFGENERIC = 6 - KEV_DL_ADDMULTI = 7 - KEV_DL_DELMULTI = 8 - KEV_DL_IF_ATTACHED = 9 - KEV_DL_IF_DETACHING = 10 - KEV_DL_IF_DETACHED = 11 - KEV_DL_LINK_OFF = 12 - KEV_DL_LINK_ON = 13 - KEV_DL_PROTO_ATTACHED = 14 - KEV_DL_PROTO_DETACHED = 15 - KEV_DL_LINK_ADDRESS_CHANGED = 16 - KEV_DL_WAKEFLAGS_CHANGED = 17 - KEV_DL_IF_IDLE_ROUTE_REFCNT = 18 - KEV_DL_IFCAP_CHANGED = 19 - KEV_DL_LINK_QUALITY_METRIC_CHANGED = 20 - KEV_DL_NODE_PRESENCE = 21 - KEV_DL_NODE_ABSENCE = 22 - KEV_DL_PRIMARY_ELECTED = 23 - KEV_DL_ISSUES = 24 - KEV_DL_IFDELEGATE_CHANGED = 25 - KEV_DL_AWDL_RESTRICTED = 26 - KEV_DL_AWDL_UNRESTRICTED = 27 - KEV_DL_RRC_STATE_CHANGED = 28 - KEV_DL_QOS_MODE_CHANGED = 29 - KEV_DL_LOW_POWER_MODE_CHANGED = 30 -) - -// inet6 subclass -const KEV_INET6_SUBCLASS = 6 - -// KEV_INET6_SUBCLASS event codes -const ( - KEV_INET6_NEW_USER_ADDR = 1 - // Address changed event (future) - KEV_INET6_CHANGED_ADDR = 2 - // IPv6 address was deleted - KEV_INET6_ADDR_DELETED = 3 - // Autoconf LL address appeared - KEV_INET6_NEW_LL_ADDR = 4 - // Autoconf address has appeared - KEV_INET6_NEW_RTADV_ADDR = 5 - // Default router detected - KEV_INET6_DEFROUTER = 6 - // Asking for the NAT64-prefix - KEV_INET6_REQUEST_NAT64_PREFIX = 7 -) diff --git a/c/net/netdb_darwin_arm64.go b/c/net/netdb_darwin_arm64.go deleted file mode 100644 index b6c3a1ff..00000000 --- a/c/net/netdb_darwin_arm64.go +++ /dev/null @@ -1,287 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_PATH_HEQUIV = "/etc/hosts.equiv" -const ( - X_PATH_HOSTS = "/etc/hosts" - X_PATH_NETWORKS = "/etc/networks" - X_PATH_PROTOCOLS = "/etc/protocols" - X_PATH_SERVICES = "/etc/services" -) -const ( - // see errno - NETDB_INTERNAL = -1 - // no problem - NETDB_SUCCESS = 0 -) -const ( - // Authoritative Answer Host not found - HOST_NOT_FOUND = 1 - // Non-Authoritative Host not found, or SERVERFAIL - TRY_AGAIN = 2 - // Non recoverable errors, FORMERR, REFUSED, NOTIMP - NO_RECOVERY = 3 - // Valid name, no data record of requested type - NO_DATA = 4 -) - -// no address, look for MX record -const NO_ADDRESS = 4 - -// address family for hostname not supported -const EAI_ADDRFAMILY = 1 -const ( - // temporary failure in name resolution - EAI_AGAIN = 2 - // invalid value for ai_flags - EAI_BADFLAGS = 3 - // non-recoverable failure in name resolution - EAI_FAIL = 4 - // ai_family not supported - EAI_FAMILY = 5 - // memory allocation failure - EAI_MEMORY = 6 -) - -// no address associated with hostname -const EAI_NODATA = 7 -const ( - // hostname nor servname provided, or not known - EAI_NONAME = 8 - // servname not supported for ai_socktype - EAI_SERVICE = 9 - // ai_socktype not supported - EAI_SOCKTYPE = 10 - // system error returned in errno - EAI_SYSTEM = 11 -) -const ( - // invalid value for hints - EAI_BADHINTS = 12 - // resolved protocol is unknown - EAI_PROTOCOL = 13 -) - -// argument buffer overflow -const EAI_OVERFLOW = 14 -const EAI_MAX = 15 - -// Flag values for getaddrinfo() -const ( - AI_PASSIVE = 1 - // fill ai_canonname - AI_CANONNAME = 2 - // prevent host name resolution - AI_NUMERICHOST = 4 - // prevent service name resolution - AI_NUMERICSERV = 4096 -) - -// IPv6 and IPv4-mapped (with AI_V4MAPPED) -const AI_ALL = 256 - -// accept IPv4-mapped if kernel supports -const AI_V4MAPPED_CFG = 512 -const ( - // only if any address is assigned - AI_ADDRCONFIG = 1024 - // accept IPv4-mapped IPv6 address - AI_V4MAPPED = 2048 -) - -// If the hints pointer is null or ai_flags is zero, getaddrinfo() automatically defaults to the AI_DEFAULT behavior. -// To override this default behavior, thereby causing unusable addresses to be included in the results, pass any nonzero -// value for ai_flags, by setting any desired flag values, or by setting AI_UNUSABLE if no other flags are desired. -const AI_DEFAULT = 1536 - -// If the hints pointer is null or ai_flags is zero, getaddrinfo() automatically defaults to the AI_DEFAULT behavior. -// To override this default behavior, thereby causing unusable addresses to be included in the results, pass any nonzero -// value for ai_flags, by setting any desired flag values, or by setting AI_UNUSABLE if no other flags are desired. -const AI_UNUSABLE = 268435456 -const ( - NI_MAXHOST = 1025 - NI_MAXSERV = 32 -) - -// Flag values for getnameinfo() -const ( - NI_NOFQDN = 1 - NI_NUMERICHOST = 2 - NI_NAMEREQD = 4 - NI_NUMERICSERV = 8 - NI_NUMERICSCOPE = 256 - NI_DGRAM = 16 -) -const NI_WITHSCOPEID = 32 - -// Structures returned by network data base library. All addresses are -// supplied in host order, and returned in network order (suitable for -// use in system calls). -type Hostent struct { - Name charPtr - Aliases charPP - AddrType c.Int - Length c.Int - AddrList charPP -} - -// Assumption here is that a network number -// fits in an unsigned long -- probably a poor one. -type Netent struct { - NName *c.Char - NAliases **c.Char - NAddrtype c.Int - NNet c.Uint32T -} -type Servent struct { - SName *c.Char - SAliases **c.Char - SPort c.Int - SProto *c.Char -} -type Protoent struct { - PName *c.Char - PAliases **c.Char - PProto c.Int -} -type AddrInfo struct { - Flags c.Int - Family c.Int - SockType c.Int - Protocol c.Int - AddrLen SocklenT - CanOnName charPtr - Addr sockaddrPtr - Next addrinfoPtr -} -type Rpcent struct { - RName *c.Char - RAliases **c.Char - RNumber c.Int -} - -//go:linkname HErrno C.h_errno -var HErrno c.Int - -//go:linkname Endhostent C.endhostent -func Endhostent() - -//go:linkname Endnetent C.endnetent -func Endnetent() - -//go:linkname Endprotoent C.endprotoent -func Endprotoent() - -//go:linkname Endservent C.endservent -func Endservent() - -//go:linkname GaiStrerror C.gai_strerror -func GaiStrerror(_llcppg_param1 c.Int) *c.Char - -//go:linkname Gethostbyaddr C.gethostbyaddr -func Gethostbyaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int) *Hostent - -//go:linkname Gethostent C.gethostent -func Gethostent() *Hostent - -// llgo:link (*SockAddr).Getnameinfo C.getnameinfo -func (self *SockAddr) Getnameinfo(_llcppg_param2 SocklenT, _llcppg_param3 *c.Char, _llcppg_param4 SocklenT, _llcppg_param5 *c.Char, _llcppg_param6 SocklenT, _llcppg_param7 c.Int) c.Int { - return 0 -} - -//go:linkname Getnetbyaddr C.getnetbyaddr -func Getnetbyaddr(_llcppg_param1 c.Uint32T, _llcppg_param2 c.Int) *Netent - -//go:linkname Getnetbyname C.getnetbyname -func Getnetbyname(_llcppg_param1 *c.Char) *Netent - -//go:linkname Getnetent C.getnetent -func Getnetent() *Netent - -//go:linkname Getprotobyname C.getprotobyname -func Getprotobyname(_llcppg_param1 *c.Char) *Protoent - -//go:linkname Getprotobynumber C.getprotobynumber -func Getprotobynumber(_llcppg_param1 c.Int) *Protoent - -//go:linkname Getprotoent C.getprotoent -func Getprotoent() *Protoent - -//go:linkname Getservbyname C.getservbyname -func Getservbyname(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) *Servent - -//go:linkname Getservbyport C.getservbyport -func Getservbyport(_llcppg_param1 c.Int, _llcppg_param2 *c.Char) *Servent - -//go:linkname Getservent C.getservent -func Getservent() *Servent - -// void sethostfile(const char *); -// -//go:linkname Sethostent C.sethostent -func Sethostent(_llcppg_param1 c.Int) - -// void sethostfile(const char *); -// -//go:linkname Setnetent C.setnetent -func Setnetent(_llcppg_param1 c.Int) - -//go:linkname Setprotoent C.setprotoent -func Setprotoent(_llcppg_param1 c.Int) - -//go:linkname Setservent C.setservent -func Setservent(_llcppg_param1 c.Int) - -// llgo:link (*Hostent).Free C.freehostent -func (self *Hostent) Free() { -} - -//go:linkname Gethostbyname2 C.gethostbyname2 -func Gethostbyname2(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) *Hostent - -//go:linkname Getipnodebyaddr C.getipnodebyaddr -func Getipnodebyaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) *Hostent - -//go:linkname Getipnodebyname C.getipnodebyname -func Getipnodebyname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) *Hostent - -//go:linkname Getrpcbyname C.getrpcbyname -func Getrpcbyname(name *c.Char) *Rpcent - -//go:linkname Getrpcbynumber C.getrpcbynumber -func Getrpcbynumber(number c.Int) *Rpcent - -//go:linkname Getrpcent C.getrpcent -func Getrpcent() *Rpcent - -//go:linkname Setrpcent C.setrpcent -func Setrpcent(stayopen c.Int) - -//go:linkname Endrpcent C.endrpcent -func Endrpcent() - -//go:linkname Herror C.herror -func Herror(_llcppg_param1 *c.Char) - -//go:linkname Hstrerror C.hstrerror -func Hstrerror(_llcppg_param1 c.Int) *c.Char - -//go:linkname Innetgr C.innetgr -func Innetgr(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char) c.Int - -//go:linkname Getnetgrent C.getnetgrent -func Getnetgrent(_llcppg_param1 **c.Char, _llcppg_param2 **c.Char, _llcppg_param3 **c.Char) c.Int - -//go:linkname Endnetgrent C.endnetgrent -func Endnetgrent() - -//go:linkname Setnetgrent C.setnetgrent -func Setnetgrent(_llcppg_param1 *c.Char) diff --git a/c/net/netdb_linux_amd64.go b/c/net/netdb_linux_amd64.go deleted file mode 100644 index 1fc2f355..00000000 --- a/c/net/netdb_linux_amd64.go +++ /dev/null @@ -1,605 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_NETDB_H = 1 - -// Absolute file name for network data base files. -const ( - X_PATH_HEQUIV = "/etc/hosts.equiv" - X_PATH_HOSTS = "/etc/hosts" - X_PATH_NETWORKS = "/etc/networks" - X_PATH_NSSWITCH_CONF = "/etc/nsswitch.conf" - X_PATH_PROTOCOLS = "/etc/protocols" - X_PATH_SERVICES = "/etc/services" -) - -// Possible values left in `h_errno'. -const ( - HOST_NOT_FOUND = 1 - // Non-Authoritative Host not found, - // or SERVERFAIL. - TRY_AGAIN = 2 -) - -// Non recoverable errors, FORMERR, REFUSED, -// NOTIMP. -const NO_RECOVERY = 3 - -// Valid name, no data record of requested -// type. -const NO_DATA = 4 -const ( - // See errno. - NETDB_INTERNAL = -1 - // No problem. - NETDB_SUCCESS = 0 - // No address, look for MX record. - NO_ADDRESS = 4 -) - -// Possible values for `ai_flags' field in `addrinfo' structure. -const ( - AI_PASSIVE = 1 - // Request for canonical name. - AI_CANONNAME = 2 - // Don't use name resolution. - AI_NUMERICHOST = 4 - // IPv4 mapped addresses are acceptable. - AI_V4MAPPED = 8 - // Return IPv4 mapped and IPv6 addresses. - AI_ALL = 16 - // Use configuration of this host to choose - // returned address type.. - AI_ADDRCONFIG = 32 -) - -// Don't use name resolution. -const AI_NUMERICSERV = 1024 - -// Error values for `getaddrinfo' function. -const ( - EAI_BADFLAGS = -1 - // NAME or SERVICE is unknown. - EAI_NONAME = -2 - // Temporary failure in name resolution. - EAI_AGAIN = -3 - // Non-recoverable failure in name res. - EAI_FAIL = -4 - // `ai_family' not supported. - EAI_FAMILY = -6 - // `ai_socktype' not supported. - EAI_SOCKTYPE = -7 - // SERVICE not supported for `ai_socktype'. - EAI_SERVICE = -8 - // Memory allocation failure. - EAI_MEMORY = -10 - // System error returned in `errno'. - EAI_SYSTEM = -11 - // Argument buffer overflow. - EAI_OVERFLOW = -12 -) -const ( - NI_MAXHOST = 1025 - NI_MAXSERV = 32 -) -const ( - // Don't try to look up hostname. - NI_NUMERICHOST = 1 - // Don't convert port number to name. - NI_NUMERICSERV = 2 - // Only return nodename portion. - NI_NOFQDN = 4 - // Don't return numeric addresses. - NI_NAMEREQD = 8 - // Look up UDP service rather than TCP. - NI_DGRAM = 16 -) - -// Description of data base entry for a single host. -type Hostent struct { - Name charPtr - Aliases charPP - AddrType c.Int - Length c.Int - AddrList charPP -} - -// Description of data base entry for a single service. -type Servent struct { - SName *c.Char - SAliases **c.Char - SPort c.Int - SProto *c.Char -} - -// Description of data base entry for a single service. -type Protoent struct { - PName *c.Char - PAliases **c.Char - PProto c.Int -} - -// Structure to contain information about address of a service provider. -type AddrInfo struct { - Flags c.Int - Family c.Int - SockType c.Int - Protocol c.Int - AddrLen SocklenT - Addr sockaddrPtr - CanOnName charPtr - Next addrinfoPtr -} - -// Function to get address of global `h_errno' variable. -// -//go:linkname X__HErrnoLocation C.__h_errno_location -func X__HErrnoLocation() *c.Int - -// Print error indicated by `h_errno' variable on standard error. STR -// if non-null is printed before the error string. -// -//go:linkname Herror C.herror -func Herror(__str *c.Char) - -// Return string associated with error ERR_NUM. -// -//go:linkname Hstrerror C.hstrerror -func Hstrerror(__err_num c.Int) *c.Char - -// Open host data base files and mark them as staying open even after -// a later search if STAY_OPEN is non-zero. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Sethostent C.sethostent -func Sethostent(__stay_open c.Int) - -// Close host data base files and clear `stay open' flag. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Endhostent C.endhostent -func Endhostent() - -// Get next entry from host data base file. Open data base if -// necessary. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Gethostent C.gethostent -func Gethostent() *Hostent - -// Return entry from host data base which address match ADDR with -// length LEN and type TYPE. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Gethostbyaddr C.gethostbyaddr -func Gethostbyaddr(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int) *Hostent - -// Return entry from host data base for host with NAME. AF must be -// set to the address type which is `AF_INET' for IPv4 or `AF_INET6' -// for IPv6. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Gethostbyname2 C.gethostbyname2 -func Gethostbyname2(__name *c.Char, __af c.Int) *Hostent - -// Reentrant versions of the functions above. The additional -// arguments specify a buffer of BUFLEN starting at BUF. The last -// argument is a pointer to a variable which gets the value which -// would be stored in the global variable `herrno' by the -// non-reentrant functions. -// -// These functions are not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation they are cancellation points and -// therefore not marked with __THROW. -// -// llgo:link (*Hostent).GethostentR C.gethostent_r -func (self *Hostent) GethostentR(__buf *c.Char, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int { - return 0 -} - -//go:linkname GethostbyaddrR C.gethostbyaddr_r -func GethostbyaddrR(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int, __result_buf *Hostent, __buf *c.Char, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int - -//go:linkname GethostbynameR C.gethostbyname_r -func GethostbynameR(__name *c.Char, __result_buf *Hostent, __buf *c.Char, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int - -//go:linkname Gethostbyname2R C.gethostbyname2_r -func Gethostbyname2R(__name *c.Char, __af c.Int, __result_buf *Hostent, __buf *c.Char, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int - -// Open network data base files and mark them as staying open even -// after a later search if STAY_OPEN is non-zero. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Setnetent C.setnetent -func Setnetent(__stay_open c.Int) - -// Close network data base files and clear `stay open' flag. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Endnetent C.endnetent -func Endnetent() - -// Get next entry from network data base file. Open data base if -// necessary. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getnetent C.getnetent -func Getnetent() *Netent - -// Return entry from network data base which address match NET and -// type TYPE. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getnetbyaddr C.getnetbyaddr -func Getnetbyaddr(__net c.Uint32T, __type c.Int) *Netent - -// Return entry from network data base for network with NAME. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getnetbyname C.getnetbyname -func Getnetbyname(__name *c.Char) *Netent - -// Reentrant versions of the functions above. The additional -// arguments specify a buffer of BUFLEN starting at BUF. The last -// argument is a pointer to a variable which gets the value which -// would be stored in the global variable `herrno' by the -// non-reentrant functions. -// -// These functions are not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation they are cancellation points and -// therefore not marked with __THROW. -// -// llgo:link (*Netent).GetnetentR C.getnetent_r -func (self *Netent) GetnetentR(__buf *c.Char, __buflen c.SizeT, __result **Netent, __h_errnop *c.Int) c.Int { - return 0 -} - -//go:linkname GetnetbyaddrR C.getnetbyaddr_r -func GetnetbyaddrR(__net c.Uint32T, __type c.Int, __result_buf *Netent, __buf *c.Char, __buflen c.SizeT, __result **Netent, __h_errnop *c.Int) c.Int - -//go:linkname GetnetbynameR C.getnetbyname_r -func GetnetbynameR(__name *c.Char, __result_buf *Netent, __buf *c.Char, __buflen c.SizeT, __result **Netent, __h_errnop *c.Int) c.Int - -// Open service data base files and mark them as staying open even -// after a later search if STAY_OPEN is non-zero. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Setservent C.setservent -func Setservent(__stay_open c.Int) - -// Close service data base files and clear `stay open' flag. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Endservent C.endservent -func Endservent() - -// Get next entry from service data base file. Open data base if -// necessary. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getservent C.getservent -func Getservent() *Servent - -// Return entry from network data base for network with NAME and -// protocol PROTO. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getservbyname C.getservbyname -func Getservbyname(__name *c.Char, __proto *c.Char) *Servent - -// Return entry from service data base which matches port PORT and -// protocol PROTO. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getservbyport C.getservbyport -func Getservbyport(__port c.Int, __proto *c.Char) *Servent - -// Reentrant versions of the functions above. The additional -// arguments specify a buffer of BUFLEN starting at BUF. -// -// These functions are not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation they are cancellation points and -// therefore not marked with __THROW. -// -// llgo:link (*Servent).GetserventR C.getservent_r -func (self *Servent) GetserventR(__buf *c.Char, __buflen c.SizeT, __result **Servent) c.Int { - return 0 -} - -//go:linkname GetservbynameR C.getservbyname_r -func GetservbynameR(__name *c.Char, __proto *c.Char, __result_buf *Servent, __buf *c.Char, __buflen c.SizeT, __result **Servent) c.Int - -//go:linkname GetservbyportR C.getservbyport_r -func GetservbyportR(__port c.Int, __proto *c.Char, __result_buf *Servent, __buf *c.Char, __buflen c.SizeT, __result **Servent) c.Int - -// Open protocol data base files and mark them as staying open even -// after a later search if STAY_OPEN is non-zero. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Setprotoent C.setprotoent -func Setprotoent(__stay_open c.Int) - -// Close protocol data base files and clear `stay open' flag. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Endprotoent C.endprotoent -func Endprotoent() - -// Get next entry from protocol data base file. Open data base if -// necessary. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getprotoent C.getprotoent -func Getprotoent() *Protoent - -// Return entry from protocol data base for network with NAME. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getprotobyname C.getprotobyname -func Getprotobyname(__name *c.Char) *Protoent - -// Return entry from protocol data base which number is PROTO. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getprotobynumber C.getprotobynumber -func Getprotobynumber(__proto c.Int) *Protoent - -// Reentrant versions of the functions above. The additional -// arguments specify a buffer of BUFLEN starting at BUF. -// -// These functions are not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation they are cancellation points and -// therefore not marked with __THROW. -// -// llgo:link (*Protoent).GetprotoentR C.getprotoent_r -func (self *Protoent) GetprotoentR(__buf *c.Char, __buflen c.SizeT, __result **Protoent) c.Int { - return 0 -} - -//go:linkname GetprotobynameR C.getprotobyname_r -func GetprotobynameR(__name *c.Char, __result_buf *Protoent, __buf *c.Char, __buflen c.SizeT, __result **Protoent) c.Int - -//go:linkname GetprotobynumberR C.getprotobynumber_r -func GetprotobynumberR(__proto c.Int, __result_buf *Protoent, __buf *c.Char, __buflen c.SizeT, __result **Protoent) c.Int - -// Establish network group NETGROUP for enumeration. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Setnetgrent C.setnetgrent -func Setnetgrent(__netgroup *c.Char) c.Int - -// Free all space allocated by previous `setnetgrent' call. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Endnetgrent C.endnetgrent -func Endnetgrent() - -// Get next member of netgroup established by last `setnetgrent' call -// and return pointers to elements in HOSTP, USERP, and DOMAINP. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Getnetgrent C.getnetgrent -func Getnetgrent(__hostp **c.Char, __userp **c.Char, __domainp **c.Char) c.Int - -// Test whether NETGROUP contains the triple (HOST,USER,DOMAIN). -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Innetgr C.innetgr -func Innetgr(__netgroup *c.Char, __host *c.Char, __user *c.Char, __domain *c.Char) c.Int - -// Reentrant version of `getnetgrent' where result is placed in BUFFER. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname GetnetgrentR C.getnetgrent_r -func GetnetgrentR(__hostp **c.Char, __userp **c.Char, __domainp **c.Char, __buffer *c.Char, __buflen c.SizeT) c.Int - -// Call `rshd' at port RPORT on remote machine *AHOST to execute CMD. -// The local user is LOCUSER, on the remote machine the command is -// executed as REMUSER. In *FD2P the descriptor to the socket for the -// connection is returned. The caller must have the right to use a -// reserved port. When the function returns *AHOST contains the -// official host name. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Rcmd C.rcmd -func Rcmd(__ahost **c.Char, __rport uint16, __locuser *c.Char, __remuser *c.Char, __cmd *c.Char, __fd2p *c.Int) c.Int - -// This is the equivalent function where the protocol can be selected -// and which therefore can be used for IPv6. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname RcmdAf C.rcmd_af -func RcmdAf(__ahost **c.Char, __rport uint16, __locuser *c.Char, __remuser *c.Char, __cmd *c.Char, __fd2p *c.Int, __af SaFamilyT) c.Int - -// Call `rexecd' at port RPORT on remote machine *AHOST to execute -// CMD. The process runs at the remote machine using the ID of user -// NAME whose cleartext password is PASSWD. In *FD2P the descriptor -// to the socket for the connection is returned. When the function -// returns *AHOST contains the official host name. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Rexec C.rexec -func Rexec(__ahost **c.Char, __rport c.Int, __name *c.Char, __pass *c.Char, __cmd *c.Char, __fd2p *c.Int) c.Int - -// This is the equivalent function where the protocol can be selected -// and which therefore can be used for IPv6. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname RexecAf C.rexec_af -func RexecAf(__ahost **c.Char, __rport c.Int, __name *c.Char, __pass *c.Char, __cmd *c.Char, __fd2p *c.Int, __af SaFamilyT) c.Int - -// Check whether user REMUSER on system RHOST is allowed to login as LOCUSER. -// If SUSER is not zero the user tries to become superuser. Return 0 if -// it is possible. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Ruserok C.ruserok -func Ruserok(__rhost *c.Char, __suser c.Int, __remuser *c.Char, __locuser *c.Char) c.Int - -// This is the equivalent function where the protocol can be selected -// and which therefore can be used for IPv6. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname RuserokAf C.ruserok_af -func RuserokAf(__rhost *c.Char, __suser c.Int, __remuser *c.Char, __locuser *c.Char, __af SaFamilyT) c.Int - -// Check whether user REMUSER on system indicated by IPv4 address -// RADDR is allowed to login as LOCUSER. Non-IPv4 (e.g., IPv6) are -// not supported. If SUSER is not zero the user tries to become -// superuser. Return 0 if it is possible. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Iruserok C.iruserok -func Iruserok(__raddr c.Uint32T, __suser c.Int, __remuser *c.Char, __locuser *c.Char) c.Int - -// This is the equivalent function where the pfamiliy if the address -// pointed to by RADDR is determined by the value of AF. It therefore -// can be used for IPv6 -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname IruserokAf C.iruserok_af -func IruserokAf(__raddr unsafe.Pointer, __suser c.Int, __remuser *c.Char, __locuser *c.Char, __af SaFamilyT) c.Int - -// Try to allocate reserved port, returning a descriptor for a socket opened -// at this port or -1 if unsuccessful. The search for an available port -// will start at ALPORT and continues with lower numbers. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Rresvport C.rresvport -func Rresvport(__alport *c.Int) c.Int - -// This is the equivalent function where the protocol can be selected -// and which therefore can be used for IPv6. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname RresvportAf C.rresvport_af -func RresvportAf(__alport *c.Int, __af SaFamilyT) c.Int - -// Convert error return from getaddrinfo() to a string. -// -//go:linkname GaiStrerror C.gai_strerror -func GaiStrerror(__ecode c.Int) *c.Char - -// Translate a socket address to a location and service name. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -// llgo:link (*SockAddr).Getnameinfo C.getnameinfo -func (self *SockAddr) Getnameinfo(__salen SocklenT, __host *c.Char, __hostlen SocklenT, __serv *c.Char, __servlen SocklenT, __flags c.Int) c.Int { - return 0 -} diff --git a/c/net/netdb_linux_arm64.go b/c/net/netdb_linux_arm64.go deleted file mode 100644 index 06c56366..00000000 --- a/c/net/netdb_linux_arm64.go +++ /dev/null @@ -1,605 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_NETDB_H = 1 - -// Absolute file name for network data base files. -const ( - X_PATH_HEQUIV = "/etc/hosts.equiv" - X_PATH_HOSTS = "/etc/hosts" - X_PATH_NETWORKS = "/etc/networks" - X_PATH_NSSWITCH_CONF = "/etc/nsswitch.conf" - X_PATH_PROTOCOLS = "/etc/protocols" - X_PATH_SERVICES = "/etc/services" -) - -// Possible values left in `h_errno'. -const ( - HOST_NOT_FOUND = 1 - // Non-Authoritative Host not found, - // or SERVERFAIL. - TRY_AGAIN = 2 -) - -// Non recoverable errors, FORMERR, REFUSED, -// NOTIMP. -const NO_RECOVERY = 3 - -// Valid name, no data record of requested -// type. -const NO_DATA = 4 -const ( - // See errno. - NETDB_INTERNAL = -1 - // No problem. - NETDB_SUCCESS = 0 - // No address, look for MX record. - NO_ADDRESS = 4 -) - -// Possible values for `ai_flags' field in `addrinfo' structure. -const ( - AI_PASSIVE = 1 - // Request for canonical name. - AI_CANONNAME = 2 - // Don't use name resolution. - AI_NUMERICHOST = 4 - // IPv4 mapped addresses are acceptable. - AI_V4MAPPED = 8 - // Return IPv4 mapped and IPv6 addresses. - AI_ALL = 16 - // Use configuration of this host to choose - // returned address type.. - AI_ADDRCONFIG = 32 -) - -// Don't use name resolution. -const AI_NUMERICSERV = 1024 - -// Error values for `getaddrinfo' function. -const ( - EAI_BADFLAGS = -1 - // NAME or SERVICE is unknown. - EAI_NONAME = -2 - // Temporary failure in name resolution. - EAI_AGAIN = -3 - // Non-recoverable failure in name res. - EAI_FAIL = -4 - // `ai_family' not supported. - EAI_FAMILY = -6 - // `ai_socktype' not supported. - EAI_SOCKTYPE = -7 - // SERVICE not supported for `ai_socktype'. - EAI_SERVICE = -8 - // Memory allocation failure. - EAI_MEMORY = -10 - // System error returned in `errno'. - EAI_SYSTEM = -11 - // Argument buffer overflow. - EAI_OVERFLOW = -12 -) -const ( - NI_MAXHOST = 1025 - NI_MAXSERV = 32 -) -const ( - // Don't try to look up hostname. - NI_NUMERICHOST = 1 - // Don't convert port number to name. - NI_NUMERICSERV = 2 - // Only return nodename portion. - NI_NOFQDN = 4 - // Don't return numeric addresses. - NI_NAMEREQD = 8 - // Look up UDP service rather than TCP. - NI_DGRAM = 16 -) - -// Description of data base entry for a single host. -type Hostent struct { - Name charPtr - Aliases charPP - AddrType c.Int - Length c.Int - AddrList charPP -} - -// Description of data base entry for a single service. -type Servent struct { - SName *uint8 - SAliases **uint8 - SPort c.Int - SProto *uint8 -} - -// Description of data base entry for a single service. -type Protoent struct { - PName *uint8 - PAliases **uint8 - PProto c.Int -} - -// Structure to contain information about address of a service provider. -type AddrInfo struct { - Flags c.Int - Family c.Int - SockType c.Int - Protocol c.Int - AddrLen SocklenT - Addr sockaddrPtr - CanOnName charPtr - Next addrinfoPtr -} - -// Function to get address of global `h_errno' variable. -// -//go:linkname X__HErrnoLocation C.__h_errno_location -func X__HErrnoLocation() *c.Int - -// Print error indicated by `h_errno' variable on standard error. STR -// if non-null is printed before the error string. -// -//go:linkname Herror C.herror -func Herror(__str *uint8) - -// Return string associated with error ERR_NUM. -// -//go:linkname Hstrerror C.hstrerror -func Hstrerror(__err_num c.Int) *uint8 - -// Open host data base files and mark them as staying open even after -// a later search if STAY_OPEN is non-zero. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Sethostent C.sethostent -func Sethostent(__stay_open c.Int) - -// Close host data base files and clear `stay open' flag. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Endhostent C.endhostent -func Endhostent() - -// Get next entry from host data base file. Open data base if -// necessary. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Gethostent C.gethostent -func Gethostent() *Hostent - -// Return entry from host data base which address match ADDR with -// length LEN and type TYPE. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Gethostbyaddr C.gethostbyaddr -func Gethostbyaddr(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int) *Hostent - -// Return entry from host data base for host with NAME. AF must be -// set to the address type which is `AF_INET' for IPv4 or `AF_INET6' -// for IPv6. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Gethostbyname2 C.gethostbyname2 -func Gethostbyname2(__name *uint8, __af c.Int) *Hostent - -// Reentrant versions of the functions above. The additional -// arguments specify a buffer of BUFLEN starting at BUF. The last -// argument is a pointer to a variable which gets the value which -// would be stored in the global variable `herrno' by the -// non-reentrant functions. -// -// These functions are not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation they are cancellation points and -// therefore not marked with __THROW. -// -// llgo:link (*Hostent).GethostentR C.gethostent_r -func (self *Hostent) GethostentR(__buf *uint8, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int { - return 0 -} - -//go:linkname GethostbyaddrR C.gethostbyaddr_r -func GethostbyaddrR(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int, __result_buf *Hostent, __buf *uint8, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int - -//go:linkname GethostbynameR C.gethostbyname_r -func GethostbynameR(__name *uint8, __result_buf *Hostent, __buf *uint8, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int - -//go:linkname Gethostbyname2R C.gethostbyname2_r -func Gethostbyname2R(__name *uint8, __af c.Int, __result_buf *Hostent, __buf *uint8, __buflen c.SizeT, __result **Hostent, __h_errnop *c.Int) c.Int - -// Open network data base files and mark them as staying open even -// after a later search if STAY_OPEN is non-zero. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Setnetent C.setnetent -func Setnetent(__stay_open c.Int) - -// Close network data base files and clear `stay open' flag. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Endnetent C.endnetent -func Endnetent() - -// Get next entry from network data base file. Open data base if -// necessary. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getnetent C.getnetent -func Getnetent() *Netent - -// Return entry from network data base which address match NET and -// type TYPE. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getnetbyaddr C.getnetbyaddr -func Getnetbyaddr(__net c.Uint32T, __type c.Int) *Netent - -// Return entry from network data base for network with NAME. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getnetbyname C.getnetbyname -func Getnetbyname(__name *uint8) *Netent - -// Reentrant versions of the functions above. The additional -// arguments specify a buffer of BUFLEN starting at BUF. The last -// argument is a pointer to a variable which gets the value which -// would be stored in the global variable `herrno' by the -// non-reentrant functions. -// -// These functions are not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation they are cancellation points and -// therefore not marked with __THROW. -// -// llgo:link (*Netent).GetnetentR C.getnetent_r -func (self *Netent) GetnetentR(__buf *uint8, __buflen c.SizeT, __result **Netent, __h_errnop *c.Int) c.Int { - return 0 -} - -//go:linkname GetnetbyaddrR C.getnetbyaddr_r -func GetnetbyaddrR(__net c.Uint32T, __type c.Int, __result_buf *Netent, __buf *uint8, __buflen c.SizeT, __result **Netent, __h_errnop *c.Int) c.Int - -//go:linkname GetnetbynameR C.getnetbyname_r -func GetnetbynameR(__name *uint8, __result_buf *Netent, __buf *uint8, __buflen c.SizeT, __result **Netent, __h_errnop *c.Int) c.Int - -// Open service data base files and mark them as staying open even -// after a later search if STAY_OPEN is non-zero. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Setservent C.setservent -func Setservent(__stay_open c.Int) - -// Close service data base files and clear `stay open' flag. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Endservent C.endservent -func Endservent() - -// Get next entry from service data base file. Open data base if -// necessary. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getservent C.getservent -func Getservent() *Servent - -// Return entry from network data base for network with NAME and -// protocol PROTO. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getservbyname C.getservbyname -func Getservbyname(__name *uint8, __proto *uint8) *Servent - -// Return entry from service data base which matches port PORT and -// protocol PROTO. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getservbyport C.getservbyport -func Getservbyport(__port c.Int, __proto *uint8) *Servent - -// Reentrant versions of the functions above. The additional -// arguments specify a buffer of BUFLEN starting at BUF. -// -// These functions are not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation they are cancellation points and -// therefore not marked with __THROW. -// -// llgo:link (*Servent).GetserventR C.getservent_r -func (self *Servent) GetserventR(__buf *uint8, __buflen c.SizeT, __result **Servent) c.Int { - return 0 -} - -//go:linkname GetservbynameR C.getservbyname_r -func GetservbynameR(__name *uint8, __proto *uint8, __result_buf *Servent, __buf *uint8, __buflen c.SizeT, __result **Servent) c.Int - -//go:linkname GetservbyportR C.getservbyport_r -func GetservbyportR(__port c.Int, __proto *uint8, __result_buf *Servent, __buf *uint8, __buflen c.SizeT, __result **Servent) c.Int - -// Open protocol data base files and mark them as staying open even -// after a later search if STAY_OPEN is non-zero. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Setprotoent C.setprotoent -func Setprotoent(__stay_open c.Int) - -// Close protocol data base files and clear `stay open' flag. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Endprotoent C.endprotoent -func Endprotoent() - -// Get next entry from protocol data base file. Open data base if -// necessary. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getprotoent C.getprotoent -func Getprotoent() *Protoent - -// Return entry from protocol data base for network with NAME. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getprotobyname C.getprotobyname -func Getprotobyname(__name *uint8) *Protoent - -// Return entry from protocol data base which number is PROTO. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getprotobynumber C.getprotobynumber -func Getprotobynumber(__proto c.Int) *Protoent - -// Reentrant versions of the functions above. The additional -// arguments specify a buffer of BUFLEN starting at BUF. -// -// These functions are not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation they are cancellation points and -// therefore not marked with __THROW. -// -// llgo:link (*Protoent).GetprotoentR C.getprotoent_r -func (self *Protoent) GetprotoentR(__buf *uint8, __buflen c.SizeT, __result **Protoent) c.Int { - return 0 -} - -//go:linkname GetprotobynameR C.getprotobyname_r -func GetprotobynameR(__name *uint8, __result_buf *Protoent, __buf *uint8, __buflen c.SizeT, __result **Protoent) c.Int - -//go:linkname GetprotobynumberR C.getprotobynumber_r -func GetprotobynumberR(__proto c.Int, __result_buf *Protoent, __buf *uint8, __buflen c.SizeT, __result **Protoent) c.Int - -// Establish network group NETGROUP for enumeration. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Setnetgrent C.setnetgrent -func Setnetgrent(__netgroup *uint8) c.Int - -// Free all space allocated by previous `setnetgrent' call. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Endnetgrent C.endnetgrent -func Endnetgrent() - -// Get next member of netgroup established by last `setnetgrent' call -// and return pointers to elements in HOSTP, USERP, and DOMAINP. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Getnetgrent C.getnetgrent -func Getnetgrent(__hostp **uint8, __userp **uint8, __domainp **uint8) c.Int - -// Test whether NETGROUP contains the triple (HOST,USER,DOMAIN). -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Innetgr C.innetgr -func Innetgr(__netgroup *uint8, __host *uint8, __user *uint8, __domain *uint8) c.Int - -// Reentrant version of `getnetgrent' where result is placed in BUFFER. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname GetnetgrentR C.getnetgrent_r -func GetnetgrentR(__hostp **uint8, __userp **uint8, __domainp **uint8, __buffer *uint8, __buflen c.SizeT) c.Int - -// Call `rshd' at port RPORT on remote machine *AHOST to execute CMD. -// The local user is LOCUSER, on the remote machine the command is -// executed as REMUSER. In *FD2P the descriptor to the socket for the -// connection is returned. The caller must have the right to use a -// reserved port. When the function returns *AHOST contains the -// official host name. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Rcmd C.rcmd -func Rcmd(__ahost **uint8, __rport uint16, __locuser *uint8, __remuser *uint8, __cmd *uint8, __fd2p *c.Int) c.Int - -// This is the equivalent function where the protocol can be selected -// and which therefore can be used for IPv6. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname RcmdAf C.rcmd_af -func RcmdAf(__ahost **uint8, __rport uint16, __locuser *uint8, __remuser *uint8, __cmd *uint8, __fd2p *c.Int, __af SaFamilyT) c.Int - -// Call `rexecd' at port RPORT on remote machine *AHOST to execute -// CMD. The process runs at the remote machine using the ID of user -// NAME whose cleartext password is PASSWD. In *FD2P the descriptor -// to the socket for the connection is returned. When the function -// returns *AHOST contains the official host name. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Rexec C.rexec -func Rexec(__ahost **uint8, __rport c.Int, __name *uint8, __pass *uint8, __cmd *uint8, __fd2p *c.Int) c.Int - -// This is the equivalent function where the protocol can be selected -// and which therefore can be used for IPv6. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname RexecAf C.rexec_af -func RexecAf(__ahost **uint8, __rport c.Int, __name *uint8, __pass *uint8, __cmd *uint8, __fd2p *c.Int, __af SaFamilyT) c.Int - -// Check whether user REMUSER on system RHOST is allowed to login as LOCUSER. -// If SUSER is not zero the user tries to become superuser. Return 0 if -// it is possible. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Ruserok C.ruserok -func Ruserok(__rhost *uint8, __suser c.Int, __remuser *uint8, __locuser *uint8) c.Int - -// This is the equivalent function where the protocol can be selected -// and which therefore can be used for IPv6. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname RuserokAf C.ruserok_af -func RuserokAf(__rhost *uint8, __suser c.Int, __remuser *uint8, __locuser *uint8, __af SaFamilyT) c.Int - -// Check whether user REMUSER on system indicated by IPv4 address -// RADDR is allowed to login as LOCUSER. Non-IPv4 (e.g., IPv6) are -// not supported. If SUSER is not zero the user tries to become -// superuser. Return 0 if it is possible. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Iruserok C.iruserok -func Iruserok(__raddr c.Uint32T, __suser c.Int, __remuser *uint8, __locuser *uint8) c.Int - -// This is the equivalent function where the pfamiliy if the address -// pointed to by RADDR is determined by the value of AF. It therefore -// can be used for IPv6 -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname IruserokAf C.iruserok_af -func IruserokAf(__raddr unsafe.Pointer, __suser c.Int, __remuser *uint8, __locuser *uint8, __af SaFamilyT) c.Int - -// Try to allocate reserved port, returning a descriptor for a socket opened -// at this port or -1 if unsuccessful. The search for an available port -// will start at ALPORT and continues with lower numbers. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Rresvport C.rresvport -func Rresvport(__alport *c.Int) c.Int - -// This is the equivalent function where the protocol can be selected -// and which therefore can be used for IPv6. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname RresvportAf C.rresvport_af -func RresvportAf(__alport *c.Int, __af SaFamilyT) c.Int - -// Convert error return from getaddrinfo() to a string. -// -//go:linkname GaiStrerror C.gai_strerror -func GaiStrerror(__ecode c.Int) *uint8 - -// Translate a socket address to a location and service name. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -// llgo:link (*SockAddr).Getnameinfo C.getnameinfo -func (self *SockAddr) Getnameinfo(__salen SocklenT, __host *uint8, __hostlen SocklenT, __serv *uint8, __servlen SocklenT, __flags c.Int) c.Int { - return 0 -} diff --git a/c/net/netinet-in_darwin_arm64.go b/c/net/netinet-in_darwin_arm64.go deleted file mode 100644 index fb3d03e5..00000000 --- a/c/net/netinet-in_darwin_arm64.go +++ /dev/null @@ -1,637 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// Protocols (RFC 1700) -const IPPROTO_IP = 0 - -// IP6 hop-by-hop options -const IPPROTO_HOPOPTS = 0 - -// control message protocol -const IPPROTO_ICMP = 1 -const ( - // group mgmt protocol - IPPROTO_IGMP = 2 - // gateway^2 (deprecated) - IPPROTO_GGP = 3 - // IPv4 encapsulation - IPPROTO_IPV4 = 4 - // for compatibility - IPPROTO_IPIP = 4 -) - -// tcp -const IPPROTO_TCP = 6 -const ( - // Stream protocol II - IPPROTO_ST = 7 - // exterior gateway protocol - IPPROTO_EGP = 8 - // private interior gateway - IPPROTO_PIGP = 9 - // BBN RCC Monitoring - IPPROTO_RCCMON = 10 - // network voice protocol - IPPROTO_NVPII = 11 - // pup - IPPROTO_PUP = 12 - // Argus - IPPROTO_ARGUS = 13 - // EMCON - IPPROTO_EMCON = 14 - // Cross Net Debugger - IPPROTO_XNET = 15 - // Chaos - IPPROTO_CHAOS = 16 -) - -// user datagram protocol -const IPPROTO_UDP = 17 -const ( - // Multiplexing - IPPROTO_MUX = 18 - // DCN Measurement Subsystems - IPPROTO_MEAS = 19 - // Host Monitoring - IPPROTO_HMP = 20 - // Packet Radio Measurement - IPPROTO_PRM = 21 - // xns idp - IPPROTO_IDP = 22 - // Trunk-1 - IPPROTO_TRUNK1 = 23 - // Trunk-2 - IPPROTO_TRUNK2 = 24 - // Leaf-1 - IPPROTO_LEAF1 = 25 - // Leaf-2 - IPPROTO_LEAF2 = 26 - // Reliable Data - IPPROTO_RDP = 27 - // Reliable Transaction - IPPROTO_IRTP = 28 - // tp-4 w/ class negotiation - IPPROTO_TP = 29 - // Bulk Data Transfer - IPPROTO_BLT = 30 - // Network Services - IPPROTO_NSP = 31 - // Merit Internodal - IPPROTO_INP = 32 - // Sequential Exchange - IPPROTO_SEP = 33 - // Third Party Connect - IPPROTO_3PC = 34 - // InterDomain Policy Routing - IPPROTO_IDPR = 35 - // XTP - IPPROTO_XTP = 36 - // Datagram Delivery - IPPROTO_DDP = 37 - // Control Message Transport - IPPROTO_CMTP = 38 - // TP++ Transport - IPPROTO_TPXX = 39 - // IL transport protocol - IPPROTO_IL = 40 -) - -// IP6 header -const IPPROTO_IPV6 = 41 -const ( - // Source Demand Routing - IPPROTO_SDRP = 42 - // IP6 routing header - IPPROTO_ROUTING = 43 - // IP6 fragmentation header - IPPROTO_FRAGMENT = 44 - // InterDomain Routing - IPPROTO_IDRP = 45 - // resource reservation - IPPROTO_RSVP = 46 - // General Routing Encap. - IPPROTO_GRE = 47 - // Mobile Host Routing - IPPROTO_MHRP = 48 - // BHA - IPPROTO_BHA = 49 - // IP6 Encap Sec. Payload - IPPROTO_ESP = 50 - // IP6 Auth Header - IPPROTO_AH = 51 - // Integ. Net Layer Security - IPPROTO_INLSP = 52 - // IP with encryption - IPPROTO_SWIPE = 53 - // Next Hop Resolution - IPPROTO_NHRP = 54 -) - -// 55-57: Unassigned -const ( - IPPROTO_ICMPV6 = 58 - // IP6 no next header - IPPROTO_NONE = 59 - // IP6 destination option - IPPROTO_DSTOPTS = 60 - // any host internal protocol - IPPROTO_AHIP = 61 - // CFTP - IPPROTO_CFTP = 62 - // "hello" routing protocol - IPPROTO_HELLO = 63 - // SATNET/Backroom EXPAK - IPPROTO_SATEXPAK = 64 - // Kryptolan - IPPROTO_KRYPTOLAN = 65 - // Remote Virtual Disk - IPPROTO_RVD = 66 - // Pluribus Packet Core - IPPROTO_IPPC = 67 - // Any distributed FS - IPPROTO_ADFS = 68 - // Satnet Monitoring - IPPROTO_SATMON = 69 - // VISA Protocol - IPPROTO_VISA = 70 - // Packet Core Utility - IPPROTO_IPCV = 71 - // Comp. Prot. Net. Executive - IPPROTO_CPNX = 72 - // Comp. Prot. HeartBeat - IPPROTO_CPHB = 73 - // Wang Span Network - IPPROTO_WSN = 74 - // Packet Video Protocol - IPPROTO_PVP = 75 - // BackRoom SATNET Monitoring - IPPROTO_BRSATMON = 76 - // Sun net disk proto (temp.) - IPPROTO_ND = 77 - // WIDEBAND Monitoring - IPPROTO_WBMON = 78 - // WIDEBAND EXPAK - IPPROTO_WBEXPAK = 79 - // ISO cnlp - IPPROTO_EON = 80 - // VMTP - IPPROTO_VMTP = 81 - // Secure VMTP - IPPROTO_SVMTP = 82 - // Banyon VINES - IPPROTO_VINES = 83 - // TTP - IPPROTO_TTP = 84 - // NSFNET-IGP - IPPROTO_IGP = 85 - // dissimilar gateway prot. - IPPROTO_DGP = 86 - // TCF - IPPROTO_TCF = 87 - // Cisco/GXS IGRP - IPPROTO_IGRP = 88 - // OSPFIGP - IPPROTO_OSPFIGP = 89 - // Strite RPC protocol - IPPROTO_SRPC = 90 - // Locus Address Resoloution - IPPROTO_LARP = 91 - // Multicast Transport - IPPROTO_MTP = 92 - // AX.25 Frames - IPPROTO_AX25 = 93 - // IP encapsulated in IP - IPPROTO_IPEIP = 94 - // Mobile Int.ing control - IPPROTO_MICP = 95 - // Semaphore Comm. security - IPPROTO_SCCSP = 96 - // Ethernet IP encapsulation - IPPROTO_ETHERIP = 97 - // encapsulation header - IPPROTO_ENCAP = 98 - // any private encr. scheme - IPPROTO_APES = 99 - // GMTP - IPPROTO_GMTP = 100 -) - -// 101-252: Partly Unassigned -const ( - IPPROTO_PIM = 103 - // payload compression (IPComp) - IPPROTO_IPCOMP = 108 - // PGM - IPPROTO_PGM = 113 - // SCTP - IPPROTO_SCTP = 132 -) - -// BSD Private, local use, namespace incursion -const IPPROTO_DIVERT = 254 - -// raw IP packet -const IPPROTO_RAW = 255 -const IPPROTO_MAX = 256 - -// last return value of *_input(), meaning "all job for this pkt is done". -const IPPROTO_DONE = 257 -const X__DARWIN_IPPORT_RESERVED = 1024 -const IPPORT_USERRESERVED = 5000 - -// Default local port range to use by setting IP_PORTRANGE_HIGH -const ( - IPPORT_HIFIRSTAUTO = 49152 - IPPORT_HILASTAUTO = 65535 -) - -// Scanning for a free reserved port return a value below IPPORT_RESERVED, -// but higher than IPPORT_RESERVEDSTART. Traditionally the start value was -// 512, but that conflicts with some well-known-services that firewalls may -// have a fit if we use. -const IPPORT_RESERVEDSTART = 600 -const ( - IN_CLASSA_NET = 4278190080 - IN_CLASSA_NSHIFT = 24 - IN_CLASSA_HOST = 16777215 - IN_CLASSA_MAX = 128 -) -const ( - IN_CLASSB_NET = 4294901760 - IN_CLASSB_NSHIFT = 16 - IN_CLASSB_HOST = 65535 - IN_CLASSB_MAX = 65536 -) -const ( - IN_CLASSC_NET = 4294967040 - IN_CLASSC_NSHIFT = 8 - IN_CLASSC_HOST = 255 -) -const ( - // These ones aren't really - IN_CLASSD_NET = 4026531840 - // net and host fields, but - IN_CLASSD_NSHIFT = 28 - // routing needn't know. - IN_CLASSD_HOST = 268435455 -) - -// -1 return -const INADDR_NONE = 4294967295 - -// official! -const IN_LOOPBACKNET = 127 -const INET_ADDRSTRLEN = 16 - -// Options for use with [gs]etsockopt at the IP level. -// First word of comment is data type; bool is stored in int. -const ( - IP_OPTIONS = 1 - // int; header is included with data - IP_HDRINCL = 2 - // int; IP type of service and preced. - IP_TOS = 3 - // int; IP time to live - IP_TTL = 4 - // bool; receive all IP opts w/dgram - IP_RECVOPTS = 5 - // bool; receive IP opts for response - IP_RECVRETOPTS = 6 - // bool; receive IP dst addr w/dgram - IP_RECVDSTADDR = 7 - // ip_opts; set/get IP options - IP_RETOPTS = 8 - // u_char; set/get IP multicast i/f - IP_MULTICAST_IF = 9 - // u_char; set/get IP multicast ttl - IP_MULTICAST_TTL = 10 - // u_char; set/get IP multicast loopback - IP_MULTICAST_LOOP = 11 - // ip_mreq; add an IP group membership - IP_ADD_MEMBERSHIP = 12 - // ip_mreq; drop an IP group membership - IP_DROP_MEMBERSHIP = 13 - // set/get IP mcast virt. iface - IP_MULTICAST_VIF = 14 - // enable RSVP in kernel - IP_RSVP_ON = 15 - // disable RSVP in kernel - IP_RSVP_OFF = 16 - // set RSVP per-vif socket - IP_RSVP_VIF_ON = 17 - // unset RSVP per-vif socket - IP_RSVP_VIF_OFF = 18 - // int; range to choose for unspec port - IP_PORTRANGE = 19 - // bool; receive reception if w/dgram - IP_RECVIF = 20 -) - -// for IPSEC -const ( - IP_IPSEC_POLICY = 21 - // deprecated - IP_FAITH = 22 -) - -// bool: drop receive of raw IP header -const IP_STRIPHDR = 23 -const ( - // bool; receive reception TTL w/dgram - IP_RECVTTL = 24 - // int; set/get bound interface - IP_BOUND_IF = 25 - // get pktinfo on recv socket, set src on sent dgram - IP_PKTINFO = 26 - // receive pktinfo w/dgram - IP_RECVPKTINFO = 26 - // bool; receive IP TOS w/dgram - IP_RECVTOS = 27 - // don't fragment packet - IP_DONTFRAG = 28 -) -const ( - // add a firewall rule to chain - IP_FW_ADD = 40 - // delete a firewall rule from chain - IP_FW_DEL = 41 - // flush firewall rule chain - IP_FW_FLUSH = 42 - // clear single/all firewall counter(s) - IP_FW_ZERO = 43 - // get entire firewall rule chain - IP_FW_GET = 44 - // reset logging counters - IP_FW_RESETLOG = 45 -) - -// These older firewall socket option codes are maintained for backward compatibility. -const ( - IP_OLD_FW_ADD = 50 - // delete a firewall rule from chain - IP_OLD_FW_DEL = 51 - // flush firewall rule chain - IP_OLD_FW_FLUSH = 52 - // clear single/all firewall counter(s) - IP_OLD_FW_ZERO = 53 - // get entire firewall rule chain - IP_OLD_FW_GET = 54 - // set/get NAT opts XXX Deprecated, do not use - IP_NAT__XXX = 55 - // reset logging counters - IP_OLD_FW_RESETLOG = 56 -) -const ( - // add/configure a dummynet pipe - IP_DUMMYNET_CONFIGURE = 60 - // delete a dummynet pipe from chain - IP_DUMMYNET_DEL = 61 - // flush dummynet - IP_DUMMYNET_FLUSH = 62 - // get entire dummynet pipes - IP_DUMMYNET_GET = 64 -) -const ( - // int*; get background IO flags; set background IO - IP_TRAFFIC_MGT_BACKGROUND = 65 - // int*; set/get IP multicast i/f index - IP_MULTICAST_IFINDEX = 66 -) - -// IPv4 Source Filter Multicast API [RFC3678] -const ( - IP_ADD_SOURCE_MEMBERSHIP = 70 - // drop a single source - IP_DROP_SOURCE_MEMBERSHIP = 71 - // block a source - IP_BLOCK_SOURCE = 72 - // unblock a source - IP_UNBLOCK_SOURCE = 73 -) - -// The following option is private; do not use it from user applications. -const IP_MSFILTER = 74 - -// Protocol Independent Multicast API [RFC3678] -const ( - MCAST_JOIN_GROUP = 80 - // leave all sources for group - MCAST_LEAVE_GROUP = 81 - // join a source-specific group - MCAST_JOIN_SOURCE_GROUP = 82 - // leave a single source - MCAST_LEAVE_SOURCE_GROUP = 83 - // block a source - MCAST_BLOCK_SOURCE = 84 - // unblock a source - MCAST_UNBLOCK_SOURCE = 85 -) - -// Defaults and limits for options -const ( - IP_DEFAULT_MULTICAST_TTL = 1 - // normally hear sends if a member - IP_DEFAULT_MULTICAST_LOOP = 1 -) - -// The imo_membership vector for each socket is now dynamically allocated at -// run-time, bounded by USHRT_MAX, and is reallocated when needed, sized -// according to a power-of-two increment. -const ( - IP_MIN_MEMBERSHIPS = 31 - IP_MAX_MEMBERSHIPS = 4095 -) - -// Default resource limits for IPv4 multicast source filtering. -// These may be modified by sysctl. -const ( - IP_MAX_GROUP_SRC_FILTER = 512 - // sources per socket/group - IP_MAX_SOCK_SRC_FILTER = 128 - // XXX no longer used - IP_MAX_SOCK_MUTE_FILTER = 128 -) - -// Filter modes; also used to represent per-socket filter mode internally. -const ( - MCAST_UNDEFINED = 0 - // fmode: include these source(s) - MCAST_INCLUDE = 1 - // fmode: exclude these source(s) - MCAST_EXCLUDE = 2 -) - -// Argument for IP_PORTRANGE: -// - which range to search when port is unspecified at bind() or connect() -const ( - IP_PORTRANGE_DEFAULT = 0 - // "high" - request firewall bypass - IP_PORTRANGE_HIGH = 1 - // "low" - vouchsafe security - IP_PORTRANGE_LOW = 2 -) - -// Definitions for inet sysctl operations. -// -// Third level is protocol number. -// Fourth level is desired variable within that protocol. -const IPPROTO_MAXID = 52 - -// Names for IP sysctl objects -const ( - IPCTL_FORWARDING = 1 - // may send redirects when forwarding - IPCTL_SENDREDIRECTS = 2 - // default TTL - IPCTL_DEFTTL = 3 -) -const ( - // cloned route expiration time - IPCTL_RTEXPIRE = 5 - // min value for expiration time - IPCTL_RTMINEXPIRE = 6 - // trigger level for dynamic expire - IPCTL_RTMAXCACHE = 7 - // may perform source routes - IPCTL_SOURCEROUTE = 8 - // may re-broadcast received packets - IPCTL_DIRECTEDBROADCAST = 9 - // max length of netisr queue - IPCTL_INTRQMAXLEN = 10 - // number of netisr q drops - IPCTL_INTRQDROPS = 11 - // ipstat structure - IPCTL_STATS = 12 - // may accept source routed packets - IPCTL_ACCEPTSOURCEROUTE = 13 - // use fast IP forwarding code - IPCTL_FASTFORWARDING = 14 - // deprecated - IPCTL_KEEPFAITH = 15 - // default TTL for gif encap packet - IPCTL_GIF_TTL = 16 - IPCTL_MAXID = 17 -) - -// Internet address (a structure for historical reasons) -type InAddr struct { - Addr uint32 -} - -// Socket address, internet style. -type SockaddrIn struct { - Len uint8 - Family uint8 - Port uint16 - Addr InAddr - Zero [8]c.Char -} - -// Structure used to describe IP options. -// Used to store options internally, to pass them to a process, -// or to restore options retrieved earlier. -// The ip_dst is used for the first-hop gateway when using a source route -// (this gets put into the header proper). -type IpOpts struct { - IpDst InAddr - IpOpts [40]c.Char -} - -// Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. -type IpMreq struct { - ImrMultiaddr InAddr - ImrInterface InAddr -} - -// Modified argument structure for IP_MULTICAST_IF, obtained from Linux. -// This is used to specify an interface index for multicast sends, as -// the IPv4 legacy APIs do not support this (unless IP_SENDIF is available). -type IpMreqn struct { - ImrMultiaddr InAddr - ImrAddress InAddr - ImrIfindex c.Int -} - -// Argument structure for IPv4 Multicast Source Filter APIs. [RFC3678] -type IpMreqSource struct { - ImrMultiaddr InAddr - ImrSourceaddr InAddr - ImrInterface InAddr -} - -// Argument structures for Protocol-Independent Multicast Source -// Filter APIs. [RFC3678] -type GroupReq struct { - GrInterface c.Uint32T - GrGroup SockaddrStorage -} -type GroupSourceReq struct { - GsrInterface c.Uint32T - GsrGroup SockaddrStorage - GsrSource SockaddrStorage -} - -// The following structure is private; do not use it from user applications. -// It is used to communicate IP_MSFILTER/IPV6_MSFILTER information between -// the RFC 3678 libc functions and the kernel. -type X__Msfilterreq struct { - MsfrIfindex c.Uint32T - MsfrFmode c.Uint32T - MsfrNsrcs c.Uint32T - X__MsfrAlign c.Uint32T - MsfrGroup SockaddrStorage - MsfrSrcs *SockaddrStorage -} - -// IP_PKTINFO: Packet information (equivalent to RFC2292 sec 5 for IPv4) -// This structure is used for -// -// 1. Receiving ancilliary data about the datagram if IP_PKTINFO sockopt is -// set on the socket. In this case ipi_ifindex will contain the interface -// index the datagram was received on, ipi_addr is the IP address the -// datagram was received to. -// -// 2. Sending a datagram using a specific interface or IP source address. -// if ipi_ifindex is set to non-zero when in_pktinfo is passed as -// ancilliary data of type IP_PKTINFO, this will be used as the source -// interface to send the datagram from. If ipi_ifindex is null, ip_spec_dst -// will be used for the source address. -// -// Note: if IP_BOUND_IF is set on the socket, ipi_ifindex in the ancillary -// IP_PKTINFO option silently overrides the bound interface when it is -// specified during send time. -type InPktinfo struct { - IpiIfindex c.Uint - IpiSpecDst InAddr - IpiAddr InAddr -} - -// Advanced (Full-state) APIs [RFC3678] -// The RFC specifies uint_t for the 6th argument to [sg]etsourcefilter(). -// We use uint32_t here to be consistent. -// -//go:linkname Setipv4sourcefilter C.setipv4sourcefilter -func Setipv4sourcefilter(_llcppg_param1 c.Int, _llcppg_param2 InAddr, _llcppg_param3 InAddr, _llcppg_param4 c.Uint32T, _llcppg_param5 c.Uint32T, _llcppg_param6 *InAddr) c.Int - -//go:linkname Getipv4sourcefilter C.getipv4sourcefilter -func Getipv4sourcefilter(_llcppg_param1 c.Int, _llcppg_param2 InAddr, _llcppg_param3 InAddr, _llcppg_param4 *c.Uint32T, _llcppg_param5 *c.Uint32T, _llcppg_param6 *InAddr) c.Int - -//go:linkname Setsourcefilter C.setsourcefilter -func Setsourcefilter(_llcppg_param1 c.Int, _llcppg_param2 c.Uint32T, _llcppg_param3 *SockAddr, _llcppg_param4 SocklenT, _llcppg_param5 c.Uint32T, _llcppg_param6 c.Uint32T, _llcppg_param7 *SockaddrStorage) c.Int - -//go:linkname Getsourcefilter C.getsourcefilter -func Getsourcefilter(_llcppg_param1 c.Int, _llcppg_param2 c.Uint32T, _llcppg_param3 *SockAddr, _llcppg_param4 SocklenT, _llcppg_param5 *c.Uint32T, _llcppg_param6 *c.Uint32T, _llcppg_param7 *SockaddrStorage) c.Int - -//go:linkname Bindresvport C.bindresvport -func Bindresvport(_llcppg_param1 c.Int, _llcppg_param2 *SockaddrIn) c.Int - -//go:linkname BindresvportSa C.bindresvport_sa -func BindresvportSa(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr) c.Int diff --git a/c/net/netinet-in_linux_amd64.go b/c/net/netinet-in_linux_amd64.go deleted file mode 100644 index aafeed35..00000000 --- a/c/net/netinet-in_linux_amd64.go +++ /dev/null @@ -1,218 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_NETINET_IN_H = 1 -const ( - IN_CLASSA_NET = 4278190080 - IN_CLASSA_NSHIFT = 24 - IN_CLASSA_HOST = 16777215 - IN_CLASSA_MAX = 128 -) -const ( - IN_CLASSB_NET = 4294901760 - IN_CLASSB_NSHIFT = 16 - IN_CLASSB_HOST = 65535 - IN_CLASSB_MAX = 65536 -) -const ( - IN_CLASSC_NET = 4294967040 - IN_CLASSC_NSHIFT = 8 - IN_CLASSC_HOST = 255 -) - -// Network number for local host loopback. -const IN_LOOPBACKNET = 127 -const ( - INET_ADDRSTRLEN = 16 - INET6_ADDRSTRLEN = 46 -) - -type InAddr struct { - Addr uint32 -} - -// Standard well-defined IP protocols. -const ( - IPPROTO_IP = 0 - IPPROTO_ICMP = 1 - IPPROTO_IGMP = 2 - IPPROTO_IPIP = 4 - IPPROTO_TCP = 6 - IPPROTO_EGP = 8 - IPPROTO_PUP = 12 - IPPROTO_UDP = 17 - IPPROTO_IDP = 22 - IPPROTO_TP = 29 - IPPROTO_DCCP = 33 - IPPROTO_IPV6 = 41 - IPPROTO_RSVP = 46 - IPPROTO_GRE = 47 - IPPROTO_ESP = 50 - IPPROTO_AH = 51 - IPPROTO_MTP = 92 - IPPROTO_BEETPH = 94 - IPPROTO_ENCAP = 98 - IPPROTO_PIM = 103 - IPPROTO_COMP = 108 - IPPROTO_SCTP = 132 - IPPROTO_UDPLITE = 136 - IPPROTO_MPLS = 137 - IPPROTO_RAW = 255 - IPPROTO_MAX = 256 -) -const ( - IPPROTO_HOPOPTS = 0 - IPPROTO_ROUTING = 43 - IPPROTO_FRAGMENT = 44 - IPPROTO_ICMPV6 = 58 - IPPROTO_NONE = 59 - IPPROTO_DSTOPTS = 60 - // IPv6 mobility header. - IPPROTO_MH = 135 -) - -// Standard well-known ports. -const ( - IPPORT_ECHO = 7 - IPPORT_DISCARD = 9 - IPPORT_SYSTAT = 11 - IPPORT_DAYTIME = 13 - IPPORT_NETSTAT = 15 - IPPORT_FTP = 21 - IPPORT_TELNET = 23 - IPPORT_SMTP = 25 - IPPORT_TIMESERVER = 37 - IPPORT_NAMESERVER = 42 - IPPORT_WHOIS = 43 - IPPORT_MTP = 57 - IPPORT_TFTP = 69 - IPPORT_RJE = 77 - IPPORT_FINGER = 79 - IPPORT_TTYLINK = 87 - IPPORT_SUPDUP = 95 - IPPORT_EXECSERVER = 512 - IPPORT_LOGINSERVER = 513 - IPPORT_CMDSERVER = 514 - IPPORT_EFSSERVER = 520 - // UDP ports. - IPPORT_BIFFUDP = 512 - IPPORT_WHOSERVER = 513 - IPPORT_ROUTESERVER = 520 - // Ports less than this value are reserved for privileged processes. - IPPORT_RESERVED = 1024 - // Ports greater this value are reserved for (non-privileged) servers. - IPPORT_USERRESERVED = 5000 -) - -// IPv6 address -type nativeIn6Addr struct { - X__In6U _llcppg_anon_0 -} - -// Structure describing an Internet socket address. -type SockaddrIn struct { - Family uint16 - Port uint16 - Addr InAddr - Zero [8]uint8 -} - -// Ditto, for IPv6. -type SockaddrIn6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr In6Addr - ScopeId uint32 -} - -// IPv4 multicast request. -type IpMreq struct { - ImrMultiaddr InAddr - ImrInterface InAddr -} -type IpMreqSource struct { - ImrMultiaddr InAddr - ImrInterface InAddr - ImrSourceaddr InAddr -} - -// Likewise, for IPv6. -type Ipv6Mreq struct { - Ipv6mrMultiaddr nativeIn6Addr - Ipv6mrInterface c.Uint -} - -// Multicast group request. -type GroupReq struct { - GrInterface c.Uint32T - GrGroup SockaddrStorage -} -type GroupSourceReq struct { - GsrInterface c.Uint32T - GsrGroup SockaddrStorage - GsrSource SockaddrStorage -} - -// Full-state filter operations. -type IpMsfilter struct { - ImsfMultiaddr InAddr - ImsfInterface InAddr - ImsfFmode c.Uint32T - ImsfNumsrc c.Uint32T - ImsfSlist [1]InAddr -} -type GroupFilter struct { - GfInterface c.Uint32T - GfGroup SockaddrStorage - GfFmode c.Uint32T - GfNumsrc c.Uint32T - GfSlist [1]SockaddrStorage -} - -// Internet address. -type InAddrT = c.Uint32T - -// Type to represent a port. -type InPortT = c.Uint16T -type _llcppg_anon_0 struct { - _xgo_union [4]uint32 -} - -func (p *_llcppg_anon_0) XGof_ref___u6_addr8() *[16]c.Uint8T { - return (*[16]c.Uint8T)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_0) XGof_ref___u6_addr16() *[8]c.Uint16T { - return (*[8]c.Uint16T)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_0) XGof_ref___u6_addr32() *[4]c.Uint32T { - return (*[4]c.Uint32T)(unsafe.Pointer(p)) -} - -// :: -// -//go:linkname In6addrAny C.in6addr_any -var In6addrAny nativeIn6Addr - -// ::1 -// -//go:linkname In6addrLoopback C.in6addr_loopback -var In6addrLoopback nativeIn6Addr - -// Bind socket to a privileged IP port. -// -//go:linkname Bindresvport C.bindresvport -func Bindresvport(__sockfd c.Int, __sock_in *SockaddrIn) c.Int - -// The IPv6 version of this function. -// -//go:linkname Bindresvport6 C.bindresvport6 -func Bindresvport6(__sockfd c.Int, __sock_in *SockaddrIn6) c.Int diff --git a/c/net/netinet-in_linux_arm64.go b/c/net/netinet-in_linux_arm64.go deleted file mode 100644 index c23a3159..00000000 --- a/c/net/netinet-in_linux_arm64.go +++ /dev/null @@ -1,218 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_NETINET_IN_H = 1 -const ( - IN_CLASSA_NET = 4278190080 - IN_CLASSA_NSHIFT = 24 - IN_CLASSA_HOST = 16777215 - IN_CLASSA_MAX = 128 -) -const ( - IN_CLASSB_NET = 4294901760 - IN_CLASSB_NSHIFT = 16 - IN_CLASSB_HOST = 65535 - IN_CLASSB_MAX = 65536 -) -const ( - IN_CLASSC_NET = 4294967040 - IN_CLASSC_NSHIFT = 8 - IN_CLASSC_HOST = 255 -) - -// Network number for local host loopback. -const IN_LOOPBACKNET = 127 -const ( - INET_ADDRSTRLEN = 16 - INET6_ADDRSTRLEN = 46 -) - -type InAddr struct { - Addr uint32 -} - -// Standard well-defined IP protocols. -const ( - IPPROTO_IP = 0 - IPPROTO_ICMP = 1 - IPPROTO_IGMP = 2 - IPPROTO_IPIP = 4 - IPPROTO_TCP = 6 - IPPROTO_EGP = 8 - IPPROTO_PUP = 12 - IPPROTO_UDP = 17 - IPPROTO_IDP = 22 - IPPROTO_TP = 29 - IPPROTO_DCCP = 33 - IPPROTO_IPV6 = 41 - IPPROTO_RSVP = 46 - IPPROTO_GRE = 47 - IPPROTO_ESP = 50 - IPPROTO_AH = 51 - IPPROTO_MTP = 92 - IPPROTO_BEETPH = 94 - IPPROTO_ENCAP = 98 - IPPROTO_PIM = 103 - IPPROTO_COMP = 108 - IPPROTO_SCTP = 132 - IPPROTO_UDPLITE = 136 - IPPROTO_MPLS = 137 - IPPROTO_RAW = 255 - IPPROTO_MAX = 256 -) -const ( - IPPROTO_HOPOPTS = 0 - IPPROTO_ROUTING = 43 - IPPROTO_FRAGMENT = 44 - IPPROTO_ICMPV6 = 58 - IPPROTO_NONE = 59 - IPPROTO_DSTOPTS = 60 - // IPv6 mobility header. - IPPROTO_MH = 135 -) - -// Standard well-known ports. -const ( - IPPORT_ECHO = 7 - IPPORT_DISCARD = 9 - IPPORT_SYSTAT = 11 - IPPORT_DAYTIME = 13 - IPPORT_NETSTAT = 15 - IPPORT_FTP = 21 - IPPORT_TELNET = 23 - IPPORT_SMTP = 25 - IPPORT_TIMESERVER = 37 - IPPORT_NAMESERVER = 42 - IPPORT_WHOIS = 43 - IPPORT_MTP = 57 - IPPORT_TFTP = 69 - IPPORT_RJE = 77 - IPPORT_FINGER = 79 - IPPORT_TTYLINK = 87 - IPPORT_SUPDUP = 95 - IPPORT_EXECSERVER = 512 - IPPORT_LOGINSERVER = 513 - IPPORT_CMDSERVER = 514 - IPPORT_EFSSERVER = 520 - // UDP ports. - IPPORT_BIFFUDP = 512 - IPPORT_WHOSERVER = 513 - IPPORT_ROUTESERVER = 520 - // Ports less than this value are reserved for privileged processes. - IPPORT_RESERVED = 1024 - // Ports greater this value are reserved for (non-privileged) servers. - IPPORT_USERRESERVED = 5000 -) - -// IPv6 address -type nativeIn6Addr struct { - X__In6U _llcppg_anon_0 -} - -// Structure describing an Internet socket address. -type SockaddrIn struct { - Family uint16 - Port uint16 - Addr InAddr - Zero [8]c.Char -} - -// Ditto, for IPv6. -type SockaddrIn6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr In6Addr - ScopeId uint32 -} - -// IPv4 multicast request. -type IpMreq struct { - ImrMultiaddr InAddr - ImrInterface InAddr -} -type IpMreqSource struct { - ImrMultiaddr InAddr - ImrInterface InAddr - ImrSourceaddr InAddr -} - -// Likewise, for IPv6. -type Ipv6Mreq struct { - Ipv6mrMultiaddr nativeIn6Addr - Ipv6mrInterface c.Uint -} - -// Multicast group request. -type GroupReq struct { - GrInterface c.Uint32T - GrGroup SockaddrStorage -} -type GroupSourceReq struct { - GsrInterface c.Uint32T - GsrGroup SockaddrStorage - GsrSource SockaddrStorage -} - -// Full-state filter operations. -type IpMsfilter struct { - ImsfMultiaddr InAddr - ImsfInterface InAddr - ImsfFmode c.Uint32T - ImsfNumsrc c.Uint32T - ImsfSlist [1]InAddr -} -type GroupFilter struct { - GfInterface c.Uint32T - GfGroup SockaddrStorage - GfFmode c.Uint32T - GfNumsrc c.Uint32T - GfSlist [1]SockaddrStorage -} - -// Internet address. -type InAddrT = c.Uint32T - -// Type to represent a port. -type InPortT = c.Uint16T -type _llcppg_anon_0 struct { - _xgo_union [4]uint32 -} - -func (p *_llcppg_anon_0) XGof_ref___u6_addr8() *[16]c.Uint8T { - return (*[16]c.Uint8T)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_0) XGof_ref___u6_addr16() *[8]c.Uint16T { - return (*[8]c.Uint16T)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_0) XGof_ref___u6_addr32() *[4]c.Uint32T { - return (*[4]c.Uint32T)(unsafe.Pointer(p)) -} - -// :: -// -//go:linkname In6addrAny C.in6addr_any -var In6addrAny nativeIn6Addr - -// ::1 -// -//go:linkname In6addrLoopback C.in6addr_loopback -var In6addrLoopback nativeIn6Addr - -// Bind socket to a privileged IP port. -// -//go:linkname Bindresvport C.bindresvport -func Bindresvport(__sockfd c.Int, __sock_in *SockaddrIn) c.Int - -// The IPv6 version of this function. -// -//go:linkname Bindresvport6 C.bindresvport6 -func Bindresvport6(__sockfd c.Int, __sock_in *SockaddrIn6) c.Int diff --git a/c/net/netinet6-in6_darwin_arm64.go b/c/net/netinet6-in6_darwin_arm64.go deleted file mode 100644 index 7e0c848a..00000000 --- a/c/net/netinet6-in6_darwin_arm64.go +++ /dev/null @@ -1,405 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -// Identification of the network protocol stack -// for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE -// has the table of implementation/integration differences. -const X__KAME_VERSION = "2009/apple-darwin" -const ( - IPV6PORT_RESERVED = 1024 - IPV6PORT_ANONMIN = 49152 - IPV6PORT_ANONMAX = 65535 - IPV6PORT_RESERVEDMIN = 600 - IPV6PORT_RESERVEDMAX = 1023 -) -const INET6_ADDRSTRLEN = 46 -const ( - X__IPV6_ADDR_SCOPE_NODELOCAL = 1 - X__IPV6_ADDR_SCOPE_INTFACELOCAL = 1 - X__IPV6_ADDR_SCOPE_LINKLOCAL = 2 - X__IPV6_ADDR_SCOPE_SITELOCAL = 5 - // just used in this file - X__IPV6_ADDR_SCOPE_ORGLOCAL = 8 - X__IPV6_ADDR_SCOPE_GLOBAL = 14 -) -const ( - IPV6_ADDR_MC_FLAGS_TRANSIENT = 16 - IPV6_ADDR_MC_FLAGS_PREFIX = 32 - IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 48 -) - -// reserved for future use -const IPV6_SOCKOPT_RESERVED1 = 3 -const ( - // int; IP6 hops - IPV6_UNICAST_HOPS = 4 - // u_int; set/get IP6 multicast i/f - IPV6_MULTICAST_IF = 9 - // int; set/get IP6 multicast hops - IPV6_MULTICAST_HOPS = 10 - // u_int; set/get IP6 mcast loopback - IPV6_MULTICAST_LOOP = 11 - // ip6_mreq; join a group membership - IPV6_JOIN_GROUP = 12 - // ip6_mreq; leave a group membership - IPV6_LEAVE_GROUP = 13 -) -const ( - // int; range to choose for unspec port - IPV6_PORTRANGE = 14 - // icmp6_filter; icmp6 filter - ICMP6_FILTER = 18 - // bool; send/recv if, src/dst addr - IPV6_2292PKTINFO = 19 - // bool; hop limit - IPV6_2292HOPLIMIT = 20 - // bool; next hop addr - IPV6_2292NEXTHOP = 21 - // bool; hop-by-hop option - IPV6_2292HOPOPTS = 22 - // bool; destinaion option - IPV6_2292DSTOPTS = 23 - // ip6_rthdr: routing header - IPV6_2292RTHDR = 24 -) - -// buf/cmsghdr; set/get IPv6 options [obsoleted by RFC3542] -const IPV6_2292PKTOPTIONS = 25 - -// int; checksum offset for raw socket -const IPV6_CHECKSUM = 26 - -// bool; only bind INET6 at wildcard bind -const IPV6_V6ONLY = 27 -const IPV6_BINDV6ONLY = 27 - -// struct; get/set security policy -const IPV6_IPSEC_POLICY = 28 - -// deprecated -const IPV6_FAITH = 29 -const ( - // add a firewall rule to chain - IPV6_FW_ADD = 30 - // delete a firewall rule from chain - IPV6_FW_DEL = 31 - // flush firewall rule chain - IPV6_FW_FLUSH = 32 - // clear single/all firewall counter(s) - IPV6_FW_ZERO = 33 - // get entire firewall rule chain - IPV6_FW_GET = 34 -) - -// APPLE: NOTE the value of those 2 options is kept unchanged from -// -// previous version of darwin/OS X for binary compatibility reasons -// and differ from FreeBSD (values 57 and 61). See below. -const ( - IPV6_RECVTCLASS = 35 - // int; send traffic class value - IPV6_TCLASS = 36 -) - -// int; set/get bound interface -const IPV6_BOUND_IF = 125 -const ( - // this hop need not be a neighbor. - IPV6_RTHDR_LOOSE = 0 - // this hop must be a neighbor. - IPV6_RTHDR_STRICT = 1 - // IPv6 routing header type 0 - IPV6_RTHDR_TYPE_0 = 0 -) - -// Defaults and limits for options -const ( - IPV6_DEFAULT_MULTICAST_HOPS = 1 - // normally hear sends if a member - IPV6_DEFAULT_MULTICAST_LOOP = 1 -) - -// The im6o_membership vector for each socket is now dynamically allocated at -// run-time, bounded by USHRT_MAX, and is reallocated when needed, sized -// according to a power-of-two increment. -const ( - IPV6_MIN_MEMBERSHIPS = 31 - IPV6_MAX_MEMBERSHIPS = 4095 -) - -// Default resource limits for IPv6 multicast source filtering. -// These may be modified by sysctl. -const ( - IPV6_MAX_GROUP_SRC_FILTER = 512 - // sources per socket/group - IPV6_MAX_SOCK_SRC_FILTER = 128 -) - -// Argument for IPV6_PORTRANGE: -// - which range to search when port is unspecified at bind() or connect() -const ( - IPV6_PORTRANGE_DEFAULT = 0 - // "high" - request firewall bypass - IPV6_PORTRANGE_HIGH = 1 - // "low" - vouchsafe security - IPV6_PORTRANGE_LOW = 2 -) - -// Definitions for inet6 sysctl operations. -// -// Third level is protocol number. -// Fourth level is desired variable within that protocol. -const IPV6PROTO_MAXID = 104 - -// Names for IP sysctl objects -const ( - IPV6CTL_FORWARDING = 1 - // may send redirects when forwarding - IPV6CTL_SENDREDIRECTS = 2 - // default Hop-Limit - IPV6CTL_DEFHLIM = 3 -) -const ( - // forward source-routed dgrams - IPV6CTL_FORWSRCRT = 5 - // stats - IPV6CTL_STATS = 6 - // multicast forwarding stats - IPV6CTL_MRTSTATS = 7 - // multicast routing protocol - IPV6CTL_MRTPROTO = 8 - // max packets reassembly queue - IPV6CTL_MAXFRAGPACKETS = 9 - // verify source route and intf - IPV6CTL_SOURCECHECK = 10 - // minimume logging interval - IPV6CTL_SOURCECHECK_LOGINT = 11 - IPV6CTL_ACCEPT_RTADV = 12 - // deprecated - IPV6CTL_KEEPFAITH = 13 - IPV6CTL_LOG_INTERVAL = 14 - IPV6CTL_HDRNESTLIMIT = 15 - IPV6CTL_DAD_COUNT = 16 - IPV6CTL_AUTO_FLOWLABEL = 17 - IPV6CTL_DEFMCASTHLIM = 18 - // default HLIM for gif encap packet - IPV6CTL_GIF_HLIM = 19 - IPV6CTL_KAME_VERSION = 20 - // use deprec addr (RFC2462 5.5.4) - IPV6CTL_USE_DEPRECATED = 21 - // walk timer for router renumbering - IPV6CTL_RR_PRUNE = 22 -) -const ( - IPV6CTL_V6ONLY = 24 - // cloned route expiration time - IPV6CTL_RTEXPIRE = 25 - // min value for expiration time - IPV6CTL_RTMINEXPIRE = 26 - // trigger level for dynamic expire - IPV6CTL_RTMAXCACHE = 27 -) -const ( - // use temporary addresses [RFC 4941] - IPV6CTL_USETEMPADDR = 32 - // preferred lifetime for tmpaddrs - IPV6CTL_TEMPPLTIME = 33 - // valid lifetime for tmpaddrs - IPV6CTL_TEMPVLTIME = 34 - // automatic link-local addr assign - IPV6CTL_AUTO_LINKLOCAL = 35 - // raw_ip6 stats - IPV6CTL_RIP6STATS = 36 - // prefer temporary addr as src - IPV6CTL_PREFER_TEMPADDR = 37 - // get/set address selection policy - IPV6CTL_ADDRCTLPOLICY = 38 - // use default scope zone - IPV6CTL_USE_DEFAULTZONE = 39 -) -const ( - // max fragments - IPV6CTL_MAXFRAGS = 41 - // enable pMTU discovery for mcast? - IPV6CTL_MCAST_PMTU = 44 -) -const ( - IPV6CTL_NEIGHBORGCTHRESH = 46 - IPV6CTL_MAXIFPREFIXES = 47 - IPV6CTL_MAXIFDEFROUTERS = 48 - IPV6CTL_MAXDYNROUTES = 49 - ICMPV6CTL_ND6_ONLINKNSRFC4861 = 50 - IPV6CTL_ULA_USETEMPADDR = 51 -) - -// to define items, should talk with KAME guys first, for *BSD compatibility -const IPV6CTL_MAXID = 51 - -// IPv6 address -type nativeIn6Addr struct { - X__U6Addr _llcppg_anon_0 -} -type SockaddrIn6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr In6Addr - ScopeId uint32 -} - -// Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP. -type Ipv6Mreq struct { - Ipv6mrMultiaddr nativeIn6Addr - Ipv6mrInterface c.Uint -} - -// IPV6_2292PKTINFO: Packet information(RFC2292 sec 5) -type In6Pktinfo struct { - Ipi6Addr nativeIn6Addr - Ipi6Ifindex c.Uint -} - -// Control structure for IPV6_RECVPATHMTU socket option. -type Ip6Mtuinfo struct { - Ip6mAddr SockaddrIn6 - Ip6mMtu c.Uint32T -} -type _llcppg_anon_0 struct { - _xgo_union [4]uint32 -} - -// IPv6 address -type In6AddrT = nativeIn6Addr - -func (p *_llcppg_anon_0) XGof_ref___u6_addr8() *[16]X__Uint8T { - return (*[16]X__Uint8T)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_0) XGof_ref___u6_addr16() *[8]X__Uint16T { - return (*[8]X__Uint16T)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_0) XGof_ref___u6_addr32() *[4]X__Uint32T { - return (*[4]X__Uint32T)(unsafe.Pointer(p)) -} - -//go:linkname In6addrAny C.in6addr_any -var In6addrAny nativeIn6Addr - -//go:linkname In6addrLoopback C.in6addr_loopback -var In6addrLoopback nativeIn6Addr - -//go:linkname In6addrNodelocalAllnodes C.in6addr_nodelocal_allnodes -var In6addrNodelocalAllnodes nativeIn6Addr - -//go:linkname In6addrLinklocalAllnodes C.in6addr_linklocal_allnodes -var In6addrLinklocalAllnodes nativeIn6Addr - -//go:linkname In6addrLinklocalAllrouters C.in6addr_linklocal_allrouters -var In6addrLinklocalAllrouters nativeIn6Addr - -//go:linkname In6addrLinklocalAllv2routers C.in6addr_linklocal_allv2routers -var In6addrLinklocalAllv2routers nativeIn6Addr - -//go:linkname Inet6OptionSpace C.inet6_option_space -func Inet6OptionSpace(_llcppg_param1 c.Int) c.Int - -//go:linkname Inet6OptionInit C.inet6_option_init -func Inet6OptionInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 **Cmsghdr, _llcppg_param3 c.Int) c.Int - -// llgo:link (*Cmsghdr).Inet6OptionAppend C.inet6_option_append -func (self *Cmsghdr) Inet6OptionAppend(_llcppg_param2 *X__Uint8T, _llcppg_param3 c.Int, _llcppg_param4 c.Int) c.Int { - return 0 -} - -// llgo:link (*Cmsghdr).Inet6OptionAlloc C.inet6_option_alloc -func (self *Cmsghdr) Inet6OptionAlloc(_llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 c.Int) *X__Uint8T { - return nil -} - -// llgo:link (*Cmsghdr).Inet6OptionNext C.inet6_option_next -func (self *Cmsghdr) Inet6OptionNext(_llcppg_param2 **X__Uint8T) c.Int { - return 0 -} - -// llgo:link (*Cmsghdr).Inet6OptionFind C.inet6_option_find -func (self *Cmsghdr) Inet6OptionFind(_llcppg_param2 **X__Uint8T, _llcppg_param3 c.Int) c.Int { - return 0 -} - -//go:linkname Inet6RthdrSpace C.inet6_rthdr_space -func Inet6RthdrSpace(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.SizeT - -//go:linkname Inet6RthdrInit C.inet6_rthdr_init -func Inet6RthdrInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int) *Cmsghdr - -// llgo:link (*Cmsghdr).Inet6RthdrAdd C.inet6_rthdr_add -func (self *Cmsghdr) Inet6RthdrAdd(_llcppg_param2 *nativeIn6Addr, _llcppg_param3 c.Uint) c.Int { - return 0 -} - -// llgo:link (*Cmsghdr).Inet6RthdrLasthop C.inet6_rthdr_lasthop -func (self *Cmsghdr) Inet6RthdrLasthop(_llcppg_param2 c.Uint) c.Int { - return 0 -} - -// llgo:link (*Cmsghdr).Inet6RthdrSegments C.inet6_rthdr_segments -func (self *Cmsghdr) Inet6RthdrSegments() c.Int { - return 0 -} - -// llgo:link (*Cmsghdr).Inet6RthdrGetaddr C.inet6_rthdr_getaddr -func (self *Cmsghdr) Inet6RthdrGetaddr(_llcppg_param2 c.Int) *nativeIn6Addr { - return nil -} - -// llgo:link (*Cmsghdr).Inet6RthdrGetflags C.inet6_rthdr_getflags -func (self *Cmsghdr) Inet6RthdrGetflags(_llcppg_param2 c.Int) c.Int { - return 0 -} - -//go:linkname Inet6OptInit C.inet6_opt_init -func Inet6OptInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT) c.Int - -//go:linkname Inet6OptAppend C.inet6_opt_append -func Inet6OptAppend(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int, _llcppg_param4 X__Uint8T, _llcppg_param5 SocklenT, _llcppg_param6 X__Uint8T, _llcppg_param7 *unsafe.Pointer) c.Int - -//go:linkname Inet6OptFinish C.inet6_opt_finish -func Inet6OptFinish(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int) c.Int - -//go:linkname Inet6OptSetVal C.inet6_opt_set_val -func Inet6OptSetVal(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SocklenT) c.Int - -//go:linkname Inet6OptNext C.inet6_opt_next -func Inet6OptNext(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int, _llcppg_param4 *X__Uint8T, _llcppg_param5 *SocklenT, _llcppg_param6 *unsafe.Pointer) c.Int - -//go:linkname Inet6OptFind C.inet6_opt_find -func Inet6OptFind(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int, _llcppg_param4 X__Uint8T, _llcppg_param5 *SocklenT, _llcppg_param6 *unsafe.Pointer) c.Int - -//go:linkname Inet6OptGetVal C.inet6_opt_get_val -func Inet6OptGetVal(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SocklenT) c.Int - -//go:linkname Inet6RthSpace C.inet6_rth_space -func Inet6RthSpace(_llcppg_param1 c.Int, _llcppg_param2 c.Int) SocklenT - -//go:linkname Inet6RthInit C.inet6_rth_init -func Inet6RthInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int, _llcppg_param4 c.Int) unsafe.Pointer - -//go:linkname Inet6RthAdd C.inet6_rth_add -func Inet6RthAdd(_llcppg_param1 unsafe.Pointer, _llcppg_param2 *nativeIn6Addr) c.Int - -//go:linkname Inet6RthReverse C.inet6_rth_reverse -func Inet6RthReverse(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer) c.Int - -//go:linkname Inet6RthSegments C.inet6_rth_segments -func Inet6RthSegments(_llcppg_param1 unsafe.Pointer) c.Int - -//go:linkname Inet6RthGetaddr C.inet6_rth_getaddr -func Inet6RthGetaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int) *nativeIn6Addr diff --git a/c/net/rpc-netdb_linux_amd64.go b/c/net/rpc-netdb_linux_amd64.go deleted file mode 100644 index 3d5ca81f..00000000 --- a/c/net/rpc-netdb_linux_amd64.go +++ /dev/null @@ -1,44 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_RPC_NETDB_H = 1 - -type Rpcent struct { - RName *c.Char - RAliases **c.Char - RNumber c.Int -} - -//go:linkname Setrpcent C.setrpcent -func Setrpcent(__stayopen c.Int) - -//go:linkname Endrpcent C.endrpcent -func Endrpcent() - -//go:linkname Getrpcbyname C.getrpcbyname -func Getrpcbyname(__name *c.Char) *Rpcent - -//go:linkname Getrpcbynumber C.getrpcbynumber -func Getrpcbynumber(__number c.Int) *Rpcent - -//go:linkname Getrpcent C.getrpcent -func Getrpcent() *Rpcent - -//go:linkname GetrpcbynameR C.getrpcbyname_r -func GetrpcbynameR(__name *c.Char, __result_buf *Rpcent, __buffer *c.Char, __buflen c.SizeT, __result **Rpcent) c.Int - -//go:linkname GetrpcbynumberR C.getrpcbynumber_r -func GetrpcbynumberR(__number c.Int, __result_buf *Rpcent, __buffer *c.Char, __buflen c.SizeT, __result **Rpcent) c.Int - -// llgo:link (*Rpcent).GetrpcentR C.getrpcent_r -func (self *Rpcent) GetrpcentR(__buffer *c.Char, __buflen c.SizeT, __result **Rpcent) c.Int { - return 0 -} diff --git a/c/net/rpc-netdb_linux_arm64.go b/c/net/rpc-netdb_linux_arm64.go deleted file mode 100644 index 3e4fe1d3..00000000 --- a/c/net/rpc-netdb_linux_arm64.go +++ /dev/null @@ -1,44 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_RPC_NETDB_H = 1 - -type Rpcent struct { - RName *uint8 - RAliases **uint8 - RNumber c.Int -} - -//go:linkname Setrpcent C.setrpcent -func Setrpcent(__stayopen c.Int) - -//go:linkname Endrpcent C.endrpcent -func Endrpcent() - -//go:linkname Getrpcbyname C.getrpcbyname -func Getrpcbyname(__name *uint8) *Rpcent - -//go:linkname Getrpcbynumber C.getrpcbynumber -func Getrpcbynumber(__number c.Int) *Rpcent - -//go:linkname Getrpcent C.getrpcent -func Getrpcent() *Rpcent - -//go:linkname GetrpcbynameR C.getrpcbyname_r -func GetrpcbynameR(__name *uint8, __result_buf *Rpcent, __buffer *uint8, __buflen c.SizeT, __result **Rpcent) c.Int - -//go:linkname GetrpcbynumberR C.getrpcbynumber_r -func GetrpcbynumberR(__number c.Int, __result_buf *Rpcent, __buffer *uint8, __buflen c.SizeT, __result **Rpcent) c.Int - -// llgo:link (*Rpcent).GetrpcentR C.getrpcent_r -func (self *Rpcent) GetrpcentR(__buffer *uint8, __buflen c.SizeT, __result **Rpcent) c.Int { - return 0 -} diff --git a/c/net/sys-_types-_caddr_t_darwin_arm64.go b/c/net/sys-_types-_caddr_t_darwin_arm64.go deleted file mode 100644 index e57a61a8..00000000 --- a/c/net/sys-_types-_caddr_t_darwin_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -type CaddrT = *c.Char diff --git a/c/net/sys-_types-_in_addr_t_darwin_arm64.go b/c/net/sys-_types-_in_addr_t_darwin_arm64.go deleted file mode 100644 index baaac132..00000000 --- a/c/net/sys-_types-_in_addr_t_darwin_arm64.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -// base type for internet address -type InAddrT = X__Uint32T diff --git a/c/net/sys-_types-_in_port_t_darwin_arm64.go b/c/net/sys-_types-_in_port_t_darwin_arm64.go deleted file mode 100644 index 20e75c20..00000000 --- a/c/net/sys-_types-_in_port_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -type InPortT = X__Uint16T diff --git a/c/net/sys-_types-_sa_family_t_darwin_arm64.go b/c/net/sys-_types-_sa_family_t_darwin_arm64.go deleted file mode 100644 index aaaf62c2..00000000 --- a/c/net/sys-_types-_sa_family_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -type SaFamilyT = X__Uint8T diff --git a/c/net/sys-_types-_socklen_t_darwin_arm64.go b/c/net/sys-_types-_socklen_t_darwin_arm64.go deleted file mode 100644 index 2772253b..00000000 --- a/c/net/sys-_types-_socklen_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -type SocklenT = X__DarwinSocklenT diff --git a/c/net/sys-_types-_timeval32_darwin_arm64.go b/c/net/sys-_types-_timeval32_darwin_arm64.go deleted file mode 100644 index 49c8978b..00000000 --- a/c/net/sys-_types-_timeval32_darwin_arm64.go +++ /dev/null @@ -1,10 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -type Timeval32 struct { - TvSec X__Int32T - TvUsec X__Int32T -} diff --git a/c/net/sys-_types-_u_char_darwin_arm64.go b/c/net/sys-_types-_u_char_darwin_arm64.go deleted file mode 100644 index e44c2af9..00000000 --- a/c/net/sys-_types-_u_char_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -type UChar = uint8 diff --git a/c/net/sys-_types-_u_int32_t_darwin_arm64.go b/c/net/sys-_types-_u_int32_t_darwin_arm64.go deleted file mode 100644 index c307a1d7..00000000 --- a/c/net/sys-_types-_u_int32_t_darwin_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -type UInt32T = c.Uint diff --git a/c/net/sys-_types-_u_int64_t_darwin_arm64.go b/c/net/sys-_types-_u_int64_t_darwin_arm64.go deleted file mode 100644 index 12b3c20a..00000000 --- a/c/net/sys-_types-_u_int64_t_darwin_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -type UInt64T = c.UlongLong diff --git a/c/net/sys-_types-_u_short_darwin_arm64.go b/c/net/sys-_types-_u_short_darwin_arm64.go deleted file mode 100644 index 638bbe62..00000000 --- a/c/net/sys-_types-_u_short_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -type UShort = uint16 diff --git a/c/net/sys-_types_darwin_arm64.go b/c/net/sys-_types_darwin_arm64.go deleted file mode 100644 index bc995bad..00000000 --- a/c/net/sys-_types_darwin_arm64.go +++ /dev/null @@ -1,63 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -// total blocks -type X__DarwinBlkcntT = X__Int64T - -// preferred block size -type X__DarwinBlksizeT = X__Int32T - -// dev_t -type X__DarwinDevT = X__Int32T - -// Used by statvfs and fstatvfs -type X__DarwinFsblkcntT = c.Uint - -// Used by statvfs and fstatvfs -type X__DarwinFsfilcntT = c.Uint - -// [???] process and group IDs -type X__DarwinGidT = X__Uint32T - -// [XSI] pid_t, uid_t, or gid_t -type X__DarwinIdT = X__Uint32T - -// [???] Used for 64 bit inodes -type X__DarwinIno64T = X__Uint64T - -// [???] Used for inodes -type X__DarwinInoT = X__DarwinIno64T - -// Used by mach -type X__DarwinMachPortNameT = X__DarwinNaturalT - -// Used by mach -type X__DarwinMachPortT = X__DarwinMachPortNameT - -// [???] Some file attributes -type X__DarwinModeT = X__Uint16T - -// [???] Used for file sizes -type X__DarwinOffT = X__Int64T - -// [???] process and group IDs -type X__DarwinPidT = X__Int32T - -// [???] signal set -type X__DarwinSigsetT = X__Uint32T - -// [???] microseconds -type X__DarwinSusecondsT = X__Int32T - -// [???] user IDs -type X__DarwinUidT = X__Uint32T - -// [???] microseconds -type X__DarwinUsecondsT = X__Uint32T -type X__DarwinUuidT = [16]uint8 -type X__DarwinUuidStringT = [37]c.Char diff --git a/c/net/sys-socket_darwin_arm64.go b/c/net/sys-socket_darwin_arm64.go deleted file mode 100644 index 6facc2dc..00000000 --- a/c/net/sys-socket_darwin_arm64.go +++ /dev/null @@ -1,554 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -// Types -const ( - _native_SOCK_STREAM = 1 - // datagram socket - _native_SOCK_DGRAM = 2 - // raw-protocol interface - _native_SOCK_RAW = 3 -) - -// reliably-delivered message -const _native_SOCK_RDM = 4 - -// sequenced packet stream -const _native_SOCK_SEQPACKET = 5 - -// Option flags per-socket. -const ( - SO_DEBUG = 1 - // socket has had listen() - SO_ACCEPTCONN = 2 - // allow local address reuse - SO_REUSEADDR = 4 - // keep connections alive - SO_KEEPALIVE = 8 - // just use interface addresses - SO_DONTROUTE = 16 - // permit sending of broadcast msgs - SO_BROADCAST = 32 -) -const ( - // bypass hardware when possible - SO_USELOOPBACK = 64 - // linger on close if data present (in ticks) - SO_LINGER = 128 - // linger on close if data present (in seconds) - SO_LINGER_SEC = 4224 -) - -// leave received OOB data in line -const SO_OOBINLINE = 256 -const ( - // allow local address & port reuse - SO_REUSEPORT = 512 - // timestamp received dgram traffic - SO_TIMESTAMP = 1024 - // Monotonically increasing timestamp on rcvd dgram - SO_TIMESTAMP_MONOTONIC = 2048 -) - -// APPLE: Retain unread data -const SO_DONTTRUNC = 8192 - -// (ATOMIC proto) -const ( - SO_WANTMORE = 16384 - // APPLE: Want OOB in MSG_FLAG on receive - SO_WANTOOBFLAG = 32768 -) - -// Additional options, not kept in so_options. -const ( - SO_SNDBUF = 4097 - // receive buffer size - SO_RCVBUF = 4098 - // send low-water mark - SO_SNDLOWAT = 4099 - // receive low-water mark - SO_RCVLOWAT = 4100 - // send timeout - SO_SNDTIMEO = 4101 - // receive timeout - SO_RCVTIMEO = 4102 - // get error status and clear - SO_ERROR = 4103 - // get socket type - SO_TYPE = 4104 -) -const ( - // deprecated - SO_LABEL = 4112 - // deprecated - SO_PEERLABEL = 4113 -) -const ( - // APPLE: get 1st-packet byte count - SO_NREAD = 4128 - // APPLE: Install socket-level NKE - SO_NKE = 4129 - // APPLE: No SIGPIPE on EPIPE - SO_NOSIGPIPE = 4130 - // APPLE: Returns EADDRNOTAVAIL when src is not available anymore - SO_NOADDRERR = 4131 - // APPLE: Get number of bytes currently in send socket buffer - SO_NWRITE = 4132 - // APPLE: Allow reuse of port/socket by different userids - SO_REUSESHAREUID = 4133 -) -const ( - // APPLE: send notification if there is a bind on a port which is already in use - SO_NOTIFYCONFLICT = 4134 - // APPLE: block on close until an upcall returns - SO_UPCALLCLOSEWAIT = 4135 -) -const ( - // APPLE: request local port randomization - SO_RANDOMPORT = 4226 - // To turn off some POSIX behavior - SO_NP_EXTENSIONS = 4227 -) -const ( - // number of datagrams in receive socket buffer - SO_NUMRCVPKT = 4370 - // Network service type - SO_NET_SERVICE_TYPE = 4374 -) - -// Get QoS marking in effect for socket -const SO_NETSVC_MARKING_LEVEL = 4377 - -// A signed data blob from the system resolver -const SO_RESOLVER_SIGNATURE = 4401 -const ( - // Best effort - NET_SERVICE_TYPE_BE = 0 - // Background system initiated - NET_SERVICE_TYPE_BK = 1 - // Signaling - NET_SERVICE_TYPE_SIG = 2 - // Interactive Video - NET_SERVICE_TYPE_VI = 3 - // Interactive Voice - NET_SERVICE_TYPE_VO = 4 - // Responsive Multimedia Audio/Video - NET_SERVICE_TYPE_RV = 5 - // Multimedia Audio/Video Streaming - NET_SERVICE_TYPE_AV = 6 - // Operations, Administration, and Management - NET_SERVICE_TYPE_OAM = 7 - // Responsive Data - NET_SERVICE_TYPE_RD = 8 -) - -// These are supported values for SO_NETSVC_MARKING_LEVEL -const ( - NETSVC_MRKNG_UNKNOWN = 0 - // Default marking at layer 2 (for example Wi-Fi WMM) - NETSVC_MRKNG_LVL_L2 = 1 - // Layer 3 DSCP marking and layer 2 marking for all Network Service Types - NETSVC_MRKNG_LVL_L3L2_ALL = 2 - // The system policy limits layer 3 DSCP marking and layer 2 marking - // to background Network Service Types - NETSVC_MRKNG_LVL_L3L2_BK = 3 -) -const SAE_ASSOCID_ANY = 0 -const SAE_CONNID_ANY = 0 - -// connectx() flag parameters -const ( - CONNECT_RESUME_ON_READ_WRITE = 1 - // data is idempotent - CONNECT_DATA_IDEMPOTENT = 2 - // data includes security that replaces the TFO-cookie - CONNECT_DATA_AUTHENTICATED = 4 -) - -// flag for allowing setsockopt after shutdown -const SONPX_SETOPTSHUT = 1 - -// Level number for (get/set)sockopt() to apply to socket itself. -const SOL_SOCKET = 65535 - -// Address families. -const ( - AF_UNSPEC = 0 - // local to host (pipes) - AF_UNIX = 1 -) - -// backward compatibility -const AF_LOCAL = 1 - -// internetwork: UDP, TCP, etc. -const AF_INET = 2 -const ( - // arpanet imp addresses - AF_IMPLINK = 3 - // pup protocols: e.g. BSP - AF_PUP = 4 - // mit CHAOS protocols - AF_CHAOS = 5 - // XEROX NS protocols - AF_NS = 6 - // ISO protocols - AF_ISO = 7 - AF_OSI = 7 - // European computer manufacturers - AF_ECMA = 8 - // datakit protocols - AF_DATAKIT = 9 - // CCITT protocols, X.25 etc - AF_CCITT = 10 - // IBM SNA - AF_SNA = 11 - // DECnet - AF_DECnet = 12 - // DEC Direct data link interface - AF_DLI = 13 - // LAT - AF_LAT = 14 - // NSC Hyperchannel - AF_HYLINK = 15 - // Apple Talk - AF_APPLETALK = 16 - // Internal Routing Protocol - AF_ROUTE = 17 - // Link layer interface - AF_LINK = 18 - // eXpress Transfer Protocol (no AF) - Pseudo_AF_XTP = 19 - // connection-oriented IP, aka ST II - AF_COIP = 20 - // Computer Network Technology - AF_CNT = 21 - // Help Identify RTIP packets - Pseudo_AF_RTIP = 22 - // Novell Internet Protocol - AF_IPX = 23 - // Simple Internet Protocol - AF_SIP = 24 - // Help Identify PIP packets - Pseudo_AF_PIP = 25 - // Network Driver 'raw' access - AF_NDRV = 27 - // Integrated Services Digital Network - AF_ISDN = 28 - // CCITT E.164 recommendation - AF_E164 = 28 - // Internal key-management function - Pseudo_AF_KEY = 29 -) - -// IPv6 -const AF_INET6 = 30 -const ( - // native ATM access - AF_NATM = 31 - // Kernel event messages - AF_SYSTEM = 32 - // NetBIOS - AF_NETBIOS = 33 - // PPP communication protocol - AF_PPP = 34 - // Used by BPF to not rewrite headers - // in interface output routine - Pseudo_AF_HDRCMPLT = 35 -) -const ( - // Reserved for internal usage - AF_RESERVED_36 = 36 - // IEEE 802.11 protocol - AF_IEEE80211 = 37 - AF_UTUN = 38 - // VM Sockets - AF_VSOCK = 40 - AF_MAX = 41 -) - -// longest possible addresses -const SOCK_MAXADDRLEN = 255 - -// RFC 2553: protocol-independent placeholder for socket addresses -const X_SS_MAXSIZE = 128 - -// Protocol families, same as address families for now. -const ( - PF_UNSPEC = 0 - PF_LOCAL = 1 - // backward compatibility - PF_UNIX = 1 - PF_INET = 2 - PF_IMPLINK = 3 - PF_PUP = 4 - PF_CHAOS = 5 - PF_NS = 6 - PF_ISO = 7 - PF_OSI = 7 - PF_ECMA = 8 - PF_DATAKIT = 9 - PF_CCITT = 10 - PF_SNA = 11 - PF_DECnet = 12 - PF_DLI = 13 - PF_LAT = 14 - PF_HYLINK = 15 - PF_APPLETALK = 16 - PF_ROUTE = 17 - PF_LINK = 18 - // really just proto family, no AF - PF_XTP = 19 - PF_COIP = 20 - PF_CNT = 21 - PF_SIP = 24 - // same format as AF_NS - PF_IPX = 23 - // same format as AF_INET - PF_RTIP = 22 - PF_PIP = 25 - PF_NDRV = 27 - PF_ISDN = 28 - PF_KEY = 29 - PF_INET6 = 30 - PF_NATM = 31 - PF_SYSTEM = 32 - PF_NETBIOS = 33 - PF_PPP = 34 - PF_RESERVED_36 = 36 - PF_UTUN = 38 - PF_VSOCK = 40 - PF_MAX = 41 -) -const NET_MAXID = 41 - -// PF_ROUTE - Routing table -// -// Three additional levels are defined: -// -// Fourth: address family, 0 is wildcard -// Fifth: type of info, defined below -// Sixth: flag(s) to mask with for NET_RT_FLAGS -const ( - NET_RT_DUMP = 1 - // by flags, e.g. RESOLVING - NET_RT_FLAGS = 2 - // survey interface list - NET_RT_IFLIST = 3 - // routing statistics - NET_RT_STAT = 4 - // routes not in table but not freed - NET_RT_TRASH = 5 - // interface list with addresses - NET_RT_IFLIST2 = 6 - // dump; may limit to a.f. - NET_RT_DUMP2 = 7 -) - -// Allows read access non-local host's MAC address -// if the process has neighbor cache entitlement. -const ( - NET_RT_FLAGS_PRIV = 10 - NET_RT_MAXID = 11 -) - -// Maximum queue length specifiable by listen. -const SOMAXCONN = 128 -const ( - // process out-of-band data - MSG_OOB = 1 - // peek at incoming message - MSG_PEEK = 2 - // send without using routing tables - MSG_DONTROUTE = 4 - // data completes record - MSG_EOR = 8 - // data discarded before delivery - MSG_TRUNC = 16 - // control data lost before delivery - MSG_CTRUNC = 32 - // wait for full request or error - MSG_WAITALL = 64 -) -const ( - // this message should be nonblocking - MSG_DONTWAIT = 128 - // data completes connection - MSG_EOF = 256 -) - -// wait up to full request.. may return partial -const MSG_WAITSTREAM = 512 -const ( - // Start of 'hold' seq; dump so_temp, deprecated - MSG_FLUSH = 1024 - // Hold frag in so_temp, deprecated - MSG_HOLD = 2048 - // Send the packet in so_temp, deprecated - MSG_SEND = 4096 - // Data ready to be read - MSG_HAVEMORE = 8192 - // Data remains in current pkt - MSG_RCVMORE = 16384 -) - -// Fail receive if socket address cannot be allocated -const MSG_NEEDSA = 65536 - -// do not generate SIGPIPE on EOF -const MSG_NOSIGNAL = 524288 - -// "Socket"-level control message types: -const SCM_RIGHTS = 1 -const ( - // timestamp (struct timeval) - SCM_TIMESTAMP = 2 - // process creds (struct cmsgcred) - SCM_CREDS = 3 - // timestamp (uint64_t) - SCM_TIMESTAMP_MONOTONIC = 4 -) - -// howto arguments for shutdown(2), specified by Posix.1g. -const ( - SHUT_RD = 0 - // shut down the writing side - SHUT_WR = 1 - // shut down both sides - SHUT_RDWR = 2 -) - -// sockaddr endpoints -type SaEndpoints struct { - SaeSrcif c.Uint - SaeSrcaddr *SockAddr - SaeSrcaddrlen SocklenT - SaeDstaddr *SockAddr - SaeDstaddrlen SocklenT -} - -// Structure used for manipulating linger option. -type Linger struct { - LOnoff c.Int - LLinger c.Int -} - -// Structure to control non-portable Sockets extension to POSIX -type SoNpExtensions struct { - NpxFlags UInt32T - NpxMask UInt32T -} - -// [XSI] Structure used by kernel to store most addresses. -type SockAddr struct { - Len uint8 - Family uint8 - Data [14]c.Char -} - -// Least amount of information that a sockaddr requires. -// Sockaddr_header is a compatible prefix structure of -// all sockaddr objects. -type X__SockaddrHeader struct { - SaLen X__Uint8T - SaFamily SaFamilyT -} - -// Structure used by kernel to pass protocol -// information in raw sockets. -type Sockproto struct { - SpFamily X__Uint16T - SpProtocol X__Uint16T -} - -// [XSI] sockaddr_storage -type SockaddrStorage struct { - Len uint8 - Family uint8 - X__SsPad1 [6]c.Char - X__SsAlign X__Int64T - X__SsPad2 [112]c.Char -} - -// [XSI] Message header for recvmsg and sendmsg calls. -// Used value-result for recvmsg, value only for sendmsg. -type Msghdr struct { - MsgName unsafe.Pointer - MsgNamelen SocklenT - MsgIov *c.Iovec - MsgIovlen c.Int - MsgControl unsafe.Pointer - MsgControllen SocklenT - MsgFlags c.Int -} - -// Header for ancillary data objects in msg_control buffer. -// Used for additional information with/about a datagram -// not expressible by flags. The format is a sequence -// of message elements headed by cmsghdr structures. -type Cmsghdr struct { - CmsgLen SocklenT - CmsgLevel c.Int - CmsgType c.Int -} - -// sendfile(2) header/trailer struct -type SfHdtr struct { - Headers *c.Iovec - HdrCnt c.Int - Trailers *c.Iovec - TrlCnt c.Int -} -type SaeAssocidT = X__Uint32T -type SaeConnidT = X__Uint32T - -// sockaddr endpoints -type SaEndpointsT = SaEndpoints - -//go:linkname Getpeername C.getpeername -func Getpeername(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 *SocklenT) c.Int - -//go:linkname Getsockname C.getsockname -func Getsockname(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 *SocklenT) c.Int - -//go:linkname Getsockopt C.getsockopt -func Getsockopt(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 unsafe.Pointer, _llcppg_param5 *SocklenT) c.Int - -//go:linkname Recvfrom C.recvfrom -func Recvfrom(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.SizeT, _llcppg_param4 c.Int, _llcppg_param5 *SockAddr, _llcppg_param6 *SocklenT) c.SsizeT - -//go:linkname Recvmsg C.recvmsg -func Recvmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) c.SsizeT - -//go:linkname Sendmsg C.sendmsg -func Sendmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) c.SsizeT - -//go:linkname Sendto C.sendto -func Sendto(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.SizeT, _llcppg_param4 c.Int, _llcppg_param5 *SockAddr, _llcppg_param6 SocklenT) c.SsizeT - -//go:linkname Shutdown C.shutdown -func Shutdown(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int - -//go:linkname Sockatmark C.sockatmark -func Sockatmark(_llcppg_param1 c.Int) c.Int - -//go:linkname Socketpair C.socketpair -func Socketpair(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) c.Int - -//go:linkname Pfctlinput C.pfctlinput -func Pfctlinput(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr) - -//go:linkname Connectx C.connectx -func Connectx(_llcppg_param1 c.Int, _llcppg_param2 *SaEndpointsT, _llcppg_param3 SaeAssocidT, _llcppg_param4 c.Uint, _llcppg_param5 *Iovec, _llcppg_param6 c.Uint, _llcppg_param7 *c.SizeT, _llcppg_param8 *SaeConnidT) c.Int - -//go:linkname Disconnectx C.disconnectx -func Disconnectx(_llcppg_param1 c.Int, _llcppg_param2 SaeAssocidT, _llcppg_param3 SaeConnidT) c.Int diff --git a/c/net/sys-socket_linux_amd64.go b/c/net/sys-socket_linux_amd64.go deleted file mode 100644 index 581baed0..00000000 --- a/c/net/sys-socket_linux_amd64.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_SYS_SOCKET_H = 1 - -// This is the 4.3 BSD `struct sockaddr' format, which is used as wire -// format in the grotty old 4.3 `talk' protocol. -type Osockaddr struct { - SaFamily uint16 - SaData [14]uint8 -} - -// The following constants should be used for the second parameter of -// `shutdown'. -const ( - SHUT_RD = 0 - SHUT_WR = 1 - // No more receptions or transmissions. - SHUT_RDWR = 2 -) - -// Create two new sockets, of type TYPE in domain DOMAIN and using -// protocol PROTOCOL, which are connected to each other, and put file -// descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero, -// one will be chosen automatically. Returns 0 on success, -1 for errors. -// -//go:linkname Socketpair C.socketpair -func Socketpair(__domain c.Int, __type c.Int, __protocol c.Int, __fds *c.Int) c.Int - -// Put the local address of FD into *ADDR and its length in *LEN. -// -//go:linkname Getsockname C.getsockname -func Getsockname(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int - -// Put the address of the peer connected to socket FD into *ADDR -// (which is *LEN bytes long), and its actual length into *LEN. -// -//go:linkname Getpeername C.getpeername -func Getpeername(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int - -// Send N bytes of BUF on socket FD to peer at address ADDR (which is -// ADDR_LEN bytes long). Returns the number sent, or -1 for errors. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Sendto C.sendto -func Sendto(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __flags c.Int, __addr *SockAddr, __addr_len SocklenT) c.SsizeT - -// Read N bytes into BUF through socket FD. -// If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of -// the sender, and store the actual size of the address in *ADDR_LEN. -// Returns the number of bytes read or -1 for errors. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Recvfrom C.recvfrom -func Recvfrom(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __flags c.Int, __addr *SockAddr, __addr_len *SocklenT) c.SsizeT - -// Send a message described MESSAGE on socket FD. -// Returns the number of bytes sent, or -1 for errors. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Sendmsg C.sendmsg -func Sendmsg(__fd c.Int, __message *Msghdr, __flags c.Int) c.SsizeT - -// Receive a message as described by MESSAGE from socket FD. -// Returns the number of bytes read or -1 for errors. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Recvmsg C.recvmsg -func Recvmsg(__fd c.Int, __message *Msghdr, __flags c.Int) c.SsizeT - -// Put the current value for socket FD's option OPTNAME at protocol level LEVEL -// into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's -// actual length. Returns 0 on success, -1 for errors. -// -//go:linkname Getsockopt C.getsockopt -func Getsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen *SocklenT) c.Int - -// Shut down all or part of the connection open on socket FD. -// HOW determines what to shut down: -// SHUT_RD = No more receptions; -// SHUT_WR = No more transmissions; -// SHUT_RDWR = No more receptions or transmissions. -// Returns 0 on success, -1 for errors. -// -//go:linkname Shutdown C.shutdown -func Shutdown(__fd c.Int, __how c.Int) c.Int - -// Determine wheter socket is at a out-of-band mark. -// -//go:linkname Sockatmark C.sockatmark -func Sockatmark(__fd c.Int) c.Int - -// FDTYPE is S_IFSOCK or another S_IF* macro defined in ; -// returns 1 if FD is open on an object of the indicated type, 0 if not, -// or -1 for errors (setting errno). -// -//go:linkname Isfdtype C.isfdtype -func Isfdtype(__fd c.Int, __fdtype c.Int) c.Int diff --git a/c/net/sys-socket_linux_arm64.go b/c/net/sys-socket_linux_arm64.go deleted file mode 100644 index 350830f8..00000000 --- a/c/net/sys-socket_linux_arm64.go +++ /dev/null @@ -1,114 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_SYS_SOCKET_H = 1 - -// This is the 4.3 BSD `struct sockaddr' format, which is used as wire -// format in the grotty old 4.3 `talk' protocol. -type Osockaddr struct { - SaFamily uint16 - SaData [14]uint8 -} - -// The following constants should be used for the second parameter of -// `shutdown'. -const ( - SHUT_RD = 0 - SHUT_WR = 1 - // No more receptions or transmissions. - SHUT_RDWR = 2 -) - -// Create two new sockets, of type TYPE in domain DOMAIN and using -// protocol PROTOCOL, which are connected to each other, and put file -// descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero, -// one will be chosen automatically. Returns 0 on success, -1 for errors. -// -//go:linkname Socketpair C.socketpair -func Socketpair(__domain c.Int, __type c.Int, __protocol c.Int, __fds *c.Int) c.Int - -// Put the local address of FD into *ADDR and its length in *LEN. -// -//go:linkname Getsockname C.getsockname -func Getsockname(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int - -// Put the address of the peer connected to socket FD into *ADDR -// (which is *LEN bytes long), and its actual length into *LEN. -// -//go:linkname Getpeername C.getpeername -func Getpeername(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int - -// Send N bytes of BUF on socket FD to peer at address ADDR (which is -// ADDR_LEN bytes long). Returns the number sent, or -1 for errors. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Sendto C.sendto -func Sendto(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __flags c.Int, __addr *SockAddr, __addr_len SocklenT) c.SsizeT - -// Read N bytes into BUF through socket FD. -// If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of -// the sender, and store the actual size of the address in *ADDR_LEN. -// Returns the number of bytes read or -1 for errors. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Recvfrom C.recvfrom -func Recvfrom(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __flags c.Int, __addr *SockAddr, __addr_len *SocklenT) c.SsizeT - -// Send a message described MESSAGE on socket FD. -// Returns the number of bytes sent, or -1 for errors. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Sendmsg C.sendmsg -func Sendmsg(__fd c.Int, __message *Msghdr, __flags c.Int) c.SsizeT - -// Receive a message as described by MESSAGE from socket FD. -// Returns the number of bytes read or -1 for errors. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Recvmsg C.recvmsg -func Recvmsg(__fd c.Int, __message *Msghdr, __flags c.Int) c.SsizeT - -// Put the current value for socket FD's option OPTNAME at protocol level LEVEL -// into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's -// actual length. Returns 0 on success, -1 for errors. -// -//go:linkname Getsockopt C.getsockopt -func Getsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen *SocklenT) c.Int - -// Shut down all or part of the connection open on socket FD. -// HOW determines what to shut down: -// SHUT_RD = No more receptions; -// SHUT_WR = No more transmissions; -// SHUT_RDWR = No more receptions or transmissions. -// Returns 0 on success, -1 for errors. -// -//go:linkname Shutdown C.shutdown -func Shutdown(__fd c.Int, __how c.Int) c.Int - -// Determine wheter socket is at a out-of-band mark. -// -//go:linkname Sockatmark C.sockatmark -func Sockatmark(__fd c.Int) c.Int - -// FDTYPE is S_IFSOCK or another S_IF* macro defined in ; -// returns 1 if FD is open on an object of the indicated type, 0 if not, -// or -1 for errors (setting errno). -// -//go:linkname Isfdtype C.isfdtype -func Isfdtype(__fd c.Int, __fdtype c.Int) c.Int diff --git a/c/net/sys-un_darwin_arm64.go b/c/net/sys-un_darwin_arm64.go deleted file mode 100644 index 867fda33..00000000 --- a/c/net/sys-un_darwin_arm64.go +++ /dev/null @@ -1,32 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -// Level number of get/setsockopt for local domain sockets -const SOL_LOCAL = 0 - -// Socket options. -const ( - LOCAL_PEERCRED = 1 - // retrieve peer pid - LOCAL_PEERPID = 2 - // retrieve eff. peer pid - LOCAL_PEEREPID = 3 - // retrieve peer UUID - LOCAL_PEERUUID = 4 - // retrieve eff. peer UUID - LOCAL_PEEREUUID = 5 - // retrieve peer audit token - LOCAL_PEERTOKEN = 6 -) - -// [XSI] Definitions for UNIX IPC domain. -type SockaddrUn struct { - SunLen uint8 - SunFamily SaFamilyT - SunPath [104]c.Char -} diff --git a/c/net/sys-un_linux_amd64.go b/c/net/sys-un_linux_amd64.go deleted file mode 100644 index 1c3b0ab1..00000000 --- a/c/net/sys-un_linux_amd64.go +++ /dev/null @@ -1,15 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -import "github.com/goplus/lib/c" - -const X_SYS_UN_H = 1 - -// Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. -type SockaddrUn struct { - SunFamily SaFamilyT - SunPath [108]c.Char -} diff --git a/c/net/sys-un_linux_arm64.go b/c/net/sys-un_linux_arm64.go deleted file mode 100644 index 7f6d4adb..00000000 --- a/c/net/sys-un_linux_arm64.go +++ /dev/null @@ -1,13 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package net - -const X_SYS_UN_H = 1 - -// Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. -type SockaddrUn struct { - SunFamily SaFamilyT - SunPath [108]uint8 -} From 8e79a45051ccbfbe26e44a6dd1a6de1e88ab87bb Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Tue, 20 Oct 2026 00:21:43 +0800 Subject: [PATCH 4/8] Publish expanded unified libc classification for c/net --- c/net/README.md | 6 +- c/net/libc_darwin_arm64.go | 196 ++++++++++++++++++++++++++++++++- c/net/libc_linux_amd64.go | 206 ++++++++++++++++++++++++++++++++++- c/net/libc_linux_arm64.go | 206 ++++++++++++++++++++++++++++++++++- c/net/llcppg-linux_amd64.cfg | 96 ---------------- c/net/llcppg-linux_arm64.cfg | 96 ---------------- c/net/llcppg.cfg | 95 +--------------- c/net/llcppg.pub | 84 +++++++++++++- 8 files changed, 686 insertions(+), 299 deletions(-) delete mode 100644 c/net/llcppg-linux_amd64.cfg delete mode 100644 c/net/llcppg-linux_arm64.cfg diff --git a/c/net/README.md b/c/net/README.md index 9b3cc9e2..bde033e0 100644 --- a/c/net/README.md +++ b/c/net/README.md @@ -12,8 +12,8 @@ Linux support assumes glibc. Existing implementations remain selected for other `legacy_native.go` retains the existing Unix function names and signatures, including `Bind`, `Accept`, `GetHostByName`, `SetSockOpt`, and `Freeaddrinfo`, along with the five untyped socket constants. Address types retain the existing field names for corresponding C fields. Linux address families use a 16-bit field without the BSD length byte, and Linux `AddrInfo` places `Addr` before `CanOnName`. `In6Addr.U6Addr` remains a byte array with native IPv6 alignment. `Iovec` aliases the shared `c.Iovec` definition. -`llcppg.cfg` and its Linux variants retain local header ownership and dependency metadata for downstream bindings. The current snapshots come from unified generation followed by classification, rather than running these directory configurations independently. `Dir` and `Stdlib` refer to locally prepared headers under ignored `.sysroot` directories. `Deps` contains directories such as `..`; the local caller resolves them through the existing `Config.IncludeDir` callback. Each target is kept in one `libc__.go` file. Generation inputs, scripts, and header caches are kept locally and are not included in these package changes. `llcppg.pub` lists only types retained in the available target outputs. +The directory llcppg.cfg contains only Dir, used by the existing local directory-dependency caller to locate prepared headers. It is dependency metadata, not an independent generation recipe. Obsolete generation rules and platform configuration variants have been removed. Actual generation uses the unified libc configurations followed by classification. Each target is kept in one libc__.go file. Generation inputs, scripts, and ignored header caches remain local; _generate is not included in these changes. The llcppg.pub manifest maps types present in the classified outputs. -The input preserves existing handwritten functions and skips unsupported declarations. `cmsghdr` is excluded on every target. Records requiring packing, explicit alignment, bit fields, flexible arrays, unsupported scalar types, or unresolved callback-field layouts are excluded together with declarations that depend on them. The existing `if_nameindex` name collision is also skipped. This is a selection of common native APIs, rather than a complete libc binding. +The input preserves existing handwritten functions and filters selected unsupported declarations. Cmsghdr now contains only the fixed C header fields: 16 bytes with 8-byte alignment on Linux and 12 bytes with 4-byte alignment on macOS, with no trailing flexible-array field. The interface enumeration function is retained as IfNameindex and its record is named IfNameindexT. Restored Linux resolver declarations link libresolv. Selected packed, explicitly aligned, bit-field, flexible-array, wide-scalar, and unresolved callback layouts remain filtered. This is an incomplete selection of common native APIs. -Validation compares C and Go sizes, alignments, field offsets, and field widths using the original target headers. LLGo runtime checks exercise sockets, address resolution, IPv6 conversion, and interface names in both GC and nogc modes on all three targets. Linux runtime checks ran on newer glibc installations; the generation baseline is glibc 2.24. +The unified raw outputs passed their measured original-header C/Go ABI comparisons on all three targets. Final ABI and runtime validation has not been completed for this expanded classified snapshot. The current combined draft fails to build c/sys because it defines methods on the non-local Timeval alias, blocking dependent packages; declarations such as bindresvport6 also still need link-availability checks. The glibc 2.24 and macOS 14 SDK header baselines do not establish minimum executable runtime versions. \ No newline at end of file diff --git a/c/net/libc_darwin_arm64.go b/c/net/libc_darwin_arm64.go index 73bc42e1..bc1634f3 100644 --- a/c/net/libc_darwin_arm64.go +++ b/c/net/libc_darwin_arm64.go @@ -10,23 +10,66 @@ import ( "unsafe" ) +const XGoPackage = true +const LLGoPackage = "link: -lSystem" + +type X__MbstateT struct { + _xgo_union [16]uint64 +} + +type X__Int8T = int8 + type X__Uint8T = uint8 +type X__Int16T = int16 + type X__Uint16T = uint16 +type X__Int32T = c.Int + type X__Uint32T = c.Uint type X__Int64T = c.LongLong +type X__Uint64T = c.UlongLong + +type X__DarwinIntptrT = c.Long + +type X__DarwinNaturalT = c.Uint + +// ct_rune_t +type X__DarwinCtRuneT = c.Int + +// mbstate_t +type X__DarwinMbstateT = X__MbstateT + +// ptr1 - ptr2 +type X__DarwinPtrdiffT = c.Long + // sizeof() type X__DarwinSizeT = c.Ulong +// wchar_t +type X__DarwinWcharT = c.Int + +// rune_t +type X__DarwinRuneT = X__DarwinWcharT + +// wint_t +type X__DarwinWintT = c.Int + +// clock() +type X__DarwinClockT = c.Ulong + // socklen_t (duh) type X__DarwinSocklenT = X__Uint32T // byte count or error type X__DarwinSsizeT = c.Long +// time() +type X__DarwinTimeT = c.Long + // llgo:link InAddr.InetNtoa C.inet_ntoa func (self InAddr) InetNtoa() *c.Char { return nil @@ -186,6 +229,19 @@ const IF_WAKE_ON_MAGIC_PACKET = 1 // 10 lines of text const IFSTATMAX = 800 +const ( + IFRTYPE_FUNCTIONAL_UNKNOWN = 0 + IFRTYPE_FUNCTIONAL_LOOPBACK = 1 + IFRTYPE_FUNCTIONAL_WIRED = 2 + IFRTYPE_FUNCTIONAL_WIFI_INFRA = 3 + IFRTYPE_FUNCTIONAL_WIFI_AWDL = 4 + IFRTYPE_FUNCTIONAL_CELLULAR = 5 + IFRTYPE_FUNCTIONAL_INTCOPROC = 6 + IFRTYPE_FUNCTIONAL_COMPANIONLINK = 7 + IFRTYPE_FUNCTIONAL_MANAGEMENT = 8 + IFRTYPE_FUNCTIONAL_LAST = 8 +) + type IfClonereq struct { IfcrTotal c.Int IfcrCount c.Int @@ -261,7 +317,7 @@ type KevDlProtoData struct { ProtoRemainingCount UInt32T } -type IfNameindex struct { +type IfNameindexT struct { IfIndex c.Uint IfName *c.Char } @@ -272,8 +328,11 @@ func IfNametoindex(_llcppg_param1 *c.Char) c.Uint //go:linkname IfIndextoname C.if_indextoname func IfIndextoname(_llcppg_param1 c.Uint, _llcppg_param2 *c.Char) *c.Char -// llgo:link (*IfNameindex).IfFreenameindex C.if_freenameindex -func (self *IfNameindex) IfFreenameindex() { +//go:linkname IfNameindex C.if_nameindex +func IfNameindex() *IfNameindexT + +// llgo:link (*IfNameindexT).IfFreenameindex C.if_freenameindex +func (self *IfNameindexT) IfFreenameindex() { } const ( @@ -323,6 +382,9 @@ type Ifqueue struct { IfqDrops c.Int } +type IfnetInterfaceAdvisory struct { +} + // Kernel event subclass identifiers for KEV_NETWORK_CLASS const KEV_INET_SUBCLASS = 1 @@ -1622,9 +1684,60 @@ var In6addrLinklocalAllv2routers In6Addr //go:linkname Inet6OptionSpace C.inet6_option_space func Inet6OptionSpace(_llcppg_param1 c.Int) c.Int +//go:linkname Inet6OptionInit C.inet6_option_init +func Inet6OptionInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 **Cmsghdr, _llcppg_param3 c.Int) c.Int + +// llgo:link (*Cmsghdr).Inet6OptionAppend C.inet6_option_append +func (self *Cmsghdr) Inet6OptionAppend(_llcppg_param2 *X__Uint8T, _llcppg_param3 c.Int, _llcppg_param4 c.Int) c.Int { + return 0 +} + +// llgo:link (*Cmsghdr).Inet6OptionAlloc C.inet6_option_alloc +func (self *Cmsghdr) Inet6OptionAlloc(_llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 c.Int) *X__Uint8T { + return nil +} + +// llgo:link (*Cmsghdr).Inet6OptionNext C.inet6_option_next +func (self *Cmsghdr) Inet6OptionNext(_llcppg_param2 **X__Uint8T) c.Int { + return 0 +} + +// llgo:link (*Cmsghdr).Inet6OptionFind C.inet6_option_find +func (self *Cmsghdr) Inet6OptionFind(_llcppg_param2 **X__Uint8T, _llcppg_param3 c.Int) c.Int { + return 0 +} + //go:linkname Inet6RthdrSpace C.inet6_rthdr_space func Inet6RthdrSpace(_llcppg_param1 c.Int, _llcppg_param2 c.Int) SizeT +//go:linkname Inet6RthdrInit C.inet6_rthdr_init +func Inet6RthdrInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int) *Cmsghdr + +// llgo:link (*Cmsghdr).Inet6RthdrAdd C.inet6_rthdr_add +func (self *Cmsghdr) Inet6RthdrAdd(_llcppg_param2 *In6Addr, _llcppg_param3 c.Uint) c.Int { + return 0 +} + +// llgo:link (*Cmsghdr).Inet6RthdrLasthop C.inet6_rthdr_lasthop +func (self *Cmsghdr) Inet6RthdrLasthop(_llcppg_param2 c.Uint) c.Int { + return 0 +} + +// llgo:link (*Cmsghdr).Inet6RthdrSegments C.inet6_rthdr_segments +func (self *Cmsghdr) Inet6RthdrSegments() c.Int { + return 0 +} + +// llgo:link (*Cmsghdr).Inet6RthdrGetaddr C.inet6_rthdr_getaddr +func (self *Cmsghdr) Inet6RthdrGetaddr(_llcppg_param2 c.Int) *In6Addr { + return nil +} + +// llgo:link (*Cmsghdr).Inet6RthdrGetflags C.inet6_rthdr_getflags +func (self *Cmsghdr) Inet6RthdrGetflags(_llcppg_param2 c.Int) c.Int { + return 0 +} + //go:linkname Inet6OptInit C.inet6_opt_init func Inet6OptInit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT) c.Int @@ -1664,6 +1777,8 @@ func Inet6RthSegments(_llcppg_param1 unsafe.Pointer) c.Int //go:linkname Inet6RthGetaddr C.inet6_rth_getaddr func Inet6RthGetaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int) *In6Addr +type CaddrT = *c.Char + // base type for internet address type InAddrT = X__Uint32T @@ -1683,15 +1798,77 @@ type SocklenT = X__DarwinSocklenT type SsizeT = X__DarwinSsizeT +type Timeval32 struct { + TvSec X__Int32T + TvUsec X__Int32T +} + type UChar = uint8 type UInt32T = c.Uint +type UInt64T = c.UlongLong + type UShort = uint16 +// total blocks +type X__DarwinBlkcntT = X__Int64T + +// preferred block size +type X__DarwinBlksizeT = X__Int32T + +// dev_t +type X__DarwinDevT = X__Int32T + +// Used by statvfs and fstatvfs +type X__DarwinFsblkcntT = c.Uint + +// Used by statvfs and fstatvfs +type X__DarwinFsfilcntT = c.Uint + +// [???] process and group IDs +type X__DarwinGidT = X__Uint32T + +// [XSI] pid_t, uid_t, or gid_t +type X__DarwinIdT = X__Uint32T + +// [???] Used for 64 bit inodes +type X__DarwinIno64T = X__Uint64T + +// [???] Used for inodes +type X__DarwinInoT = X__DarwinIno64T + +// Used by mach +type X__DarwinMachPortNameT = X__DarwinNaturalT + +// Used by mach +type X__DarwinMachPortT = X__DarwinMachPortNameT + +// [???] Some file attributes +type X__DarwinModeT = X__Uint16T + // [???] Used for file sizes type X__DarwinOffT = X__Int64T +// [???] process and group IDs +type X__DarwinPidT = X__Int32T + +// [???] signal set +type X__DarwinSigsetT = X__Uint32T + +// [???] microseconds +type X__DarwinSusecondsT = X__Int32T + +// [???] user IDs +type X__DarwinUidT = X__Uint32T + +// [???] microseconds +type X__DarwinUsecondsT = X__Uint32T + +type X__DarwinUuidT = [16]uint8 + +type X__DarwinUuidStringT = [37]c.Char + // Types const ( // datagram socket @@ -2187,6 +2364,16 @@ type Msghdr struct { MsgFlags c.Int } +// Header for ancillary data objects in msg_control buffer. +// Used for additional information with/about a datagram +// not expressible by flags. The format is a sequence +// of message elements headed by cmsghdr structures. +type Cmsghdr struct { + CmsgLen SocklenT + CmsgLevel c.Int + CmsgType c.Int +} + // sendfile(2) header/trailer struct type SfHdtr struct { Headers *Iovec @@ -2235,6 +2422,9 @@ func Socketpair(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int //go:linkname Sendfile C.sendfile func Sendfile(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 OffT, _llcppg_param4 *OffT, _llcppg_param5 *SfHdtr, _llcppg_param6 c.Int) c.Int +//go:linkname Pfctlinput C.pfctlinput +func Pfctlinput(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr) + //go:linkname Connectx C.connectx func Connectx(_llcppg_param1 c.Int, _llcppg_param2 *SaEndpointsT, _llcppg_param3 SaeAssocidT, _llcppg_param4 c.Uint, _llcppg_param5 *Iovec, _llcppg_param6 c.Uint, _llcppg_param7 *SizeT, _llcppg_param8 *SaeConnidT) c.Int diff --git a/c/net/libc_linux_amd64.go b/c/net/libc_linux_amd64.go index 2aa537fc..932899a3 100644 --- a/c/net/libc_linux_amd64.go +++ b/c/net/libc_linux_amd64.go @@ -10,6 +10,9 @@ import ( "unsafe" ) +const XGoPackage = true +const LLGoPackage = "link: -lc -lresolv" + const X_ARPA_INET_H = 1 // Return the local host address part of the Internet address in IN. @@ -59,6 +62,26 @@ func InetPton(__af c.Int, __cp *c.Char, __buf unsafe.Pointer) c.Int //go:linkname InetAton C.inet_aton func InetAton(__cp *c.Char, __inp *InAddr) c.Int +// Format a network number NET into presentation format and place result +// in buffer starting at BUF with length of LEN bytes. +// +//go:linkname InetNeta C.inet_neta +func InetNeta(__net InAddrT, __buf *c.Char, __len SizeT) *c.Char + +// Convert network number for interface type AF in buffer starting at +// CP to presentation format. The result will specifiy BITS bits of +// the number. +// +//go:linkname InetNetNtop C.inet_net_ntop +func InetNetNtop(__af c.Int, __cp unsafe.Pointer, __bits c.Int, __buf *c.Char, __len SizeT) *c.Char + +// Convert network number for interface type AF from presentation in +// buffer starting at CP to network format and store result int +// buffer starting at BUF of size LEN. +// +//go:linkname InetNetPton C.inet_net_pton +func InetNetPton(__af c.Int, __cp *c.Char, __buf unsafe.Pointer, __len SizeT) c.Int + // Convert ASCII representation in hexadecimal form of the Internet // address to binary form and place result in buffer of length LEN // starting at BUF. @@ -675,6 +698,13 @@ type Msghdr struct { MsgFlags c.Int } +// Structure used for storage of ancillary data object information. +type Cmsghdr struct { + CmsgLen c.SizeT + CmsgLevel c.Int + CmsgType c.Int +} + // Socket level message types. This must match the definitions in // . const SCM_RIGHTS = 1 @@ -687,6 +717,11 @@ type Linger struct { type SocklenT = X__SocklenT +// llgo:link (*Msghdr).X__CmsgNxthdr C.__cmsg_nxthdr +func (self *Msghdr) X__CmsgNxthdr(__cmsg *Cmsghdr) *Cmsghdr { + return nil +} + // Types of sockets. type X__SocketType c.Uint @@ -699,11 +734,144 @@ const ( SOCK_NONBLOCK X__SocketType = 2048 ) +type X__FsidT struct { + X__Val [2]c.Int +} + +// Convenience types. +type X__UChar = uint8 + +type X__UShort = uint16 + +type X__UInt = c.Uint + +type X__ULong = c.Ulong + +// Fixed-size types, underlying types depend on word size and compiler. +type X__Int8T = int8 + +type X__Uint8T = uint8 + +type X__Int16T = int16 + +type X__Uint16T = uint16 + +type X__Int32T = c.Int + +type X__Uint32T = c.Uint + +type X__Int64T = c.Long + +type X__Uint64T = c.Ulong + +type X__QuadT = c.Long + +type X__UQuadT = c.Ulong + +// Type of device numbers. +type X__DevT = c.Ulong + +// Type of user identifications. +type X__UidT = c.Uint + +// Type of group identifications. +type X__GidT = c.Uint + +// Type of file serial numbers. +type X__InoT = c.Ulong + +// Type of file serial numbers (LFS). +type X__Ino64T = c.Ulong + +// Type of file attribute bitmasks. +type X__ModeT = c.Uint + +// Type of file link counts. +type X__NlinkT = c.Ulong + +// Type of file sizes and offsets. +type X__OffT = c.Long + +// Type of file sizes and offsets (LFS). +type X__Off64T = c.Long + +// Type of process identifications. +type X__PidT = c.Int + +// Type of CPU usage counts. +type X__ClockT = c.Long + +// Type for resource measurement. +type X__RlimT = c.Ulong + +// Type for resource measurement (LFS). +type X__Rlim64T = c.Ulong + +// General type for IDs. +type X__IdT = c.Uint + +// Seconds since the Epoch. +type X__TimeT = c.Long + +// Count of microseconds. +type X__UsecondsT = c.Uint + +// Signed count of microseconds. +type X__SusecondsT = c.Long + +// The type of a disk address. +type X__DaddrT = c.Int + +// Type of an IPC key. +type X__KeyT = c.Int + +// Clock ID used in clock and timer functions. +type X__ClockidT = c.Int + +// Timer ID returned by `timer_create'. +type X__TimerT uintptr + +// Type to represent block size. +type X__BlksizeT = c.Long + +// Type to count number of disk blocks. +type X__BlkcntT = c.Long + +type X__Blkcnt64T = c.Long + +// Type to count file system blocks. +type X__FsblkcntT = c.Ulong + +type X__Fsblkcnt64T = c.Ulong + +// Type to count file system nodes. +type X__FsfilcntT = c.Ulong + +type X__Fsfilcnt64T = c.Ulong + +// Type of miscellaneous file system fields. +type X__FswordT = c.Long + // Type of a byte count, or error. type X__SsizeT = c.Long +// Signed long type used in system calls. +type X__SyscallSlongT = c.Long + +// Unsigned long type used in system calls. +type X__SyscallUlongT = c.Ulong + +// These few don't really vary by system, they always correspond +// to one of the other defined types. +type X__LoffT = X__Off64T + +type X__QaddrT = *X__QuadT + type X__CaddrT = *c.Char +// Duplicates info from stdint.h but this is used in unistd.h. +type X__IntptrT = c.Long + // Duplicate info from sys/socket.h. type X__SocklenT = c.Uint @@ -721,7 +889,7 @@ const ( IFNAMSIZ = 16 ) -type IfNameindex struct { +type IfNameindexT struct { IfIndex c.Uint IfName *c.Char } @@ -748,6 +916,13 @@ const ( IFF_DYNAMIC = 32768 ) +type Ifaddr struct { + IfaAddr SockAddr + IfaIfu _llcppg_anon_1 + IfaIfp *Iface + IfaNext *Ifaddr +} + type Ifmap struct { MemStart c.Ulong MemEnd c.Ulong @@ -767,6 +942,13 @@ type Ifconf struct { IfcIfcu _llcppg_anon_4 } +type _llcppg_anon_1 struct { + _xgo_union [8]uint16 +} + +type Iface struct { +} + type _llcppg_anon_2 struct { _xgo_union [16]uint8 } @@ -779,6 +961,14 @@ type _llcppg_anon_4 struct { _xgo_union [1]uint64 } +func (p *_llcppg_anon_1) XGof_ref_ifu_broadaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_1) XGof_ref_ifu_dstaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + func (p *_llcppg_anon_2) XGof_ref_ifrn_name() *[16]c.Char { return (*[16]c.Char)(unsafe.Pointer(p)) } @@ -847,10 +1037,15 @@ func IfNametoindex(__ifname *c.Char) c.Uint //go:linkname IfIndextoname C.if_indextoname func IfIndextoname(__ifindex c.Uint, __ifname *c.Char) *c.Char +// Return a list of all interfaces and their indices. +// +//go:linkname IfNameindex C.if_nameindex +func IfNameindex() *IfNameindexT + // Free the data returned from if_nameindex. // -// llgo:link (*IfNameindex).IfFreenameindex C.if_freenameindex -func (self *IfNameindex) IfFreenameindex() { +// llgo:link (*IfNameindexT).IfFreenameindex C.if_freenameindex +func (self *IfNameindexT) IfFreenameindex() { } const X_NETDB_H = 1 @@ -1650,6 +1845,11 @@ var In6addrLoopback In6Addr //go:linkname Bindresvport C.bindresvport func Bindresvport(__sockfd c.Int, __sock_in *SockaddrIn) c.Int +// The IPv6 version of this function. +// +//go:linkname Bindresvport6 C.bindresvport6 +func Bindresvport6(__sockfd c.Int, __sock_in *SockaddrIn6) c.Int + const X_RPC_NETDB_H = 1 type Rpcent struct { diff --git a/c/net/libc_linux_arm64.go b/c/net/libc_linux_arm64.go index 28de474d..95e27337 100644 --- a/c/net/libc_linux_arm64.go +++ b/c/net/libc_linux_arm64.go @@ -10,6 +10,9 @@ import ( "unsafe" ) +const XGoPackage = true +const LLGoPackage = "link: -lc -lresolv" + const X_ARPA_INET_H = 1 // Return the local host address part of the Internet address in IN. @@ -59,6 +62,26 @@ func InetPton(__af c.Int, __cp *uint8, __buf unsafe.Pointer) c.Int //go:linkname InetAton C.inet_aton func InetAton(__cp *uint8, __inp *InAddr) c.Int +// Format a network number NET into presentation format and place result +// in buffer starting at BUF with length of LEN bytes. +// +//go:linkname InetNeta C.inet_neta +func InetNeta(__net InAddrT, __buf *uint8, __len SizeT) *uint8 + +// Convert network number for interface type AF in buffer starting at +// CP to presentation format. The result will specifiy BITS bits of +// the number. +// +//go:linkname InetNetNtop C.inet_net_ntop +func InetNetNtop(__af c.Int, __cp unsafe.Pointer, __bits c.Int, __buf *uint8, __len SizeT) *uint8 + +// Convert network number for interface type AF from presentation in +// buffer starting at CP to network format and store result int +// buffer starting at BUF of size LEN. +// +//go:linkname InetNetPton C.inet_net_pton +func InetNetPton(__af c.Int, __cp *uint8, __buf unsafe.Pointer, __len SizeT) c.Int + // Convert ASCII representation in hexadecimal form of the Internet // address to binary form and place result in buffer of length LEN // starting at BUF. @@ -675,6 +698,13 @@ type Msghdr struct { MsgFlags c.Int } +// Structure used for storage of ancillary data object information. +type Cmsghdr struct { + CmsgLen c.SizeT + CmsgLevel c.Int + CmsgType c.Int +} + // Socket level message types. This must match the definitions in // . const SCM_RIGHTS = 1 @@ -687,6 +717,11 @@ type Linger struct { type SocklenT = X__SocklenT +// llgo:link (*Msghdr).X__CmsgNxthdr C.__cmsg_nxthdr +func (self *Msghdr) X__CmsgNxthdr(__cmsg *Cmsghdr) *Cmsghdr { + return nil +} + // Types of sockets. type X__SocketType c.Uint @@ -699,11 +734,144 @@ const ( SOCK_NONBLOCK X__SocketType = 2048 ) +type X__FsidT struct { + X__Val [2]c.Int +} + +// Convenience types. +type X__UChar = uint8 + +type X__UShort = uint16 + +type X__UInt = c.Uint + +type X__ULong = c.Ulong + +// Fixed-size types, underlying types depend on word size and compiler. +type X__Int8T = int8 + +type X__Uint8T = uint8 + +type X__Int16T = int16 + +type X__Uint16T = uint16 + +type X__Int32T = c.Int + +type X__Uint32T = c.Uint + +type X__Int64T = c.Long + +type X__Uint64T = c.Ulong + +type X__QuadT = c.Long + +type X__UQuadT = c.Ulong + +// Type of device numbers. +type X__DevT = c.Ulong + +// Type of user identifications. +type X__UidT = c.Uint + +// Type of group identifications. +type X__GidT = c.Uint + +// Type of file serial numbers. +type X__InoT = c.Ulong + +// Type of file serial numbers (LFS). +type X__Ino64T = c.Ulong + +// Type of file attribute bitmasks. +type X__ModeT = c.Uint + +// Type of file link counts. +type X__NlinkT = c.Uint + +// Type of file sizes and offsets. +type X__OffT = c.Long + +// Type of file sizes and offsets (LFS). +type X__Off64T = c.Long + +// Type of process identifications. +type X__PidT = c.Int + +// Type of CPU usage counts. +type X__ClockT = c.Long + +// Type for resource measurement. +type X__RlimT = c.Ulong + +// Type for resource measurement (LFS). +type X__Rlim64T = c.Ulong + +// General type for IDs. +type X__IdT = c.Uint + +// Seconds since the Epoch. +type X__TimeT = c.Long + +// Count of microseconds. +type X__UsecondsT = c.Uint + +// Signed count of microseconds. +type X__SusecondsT = c.Long + +// The type of a disk address. +type X__DaddrT = c.Int + +// Type of an IPC key. +type X__KeyT = c.Int + +// Clock ID used in clock and timer functions. +type X__ClockidT = c.Int + +// Timer ID returned by `timer_create'. +type X__TimerT uintptr + +// Type to represent block size. +type X__BlksizeT = c.Int + +// Type to count number of disk blocks. +type X__BlkcntT = c.Long + +type X__Blkcnt64T = c.Long + +// Type to count file system blocks. +type X__FsblkcntT = c.Ulong + +type X__Fsblkcnt64T = c.Ulong + +// Type to count file system nodes. +type X__FsfilcntT = c.Ulong + +type X__Fsfilcnt64T = c.Ulong + +// Type of miscellaneous file system fields. +type X__FswordT = c.Long + // Type of a byte count, or error. type X__SsizeT = c.Long +// Signed long type used in system calls. +type X__SyscallSlongT = c.Long + +// Unsigned long type used in system calls. +type X__SyscallUlongT = c.Ulong + +// These few don't really vary by system, they always correspond +// to one of the other defined types. +type X__LoffT = X__Off64T + +type X__QaddrT = *X__QuadT + type X__CaddrT = *uint8 +// Duplicates info from stdint.h but this is used in unistd.h. +type X__IntptrT = c.Long + // Duplicate info from sys/socket.h. type X__SocklenT = c.Uint @@ -721,7 +889,7 @@ const ( IFNAMSIZ = 16 ) -type IfNameindex struct { +type IfNameindexT struct { IfIndex c.Uint IfName *uint8 } @@ -748,6 +916,13 @@ const ( IFF_DYNAMIC = 32768 ) +type Ifaddr struct { + IfaAddr SockAddr + IfaIfu _llcppg_anon_1 + IfaIfp *Iface + IfaNext *Ifaddr +} + type Ifmap struct { MemStart c.Ulong MemEnd c.Ulong @@ -767,6 +942,13 @@ type Ifconf struct { IfcIfcu _llcppg_anon_4 } +type _llcppg_anon_1 struct { + _xgo_union [8]uint16 +} + +type Iface struct { +} + type _llcppg_anon_2 struct { _xgo_union [16]uint8 } @@ -779,6 +961,14 @@ type _llcppg_anon_4 struct { _xgo_union [1]uint64 } +func (p *_llcppg_anon_1) XGof_ref_ifu_broadaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_1) XGof_ref_ifu_dstaddr() *SockAddr { + return (*SockAddr)(unsafe.Pointer(p)) +} + func (p *_llcppg_anon_2) XGof_ref_ifrn_name() *[16]uint8 { return (*[16]uint8)(unsafe.Pointer(p)) } @@ -847,10 +1037,15 @@ func IfNametoindex(__ifname *uint8) c.Uint //go:linkname IfIndextoname C.if_indextoname func IfIndextoname(__ifindex c.Uint, __ifname *uint8) *uint8 +// Return a list of all interfaces and their indices. +// +//go:linkname IfNameindex C.if_nameindex +func IfNameindex() *IfNameindexT + // Free the data returned from if_nameindex. // -// llgo:link (*IfNameindex).IfFreenameindex C.if_freenameindex -func (self *IfNameindex) IfFreenameindex() { +// llgo:link (*IfNameindexT).IfFreenameindex C.if_freenameindex +func (self *IfNameindexT) IfFreenameindex() { } const X_NETDB_H = 1 @@ -1650,6 +1845,11 @@ var In6addrLoopback In6Addr //go:linkname Bindresvport C.bindresvport func Bindresvport(__sockfd c.Int, __sock_in *SockaddrIn) c.Int +// The IPv6 version of this function. +// +//go:linkname Bindresvport6 C.bindresvport6 +func Bindresvport6(__sockfd c.Int, __sock_in *SockaddrIn6) c.Int + const X_RPC_NETDB_H = 1 type Rpcent struct { diff --git a/c/net/llcppg-linux_amd64.cfg b/c/net/llcppg-linux_amd64.cfg deleted file mode 100644 index 8287054b..00000000 --- a/c/net/llcppg-linux_amd64.cfg +++ /dev/null @@ -1,96 +0,0 @@ -{ - "Name": "net", - "Language": "c", - "LLGoPackage": "link: -lc", - "Dir": ".sysroot/include", - "Files": [ - "llcppg.h" - ], - "Stdlib": ".sysroot/stdlib", - "Deps": [ - ".." - ], - "Rename": { - "sockaddr": "SockAddr", - "addrinfo": "AddrInfo", - "sockaddr_in": "SockaddrIn", - "sockaddr_in6": "SockaddrIn6", - "sockaddr_storage": "SockaddrStorage", - "sockaddr_un": "SockaddrUn", - "__sockaddr_header": "X__SockaddrHeader", - "_llcppg_char_ptr": "charPtr", - "_llcppg_char_pp": "charPP", - "_llcppg_sockaddr_ptr": "sockaddrPtr", - "_llcppg_addrinfo_ptr": "addrinfoPtr", - "_llcppg_native_in6_addr": "nativeIn6Addr", - "SOCK_STREAM": "_native_SOCK_STREAM", - "SOCK_DGRAM": "_native_SOCK_DGRAM", - "SOCK_RAW": "_native_SOCK_RAW", - "SOCK_RDM": "_native_SOCK_RDM", - "SOCK_SEQPACKET": "_native_SOCK_SEQPACKET" - }, - "MacroIgnore": [ - "IPPORT_RESERVED" - ], - "FailFast": 0, - "TypeIgnore": [ - "cmsghdr", - "va_list", - "_llcppg_native_in6_addr" - ], - "FuncIgnore": [ - "socket", - "bind", - "connect", - "listen", - "accept", - "gethostbyname", - "inet_ntop", - "inet_addr", - "send", - "recv", - "setsockopt", - "ntohs", - "htons", - "ntohl", - "htonl", - "getaddrinfo", - "freeaddrinfo", - "__cmsg_nxthdr", - "if_nameindex" - ], - "FieldAlias": { - "in6_addr::_": "_ [0]uint32", - "in6_addr::U6Addr": "U6Addr [16]uint8", - "hostent::h_name": "Name .charPtr", - "hostent::h_aliases": "Aliases .charPP", - "hostent::h_addrtype": "AddrType c.Int", - "hostent::h_length": "Length c.Int", - "hostent::h_addr_list": "AddrList .charPP", - "addrinfo::ai_flags": "Flags c.Int", - "addrinfo::ai_family": "Family c.Int", - "addrinfo::ai_socktype": "SockType c.Int", - "addrinfo::ai_protocol": "Protocol c.Int", - "addrinfo::ai_addrlen": "AddrLen .SocklenT", - "addrinfo::ai_addr": "Addr .sockaddrPtr", - "addrinfo::ai_canonname": "CanOnName .charPtr", - "addrinfo::ai_next": "Next .addrinfoPtr", - "sockaddr::sa_len": "Len uint8", - "sockaddr::sa_family": "Family uint16", - "sockaddr::sa_data": "Data [14]c.Char", - "sockaddr_in::sin_len": "Len uint8", - "sockaddr_in::sin_family": "Family uint16", - "sockaddr_in::sin_port": "Port uint16", - "sockaddr_in::sin_addr": "Addr .InAddr", - "sockaddr_in::sin_zero": "Zero [8]uint8", - "sockaddr_in6::sin6_len": "Len uint8", - "sockaddr_in6::sin6_family": "Family uint16", - "sockaddr_in6::sin6_port": "Port uint16", - "sockaddr_in6::sin6_flowinfo": "Flowinfo uint32", - "sockaddr_in6::sin6_addr": "Addr .In6Addr", - "sockaddr_in6::sin6_scope_id": "ScopeId uint32", - "in_addr::s_addr": "Addr uint32", - "sockaddr_storage::ss_len": "Len uint8", - "sockaddr_storage::ss_family": "Family uint16" - } -} diff --git a/c/net/llcppg-linux_arm64.cfg b/c/net/llcppg-linux_arm64.cfg deleted file mode 100644 index b8a759d1..00000000 --- a/c/net/llcppg-linux_arm64.cfg +++ /dev/null @@ -1,96 +0,0 @@ -{ - "Name": "net", - "Language": "c", - "LLGoPackage": "link: -lc", - "Dir": ".sysroot/include", - "Files": [ - "llcppg.h" - ], - "Stdlib": ".sysroot/stdlib", - "Deps": [ - ".." - ], - "Rename": { - "sockaddr": "SockAddr", - "addrinfo": "AddrInfo", - "sockaddr_in": "SockaddrIn", - "sockaddr_in6": "SockaddrIn6", - "sockaddr_storage": "SockaddrStorage", - "sockaddr_un": "SockaddrUn", - "__sockaddr_header": "X__SockaddrHeader", - "_llcppg_char_ptr": "charPtr", - "_llcppg_char_pp": "charPP", - "_llcppg_sockaddr_ptr": "sockaddrPtr", - "_llcppg_addrinfo_ptr": "addrinfoPtr", - "_llcppg_native_in6_addr": "nativeIn6Addr", - "SOCK_STREAM": "_native_SOCK_STREAM", - "SOCK_DGRAM": "_native_SOCK_DGRAM", - "SOCK_RAW": "_native_SOCK_RAW", - "SOCK_RDM": "_native_SOCK_RDM", - "SOCK_SEQPACKET": "_native_SOCK_SEQPACKET" - }, - "MacroIgnore": [ - "IPPORT_RESERVED" - ], - "FailFast": 0, - "TypeIgnore": [ - "cmsghdr", - "va_list", - "_llcppg_native_in6_addr" - ], - "FuncIgnore": [ - "socket", - "bind", - "connect", - "listen", - "accept", - "gethostbyname", - "inet_ntop", - "inet_addr", - "send", - "recv", - "setsockopt", - "ntohs", - "htons", - "ntohl", - "htonl", - "getaddrinfo", - "freeaddrinfo", - "__cmsg_nxthdr", - "if_nameindex" - ], - "FieldAlias": { - "in6_addr::_": "_ [0]uint32", - "in6_addr::U6Addr": "U6Addr [16]uint8", - "hostent::h_name": "Name .charPtr", - "hostent::h_aliases": "Aliases .charPP", - "hostent::h_addrtype": "AddrType c.Int", - "hostent::h_length": "Length c.Int", - "hostent::h_addr_list": "AddrList .charPP", - "addrinfo::ai_flags": "Flags c.Int", - "addrinfo::ai_family": "Family c.Int", - "addrinfo::ai_socktype": "SockType c.Int", - "addrinfo::ai_protocol": "Protocol c.Int", - "addrinfo::ai_addrlen": "AddrLen .SocklenT", - "addrinfo::ai_addr": "Addr .sockaddrPtr", - "addrinfo::ai_canonname": "CanOnName .charPtr", - "addrinfo::ai_next": "Next .addrinfoPtr", - "sockaddr::sa_len": "Len uint8", - "sockaddr::sa_family": "Family uint16", - "sockaddr::sa_data": "Data [14]c.Char", - "sockaddr_in::sin_len": "Len uint8", - "sockaddr_in::sin_family": "Family uint16", - "sockaddr_in::sin_port": "Port uint16", - "sockaddr_in::sin_addr": "Addr .InAddr", - "sockaddr_in::sin_zero": "Zero [8]c.Char", - "sockaddr_in6::sin6_len": "Len uint8", - "sockaddr_in6::sin6_family": "Family uint16", - "sockaddr_in6::sin6_port": "Port uint16", - "sockaddr_in6::sin6_flowinfo": "Flowinfo uint32", - "sockaddr_in6::sin6_addr": "Addr .In6Addr", - "sockaddr_in6::sin6_scope_id": "ScopeId uint32", - "in_addr::s_addr": "Addr uint32", - "sockaddr_storage::ss_len": "Len uint8", - "sockaddr_storage::ss_family": "Family uint16" - } -} diff --git a/c/net/llcppg.cfg b/c/net/llcppg.cfg index 6c42c816..75e27be3 100644 --- a/c/net/llcppg.cfg +++ b/c/net/llcppg.cfg @@ -1,96 +1,3 @@ { - "Name": "net", - "Language": "c", - "LLGoPackage": "link: -lc", - "Dir": ".sysroot/include", - "Files": [ - "llcppg.h" - ], - "Stdlib": ".sysroot/stdlib", - "Deps": [ - ".." - ], - "Rename": { - "sockaddr": "SockAddr", - "addrinfo": "AddrInfo", - "sockaddr_in": "SockaddrIn", - "sockaddr_in6": "SockaddrIn6", - "sockaddr_storage": "SockaddrStorage", - "sockaddr_un": "SockaddrUn", - "__sockaddr_header": "X__SockaddrHeader", - "_llcppg_char_ptr": "charPtr", - "_llcppg_char_pp": "charPP", - "_llcppg_sockaddr_ptr": "sockaddrPtr", - "_llcppg_addrinfo_ptr": "addrinfoPtr", - "_llcppg_native_in6_addr": "nativeIn6Addr", - "SOCK_STREAM": "_native_SOCK_STREAM", - "SOCK_DGRAM": "_native_SOCK_DGRAM", - "SOCK_RAW": "_native_SOCK_RAW", - "SOCK_RDM": "_native_SOCK_RDM", - "SOCK_SEQPACKET": "_native_SOCK_SEQPACKET" - }, - "MacroIgnore": [ - "IPPORT_RESERVED" - ], - "FailFast": 0, - "TypeIgnore": [ - "cmsghdr", - "va_list", - "_llcppg_native_in6_addr" - ], - "FuncIgnore": [ - "socket", - "bind", - "connect", - "listen", - "accept", - "gethostbyname", - "inet_ntop", - "inet_addr", - "send", - "recv", - "setsockopt", - "ntohs", - "htons", - "ntohl", - "htonl", - "getaddrinfo", - "freeaddrinfo", - "__cmsg_nxthdr", - "if_nameindex" - ], - "FieldAlias": { - "in6_addr::_": "_ [0]uint32", - "in6_addr::U6Addr": "U6Addr [16]uint8", - "hostent::h_name": "Name .charPtr", - "hostent::h_aliases": "Aliases .charPP", - "hostent::h_addrtype": "AddrType c.Int", - "hostent::h_length": "Length c.Int", - "hostent::h_addr_list": "AddrList .charPP", - "addrinfo::ai_flags": "Flags c.Int", - "addrinfo::ai_family": "Family c.Int", - "addrinfo::ai_socktype": "SockType c.Int", - "addrinfo::ai_protocol": "Protocol c.Int", - "addrinfo::ai_addrlen": "AddrLen .SocklenT", - "addrinfo::ai_addr": "Addr .sockaddrPtr", - "addrinfo::ai_canonname": "CanOnName .charPtr", - "addrinfo::ai_next": "Next .addrinfoPtr", - "sockaddr::sa_len": "Len uint8", - "sockaddr::sa_family": "Family uint8", - "sockaddr::sa_data": "Data [14]c.Char", - "sockaddr_in::sin_len": "Len uint8", - "sockaddr_in::sin_family": "Family uint8", - "sockaddr_in::sin_port": "Port uint16", - "sockaddr_in::sin_addr": "Addr .InAddr", - "sockaddr_in::sin_zero": "Zero [8]c.Char", - "sockaddr_in6::sin6_len": "Len uint8", - "sockaddr_in6::sin6_family": "Family uint8", - "sockaddr_in6::sin6_port": "Port uint16", - "sockaddr_in6::sin6_flowinfo": "Flowinfo uint32", - "sockaddr_in6::sin6_addr": "Addr .In6Addr", - "sockaddr_in6::sin6_scope_id": "ScopeId uint32", - "in_addr::s_addr": "Addr uint32", - "sockaddr_storage::ss_len": "Len uint8", - "sockaddr_storage::ss_family": "Family uint8" - } + "Dir": ".sysroot/include" } diff --git a/c/net/llcppg.pub b/c/net/llcppg.pub index 28dc0851..422100bd 100644 --- a/c/net/llcppg.pub +++ b/c/net/llcppg.pub @@ -1,30 +1,110 @@ +T __blkcnt64_t X__Blkcnt64T +T __blkcnt_t X__BlkcntT +T __blksize_t X__BlksizeT T __caddr_t X__CaddrT +T __clock_t X__ClockT +T __clockid_t X__ClockidT +T __daddr_t X__DaddrT +T __darwin_blkcnt_t X__DarwinBlkcntT +T __darwin_blksize_t X__DarwinBlksizeT +T __darwin_clock_t X__DarwinClockT +T __darwin_ct_rune_t X__DarwinCtRuneT +T __darwin_dev_t X__DarwinDevT +T __darwin_fsblkcnt_t X__DarwinFsblkcntT +T __darwin_fsfilcnt_t X__DarwinFsfilcntT +T __darwin_gid_t X__DarwinGidT +T __darwin_id_t X__DarwinIdT +T __darwin_ino64_t X__DarwinIno64T +T __darwin_ino_t X__DarwinInoT +T __darwin_intptr_t X__DarwinIntptrT +T __darwin_mach_port_name_t X__DarwinMachPortNameT +T __darwin_mach_port_t X__DarwinMachPortT +T __darwin_mbstate_t X__DarwinMbstateT +T __darwin_mode_t X__DarwinModeT +T __darwin_natural_t X__DarwinNaturalT T __darwin_off_t X__DarwinOffT +T __darwin_pid_t X__DarwinPidT +T __darwin_ptrdiff_t X__DarwinPtrdiffT +T __darwin_rune_t X__DarwinRuneT +T __darwin_sigset_t X__DarwinSigsetT T __darwin_size_t X__DarwinSizeT T __darwin_socklen_t X__DarwinSocklenT T __darwin_ssize_t X__DarwinSsizeT +T __darwin_suseconds_t X__DarwinSusecondsT +T __darwin_time_t X__DarwinTimeT +T __darwin_uid_t X__DarwinUidT +T __darwin_useconds_t X__DarwinUsecondsT +T __darwin_uuid_string_t X__DarwinUuidStringT +T __darwin_uuid_t X__DarwinUuidT +T __darwin_wchar_t X__DarwinWcharT +T __darwin_wint_t X__DarwinWintT +T __dev_t X__DevT +T __fsblkcnt64_t X__Fsblkcnt64T +T __fsblkcnt_t X__FsblkcntT +T __fsfilcnt64_t X__Fsfilcnt64T +T __fsfilcnt_t X__FsfilcntT +T __fsid_t X__FsidT +T __fsword_t X__FswordT +T __gid_t X__GidT +T __id_t X__IdT +T __ino64_t X__Ino64T +T __ino_t X__InoT +T __int16_t X__Int16T +T __int32_t X__Int32T T __int64_t X__Int64T +T __int8_t X__Int8T +T __intptr_t X__IntptrT +T __key_t X__KeyT +T __loff_t X__LoffT +T __mbstate_t X__MbstateT +T __mode_t X__ModeT +T __nlink_t X__NlinkT +T __off64_t X__Off64T +T __off_t X__OffT +T __pid_t X__PidT +T __qaddr_t X__QaddrT +T __quad_t X__QuadT +T __rlim64_t X__Rlim64T +T __rlim_t X__RlimT T __sockaddr_header X__SockaddrHeader T __socket_type X__SocketType T __socklen_t X__SocklenT T __ssize_t X__SsizeT +T __suseconds_t X__SusecondsT +T __syscall_slong_t X__SyscallSlongT +T __syscall_ulong_t X__SyscallUlongT +T __time_t X__TimeT +T __timer_t X__TimerT +T __u_char X__UChar +T __u_int X__UInt +T __u_long X__ULong +T __u_quad_t X__UQuadT +T __u_short X__UShort +T __uid_t X__UidT T __uint16_t X__Uint16T T __uint32_t X__Uint32T +T __uint64_t X__Uint64T T __uint8_t X__Uint8T +T __useconds_t X__UsecondsT T addrinfo AddrInfo +T caddr_t CaddrT +T cmsghdr Cmsghdr T group_filter GroupFilter T group_req GroupReq T group_source_req GroupSourceReq T hostent Hostent T if_clonereq IfClonereq -T if_nameindex IfNameindex +T if_nameindex IfNameindexT T ifa_msghdr IfaMsghdr +T iface Iface +T ifaddr Ifaddr T ifaliasreq Ifaliasreq T ifconf Ifconf T ifdevmtu Ifdevmtu T ifma_msghdr IfmaMsghdr T ifma_msghdr2 IfmaMsghdr2 T ifmap Ifmap +T ifnet_interface_advisory IfnetInterfaceAdvisory T ifqueue Ifqueue T ifreq Ifreq T ifstat Ifstat @@ -67,6 +147,8 @@ T sockaddr_storage SockaddrStorage T sockaddr_un SockaddrUn T socklen_t SocklenT T sockproto Sockproto +T timeval32 Timeval32 T u_char UChar T u_int32_t UInt32T +T u_int64_t UInt64T T u_short UShort From af03c4ba2772b3c56b5d4fc969720763b8e6b249 Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Tue, 20 Oct 2026 14:03:33 +0800 Subject: [PATCH 5/8] Regenerate c/net native APIs and verify native calls --- c/net/generated_native_llgo_test.go | 80 +++++++++++++++++++ c/net/libc_darwin_arm64.go | 40 ++++++++++ c/net/libc_linux_amd64.go | 114 ++++++++++++++++++++++++++++ c/net/libc_linux_arm64.go | 114 ++++++++++++++++++++++++++++ 4 files changed, 348 insertions(+) create mode 100644 c/net/generated_native_llgo_test.go diff --git a/c/net/generated_native_llgo_test.go b/c/net/generated_native_llgo_test.go new file mode 100644 index 00000000..f2926efa --- /dev/null +++ b/c/net/generated_native_llgo_test.go @@ -0,0 +1,80 @@ +//go:build llgo && ((darwin && arm64 && !ios) || (linux && (amd64 || arm64) && !android)) + +package net + +import ( + "github.com/goplus/lib/c" + "runtime" + "syscall" + "testing" + "unsafe" +) + +func TestGeneratedNetworkLayouts(t *testing.T) { + familyOffset := uintptr(0) + addrInfoAddrOffset := uintptr(24) + canOnNameOffset := uintptr(32) + controlSize := uintptr(16) + controlAlign := uintptr(8) + if runtime.GOOS == "darwin" { + familyOffset = 1 + addrInfoAddrOffset = 32 + canOnNameOffset = 24 + controlSize = 12 + controlAlign = 4 + } + var address SockAddr + var in6 In6Addr + var storage SockaddrStorage + var info AddrInfo + var control Cmsghdr + checks := []struct { + name string + got, want uintptr + }{ + {"sockaddr size", unsafe.Sizeof(address), 16}, {"sockaddr family", unsafe.Offsetof(address.Family), familyOffset}, + {"in6_addr size", unsafe.Sizeof(in6), 16}, {"in6_addr alignment", unsafe.Alignof(in6), 4}, + {"sockaddr_storage size", unsafe.Sizeof(storage), 128}, {"sockaddr_storage alignment", unsafe.Alignof(storage), 8}, + {"addrinfo size", unsafe.Sizeof(info), 48}, {"addrinfo addr", unsafe.Offsetof(info.Addr), addrInfoAddrOffset}, {"addrinfo canonical name", unsafe.Offsetof(info.CanOnName), canOnNameOffset}, + {"cmsghdr size", unsafe.Sizeof(control), controlSize}, {"cmsghdr alignment", unsafe.Alignof(control), controlAlign}} + for _, check := range checks { + if check.got != check.want { + t.Errorf("%s = %d, want %d", check.name, check.got, check.want) + } + } +} +func TestGeneratedSocketIO(t *testing.T) { + var pair [2]c.Int + if result := Socketpair(c.Int(AF_UNIX), c.Int(SOCK_STREAM), 0, &pair[0]); result != 0 { + t.Fatalf("socketpair = %d", result) + } + defer syscall.Close(int(pair[0])) + defer syscall.Close(int(pair[1])) + var kind c.Int + length := SocklenT(unsafe.Sizeof(kind)) + if result := Getsockopt(pair[0], SOL_SOCKET, SO_TYPE, unsafe.Pointer(&kind), &length); result != 0 { + t.Fatalf("getsockopt = %d", result) + } + if kind != SOCK_STREAM || length != SocklenT(unsafe.Sizeof(kind)) { + t.Fatalf("socket type/length = %d/%d", kind, length) + } + input := [6]byte{0, 1, 127, 128, 254, 255} + var output [6]byte + for offset := 0; offset < len(input); { + n := NativeSend(pair[0], unsafe.Pointer(&input[offset]), SizeT(len(input)-offset), 0) + if n <= 0 { + t.Fatalf("send = %d", n) + } + offset += int(n) + } + for offset := 0; offset < len(output); { + n := NativeRecv(pair[1], unsafe.Pointer(&output[offset]), SizeT(len(output)-offset), 0) + if n <= 0 { + t.Fatalf("recv = %d", n) + } + offset += int(n) + } + if output != input { + t.Fatalf("socket data = %v, want %v", output, input) + } +} diff --git a/c/net/libc_darwin_arm64.go b/c/net/libc_darwin_arm64.go index bc1634f3..1de3b8d2 100644 --- a/c/net/libc_darwin_arm64.go +++ b/c/net/libc_darwin_arm64.go @@ -70,11 +70,17 @@ type X__DarwinSsizeT = c.Long // time() type X__DarwinTimeT = c.Long +//go:linkname NativeInetAddr C.inet_addr +func NativeInetAddr(_llcppg_param1 *c.Char) InAddrT + // llgo:link InAddr.InetNtoa C.inet_ntoa func (self InAddr) InetNtoa() *c.Char { return nil } +//go:linkname NativeInetNtop C.inet_ntop +func NativeInetNtop(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 *c.Char, _llcppg_param4 SocklenT) *c.Char + //go:linkname InetPton C.inet_pton func InetPton(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 unsafe.Pointer) c.Int @@ -661,12 +667,22 @@ func Endprotoent() //go:linkname Endservent C.endservent func Endservent() +// llgo:link (*AddrInfo).NativeFree C.freeaddrinfo +func (self *AddrInfo) NativeFree() { +} + //go:linkname GaiStrerror C.gai_strerror func GaiStrerror(_llcppg_param1 c.Int) *c.Char +//go:linkname NativeGetaddrinfo C.getaddrinfo +func NativeGetaddrinfo(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 *AddrInfo, _llcppg_param4 **AddrInfo) c.Int + //go:linkname Gethostbyaddr C.gethostbyaddr func Gethostbyaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int) *Hostent +//go:linkname NativeGethostbyname C.gethostbyname +func NativeGethostbyname(_llcppg_param1 *c.Char) *Hostent + //go:linkname Gethostent C.gethostent func Gethostent() *Hostent @@ -2389,6 +2405,15 @@ type SaeConnidT = X__Uint32T // sockaddr endpoints type SaEndpointsT = SaEndpoints +//go:linkname NativeAccept C.accept +func NativeAccept(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 *SocklenT) c.Int + +//go:linkname NativeBind C.bind +func NativeBind(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 SocklenT) c.Int + +//go:linkname NativeConnect C.connect +func NativeConnect(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 SocklenT) c.Int + //go:linkname Getpeername C.getpeername func Getpeername(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 *SocklenT) c.Int @@ -2398,24 +2423,39 @@ func Getsockname(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 //go:linkname Getsockopt C.getsockopt func Getsockopt(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 unsafe.Pointer, _llcppg_param5 *SocklenT) c.Int +//go:linkname NativeListen C.listen +func NativeListen(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname NativeRecv C.recv +func NativeRecv(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int) SsizeT + //go:linkname Recvfrom C.recvfrom func Recvfrom(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int, _llcppg_param5 *SockAddr, _llcppg_param6 *SocklenT) SsizeT //go:linkname Recvmsg C.recvmsg func Recvmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) SsizeT +//go:linkname NativeSend C.send +func NativeSend(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int) SsizeT + //go:linkname Sendmsg C.sendmsg func Sendmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) SsizeT //go:linkname Sendto C.sendto func Sendto(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int, _llcppg_param5 *SockAddr, _llcppg_param6 SocklenT) SsizeT +//go:linkname NativeSetsockopt C.setsockopt +func NativeSetsockopt(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 unsafe.Pointer, _llcppg_param5 SocklenT) c.Int + //go:linkname Shutdown C.shutdown func Shutdown(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int //go:linkname Sockatmark C.sockatmark func Sockatmark(_llcppg_param1 c.Int) c.Int +//go:linkname NativeSocket C.socket +func NativeSocket(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int) c.Int + //go:linkname Socketpair C.socketpair func Socketpair(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) c.Int diff --git a/c/net/libc_linux_amd64.go b/c/net/libc_linux_amd64.go index 932899a3..22455f67 100644 --- a/c/net/libc_linux_amd64.go +++ b/c/net/libc_linux_amd64.go @@ -15,6 +15,12 @@ const LLGoPackage = "link: -lc -lresolv" const X_ARPA_INET_H = 1 +// Convert Internet host address from numbers-and-dots notation in CP +// into binary data in network byte order. +// +//go:linkname NativeInetAddr C.inet_addr +func NativeInetAddr(__cp *c.Char) InAddrT + // Return the local host address part of the Internet address in IN. // // llgo:link InAddr.InetLnaof C.inet_lnaof @@ -56,6 +62,13 @@ func (self InAddr) InetNtoa() *c.Char { //go:linkname InetPton C.inet_pton func InetPton(__af c.Int, __cp *c.Char, __buf unsafe.Pointer) c.Int +// Convert a Internet address in binary network format for interface +// type AF in buffer starting at CP to presentation form and place +// result in buffer of length LEN astarting at BUF. +// +//go:linkname NativeInetNtop C.inet_ntop +func NativeInetNtop(__af c.Int, __cp unsafe.Pointer, __buf *c.Char, __len SocklenT) *c.Char + // Convert Internet host address from numbers-and-dots notation in CP // into binary data and store the result in the structure INP. // @@ -1232,6 +1245,14 @@ func Gethostent() *Hostent //go:linkname Gethostbyaddr C.gethostbyaddr func Gethostbyaddr(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int) *Hostent +// Return entry from host data base for host with NAME. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname NativeGethostbyname C.gethostbyname +func NativeGethostbyname(__name *c.Char) *Hostent + // Return entry from host data base for host with NAME. AF must be // set to the address type which is `AF_INET' for IPv4 or `AF_INET6' // for IPv6. @@ -1631,6 +1652,21 @@ func Rresvport(__alport *c.Int) c.Int //go:linkname RresvportAf C.rresvport_af func RresvportAf(__alport *c.Int, __af SaFamilyT) c.Int +// Translate name of a service location and/or a service name to set of +// socket addresses. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname NativeGetaddrinfo C.getaddrinfo +func NativeGetaddrinfo(__name *c.Char, __service *c.Char, __req *AddrInfo, __pai **AddrInfo) c.Int + +// NativeFree `addrinfo' structure AI including associated storage. +// +// llgo:link (*AddrInfo).NativeFree C.freeaddrinfo +func (self *AddrInfo) NativeFree() { +} + // Convert error return from getaddrinfo() to a string. // //go:linkname GaiStrerror C.gai_strerror @@ -1840,6 +1876,18 @@ var In6addrAny In6Addr //go:linkname In6addrLoopback C.in6addr_loopback var In6addrLoopback In6Addr +//go:linkname NativeNtohl C.ntohl +func NativeNtohl(__netlong Uint32T) Uint32T + +//go:linkname NativeNtohs C.ntohs +func NativeNtohs(__netshort Uint16T) Uint16T + +//go:linkname NativeHtonl C.htonl +func NativeHtonl(__hostlong Uint32T) Uint32T + +//go:linkname NativeHtons C.htons +func NativeHtons(__hostshort Uint16T) Uint16T + // Bind socket to a privileged IP port. // //go:linkname Bindresvport C.bindresvport @@ -1906,6 +1954,13 @@ const ( SHUT_RDWR = 2 ) +// Create a new socket of type TYPE in domain DOMAIN, using +// protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically. +// Returns a file descriptor for the new socket, or -1 for errors. +// +//go:linkname NativeSocket C.socket +func NativeSocket(__domain c.Int, __type c.Int, __protocol c.Int) c.Int + // Create two new sockets, of type TYPE in domain DOMAIN and using // protocol PROTOCOL, which are connected to each other, and put file // descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero, @@ -1914,17 +1969,50 @@ const ( //go:linkname Socketpair C.socketpair func Socketpair(__domain c.Int, __type c.Int, __protocol c.Int, __fds *c.Int) c.Int +// Give the socket FD the local address ADDR (which is LEN bytes long). +// +//go:linkname NativeBind C.bind +func NativeBind(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int + // Put the local address of FD into *ADDR and its length in *LEN. // //go:linkname Getsockname C.getsockname func Getsockname(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int +// Open a connection on socket FD to peer at ADDR (which LEN bytes long). +// For connectionless socket types, just set the default address to send to +// and the only address from which to accept transmissions. +// Return 0 on success, -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeConnect C.connect +func NativeConnect(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int + // Put the address of the peer connected to socket FD into *ADDR // (which is *LEN bytes long), and its actual length into *LEN. // //go:linkname Getpeername C.getpeername func Getpeername(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int +// NativeSend N bytes of BUF to socket FD. Returns the number sent or -1. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeSend C.send +func NativeSend(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int) SsizeT + +// Read N bytes into BUF from socket FD. +// Returns the number read or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeRecv C.recv +func NativeRecv(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int) SsizeT + // Send N bytes of BUF on socket FD to peer at address ADDR (which is // ADDR_LEN bytes long). Returns the number sent, or -1 for errors. // @@ -1970,6 +2058,32 @@ func Recvmsg(__fd c.Int, __message *Msghdr, __flags c.Int) SsizeT //go:linkname Getsockopt C.getsockopt func Getsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen *SocklenT) c.Int +// Set socket FD's option OPTNAME at protocol level LEVEL +// to *OPTVAL (which is OPTLEN bytes long). +// Returns 0 on success, -1 for errors. +// +//go:linkname NativeSetsockopt C.setsockopt +func NativeSetsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen SocklenT) c.Int + +// Prepare to accept connections on socket FD. +// N connection requests will be queued before further requests are refused. +// Returns 0 on success, -1 for errors. +// +//go:linkname NativeListen C.listen +func NativeListen(__fd c.Int, __n c.Int) c.Int + +// Await a connection on socket FD. +// When a connection arrives, open a new socket to communicate with it, +// set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting +// peer and *ADDR_LEN to the address's actual length, and return the +// new socket's descriptor, or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeAccept C.accept +func NativeAccept(__fd c.Int, __addr *SockAddr, __addr_len *SocklenT) c.Int + // Shut down all or part of the connection open on socket FD. // HOW determines what to shut down: // SHUT_RD = No more receptions; diff --git a/c/net/libc_linux_arm64.go b/c/net/libc_linux_arm64.go index 95e27337..41f83978 100644 --- a/c/net/libc_linux_arm64.go +++ b/c/net/libc_linux_arm64.go @@ -15,6 +15,12 @@ const LLGoPackage = "link: -lc -lresolv" const X_ARPA_INET_H = 1 +// Convert Internet host address from numbers-and-dots notation in CP +// into binary data in network byte order. +// +//go:linkname NativeInetAddr C.inet_addr +func NativeInetAddr(__cp *uint8) InAddrT + // Return the local host address part of the Internet address in IN. // // llgo:link InAddr.InetLnaof C.inet_lnaof @@ -56,6 +62,13 @@ func (self InAddr) InetNtoa() *uint8 { //go:linkname InetPton C.inet_pton func InetPton(__af c.Int, __cp *uint8, __buf unsafe.Pointer) c.Int +// Convert a Internet address in binary network format for interface +// type AF in buffer starting at CP to presentation form and place +// result in buffer of length LEN astarting at BUF. +// +//go:linkname NativeInetNtop C.inet_ntop +func NativeInetNtop(__af c.Int, __cp unsafe.Pointer, __buf *uint8, __len SocklenT) *uint8 + // Convert Internet host address from numbers-and-dots notation in CP // into binary data and store the result in the structure INP. // @@ -1232,6 +1245,14 @@ func Gethostent() *Hostent //go:linkname Gethostbyaddr C.gethostbyaddr func Gethostbyaddr(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int) *Hostent +// Return entry from host data base for host with NAME. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname NativeGethostbyname C.gethostbyname +func NativeGethostbyname(__name *uint8) *Hostent + // Return entry from host data base for host with NAME. AF must be // set to the address type which is `AF_INET' for IPv4 or `AF_INET6' // for IPv6. @@ -1631,6 +1652,21 @@ func Rresvport(__alport *c.Int) c.Int //go:linkname RresvportAf C.rresvport_af func RresvportAf(__alport *c.Int, __af SaFamilyT) c.Int +// Translate name of a service location and/or a service name to set of +// socket addresses. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname NativeGetaddrinfo C.getaddrinfo +func NativeGetaddrinfo(__name *uint8, __service *uint8, __req *AddrInfo, __pai **AddrInfo) c.Int + +// NativeFree `addrinfo' structure AI including associated storage. +// +// llgo:link (*AddrInfo).NativeFree C.freeaddrinfo +func (self *AddrInfo) NativeFree() { +} + // Convert error return from getaddrinfo() to a string. // //go:linkname GaiStrerror C.gai_strerror @@ -1840,6 +1876,18 @@ var In6addrAny In6Addr //go:linkname In6addrLoopback C.in6addr_loopback var In6addrLoopback In6Addr +//go:linkname NativeNtohl C.ntohl +func NativeNtohl(__netlong Uint32T) Uint32T + +//go:linkname NativeNtohs C.ntohs +func NativeNtohs(__netshort Uint16T) Uint16T + +//go:linkname NativeHtonl C.htonl +func NativeHtonl(__hostlong Uint32T) Uint32T + +//go:linkname NativeHtons C.htons +func NativeHtons(__hostshort Uint16T) Uint16T + // Bind socket to a privileged IP port. // //go:linkname Bindresvport C.bindresvport @@ -1906,6 +1954,13 @@ const ( SHUT_RDWR = 2 ) +// Create a new socket of type TYPE in domain DOMAIN, using +// protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically. +// Returns a file descriptor for the new socket, or -1 for errors. +// +//go:linkname NativeSocket C.socket +func NativeSocket(__domain c.Int, __type c.Int, __protocol c.Int) c.Int + // Create two new sockets, of type TYPE in domain DOMAIN and using // protocol PROTOCOL, which are connected to each other, and put file // descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero, @@ -1914,17 +1969,50 @@ const ( //go:linkname Socketpair C.socketpair func Socketpair(__domain c.Int, __type c.Int, __protocol c.Int, __fds *c.Int) c.Int +// Give the socket FD the local address ADDR (which is LEN bytes long). +// +//go:linkname NativeBind C.bind +func NativeBind(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int + // Put the local address of FD into *ADDR and its length in *LEN. // //go:linkname Getsockname C.getsockname func Getsockname(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int +// Open a connection on socket FD to peer at ADDR (which LEN bytes long). +// For connectionless socket types, just set the default address to send to +// and the only address from which to accept transmissions. +// Return 0 on success, -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeConnect C.connect +func NativeConnect(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int + // Put the address of the peer connected to socket FD into *ADDR // (which is *LEN bytes long), and its actual length into *LEN. // //go:linkname Getpeername C.getpeername func Getpeername(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int +// NativeSend N bytes of BUF to socket FD. Returns the number sent or -1. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeSend C.send +func NativeSend(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int) SsizeT + +// Read N bytes into BUF from socket FD. +// Returns the number read or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeRecv C.recv +func NativeRecv(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int) SsizeT + // Send N bytes of BUF on socket FD to peer at address ADDR (which is // ADDR_LEN bytes long). Returns the number sent, or -1 for errors. // @@ -1970,6 +2058,32 @@ func Recvmsg(__fd c.Int, __message *Msghdr, __flags c.Int) SsizeT //go:linkname Getsockopt C.getsockopt func Getsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen *SocklenT) c.Int +// Set socket FD's option OPTNAME at protocol level LEVEL +// to *OPTVAL (which is OPTLEN bytes long). +// Returns 0 on success, -1 for errors. +// +//go:linkname NativeSetsockopt C.setsockopt +func NativeSetsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen SocklenT) c.Int + +// Prepare to accept connections on socket FD. +// N connection requests will be queued before further requests are refused. +// Returns 0 on success, -1 for errors. +// +//go:linkname NativeListen C.listen +func NativeListen(__fd c.Int, __n c.Int) c.Int + +// Await a connection on socket FD. +// When a connection arrives, open a new socket to communicate with it, +// set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting +// peer and *ADDR_LEN to the address's actual length, and return the +// new socket's descriptor, or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeAccept C.accept +func NativeAccept(__fd c.Int, __addr *SockAddr, __addr_len *SocklenT) c.Int + // Shut down all or part of the connection open on socket FD. // HOW determines what to shut down: // SHUT_RD = No more receptions; From 60555f95110ffb86928384ef63762f587dc36e9e Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Tue, 20 Oct 2026 15:18:11 +0800 Subject: [PATCH 6/8] Replace redundant Native bindings while preserving public contracts --- c/net/README.md | 8 ++++---- c/net/legacy_native.go | 15 --------------- c/net/libc_darwin_arm64.go | 21 ++++++++++----------- c/net/libc_linux_amd64.go | 21 ++++++++++----------- c/net/libc_linux_arm64.go | 21 ++++++++++----------- 5 files changed, 34 insertions(+), 52 deletions(-) diff --git a/c/net/README.md b/c/net/README.md index bde033e0..8dd05415 100644 --- a/c/net/README.md +++ b/c/net/README.md @@ -1,6 +1,6 @@ # C networking bindings -This package binds `arpa/inet.h`, `net/if.h`, `netdb.h`, `netinet/in.h`, `sys/socket.h`, and `sys/un.h`, together with the C types those headers require. Each target is generated as one common libc translation unit, then classified into the existing C packages, with unmodified llcppg commit `4724a68a99e7f8872ae0ba41bce2a5938acd7f9c`. +This package binds `arpa/inet.h`, `net/if.h`, `netdb.h`, `netinet/in.h`, `sys/socket.h`, and `sys/un.h`, together with the C types those headers require. Each target is generated as one common libc translation unit, then classified into the existing C packages, with unmodified llcppg commit `da227ff4aaf07718d7ec0dea62e23dab03ac57fb`. | Target | Header source | Build constraint | | --- | --- | --- | @@ -10,10 +10,10 @@ This package binds `arpa/inet.h`, `net/if.h`, `netdb.h`, `netinet/in.h`, `sys/so Linux support assumes glibc. Existing implementations remain selected for other targets. -`legacy_native.go` retains the existing Unix function names and signatures, including `Bind`, `Accept`, `GetHostByName`, `SetSockOpt`, and `Freeaddrinfo`, along with the five untyped socket constants. Address types retain the existing field names for corresponding C fields. Linux address families use a 16-bit field without the BSD length byte, and Linux `AddrInfo` places `Addr` before `CanOnName`. `In6Addr.U6Addr` remains a byte array with native IPv6 alignment. `Iovec` aliases the shared `c.Iovec` definition. +`Socket`, `Connect`, `Listen`, `SetSockOpt`, and `Freeaddrinfo` use generated declarations under their existing public names. `legacy_native.go` retains the five untyped socket constants and compatibility declarations where the public Go parameter or return types differ from the generated API, including `Bind`, `Accept`, `GetHostByName`, `Send`, and `Recv`. The distinct raw declarations retain their `Native` names. The root package `c.Char` and `c.Printf` remain unchanged. Address types retain the existing field names for corresponding C fields. Linux address families use a 16-bit field without the BSD length byte, and Linux `AddrInfo` places `Addr` before `CanOnName`. `In6Addr.U6Addr` remains a byte array with native IPv6 alignment. `Iovec` aliases the shared `c.Iovec` definition. The directory llcppg.cfg contains only Dir, used by the existing local directory-dependency caller to locate prepared headers. It is dependency metadata, not an independent generation recipe. Obsolete generation rules and platform configuration variants have been removed. Actual generation uses the unified libc configurations followed by classification. Each target is kept in one libc__.go file. Generation inputs, scripts, and ignored header caches remain local; _generate is not included in these changes. The llcppg.pub manifest maps types present in the classified outputs. -The input preserves existing handwritten functions and filters selected unsupported declarations. Cmsghdr now contains only the fixed C header fields: 16 bytes with 8-byte alignment on Linux and 12 bytes with 4-byte alignment on macOS, with no trailing flexible-array field. The interface enumeration function is retained as IfNameindex and its record is named IfNameindexT. Restored Linux resolver declarations link libresolv. Selected packed, explicitly aligned, bit-field, flexible-array, wide-scalar, and unresolved callback layouts remain filtered. This is an incomplete selection of common native APIs. +Generation retains the common native C functions, including APIs that also have compatibility declarations. Existing generation-error exclusions and explicitly approved unsupported layouts remain recorded in the local generation inputs. Cmsghdr now contains only the fixed C header fields: 16 bytes with 8-byte alignment on Linux and 12 bytes with 4-byte alignment on macOS, with no trailing flexible-array field. The interface enumeration function is retained as IfNameindex and its record is named IfNameindexT. Restored Linux resolver declarations link libresolv. Selected packed, explicitly aligned, bit-field, flexible-array, wide-scalar, and unresolved callback layouts remain filtered. This is an incomplete selection of common native APIs. -The unified raw outputs passed their measured original-header C/Go ABI comparisons on all three targets. Final ABI and runtime validation has not been completed for this expanded classified snapshot. The current combined draft fails to build c/sys because it defines methods on the non-local Timeval alias, blocking dependent packages; declarations such as bindresvport6 also still need link-availability checks. The glibc 2.24 and macOS 14 SDK header baselines do not establish minimum executable runtime versions. \ No newline at end of file +The unified raw outputs passed their measured original-header C/Go ABI comparisons on all three targets. The classified packages pass `llgo test` with GC and `nogc` on macOS arm64 and Linux amd64/arm64. The networking tests check native layouts and binary socket I/O; they do not exercise every generated symbol. This cleanup preserves each package's C symbol coverage on all three targets and both GC modes. The glibc 2.24 and macOS 14 SDK header baselines do not establish minimum executable runtime versions. diff --git a/c/net/legacy_native.go b/c/net/legacy_native.go index 22071259..f6529e75 100644 --- a/c/net/legacy_native.go +++ b/c/net/legacy_native.go @@ -40,18 +40,9 @@ const ( PAD2_SIZE = MAXSIZE - unsafe.Sizeof(byte(0)) - unsafe.Sizeof(byte(0)) - PAD1_SIZE - ALIGNSIZE ) -//go:linkname Socket C.socket -func Socket(domain c.Int, typ c.Int, protocol c.Int) c.Int - //go:linkname Bind C.bind func Bind(sockfd c.Int, addr *SockaddrIn, addrlen c.Uint) c.Int -//go:linkname Connect C.connect -func Connect(sockfd c.Int, addr *SockAddr, addrlen c.Uint) c.Int - -//go:linkname Listen C.listen -func Listen(sockfd c.Int, backlog c.Int) c.Int - //go:linkname Accept C.accept func Accept(sockfd c.Int, addr *SockaddrIn, addrlen *c.Uint) c.Int @@ -70,9 +61,6 @@ func Send(c.Int, c.Pointer, uintptr, c.Int) c.Long //go:linkname Recv C.recv func Recv(c.Int, c.Pointer, uintptr, c.Int) c.Long -//go:linkname SetSockOpt C.setsockopt -func SetSockOpt(socket c.Int, level c.Int, optionName c.Int, optionValue c.Pointer, sockLen c.Uint) c.Int - //go:linkname Ntohs C.ntohs func Ntohs(x uint16) uint16 @@ -87,6 +75,3 @@ func Htonl(x c.Uint) c.Uint //go:linkname Getaddrinfo C.getaddrinfo func Getaddrinfo(host *c.Char, port *c.Char, addrInfo *AddrInfo, result **AddrInfo) c.Int - -//go:linkname Freeaddrinfo C.freeaddrinfo -func Freeaddrinfo(addrInfo *AddrInfo) diff --git a/c/net/libc_darwin_arm64.go b/c/net/libc_darwin_arm64.go index 1de3b8d2..40b2b4fd 100644 --- a/c/net/libc_darwin_arm64.go +++ b/c/net/libc_darwin_arm64.go @@ -667,9 +667,8 @@ func Endprotoent() //go:linkname Endservent C.endservent func Endservent() -// llgo:link (*AddrInfo).NativeFree C.freeaddrinfo -func (self *AddrInfo) NativeFree() { -} +//go:linkname Freeaddrinfo C.freeaddrinfo +func Freeaddrinfo(self *AddrInfo) //go:linkname GaiStrerror C.gai_strerror func GaiStrerror(_llcppg_param1 c.Int) *c.Char @@ -2411,8 +2410,8 @@ func NativeAccept(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 //go:linkname NativeBind C.bind func NativeBind(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 SocklenT) c.Int -//go:linkname NativeConnect C.connect -func NativeConnect(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 SocklenT) c.Int +//go:linkname Connect C.connect +func Connect(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 SocklenT) c.Int //go:linkname Getpeername C.getpeername func Getpeername(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 *SocklenT) c.Int @@ -2423,8 +2422,8 @@ func Getsockname(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 //go:linkname Getsockopt C.getsockopt func Getsockopt(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 unsafe.Pointer, _llcppg_param5 *SocklenT) c.Int -//go:linkname NativeListen C.listen -func NativeListen(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int +//go:linkname Listen C.listen +func Listen(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int //go:linkname NativeRecv C.recv func NativeRecv(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int) SsizeT @@ -2444,8 +2443,8 @@ func Sendmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) //go:linkname Sendto C.sendto func Sendto(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int, _llcppg_param5 *SockAddr, _llcppg_param6 SocklenT) SsizeT -//go:linkname NativeSetsockopt C.setsockopt -func NativeSetsockopt(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 unsafe.Pointer, _llcppg_param5 SocklenT) c.Int +//go:linkname SetSockOpt C.setsockopt +func SetSockOpt(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 unsafe.Pointer, _llcppg_param5 SocklenT) c.Int //go:linkname Shutdown C.shutdown func Shutdown(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int @@ -2453,8 +2452,8 @@ func Shutdown(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int //go:linkname Sockatmark C.sockatmark func Sockatmark(_llcppg_param1 c.Int) c.Int -//go:linkname NativeSocket C.socket -func NativeSocket(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int) c.Int +//go:linkname Socket C.socket +func Socket(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int) c.Int //go:linkname Socketpair C.socketpair func Socketpair(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Int) c.Int diff --git a/c/net/libc_linux_amd64.go b/c/net/libc_linux_amd64.go index 22455f67..a138c5ce 100644 --- a/c/net/libc_linux_amd64.go +++ b/c/net/libc_linux_amd64.go @@ -1663,9 +1663,8 @@ func NativeGetaddrinfo(__name *c.Char, __service *c.Char, __req *AddrInfo, __pai // NativeFree `addrinfo' structure AI including associated storage. // -// llgo:link (*AddrInfo).NativeFree C.freeaddrinfo -func (self *AddrInfo) NativeFree() { -} +//go:linkname Freeaddrinfo C.freeaddrinfo +func Freeaddrinfo(self *AddrInfo) // Convert error return from getaddrinfo() to a string. // @@ -1958,8 +1957,8 @@ const ( // protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically. // Returns a file descriptor for the new socket, or -1 for errors. // -//go:linkname NativeSocket C.socket -func NativeSocket(__domain c.Int, __type c.Int, __protocol c.Int) c.Int +//go:linkname Socket C.socket +func Socket(__domain c.Int, __type c.Int, __protocol c.Int) c.Int // Create two new sockets, of type TYPE in domain DOMAIN and using // protocol PROTOCOL, which are connected to each other, and put file @@ -1987,8 +1986,8 @@ func Getsockname(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeConnect C.connect -func NativeConnect(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int +//go:linkname Connect C.connect +func Connect(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int // Put the address of the peer connected to socket FD into *ADDR // (which is *LEN bytes long), and its actual length into *LEN. @@ -2062,15 +2061,15 @@ func Getsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Poin // to *OPTVAL (which is OPTLEN bytes long). // Returns 0 on success, -1 for errors. // -//go:linkname NativeSetsockopt C.setsockopt -func NativeSetsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen SocklenT) c.Int +//go:linkname SetSockOpt C.setsockopt +func SetSockOpt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen SocklenT) c.Int // Prepare to accept connections on socket FD. // N connection requests will be queued before further requests are refused. // Returns 0 on success, -1 for errors. // -//go:linkname NativeListen C.listen -func NativeListen(__fd c.Int, __n c.Int) c.Int +//go:linkname Listen C.listen +func Listen(__fd c.Int, __n c.Int) c.Int // Await a connection on socket FD. // When a connection arrives, open a new socket to communicate with it, diff --git a/c/net/libc_linux_arm64.go b/c/net/libc_linux_arm64.go index 41f83978..aaa481a2 100644 --- a/c/net/libc_linux_arm64.go +++ b/c/net/libc_linux_arm64.go @@ -1663,9 +1663,8 @@ func NativeGetaddrinfo(__name *uint8, __service *uint8, __req *AddrInfo, __pai * // NativeFree `addrinfo' structure AI including associated storage. // -// llgo:link (*AddrInfo).NativeFree C.freeaddrinfo -func (self *AddrInfo) NativeFree() { -} +//go:linkname Freeaddrinfo C.freeaddrinfo +func Freeaddrinfo(self *AddrInfo) // Convert error return from getaddrinfo() to a string. // @@ -1958,8 +1957,8 @@ const ( // protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically. // Returns a file descriptor for the new socket, or -1 for errors. // -//go:linkname NativeSocket C.socket -func NativeSocket(__domain c.Int, __type c.Int, __protocol c.Int) c.Int +//go:linkname Socket C.socket +func Socket(__domain c.Int, __type c.Int, __protocol c.Int) c.Int // Create two new sockets, of type TYPE in domain DOMAIN and using // protocol PROTOCOL, which are connected to each other, and put file @@ -1987,8 +1986,8 @@ func Getsockname(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeConnect C.connect -func NativeConnect(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int +//go:linkname Connect C.connect +func Connect(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int // Put the address of the peer connected to socket FD into *ADDR // (which is *LEN bytes long), and its actual length into *LEN. @@ -2062,15 +2061,15 @@ func Getsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Poin // to *OPTVAL (which is OPTLEN bytes long). // Returns 0 on success, -1 for errors. // -//go:linkname NativeSetsockopt C.setsockopt -func NativeSetsockopt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen SocklenT) c.Int +//go:linkname SetSockOpt C.setsockopt +func SetSockOpt(__fd c.Int, __level c.Int, __optname c.Int, __optval unsafe.Pointer, __optlen SocklenT) c.Int // Prepare to accept connections on socket FD. // N connection requests will be queued before further requests are refused. // Returns 0 on success, -1 for errors. // -//go:linkname NativeListen C.listen -func NativeListen(__fd c.Int, __n c.Int) c.Int +//go:linkname Listen C.listen +func Listen(__fd c.Int, __n c.Int) c.Int // Await a connection on socket FD. // When a connection arrives, open a new socket to communicate with it, From 661a2a7f24f7f380c6de411d656e7c3a21b4a581 Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Thu, 22 Oct 2026 12:44:45 +0800 Subject: [PATCH 7/8] Verify all native networking symbols and replace legacy declarations --- c/net/README.md | 14 +- c/net/generated_native_llgo_test.go | 187 +- c/net/legacy_darwin_arm64.go | 20 + c/net/legacy_native.go | 49 - c/net/libc_darwin_arm64.go | 43 +- c/net/libc_linux_amd64.go | 75 +- c/net/libc_linux_arm64.go | 75 +- c/net/libc_native_darwin_arm64_llgo_test.go | 1828 +++++++++++++++++++ c/net/libc_native_linux_amd64_llgo_test.go | 1531 ++++++++++++++++ c/net/libc_native_linux_arm64_llgo_test.go | 1531 ++++++++++++++++ 10 files changed, 5162 insertions(+), 191 deletions(-) create mode 100644 c/net/legacy_darwin_arm64.go create mode 100644 c/net/libc_native_darwin_arm64_llgo_test.go create mode 100644 c/net/libc_native_linux_amd64_llgo_test.go create mode 100644 c/net/libc_native_linux_arm64_llgo_test.go diff --git a/c/net/README.md b/c/net/README.md index 8dd05415..06850077 100644 --- a/c/net/README.md +++ b/c/net/README.md @@ -1,6 +1,6 @@ # C networking bindings -This package binds `arpa/inet.h`, `net/if.h`, `netdb.h`, `netinet/in.h`, `sys/socket.h`, and `sys/un.h`, together with the C types those headers require. Each target is generated as one common libc translation unit, then classified into the existing C packages, with unmodified llcppg commit `da227ff4aaf07718d7ec0dea62e23dab03ac57fb`. +This package binds `arpa/inet.h`, `net/if.h`, `netdb.h`, `netinet/in.h`, `sys/socket.h`, and `sys/un.h`, together with their required C types. Each target is generated as one common libc translation unit, then classified into the existing C packages, with unmodified llcppg commit `da227ff4aaf07718d7ec0dea62e23dab03ac57fb`. | Target | Header source | Build constraint | | --- | --- | --- | @@ -10,10 +10,14 @@ This package binds `arpa/inet.h`, `net/if.h`, `netdb.h`, `netinet/in.h`, `sys/so Linux support assumes glibc. Existing implementations remain selected for other targets. -`Socket`, `Connect`, `Listen`, `SetSockOpt`, and `Freeaddrinfo` use generated declarations under their existing public names. `legacy_native.go` retains the five untyped socket constants and compatibility declarations where the public Go parameter or return types differ from the generated API, including `Bind`, `Accept`, `GetHostByName`, `Send`, and `Recv`. The distinct raw declarations retain their `Native` names. The root package `c.Char` and `c.Printf` remain unchanged. Address types retain the existing field names for corresponding C fields. Linux address families use a 16-bit field without the BSD length byte, and Linux `AddrInfo` places `Addr` before `CanOnName`. `In6Addr.U6Addr` remains a byte array with native IPv6 alignment. `Iovec` aliases the shared `c.Iovec` definition. +Generated declarations use the existing public function names, including `Bind`, `Accept`, `GetHostByName`, `InetAddr`, `InetNtop`, `Getaddrinfo`, `Send`, and `Recv`. Duplicate `Native` declarations have been removed. `Bind` and `Accept` now accept the generic `*SockAddr` rather than restricting their address argument to `*SockaddrIn`. `Send` and `Recv` retain `c.SizeT` (`uintptr`) for their lengths. Existing string entry points retain `*c.Char`, including on Linux arm64. `legacy_native.go` retains the five untyped socket constants; `legacy_darwin_arm64.go` retains the four native byte-order declarations whose macOS headers expose macros. The root package `c.Char` and `c.Printf` remain unchanged. -The directory llcppg.cfg contains only Dir, used by the existing local directory-dependency caller to locate prepared headers. It is dependency metadata, not an independent generation recipe. Obsolete generation rules and platform configuration variants have been removed. Actual generation uses the unified libc configurations followed by classification. Each target is kept in one libc__.go file. Generation inputs, scripts, and ignored header caches remain local; _generate is not included in these changes. The llcppg.pub manifest maps types present in the classified outputs. +Address types retain the existing field names for corresponding C fields. Linux address families use a 16-bit field without the BSD length byte, and Linux `AddrInfo` places `Addr` before `CanOnName`. `In6Addr.U6Addr` remains a byte array with native IPv6 alignment. `Iovec` aliases the shared `c.Iovec` definition from the root C package. The compatibility padding constants follow the native `SockaddrStorage`: `PAD1_SIZE`/`PAD2_SIZE` are 6/112 on macOS and 118/0 on Linux. -Generation retains the common native C functions, including APIs that also have compatibility declarations. Existing generation-error exclusions and explicitly approved unsupported layouts remain recorded in the local generation inputs. Cmsghdr now contains only the fixed C header fields: 16 bytes with 8-byte alignment on Linux and 12 bytes with 4-byte alignment on macOS, with no trailing flexible-array field. The interface enumeration function is retained as IfNameindex and its record is named IfNameindexT. Restored Linux resolver declarations link libresolv. Selected packed, explicitly aligned, bit-field, flexible-array, wide-scalar, and unresolved callback layouts remain filtered. This is an incomplete selection of common native APIs. +The directory `llcppg.cfg` contains only `Dir`, used by the existing local directory-dependency caller to locate prepared headers. It is dependency metadata, not an independent generation recipe. Generation uses the unified libc configurations followed by classification. Each target is kept in one `libc__.go` file. Generation inputs, scripts, and header caches remain local; `_generate` is not included. The `llcppg.pub` manifest maps types present in the classified outputs. -The unified raw outputs passed their measured original-header C/Go ABI comparisons on all three targets. The classified packages pass `llgo test` with GC and `nogc` on macOS arm64 and Linux amd64/arm64. The networking tests check native layouts and binary socket I/O; they do not exercise every generated symbol. This cleanup preserves each package's C symbol coverage on all three targets and both GC modes. The glibc 2.24 and macOS 14 SDK header baselines do not establish minimum executable runtime versions. +The kernel-only macOS `pfctlinput` entry point and the Linux implementation helpers `__h_errno_location` and `__cmsg_nxthdr` are excluded. Types needed to express native layouts, including anonymous union storage and its generated field accessors, remain available. Existing approved generation-error and unsupported-layout exclusions remain recorded in the local generation inputs. `Cmsghdr` contains only its fixed C header fields: 16 bytes with 8-byte alignment on Linux and 12 bytes with 4-byte alignment on macOS. The interface enumeration function is `IfNameindex`; its record is `IfNameindexT`. Linux resolver declarations link `libresolv`. This remains a selection of common native APIs rather than the entire libc API. + +The tests compare every retained C function's parameter/result ABI against independently compiled native prototypes and take its address to require symbol resolution. They also check native type sizes, alignments and field offsets, constant values, global symbols and layouts, and generated union accessors. A source inventory check rejects missing coverage. Runtime tests exercise binary socket I/O, IPv4/IPv6 numeric conversion and resolution, interface enumeration/freeing, and TCP loopback through the generic `Bind`/`Accept` signatures. + +The independent native C link check passes for macOS. Linux excludes `bindresvport6` with explicit approval: glibc 2.24's header declares it, but neither its original libc nor the validation environment's libc exports it. macOS arm64 and Linux amd64/arm64 pass `llgo test -count=1 -v ./c/net` with GC and `nogc` using LLGo v1.0.8 (`c171abfa130108bc6451e01fcf15a8a3474eb0a7`). The macOS runs use LLD 23.1.3 with the compiler on LLVM 22. Tests use the root C bindings from dependent PR #45, which supplies `c.Iovec`. The glibc 2.24 and macOS 14 SDK header baselines do not establish minimum executable runtime versions. diff --git a/c/net/generated_native_llgo_test.go b/c/net/generated_native_llgo_test.go index f2926efa..3f1dd1fe 100644 --- a/c/net/generated_native_llgo_test.go +++ b/c/net/generated_native_llgo_test.go @@ -10,39 +10,11 @@ import ( "unsafe" ) -func TestGeneratedNetworkLayouts(t *testing.T) { - familyOffset := uintptr(0) - addrInfoAddrOffset := uintptr(24) - canOnNameOffset := uintptr(32) - controlSize := uintptr(16) - controlAlign := uintptr(8) - if runtime.GOOS == "darwin" { - familyOffset = 1 - addrInfoAddrOffset = 32 - canOnNameOffset = 24 - controlSize = 12 - controlAlign = 4 - } - var address SockAddr - var in6 In6Addr - var storage SockaddrStorage - var info AddrInfo - var control Cmsghdr - checks := []struct { - name string - got, want uintptr - }{ - {"sockaddr size", unsafe.Sizeof(address), 16}, {"sockaddr family", unsafe.Offsetof(address.Family), familyOffset}, - {"in6_addr size", unsafe.Sizeof(in6), 16}, {"in6_addr alignment", unsafe.Alignof(in6), 4}, - {"sockaddr_storage size", unsafe.Sizeof(storage), 128}, {"sockaddr_storage alignment", unsafe.Alignof(storage), 8}, - {"addrinfo size", unsafe.Sizeof(info), 48}, {"addrinfo addr", unsafe.Offsetof(info.Addr), addrInfoAddrOffset}, {"addrinfo canonical name", unsafe.Offsetof(info.CanOnName), canOnNameOffset}, - {"cmsghdr size", unsafe.Sizeof(control), controlSize}, {"cmsghdr alignment", unsafe.Alignof(control), controlAlign}} - for _, check := range checks { - if check.got != check.want { - t.Errorf("%s = %d, want %d", check.name, check.got, check.want) - } - } +type networkABISlot struct { + size, align uintptr + class int } + func TestGeneratedSocketIO(t *testing.T) { var pair [2]c.Int if result := Socketpair(c.Int(AF_UNIX), c.Int(SOCK_STREAM), 0, &pair[0]); result != 0 { @@ -61,14 +33,14 @@ func TestGeneratedSocketIO(t *testing.T) { input := [6]byte{0, 1, 127, 128, 254, 255} var output [6]byte for offset := 0; offset < len(input); { - n := NativeSend(pair[0], unsafe.Pointer(&input[offset]), SizeT(len(input)-offset), 0) + n := Send(pair[0], unsafe.Pointer(&input[offset]), c.SizeT(len(input)-offset), 0) if n <= 0 { t.Fatalf("send = %d", n) } offset += int(n) } for offset := 0; offset < len(output); { - n := NativeRecv(pair[1], unsafe.Pointer(&output[offset]), SizeT(len(output)-offset), 0) + n := Recv(pair[1], unsafe.Pointer(&output[offset]), c.SizeT(len(output)-offset), 0) if n <= 0 { t.Fatalf("recv = %d", n) } @@ -77,4 +49,151 @@ func TestGeneratedSocketIO(t *testing.T) { if output != input { t.Fatalf("socket data = %v, want %v", output, input) } + t.Run("byte order and IPv4 rendering", func(t *testing.T) { + if Htons(0x1234) != 0x3412 || Ntohs(0x3412) != 0x1234 || Htonl(0x12345678) != 0x78563412 || Ntohl(0x78563412) != 0x12345678 { + t.Fatal("native byte order conversion failed") + } + addr := InAddr{Addr: InetAddr(c.Str("127.0.0.1"))} + if got := c.GoString((*c.Char)(unsafe.Pointer(addr.InetNtoa()))); got != "127.0.0.1" { + t.Fatalf("inet_ntoa = %q", got) + } + }) + t.Run("IPv4 and IPv6 numeric addresses", func(t *testing.T) { + for _, tc := range []struct { + family c.Int + text string + }{{AF_INET, "127.0.0.1"}, {AF_INET6, "::1"}} { + t.Run(tc.text, func(t *testing.T) { + var address [16]byte + text := append([]byte(tc.text), 0) + source := (*c.Char)(unsafe.Pointer(&text[0])) + if result := InetPton(tc.family, (*nativeNetworkChar)(unsafe.Pointer(source)), unsafe.Pointer(&address[0])); result != 1 { + t.Fatalf("inet_pton = %d", result) + } + var rendered [64]c.Char + if InetNtop(tc.family, unsafe.Pointer(&address[0]), &rendered[0], SocklenT(len(rendered))) == nil { + t.Fatal("inet_ntop failed") + } + if got := c.GoString(&rendered[0]); got != tc.text { + t.Fatalf("inet_ntop = %q", got) + } + hints := AddrInfo{Flags: AI_NUMERICHOST | AI_NUMERICSERV, Family: tc.family, SockType: SOCK_STREAM} + var info *AddrInfo + if result := Getaddrinfo(source, c.Str("32123"), &hints, &info); result != 0 { + t.Fatalf("getaddrinfo = %d", result) + } + if info == nil { + t.Fatal("getaddrinfo returned nil") + } + defer Freeaddrinfo(info) + if info.Family != tc.family || info.Addr == nil { + t.Fatalf("addrinfo family/address = %d/%p", info.Family, info.Addr) + } + var host [64]nativeNetworkChar + var service [16]nativeNetworkChar + if result := info.Addr.Getnameinfo(info.AddrLen, &host[0], SocklenT(len(host)), &service[0], SocklenT(len(service)), NI_NUMERICHOST|NI_NUMERICSERV); result != 0 { + t.Fatalf("getnameinfo = %d", result) + } + if got := c.GoString((*c.Char)(unsafe.Pointer(&host[0]))); got != tc.text { + t.Fatalf("numeric host = %q", got) + } + if got := c.GoString((*c.Char)(unsafe.Pointer(&service[0]))); got != "32123" { + t.Fatalf("numeric service = %q", got) + } + }) + } + if In6addrAny.U6Addr != [16]uint8{} || In6addrLoopback.U6Addr != [16]uint8{15: 1} { + t.Fatal("native IPv6 globals are incorrect") + } + }) + t.Run("interface index lifecycle", func(t *testing.T) { + loopback := "lo" + if runtime.GOOS == "darwin" { + loopback = "lo0" + } + loopbackText := append([]byte(loopback), 0) + index := IfNametoindex((*nativeNetworkChar)(unsafe.Pointer(&loopbackText[0]))) + if index == 0 { + t.Fatal("loopback interface index is zero") + } + var name [256]nativeNetworkChar + if IfIndextoname(index, &name[0]) == nil { + t.Fatal("if_indextoname failed") + } + if got := c.GoString((*c.Char)(unsafe.Pointer(&name[0]))); got != loopback { + t.Fatalf("interface name = %q", got) + } + interfaces := IfNameindex() + if interfaces == nil { + t.Fatal("if_nameindex failed") + } + defer interfaces.IfFreenameindex() + found := false + for i := 0; ; i++ { + entry := (*IfNameindexT)(unsafe.Add(unsafe.Pointer(interfaces), uintptr(i)*unsafe.Sizeof(*interfaces))) + if entry.IfIndex == 0 && entry.IfName == nil { + break + } + if entry.IfIndex == index && c.GoString((*c.Char)(unsafe.Pointer(entry.IfName))) == loopback { + found = true + } + } + if !found { + t.Fatal("loopback interface is absent from if_nameindex") + } + }) + t.Run("TCP loopback generic sockaddr", func(t *testing.T) { + listener := Socket(AF_INET, SOCK_STREAM, 0) + if listener < 0 { + t.Fatal("listener socket failed") + } + defer syscall.Close(int(listener)) + address := SockaddrIn{Family: SaFamilyT(AF_INET), Addr: InAddr{Addr: Htonl(0x7f000001)}} + if runtime.GOOS == "darwin" { + *(*uint8)(unsafe.Pointer(&address)) = uint8(unsafe.Sizeof(address)) + } + if result := Bind(listener, (*SockAddr)(unsafe.Pointer(&address)), SocklenT(unsafe.Sizeof(address))); result != 0 { + t.Fatalf("bind = %d", result) + } + if result := Listen(listener, 1); result != 0 { + t.Fatalf("listen = %d", result) + } + length := SocklenT(unsafe.Sizeof(address)) + if result := Getsockname(listener, (*SockAddr)(unsafe.Pointer(&address)), &length); result != 0 { + t.Fatalf("getsockname = %d", result) + } + if length != SocklenT(unsafe.Sizeof(address)) || address.Port == 0 { + t.Fatalf("bound address length/port = %d/%d", length, address.Port) + } + client := Socket(AF_INET, SOCK_STREAM, 0) + if client < 0 { + t.Fatal("client socket failed") + } + defer syscall.Close(int(client)) + if result := Connect(client, (*SockAddr)(unsafe.Pointer(&address)), length); result != 0 { + t.Fatalf("connect = %d", result) + } + var peer SockaddrStorage + peerLength := SocklenT(unsafe.Sizeof(peer)) + accepted := Accept(listener, (*SockAddr)(unsafe.Pointer(&peer)), &peerLength) + if accepted < 0 { + t.Fatalf("accept = %d", accepted) + } + defer syscall.Close(int(accepted)) + if peer.Family != SaFamilyT(AF_INET) || peerLength != SocklenT(unsafe.Sizeof(address)) { + t.Fatalf("peer family/length = %d/%d", peer.Family, peerLength) + } + input := byte(0xa5) + if n := Send(client, unsafe.Pointer(&input), 1, 0); n != 1 { + t.Fatalf("TCP send = %d", n) + } + var output byte + if n := Recv(accepted, unsafe.Pointer(&output), 1, 0); n != 1 || output != input { + t.Fatalf("TCP recv = %d/%x", n, output) + } + if result := Shutdown(client, SHUT_WR); result != 0 { + t.Fatalf("shutdown = %d", result) + } + }) + } diff --git a/c/net/legacy_darwin_arm64.go b/c/net/legacy_darwin_arm64.go new file mode 100644 index 00000000..b53a53a5 --- /dev/null +++ b/c/net/legacy_darwin_arm64.go @@ -0,0 +1,20 @@ +//go:build darwin && arm64 && !ios + +package net + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +//go:linkname Ntohs C.ntohs +func Ntohs(x uint16) uint16 + +//go:linkname Htons C.htons +func Htons(x uint16) uint16 + +//go:linkname Ntohl C.ntohl +func Ntohl(x c.Uint) c.Uint + +//go:linkname Htonl C.htonl +func Htonl(x c.Uint) c.Uint diff --git a/c/net/legacy_native.go b/c/net/legacy_native.go index f6529e75..ebe3b4ff 100644 --- a/c/net/legacy_native.go +++ b/c/net/legacy_native.go @@ -18,12 +18,6 @@ package net -import ( - "unsafe" - - "github.com/goplus/lib/c" -) - // Keep the existing untyped constants usable with Socket's c.Int parameter. const ( SOCK_STREAM = 1 @@ -32,46 +26,3 @@ const ( SOCK_RDM = 4 SOCK_SEQPACKET = 5 ) - -const ( - ALIGNSIZE = unsafe.Sizeof(c.LongLong(0)) - MAXSIZE = 128 - PAD1_SIZE = ALIGNSIZE - unsafe.Sizeof(byte(0)) - unsafe.Sizeof(byte(0)) - PAD2_SIZE = MAXSIZE - unsafe.Sizeof(byte(0)) - unsafe.Sizeof(byte(0)) - PAD1_SIZE - ALIGNSIZE -) - -//go:linkname Bind C.bind -func Bind(sockfd c.Int, addr *SockaddrIn, addrlen c.Uint) c.Int - -//go:linkname Accept C.accept -func Accept(sockfd c.Int, addr *SockaddrIn, addrlen *c.Uint) c.Int - -//go:linkname GetHostByName C.gethostbyname -func GetHostByName(name *c.Char) *Hostent - -//go:linkname InetNtop C.inet_ntop -func InetNtop(af c.Int, src c.Pointer, dst *c.Char, size c.Uint) *c.Char - -//go:linkname InetAddr C.inet_addr -func InetAddr(s *c.Char) c.Uint - -//go:linkname Send C.send -func Send(c.Int, c.Pointer, uintptr, c.Int) c.Long - -//go:linkname Recv C.recv -func Recv(c.Int, c.Pointer, uintptr, c.Int) c.Long - -//go:linkname Ntohs C.ntohs -func Ntohs(x uint16) uint16 - -//go:linkname Htons C.htons -func Htons(x uint16) uint16 - -//go:linkname Ntohl C.ntohl -func Ntohl(x c.Uint) c.Uint - -//go:linkname Htonl C.htonl -func Htonl(x c.Uint) c.Uint - -//go:linkname Getaddrinfo C.getaddrinfo -func Getaddrinfo(host *c.Char, port *c.Char, addrInfo *AddrInfo, result **AddrInfo) c.Int diff --git a/c/net/libc_darwin_arm64.go b/c/net/libc_darwin_arm64.go index 40b2b4fd..30c633ce 100644 --- a/c/net/libc_darwin_arm64.go +++ b/c/net/libc_darwin_arm64.go @@ -70,16 +70,16 @@ type X__DarwinSsizeT = c.Long // time() type X__DarwinTimeT = c.Long -//go:linkname NativeInetAddr C.inet_addr -func NativeInetAddr(_llcppg_param1 *c.Char) InAddrT +//go:linkname InetAddr C.inet_addr +func InetAddr(_llcppg_param1 *c.Char) InAddrT // llgo:link InAddr.InetNtoa C.inet_ntoa func (self InAddr) InetNtoa() *c.Char { return nil } -//go:linkname NativeInetNtop C.inet_ntop -func NativeInetNtop(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 *c.Char, _llcppg_param4 SocklenT) *c.Char +//go:linkname InetNtop C.inet_ntop +func InetNtop(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 *c.Char, _llcppg_param4 SocklenT) *c.Char //go:linkname InetPton C.inet_pton func InetPton(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 unsafe.Pointer) c.Int @@ -673,14 +673,14 @@ func Freeaddrinfo(self *AddrInfo) //go:linkname GaiStrerror C.gai_strerror func GaiStrerror(_llcppg_param1 c.Int) *c.Char -//go:linkname NativeGetaddrinfo C.getaddrinfo -func NativeGetaddrinfo(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 *AddrInfo, _llcppg_param4 **AddrInfo) c.Int +//go:linkname Getaddrinfo C.getaddrinfo +func Getaddrinfo(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 *AddrInfo, _llcppg_param4 **AddrInfo) c.Int //go:linkname Gethostbyaddr C.gethostbyaddr func Gethostbyaddr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SocklenT, _llcppg_param3 c.Int) *Hostent -//go:linkname NativeGethostbyname C.gethostbyname -func NativeGethostbyname(_llcppg_param1 *c.Char) *Hostent +//go:linkname GetHostByName C.gethostbyname +func GetHostByName(_llcppg_param1 *c.Char) *Hostent //go:linkname Gethostent C.gethostent func Gethostent() *Hostent @@ -2404,11 +2404,11 @@ type SaeConnidT = X__Uint32T // sockaddr endpoints type SaEndpointsT = SaEndpoints -//go:linkname NativeAccept C.accept -func NativeAccept(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 *SocklenT) c.Int +//go:linkname Accept C.accept +func Accept(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 *SocklenT) c.Int -//go:linkname NativeBind C.bind -func NativeBind(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 SocklenT) c.Int +//go:linkname Bind C.bind +func Bind(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 SocklenT) c.Int //go:linkname Connect C.connect func Connect(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 SocklenT) c.Int @@ -2425,8 +2425,8 @@ func Getsockopt(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int //go:linkname Listen C.listen func Listen(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int -//go:linkname NativeRecv C.recv -func NativeRecv(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int) SsizeT +//go:linkname Recv C.recv +func Recv(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.SizeT, _llcppg_param4 c.Int) SsizeT //go:linkname Recvfrom C.recvfrom func Recvfrom(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int, _llcppg_param5 *SockAddr, _llcppg_param6 *SocklenT) SsizeT @@ -2434,8 +2434,8 @@ func Recvfrom(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param //go:linkname Recvmsg C.recvmsg func Recvmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) SsizeT -//go:linkname NativeSend C.send -func NativeSend(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT, _llcppg_param4 c.Int) SsizeT +//go:linkname Send C.send +func Send(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.SizeT, _llcppg_param4 c.Int) SsizeT //go:linkname Sendmsg C.sendmsg func Sendmsg(_llcppg_param1 c.Int, _llcppg_param2 *Msghdr, _llcppg_param3 c.Int) SsizeT @@ -2461,9 +2461,6 @@ func Socketpair(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int //go:linkname Sendfile C.sendfile func Sendfile(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 OffT, _llcppg_param4 *OffT, _llcppg_param5 *SfHdtr, _llcppg_param6 c.Int) c.Int -//go:linkname Pfctlinput C.pfctlinput -func Pfctlinput(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr) - //go:linkname Connectx C.connectx func Connectx(_llcppg_param1 c.Int, _llcppg_param2 *SaEndpointsT, _llcppg_param3 SaeAssocidT, _llcppg_param4 c.Uint, _llcppg_param5 *Iovec, _llcppg_param6 c.Uint, _llcppg_param7 *SizeT, _llcppg_param8 *SaeConnidT) c.Int @@ -2496,3 +2493,11 @@ type SockaddrUn struct { } type Uint32T = c.Uint + +// Compatibility sizes follow this platform's native sockaddr_storage. +const ( + ALIGNSIZE = unsafe.Alignof(SockaddrStorage{}) + MAXSIZE = X_SS_MAXSIZE + PAD1_SIZE = unsafe.Sizeof(SockaddrStorage{}.pad1) + PAD2_SIZE = unsafe.Sizeof(SockaddrStorage{}.pad2) +) diff --git a/c/net/libc_linux_amd64.go b/c/net/libc_linux_amd64.go index a138c5ce..d46d70eb 100644 --- a/c/net/libc_linux_amd64.go +++ b/c/net/libc_linux_amd64.go @@ -18,8 +18,8 @@ const X_ARPA_INET_H = 1 // Convert Internet host address from numbers-and-dots notation in CP // into binary data in network byte order. // -//go:linkname NativeInetAddr C.inet_addr -func NativeInetAddr(__cp *c.Char) InAddrT +//go:linkname InetAddr C.inet_addr +func InetAddr(__cp *c.Char) InAddrT // Return the local host address part of the Internet address in IN. // @@ -66,8 +66,8 @@ func InetPton(__af c.Int, __cp *c.Char, __buf unsafe.Pointer) c.Int // type AF in buffer starting at CP to presentation form and place // result in buffer of length LEN astarting at BUF. // -//go:linkname NativeInetNtop C.inet_ntop -func NativeInetNtop(__af c.Int, __cp unsafe.Pointer, __buf *c.Char, __len SocklenT) *c.Char +//go:linkname InetNtop C.inet_ntop +func InetNtop(__af c.Int, __cp unsafe.Pointer, __buf *c.Char, __len SocklenT) *c.Char // Convert Internet host address from numbers-and-dots notation in CP // into binary data and store the result in the structure INP. @@ -730,11 +730,6 @@ type Linger struct { type SocklenT = X__SocklenT -// llgo:link (*Msghdr).X__CmsgNxthdr C.__cmsg_nxthdr -func (self *Msghdr) X__CmsgNxthdr(__cmsg *Cmsghdr) *Cmsghdr { - return nil -} - // Types of sockets. type X__SocketType c.Uint @@ -1194,11 +1189,6 @@ type AddrInfo struct { Next *AddrInfo } -// Function to get address of global `h_errno' variable. -// -//go:linkname X__HErrnoLocation C.__h_errno_location -func X__HErrnoLocation() *c.Int - // Print error indicated by `h_errno' variable on standard error. STR // if non-null is printed before the error string. // @@ -1250,8 +1240,8 @@ func Gethostbyaddr(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int) *Host // This function is a possible cancellation point and therefore not // marked with __THROW. // -//go:linkname NativeGethostbyname C.gethostbyname -func NativeGethostbyname(__name *c.Char) *Hostent +//go:linkname GetHostByName C.gethostbyname +func GetHostByName(__name *c.Char) *Hostent // Return entry from host data base for host with NAME. AF must be // set to the address type which is `AF_INET' for IPv4 or `AF_INET6' @@ -1658,11 +1648,9 @@ func RresvportAf(__alport *c.Int, __af SaFamilyT) c.Int // This function is a possible cancellation point and therefore not // marked with __THROW. // -//go:linkname NativeGetaddrinfo C.getaddrinfo -func NativeGetaddrinfo(__name *c.Char, __service *c.Char, __req *AddrInfo, __pai **AddrInfo) c.Int +//go:linkname Getaddrinfo C.getaddrinfo +func Getaddrinfo(__name *c.Char, __service *c.Char, __req *AddrInfo, __pai **AddrInfo) c.Int -// NativeFree `addrinfo' structure AI including associated storage. -// //go:linkname Freeaddrinfo C.freeaddrinfo func Freeaddrinfo(self *AddrInfo) @@ -1875,28 +1863,23 @@ var In6addrAny In6Addr //go:linkname In6addrLoopback C.in6addr_loopback var In6addrLoopback In6Addr -//go:linkname NativeNtohl C.ntohl -func NativeNtohl(__netlong Uint32T) Uint32T +//go:linkname Ntohl C.ntohl +func Ntohl(__netlong Uint32T) Uint32T -//go:linkname NativeNtohs C.ntohs -func NativeNtohs(__netshort Uint16T) Uint16T +//go:linkname Ntohs C.ntohs +func Ntohs(__netshort Uint16T) Uint16T -//go:linkname NativeHtonl C.htonl -func NativeHtonl(__hostlong Uint32T) Uint32T +//go:linkname Htonl C.htonl +func Htonl(__hostlong Uint32T) Uint32T -//go:linkname NativeHtons C.htons -func NativeHtons(__hostshort Uint16T) Uint16T +//go:linkname Htons C.htons +func Htons(__hostshort Uint16T) Uint16T // Bind socket to a privileged IP port. // //go:linkname Bindresvport C.bindresvport func Bindresvport(__sockfd c.Int, __sock_in *SockaddrIn) c.Int -// The IPv6 version of this function. -// -//go:linkname Bindresvport6 C.bindresvport6 -func Bindresvport6(__sockfd c.Int, __sock_in *SockaddrIn6) c.Int - const X_RPC_NETDB_H = 1 type Rpcent struct { @@ -1970,8 +1953,8 @@ func Socketpair(__domain c.Int, __type c.Int, __protocol c.Int, __fds *c.Int) c. // Give the socket FD the local address ADDR (which is LEN bytes long). // -//go:linkname NativeBind C.bind -func NativeBind(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int +//go:linkname Bind C.bind +func Bind(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int // Put the local address of FD into *ADDR and its length in *LEN. // @@ -1995,13 +1978,13 @@ func Connect(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int //go:linkname Getpeername C.getpeername func Getpeername(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int -// NativeSend N bytes of BUF to socket FD. Returns the number sent or -1. +// Send N bytes of BUF to socket FD. Returns the number sent or -1. // // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeSend C.send -func NativeSend(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int) SsizeT +//go:linkname Send C.send +func Send(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __flags c.Int) SsizeT // Read N bytes into BUF from socket FD. // Returns the number read or -1 for errors. @@ -2009,8 +1992,8 @@ func NativeSend(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int) Ssiz // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeRecv C.recv -func NativeRecv(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int) SsizeT +//go:linkname Recv C.recv +func Recv(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __flags c.Int) SsizeT // Send N bytes of BUF on socket FD to peer at address ADDR (which is // ADDR_LEN bytes long). Returns the number sent, or -1 for errors. @@ -2080,8 +2063,8 @@ func Listen(__fd c.Int, __n c.Int) c.Int // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeAccept C.accept -func NativeAccept(__fd c.Int, __addr *SockAddr, __addr_len *SocklenT) c.Int +//go:linkname Accept C.accept +func Accept(__fd c.Int, __addr *SockAddr, __addr_len *SocklenT) c.Int // Shut down all or part of the connection open on socket FD. // HOW determines what to shut down: @@ -2114,3 +2097,11 @@ type SockaddrUn struct { SunFamily SaFamilyT SunPath [108]c.Char } + +// Compatibility sizes follow this platform's native sockaddr_storage. +const ( + ALIGNSIZE = unsafe.Alignof(SockaddrStorage{}) + MAXSIZE = X_SS_SIZE + PAD1_SIZE = unsafe.Sizeof(SockaddrStorage{}.pad) + PAD2_SIZE = unsafe.Sizeof(SockaddrStorage{}) - unsafe.Offsetof(SockaddrStorage{}.align) - unsafe.Sizeof(SockaddrStorage{}.align) +) diff --git a/c/net/libc_linux_arm64.go b/c/net/libc_linux_arm64.go index aaa481a2..645ae98e 100644 --- a/c/net/libc_linux_arm64.go +++ b/c/net/libc_linux_arm64.go @@ -18,8 +18,8 @@ const X_ARPA_INET_H = 1 // Convert Internet host address from numbers-and-dots notation in CP // into binary data in network byte order. // -//go:linkname NativeInetAddr C.inet_addr -func NativeInetAddr(__cp *uint8) InAddrT +//go:linkname InetAddr C.inet_addr +func InetAddr(__cp *c.Char) InAddrT // Return the local host address part of the Internet address in IN. // @@ -66,8 +66,8 @@ func InetPton(__af c.Int, __cp *uint8, __buf unsafe.Pointer) c.Int // type AF in buffer starting at CP to presentation form and place // result in buffer of length LEN astarting at BUF. // -//go:linkname NativeInetNtop C.inet_ntop -func NativeInetNtop(__af c.Int, __cp unsafe.Pointer, __buf *uint8, __len SocklenT) *uint8 +//go:linkname InetNtop C.inet_ntop +func InetNtop(__af c.Int, __cp unsafe.Pointer, __buf *c.Char, __len SocklenT) *c.Char // Convert Internet host address from numbers-and-dots notation in CP // into binary data and store the result in the structure INP. @@ -730,11 +730,6 @@ type Linger struct { type SocklenT = X__SocklenT -// llgo:link (*Msghdr).X__CmsgNxthdr C.__cmsg_nxthdr -func (self *Msghdr) X__CmsgNxthdr(__cmsg *Cmsghdr) *Cmsghdr { - return nil -} - // Types of sockets. type X__SocketType c.Uint @@ -1194,11 +1189,6 @@ type AddrInfo struct { Next *AddrInfo } -// Function to get address of global `h_errno' variable. -// -//go:linkname X__HErrnoLocation C.__h_errno_location -func X__HErrnoLocation() *c.Int - // Print error indicated by `h_errno' variable on standard error. STR // if non-null is printed before the error string. // @@ -1250,8 +1240,8 @@ func Gethostbyaddr(__addr unsafe.Pointer, __len X__SocklenT, __type c.Int) *Host // This function is a possible cancellation point and therefore not // marked with __THROW. // -//go:linkname NativeGethostbyname C.gethostbyname -func NativeGethostbyname(__name *uint8) *Hostent +//go:linkname GetHostByName C.gethostbyname +func GetHostByName(__name *c.Char) *Hostent // Return entry from host data base for host with NAME. AF must be // set to the address type which is `AF_INET' for IPv4 or `AF_INET6' @@ -1658,11 +1648,9 @@ func RresvportAf(__alport *c.Int, __af SaFamilyT) c.Int // This function is a possible cancellation point and therefore not // marked with __THROW. // -//go:linkname NativeGetaddrinfo C.getaddrinfo -func NativeGetaddrinfo(__name *uint8, __service *uint8, __req *AddrInfo, __pai **AddrInfo) c.Int +//go:linkname Getaddrinfo C.getaddrinfo +func Getaddrinfo(__name *c.Char, __service *c.Char, __req *AddrInfo, __pai **AddrInfo) c.Int -// NativeFree `addrinfo' structure AI including associated storage. -// //go:linkname Freeaddrinfo C.freeaddrinfo func Freeaddrinfo(self *AddrInfo) @@ -1875,28 +1863,23 @@ var In6addrAny In6Addr //go:linkname In6addrLoopback C.in6addr_loopback var In6addrLoopback In6Addr -//go:linkname NativeNtohl C.ntohl -func NativeNtohl(__netlong Uint32T) Uint32T +//go:linkname Ntohl C.ntohl +func Ntohl(__netlong Uint32T) Uint32T -//go:linkname NativeNtohs C.ntohs -func NativeNtohs(__netshort Uint16T) Uint16T +//go:linkname Ntohs C.ntohs +func Ntohs(__netshort Uint16T) Uint16T -//go:linkname NativeHtonl C.htonl -func NativeHtonl(__hostlong Uint32T) Uint32T +//go:linkname Htonl C.htonl +func Htonl(__hostlong Uint32T) Uint32T -//go:linkname NativeHtons C.htons -func NativeHtons(__hostshort Uint16T) Uint16T +//go:linkname Htons C.htons +func Htons(__hostshort Uint16T) Uint16T // Bind socket to a privileged IP port. // //go:linkname Bindresvport C.bindresvport func Bindresvport(__sockfd c.Int, __sock_in *SockaddrIn) c.Int -// The IPv6 version of this function. -// -//go:linkname Bindresvport6 C.bindresvport6 -func Bindresvport6(__sockfd c.Int, __sock_in *SockaddrIn6) c.Int - const X_RPC_NETDB_H = 1 type Rpcent struct { @@ -1970,8 +1953,8 @@ func Socketpair(__domain c.Int, __type c.Int, __protocol c.Int, __fds *c.Int) c. // Give the socket FD the local address ADDR (which is LEN bytes long). // -//go:linkname NativeBind C.bind -func NativeBind(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int +//go:linkname Bind C.bind +func Bind(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int // Put the local address of FD into *ADDR and its length in *LEN. // @@ -1995,13 +1978,13 @@ func Connect(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int //go:linkname Getpeername C.getpeername func Getpeername(__fd c.Int, __addr *SockAddr, __len *SocklenT) c.Int -// NativeSend N bytes of BUF to socket FD. Returns the number sent or -1. +// Send N bytes of BUF to socket FD. Returns the number sent or -1. // // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeSend C.send -func NativeSend(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int) SsizeT +//go:linkname Send C.send +func Send(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __flags c.Int) SsizeT // Read N bytes into BUF from socket FD. // Returns the number read or -1 for errors. @@ -2009,8 +1992,8 @@ func NativeSend(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int) Ssiz // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeRecv C.recv -func NativeRecv(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __flags c.Int) SsizeT +//go:linkname Recv C.recv +func Recv(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __flags c.Int) SsizeT // Send N bytes of BUF on socket FD to peer at address ADDR (which is // ADDR_LEN bytes long). Returns the number sent, or -1 for errors. @@ -2080,8 +2063,8 @@ func Listen(__fd c.Int, __n c.Int) c.Int // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeAccept C.accept -func NativeAccept(__fd c.Int, __addr *SockAddr, __addr_len *SocklenT) c.Int +//go:linkname Accept C.accept +func Accept(__fd c.Int, __addr *SockAddr, __addr_len *SocklenT) c.Int // Shut down all or part of the connection open on socket FD. // HOW determines what to shut down: @@ -2114,3 +2097,11 @@ type SockaddrUn struct { SunFamily SaFamilyT SunPath [108]uint8 } + +// Compatibility sizes follow this platform's native sockaddr_storage. +const ( + ALIGNSIZE = unsafe.Alignof(SockaddrStorage{}) + MAXSIZE = X_SS_SIZE + PAD1_SIZE = unsafe.Sizeof(SockaddrStorage{}.pad) + PAD2_SIZE = unsafe.Sizeof(SockaddrStorage{}) - unsafe.Offsetof(SockaddrStorage{}.align) - unsafe.Sizeof(SockaddrStorage{}.align) +) diff --git a/c/net/libc_native_darwin_arm64_llgo_test.go b/c/net/libc_native_darwin_arm64_llgo_test.go new file mode 100644 index 00000000..f271f680 --- /dev/null +++ b/c/net/libc_native_darwin_arm64_llgo_test.go @@ -0,0 +1,1828 @@ +//go:build llgo && darwin && arm64 && !ios + +package net + +import ( + "github.com/goplus/lib/c" + "go/ast" + "go/parser" + "go/token" + "reflect" + "runtime" + "strings" + "testing" + "unsafe" +) + +type nativeNetworkChar = c.Char + +func TestGeneratedNetworkLayouts(t *testing.T) { + // Expected values are compiled from the original macOS 14 SDK C headers. + var networkFunctionSymbols = []struct { + name string + address unsafe.Pointer + }{ + {"InetAddr", c.Func(InetAddr)}, + {"InAddr.InetNtoa", c.Func((InAddr).InetNtoa)}, + {"InetNtop", c.Func(InetNtop)}, + {"InetPton", c.Func(InetPton)}, + {"Ascii2addr", c.Func(Ascii2addr)}, + {"Addr2ascii", c.Func(Addr2ascii)}, + {"InetAton", c.Func(InetAton)}, + {"InAddr.InetLnaof", c.Func((InAddr).InetLnaof)}, + {"InetMakeaddr", c.Func(InetMakeaddr)}, + {"InAddr.InetNetof", c.Func((InAddr).InetNetof)}, + {"InetNetwork", c.Func(InetNetwork)}, + {"InetNetNtop", c.Func(InetNetNtop)}, + {"InetNetPton", c.Func(InetNetPton)}, + {"InetNeta", c.Func(InetNeta)}, + {"InetNsapAddr", c.Func(InetNsapAddr)}, + {"InetNsapNtoa", c.Func(InetNsapNtoa)}, + {"IfNametoindex", c.Func(IfNametoindex)}, + {"IfIndextoname", c.Func(IfIndextoname)}, + {"IfNameindex", c.Func(IfNameindex)}, + {"*IfNameindexT.IfFreenameindex", c.Func((*IfNameindexT).IfFreenameindex)}, + {"Endhostent", c.Func(Endhostent)}, + {"Endnetent", c.Func(Endnetent)}, + {"Endprotoent", c.Func(Endprotoent)}, + {"Endservent", c.Func(Endservent)}, + {"Freeaddrinfo", c.Func(Freeaddrinfo)}, + {"GaiStrerror", c.Func(GaiStrerror)}, + {"Getaddrinfo", c.Func(Getaddrinfo)}, + {"Gethostbyaddr", c.Func(Gethostbyaddr)}, + {"GetHostByName", c.Func(GetHostByName)}, + {"Gethostent", c.Func(Gethostent)}, + {"*SockAddr.Getnameinfo", c.Func((*SockAddr).Getnameinfo)}, + {"Getnetbyaddr", c.Func(Getnetbyaddr)}, + {"Getnetbyname", c.Func(Getnetbyname)}, + {"Getnetent", c.Func(Getnetent)}, + {"Getprotobyname", c.Func(Getprotobyname)}, + {"Getprotobynumber", c.Func(Getprotobynumber)}, + {"Getprotoent", c.Func(Getprotoent)}, + {"Getservbyname", c.Func(Getservbyname)}, + {"Getservbyport", c.Func(Getservbyport)}, + {"Getservent", c.Func(Getservent)}, + {"Sethostent", c.Func(Sethostent)}, + {"Setnetent", c.Func(Setnetent)}, + {"Setprotoent", c.Func(Setprotoent)}, + {"Setservent", c.Func(Setservent)}, + {"*Hostent.Free", c.Func((*Hostent).Free)}, + {"Gethostbyname2", c.Func(Gethostbyname2)}, + {"Getipnodebyaddr", c.Func(Getipnodebyaddr)}, + {"Getipnodebyname", c.Func(Getipnodebyname)}, + {"Getrpcbyname", c.Func(Getrpcbyname)}, + {"Getrpcbynumber", c.Func(Getrpcbynumber)}, + {"Getrpcent", c.Func(Getrpcent)}, + {"Setrpcent", c.Func(Setrpcent)}, + {"Endrpcent", c.Func(Endrpcent)}, + {"Herror", c.Func(Herror)}, + {"Hstrerror", c.Func(Hstrerror)}, + {"Innetgr", c.Func(Innetgr)}, + {"Getnetgrent", c.Func(Getnetgrent)}, + {"Endnetgrent", c.Func(Endnetgrent)}, + {"Setnetgrent", c.Func(Setnetgrent)}, + {"Setipv4sourcefilter", c.Func(Setipv4sourcefilter)}, + {"Getipv4sourcefilter", c.Func(Getipv4sourcefilter)}, + {"Setsourcefilter", c.Func(Setsourcefilter)}, + {"Getsourcefilter", c.Func(Getsourcefilter)}, + {"Bindresvport", c.Func(Bindresvport)}, + {"BindresvportSa", c.Func(BindresvportSa)}, + {"Inet6OptionSpace", c.Func(Inet6OptionSpace)}, + {"Inet6OptionInit", c.Func(Inet6OptionInit)}, + {"*Cmsghdr.Inet6OptionAppend", c.Func((*Cmsghdr).Inet6OptionAppend)}, + {"*Cmsghdr.Inet6OptionAlloc", c.Func((*Cmsghdr).Inet6OptionAlloc)}, + {"*Cmsghdr.Inet6OptionNext", c.Func((*Cmsghdr).Inet6OptionNext)}, + {"*Cmsghdr.Inet6OptionFind", c.Func((*Cmsghdr).Inet6OptionFind)}, + {"Inet6RthdrSpace", c.Func(Inet6RthdrSpace)}, + {"Inet6RthdrInit", c.Func(Inet6RthdrInit)}, + {"*Cmsghdr.Inet6RthdrAdd", c.Func((*Cmsghdr).Inet6RthdrAdd)}, + {"*Cmsghdr.Inet6RthdrLasthop", c.Func((*Cmsghdr).Inet6RthdrLasthop)}, + {"*Cmsghdr.Inet6RthdrSegments", c.Func((*Cmsghdr).Inet6RthdrSegments)}, + {"*Cmsghdr.Inet6RthdrGetaddr", c.Func((*Cmsghdr).Inet6RthdrGetaddr)}, + {"*Cmsghdr.Inet6RthdrGetflags", c.Func((*Cmsghdr).Inet6RthdrGetflags)}, + {"Inet6OptInit", c.Func(Inet6OptInit)}, + {"Inet6OptAppend", c.Func(Inet6OptAppend)}, + {"Inet6OptFinish", c.Func(Inet6OptFinish)}, + {"Inet6OptSetVal", c.Func(Inet6OptSetVal)}, + {"Inet6OptNext", c.Func(Inet6OptNext)}, + {"Inet6OptFind", c.Func(Inet6OptFind)}, + {"Inet6OptGetVal", c.Func(Inet6OptGetVal)}, + {"Inet6RthSpace", c.Func(Inet6RthSpace)}, + {"Inet6RthInit", c.Func(Inet6RthInit)}, + {"Inet6RthAdd", c.Func(Inet6RthAdd)}, + {"Inet6RthReverse", c.Func(Inet6RthReverse)}, + {"Inet6RthSegments", c.Func(Inet6RthSegments)}, + {"Inet6RthGetaddr", c.Func(Inet6RthGetaddr)}, + {"Accept", c.Func(Accept)}, + {"Bind", c.Func(Bind)}, + {"Connect", c.Func(Connect)}, + {"Getpeername", c.Func(Getpeername)}, + {"Getsockname", c.Func(Getsockname)}, + {"Getsockopt", c.Func(Getsockopt)}, + {"Listen", c.Func(Listen)}, + {"Recv", c.Func(Recv)}, + {"Recvfrom", c.Func(Recvfrom)}, + {"Recvmsg", c.Func(Recvmsg)}, + {"Send", c.Func(Send)}, + {"Sendmsg", c.Func(Sendmsg)}, + {"Sendto", c.Func(Sendto)}, + {"SetSockOpt", c.Func(SetSockOpt)}, + {"Shutdown", c.Func(Shutdown)}, + {"Sockatmark", c.Func(Sockatmark)}, + {"Socket", c.Func(Socket)}, + {"Socketpair", c.Func(Socketpair)}, + {"Sendfile", c.Func(Sendfile)}, + {"Connectx", c.Func(Connectx)}, + {"Disconnectx", c.Func(Disconnectx)}, + {"Ntohs", c.Func(Ntohs)}, + {"Htons", c.Func(Htons)}, + {"Ntohl", c.Func(Ntohl)}, + {"Htonl", c.Func(Htonl)}, + } + var networkFunctionPrototypes = []struct { + name string + signature reflect.Type + inputs []networkABISlot + output *networkABISlot + variadic bool + }{ + {"InetAddr", reflect.TypeOf(InetAddr), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"InAddr.InetNtoa", reflect.TypeOf((InAddr).InetNtoa), []networkABISlot{{4, 4, 12}}, &networkABISlot{8, 8, 5}, false}, + {"InetNtop", reflect.TypeOf(InetNtop), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"InetPton", reflect.TypeOf(InetPton), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Ascii2addr", reflect.TypeOf(Ascii2addr), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Addr2ascii", reflect.TypeOf(Addr2ascii), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"InetAton", reflect.TypeOf(InetAton), []networkABISlot{{8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"InAddr.InetLnaof", reflect.TypeOf((InAddr).InetLnaof), []networkABISlot{{4, 4, 12}}, &networkABISlot{4, 4, 1}, false}, + {"InetMakeaddr", reflect.TypeOf(InetMakeaddr), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 12}, false}, + {"InAddr.InetNetof", reflect.TypeOf((InAddr).InetNetof), []networkABISlot{{4, 4, 12}}, &networkABISlot{4, 4, 1}, false}, + {"InetNetwork", reflect.TypeOf(InetNetwork), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"InetNetNtop", reflect.TypeOf(InetNetNtop), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 1}}, &networkABISlot{8, 8, 5}, false}, + {"InetNetPton", reflect.TypeOf(InetNetPton), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &networkABISlot{4, 4, 1}, false}, + {"InetNeta", reflect.TypeOf(InetNeta), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}}, &networkABISlot{8, 8, 5}, false}, + {"InetNsapAddr", reflect.TypeOf(InetNsapAddr), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"InetNsapNtoa", reflect.TypeOf(InetNsapNtoa), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"IfNametoindex", reflect.TypeOf(IfNametoindex), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"IfIndextoname", reflect.TypeOf(IfIndextoname), []networkABISlot{{4, 4, 1}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"IfNameindex", reflect.TypeOf(IfNameindex), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"*IfNameindexT.IfFreenameindex", reflect.TypeOf((*IfNameindexT).IfFreenameindex), []networkABISlot{{8, 8, 5}}, nil, false}, + {"Endhostent", reflect.TypeOf(Endhostent), []networkABISlot{}, nil, false}, + {"Endnetent", reflect.TypeOf(Endnetent), []networkABISlot{}, nil, false}, + {"Endprotoent", reflect.TypeOf(Endprotoent), []networkABISlot{}, nil, false}, + {"Endservent", reflect.TypeOf(Endservent), []networkABISlot{}, nil, false}, + {"Freeaddrinfo", reflect.TypeOf(Freeaddrinfo), []networkABISlot{{8, 8, 5}}, nil, false}, + {"GaiStrerror", reflect.TypeOf(GaiStrerror), []networkABISlot{{4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"Getaddrinfo", reflect.TypeOf(Getaddrinfo), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Gethostbyaddr", reflect.TypeOf(Gethostbyaddr), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"GetHostByName", reflect.TypeOf(GetHostByName), []networkABISlot{{8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Gethostent", reflect.TypeOf(Gethostent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"*SockAddr.Getnameinfo", reflect.TypeOf((*SockAddr).Getnameinfo), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Getnetbyaddr", reflect.TypeOf(Getnetbyaddr), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"Getnetbyname", reflect.TypeOf(Getnetbyname), []networkABISlot{{8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Getnetent", reflect.TypeOf(Getnetent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"Getprotobyname", reflect.TypeOf(Getprotobyname), []networkABISlot{{8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Getprotobynumber", reflect.TypeOf(Getprotobynumber), []networkABISlot{{4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"Getprotoent", reflect.TypeOf(Getprotoent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"Getservbyname", reflect.TypeOf(Getservbyname), []networkABISlot{{8, 8, 5}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Getservbyport", reflect.TypeOf(Getservbyport), []networkABISlot{{4, 4, 1}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Getservent", reflect.TypeOf(Getservent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"Sethostent", reflect.TypeOf(Sethostent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"Setnetent", reflect.TypeOf(Setnetent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"Setprotoent", reflect.TypeOf(Setprotoent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"Setservent", reflect.TypeOf(Setservent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"*Hostent.Free", reflect.TypeOf((*Hostent).Free), []networkABISlot{{8, 8, 5}}, nil, false}, + {"Gethostbyname2", reflect.TypeOf(Gethostbyname2), []networkABISlot{{8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"Getipnodebyaddr", reflect.TypeOf(Getipnodebyaddr), []networkABISlot{{8, 8, 5}, {8, 8, 1}, {4, 4, 1}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Getipnodebyname", reflect.TypeOf(Getipnodebyname), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Getrpcbyname", reflect.TypeOf(Getrpcbyname), []networkABISlot{{8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Getrpcbynumber", reflect.TypeOf(Getrpcbynumber), []networkABISlot{{4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"Getrpcent", reflect.TypeOf(Getrpcent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"Setrpcent", reflect.TypeOf(Setrpcent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"Endrpcent", reflect.TypeOf(Endrpcent), []networkABISlot{}, nil, false}, + {"Herror", reflect.TypeOf(Herror), []networkABISlot{{8, 8, 5}}, nil, false}, + {"Hstrerror", reflect.TypeOf(Hstrerror), []networkABISlot{{4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"Innetgr", reflect.TypeOf(Innetgr), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Getnetgrent", reflect.TypeOf(Getnetgrent), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Endnetgrent", reflect.TypeOf(Endnetgrent), []networkABISlot{}, nil, false}, + {"Setnetgrent", reflect.TypeOf(Setnetgrent), []networkABISlot{{8, 8, 5}}, nil, false}, + {"Setipv4sourcefilter", reflect.TypeOf(Setipv4sourcefilter), []networkABISlot{{4, 4, 1}, {4, 4, 12}, {4, 4, 12}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Getipv4sourcefilter", reflect.TypeOf(Getipv4sourcefilter), []networkABISlot{{4, 4, 1}, {4, 4, 12}, {4, 4, 12}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Setsourcefilter", reflect.TypeOf(Setsourcefilter), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Getsourcefilter", reflect.TypeOf(Getsourcefilter), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Bindresvport", reflect.TypeOf(Bindresvport), []networkABISlot{{4, 4, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"BindresvportSa", reflect.TypeOf(BindresvportSa), []networkABISlot{{4, 4, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6OptionSpace", reflect.TypeOf(Inet6OptionSpace), []networkABISlot{{4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6OptionInit", reflect.TypeOf(Inet6OptionInit), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"*Cmsghdr.Inet6OptionAppend", reflect.TypeOf((*Cmsghdr).Inet6OptionAppend), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"*Cmsghdr.Inet6OptionAlloc", reflect.TypeOf((*Cmsghdr).Inet6OptionAlloc), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {4, 4, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"*Cmsghdr.Inet6OptionNext", reflect.TypeOf((*Cmsghdr).Inet6OptionNext), []networkABISlot{{8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"*Cmsghdr.Inet6OptionFind", reflect.TypeOf((*Cmsghdr).Inet6OptionFind), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6RthdrSpace", reflect.TypeOf(Inet6RthdrSpace), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Inet6RthdrInit", reflect.TypeOf(Inet6RthdrInit), []networkABISlot{{8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"*Cmsghdr.Inet6RthdrAdd", reflect.TypeOf((*Cmsghdr).Inet6RthdrAdd), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"*Cmsghdr.Inet6RthdrLasthop", reflect.TypeOf((*Cmsghdr).Inet6RthdrLasthop), []networkABISlot{{8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"*Cmsghdr.Inet6RthdrSegments", reflect.TypeOf((*Cmsghdr).Inet6RthdrSegments), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"*Cmsghdr.Inet6RthdrGetaddr", reflect.TypeOf((*Cmsghdr).Inet6RthdrGetaddr), []networkABISlot{{8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"*Cmsghdr.Inet6RthdrGetflags", reflect.TypeOf((*Cmsghdr).Inet6RthdrGetflags), []networkABISlot{{8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6OptInit", reflect.TypeOf(Inet6OptInit), []networkABISlot{{8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6OptAppend", reflect.TypeOf(Inet6OptAppend), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {4, 4, 1}, {1, 1, 1}, {4, 4, 1}, {1, 1, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6OptFinish", reflect.TypeOf(Inet6OptFinish), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6OptSetVal", reflect.TypeOf(Inet6OptSetVal), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6OptNext", reflect.TypeOf(Inet6OptNext), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6OptFind", reflect.TypeOf(Inet6OptFind), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {4, 4, 1}, {1, 1, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6OptGetVal", reflect.TypeOf(Inet6OptGetVal), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6RthSpace", reflect.TypeOf(Inet6RthSpace), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6RthInit", reflect.TypeOf(Inet6RthInit), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {4, 4, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"Inet6RthAdd", reflect.TypeOf(Inet6RthAdd), []networkABISlot{{8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6RthReverse", reflect.TypeOf(Inet6RthReverse), []networkABISlot{{8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6RthSegments", reflect.TypeOf(Inet6RthSegments), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Inet6RthGetaddr", reflect.TypeOf(Inet6RthGetaddr), []networkABISlot{{8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"Accept", reflect.TypeOf(Accept), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Bind", reflect.TypeOf(Bind), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Connect", reflect.TypeOf(Connect), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Getpeername", reflect.TypeOf(Getpeername), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Getsockname", reflect.TypeOf(Getsockname), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Getsockopt", reflect.TypeOf(Getsockopt), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Listen", reflect.TypeOf(Listen), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Recv", reflect.TypeOf(Recv), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Recvfrom", reflect.TypeOf(Recvfrom), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{8, 8, 1}, false}, + {"Recvmsg", reflect.TypeOf(Recvmsg), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Send", reflect.TypeOf(Send), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Sendmsg", reflect.TypeOf(Sendmsg), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Sendto", reflect.TypeOf(Sendto), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"SetSockOpt", reflect.TypeOf(SetSockOpt), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Shutdown", reflect.TypeOf(Shutdown), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Sockatmark", reflect.TypeOf(Sockatmark), []networkABISlot{{4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Socket", reflect.TypeOf(Socket), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Socketpair", reflect.TypeOf(Socketpair), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Sendfile", reflect.TypeOf(Sendfile), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Connectx", reflect.TypeOf(Connectx), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Disconnectx", reflect.TypeOf(Disconnectx), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Ntohs", reflect.TypeOf(Ntohs), []networkABISlot{{2, 2, 1}}, &networkABISlot{2, 2, 1}, false}, + {"Htons", reflect.TypeOf(Htons), []networkABISlot{{2, 2, 1}}, &networkABISlot{2, 2, 1}, false}, + {"Ntohl", reflect.TypeOf(Ntohl), []networkABISlot{{4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Htonl", reflect.TypeOf(Htonl), []networkABISlot{{4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + } + var networkTypeLayouts = []struct { + symbol, property string + got, want uintptr + }{ + {"X__MbstateT", "size", unsafe.Sizeof(*new(X__MbstateT)), 128}, + {"X__MbstateT", "alignment", unsafe.Alignof(*new(X__MbstateT)), 8}, + {"X__Int8T", "size", unsafe.Sizeof(*new(X__Int8T)), 1}, + {"X__Int8T", "alignment", unsafe.Alignof(*new(X__Int8T)), 1}, + {"X__Uint8T", "size", unsafe.Sizeof(*new(X__Uint8T)), 1}, + {"X__Uint8T", "alignment", unsafe.Alignof(*new(X__Uint8T)), 1}, + {"X__Int16T", "size", unsafe.Sizeof(*new(X__Int16T)), 2}, + {"X__Int16T", "alignment", unsafe.Alignof(*new(X__Int16T)), 2}, + {"X__Uint16T", "size", unsafe.Sizeof(*new(X__Uint16T)), 2}, + {"X__Uint16T", "alignment", unsafe.Alignof(*new(X__Uint16T)), 2}, + {"X__Int32T", "size", unsafe.Sizeof(*new(X__Int32T)), 4}, + {"X__Int32T", "alignment", unsafe.Alignof(*new(X__Int32T)), 4}, + {"X__Uint32T", "size", unsafe.Sizeof(*new(X__Uint32T)), 4}, + {"X__Uint32T", "alignment", unsafe.Alignof(*new(X__Uint32T)), 4}, + {"X__Int64T", "size", unsafe.Sizeof(*new(X__Int64T)), 8}, + {"X__Int64T", "alignment", unsafe.Alignof(*new(X__Int64T)), 8}, + {"X__Uint64T", "size", unsafe.Sizeof(*new(X__Uint64T)), 8}, + {"X__Uint64T", "alignment", unsafe.Alignof(*new(X__Uint64T)), 8}, + {"X__DarwinIntptrT", "size", unsafe.Sizeof(*new(X__DarwinIntptrT)), 8}, + {"X__DarwinIntptrT", "alignment", unsafe.Alignof(*new(X__DarwinIntptrT)), 8}, + {"X__DarwinNaturalT", "size", unsafe.Sizeof(*new(X__DarwinNaturalT)), 4}, + {"X__DarwinNaturalT", "alignment", unsafe.Alignof(*new(X__DarwinNaturalT)), 4}, + {"X__DarwinCtRuneT", "size", unsafe.Sizeof(*new(X__DarwinCtRuneT)), 4}, + {"X__DarwinCtRuneT", "alignment", unsafe.Alignof(*new(X__DarwinCtRuneT)), 4}, + {"X__DarwinMbstateT", "size", unsafe.Sizeof(*new(X__DarwinMbstateT)), 128}, + {"X__DarwinMbstateT", "alignment", unsafe.Alignof(*new(X__DarwinMbstateT)), 8}, + {"X__DarwinPtrdiffT", "size", unsafe.Sizeof(*new(X__DarwinPtrdiffT)), 8}, + {"X__DarwinPtrdiffT", "alignment", unsafe.Alignof(*new(X__DarwinPtrdiffT)), 8}, + {"X__DarwinSizeT", "size", unsafe.Sizeof(*new(X__DarwinSizeT)), 8}, + {"X__DarwinSizeT", "alignment", unsafe.Alignof(*new(X__DarwinSizeT)), 8}, + {"X__DarwinWcharT", "size", unsafe.Sizeof(*new(X__DarwinWcharT)), 4}, + {"X__DarwinWcharT", "alignment", unsafe.Alignof(*new(X__DarwinWcharT)), 4}, + {"X__DarwinRuneT", "size", unsafe.Sizeof(*new(X__DarwinRuneT)), 4}, + {"X__DarwinRuneT", "alignment", unsafe.Alignof(*new(X__DarwinRuneT)), 4}, + {"X__DarwinWintT", "size", unsafe.Sizeof(*new(X__DarwinWintT)), 4}, + {"X__DarwinWintT", "alignment", unsafe.Alignof(*new(X__DarwinWintT)), 4}, + {"X__DarwinClockT", "size", unsafe.Sizeof(*new(X__DarwinClockT)), 8}, + {"X__DarwinClockT", "alignment", unsafe.Alignof(*new(X__DarwinClockT)), 8}, + {"X__DarwinSocklenT", "size", unsafe.Sizeof(*new(X__DarwinSocklenT)), 4}, + {"X__DarwinSocklenT", "alignment", unsafe.Alignof(*new(X__DarwinSocklenT)), 4}, + {"X__DarwinSsizeT", "size", unsafe.Sizeof(*new(X__DarwinSsizeT)), 8}, + {"X__DarwinSsizeT", "alignment", unsafe.Alignof(*new(X__DarwinSsizeT)), 8}, + {"X__DarwinTimeT", "size", unsafe.Sizeof(*new(X__DarwinTimeT)), 8}, + {"X__DarwinTimeT", "alignment", unsafe.Alignof(*new(X__DarwinTimeT)), 8}, + {"IfClonereq", "size", unsafe.Sizeof(*new(IfClonereq)), 16}, + {"IfClonereq", "alignment", unsafe.Alignof(*new(IfClonereq)), 8}, + {"IfClonereq", "IfcrTotal offset", unsafe.Offsetof((*new(IfClonereq)).IfcrTotal), 0}, + {"IfClonereq", "IfcrTotal size", unsafe.Sizeof((*new(IfClonereq)).IfcrTotal), 4}, + {"IfClonereq", "IfcrTotal alignment", unsafe.Alignof((*new(IfClonereq)).IfcrTotal), 4}, + {"IfClonereq", "IfcrCount offset", unsafe.Offsetof((*new(IfClonereq)).IfcrCount), 4}, + {"IfClonereq", "IfcrCount size", unsafe.Sizeof((*new(IfClonereq)).IfcrCount), 4}, + {"IfClonereq", "IfcrCount alignment", unsafe.Alignof((*new(IfClonereq)).IfcrCount), 4}, + {"IfClonereq", "IfcrBuffer offset", unsafe.Offsetof((*new(IfClonereq)).IfcrBuffer), 8}, + {"IfClonereq", "IfcrBuffer size", unsafe.Sizeof((*new(IfClonereq)).IfcrBuffer), 8}, + {"IfClonereq", "IfcrBuffer alignment", unsafe.Alignof((*new(IfClonereq)).IfcrBuffer), 8}, + {"IfaMsghdr", "size", unsafe.Sizeof(*new(IfaMsghdr)), 20}, + {"IfaMsghdr", "alignment", unsafe.Alignof(*new(IfaMsghdr)), 4}, + {"IfaMsghdr", "IfamMsglen offset", unsafe.Offsetof((*new(IfaMsghdr)).IfamMsglen), 0}, + {"IfaMsghdr", "IfamMsglen size", unsafe.Sizeof((*new(IfaMsghdr)).IfamMsglen), 2}, + {"IfaMsghdr", "IfamMsglen alignment", unsafe.Alignof((*new(IfaMsghdr)).IfamMsglen), 2}, + {"IfaMsghdr", "IfamVersion offset", unsafe.Offsetof((*new(IfaMsghdr)).IfamVersion), 2}, + {"IfaMsghdr", "IfamVersion size", unsafe.Sizeof((*new(IfaMsghdr)).IfamVersion), 1}, + {"IfaMsghdr", "IfamVersion alignment", unsafe.Alignof((*new(IfaMsghdr)).IfamVersion), 1}, + {"IfaMsghdr", "IfamType offset", unsafe.Offsetof((*new(IfaMsghdr)).IfamType), 3}, + {"IfaMsghdr", "IfamType size", unsafe.Sizeof((*new(IfaMsghdr)).IfamType), 1}, + {"IfaMsghdr", "IfamType alignment", unsafe.Alignof((*new(IfaMsghdr)).IfamType), 1}, + {"IfaMsghdr", "IfamAddrs offset", unsafe.Offsetof((*new(IfaMsghdr)).IfamAddrs), 4}, + {"IfaMsghdr", "IfamAddrs size", unsafe.Sizeof((*new(IfaMsghdr)).IfamAddrs), 4}, + {"IfaMsghdr", "IfamAddrs alignment", unsafe.Alignof((*new(IfaMsghdr)).IfamAddrs), 4}, + {"IfaMsghdr", "IfamFlags offset", unsafe.Offsetof((*new(IfaMsghdr)).IfamFlags), 8}, + {"IfaMsghdr", "IfamFlags size", unsafe.Sizeof((*new(IfaMsghdr)).IfamFlags), 4}, + {"IfaMsghdr", "IfamFlags alignment", unsafe.Alignof((*new(IfaMsghdr)).IfamFlags), 4}, + {"IfaMsghdr", "IfamIndex offset", unsafe.Offsetof((*new(IfaMsghdr)).IfamIndex), 12}, + {"IfaMsghdr", "IfamIndex size", unsafe.Sizeof((*new(IfaMsghdr)).IfamIndex), 2}, + {"IfaMsghdr", "IfamIndex alignment", unsafe.Alignof((*new(IfaMsghdr)).IfamIndex), 2}, + {"IfaMsghdr", "IfamMetric offset", unsafe.Offsetof((*new(IfaMsghdr)).IfamMetric), 16}, + {"IfaMsghdr", "IfamMetric size", unsafe.Sizeof((*new(IfaMsghdr)).IfamMetric), 4}, + {"IfaMsghdr", "IfamMetric alignment", unsafe.Alignof((*new(IfaMsghdr)).IfamMetric), 4}, + {"IfmaMsghdr", "size", unsafe.Sizeof(*new(IfmaMsghdr)), 16}, + {"IfmaMsghdr", "alignment", unsafe.Alignof(*new(IfmaMsghdr)), 4}, + {"IfmaMsghdr", "IfmamMsglen offset", unsafe.Offsetof((*new(IfmaMsghdr)).IfmamMsglen), 0}, + {"IfmaMsghdr", "IfmamMsglen size", unsafe.Sizeof((*new(IfmaMsghdr)).IfmamMsglen), 2}, + {"IfmaMsghdr", "IfmamMsglen alignment", unsafe.Alignof((*new(IfmaMsghdr)).IfmamMsglen), 2}, + {"IfmaMsghdr", "IfmamVersion offset", unsafe.Offsetof((*new(IfmaMsghdr)).IfmamVersion), 2}, + {"IfmaMsghdr", "IfmamVersion size", unsafe.Sizeof((*new(IfmaMsghdr)).IfmamVersion), 1}, + {"IfmaMsghdr", "IfmamVersion alignment", unsafe.Alignof((*new(IfmaMsghdr)).IfmamVersion), 1}, + {"IfmaMsghdr", "IfmamType offset", unsafe.Offsetof((*new(IfmaMsghdr)).IfmamType), 3}, + {"IfmaMsghdr", "IfmamType size", unsafe.Sizeof((*new(IfmaMsghdr)).IfmamType), 1}, + {"IfmaMsghdr", "IfmamType alignment", unsafe.Alignof((*new(IfmaMsghdr)).IfmamType), 1}, + {"IfmaMsghdr", "IfmamAddrs offset", unsafe.Offsetof((*new(IfmaMsghdr)).IfmamAddrs), 4}, + {"IfmaMsghdr", "IfmamAddrs size", unsafe.Sizeof((*new(IfmaMsghdr)).IfmamAddrs), 4}, + {"IfmaMsghdr", "IfmamAddrs alignment", unsafe.Alignof((*new(IfmaMsghdr)).IfmamAddrs), 4}, + {"IfmaMsghdr", "IfmamFlags offset", unsafe.Offsetof((*new(IfmaMsghdr)).IfmamFlags), 8}, + {"IfmaMsghdr", "IfmamFlags size", unsafe.Sizeof((*new(IfmaMsghdr)).IfmamFlags), 4}, + {"IfmaMsghdr", "IfmamFlags alignment", unsafe.Alignof((*new(IfmaMsghdr)).IfmamFlags), 4}, + {"IfmaMsghdr", "IfmamIndex offset", unsafe.Offsetof((*new(IfmaMsghdr)).IfmamIndex), 12}, + {"IfmaMsghdr", "IfmamIndex size", unsafe.Sizeof((*new(IfmaMsghdr)).IfmamIndex), 2}, + {"IfmaMsghdr", "IfmamIndex alignment", unsafe.Alignof((*new(IfmaMsghdr)).IfmamIndex), 2}, + {"IfmaMsghdr2", "size", unsafe.Sizeof(*new(IfmaMsghdr2)), 20}, + {"IfmaMsghdr2", "alignment", unsafe.Alignof(*new(IfmaMsghdr2)), 4}, + {"IfmaMsghdr2", "IfmamMsglen offset", unsafe.Offsetof((*new(IfmaMsghdr2)).IfmamMsglen), 0}, + {"IfmaMsghdr2", "IfmamMsglen size", unsafe.Sizeof((*new(IfmaMsghdr2)).IfmamMsglen), 2}, + {"IfmaMsghdr2", "IfmamMsglen alignment", unsafe.Alignof((*new(IfmaMsghdr2)).IfmamMsglen), 2}, + {"IfmaMsghdr2", "IfmamVersion offset", unsafe.Offsetof((*new(IfmaMsghdr2)).IfmamVersion), 2}, + {"IfmaMsghdr2", "IfmamVersion size", unsafe.Sizeof((*new(IfmaMsghdr2)).IfmamVersion), 1}, + {"IfmaMsghdr2", "IfmamVersion alignment", unsafe.Alignof((*new(IfmaMsghdr2)).IfmamVersion), 1}, + {"IfmaMsghdr2", "IfmamType offset", unsafe.Offsetof((*new(IfmaMsghdr2)).IfmamType), 3}, + {"IfmaMsghdr2", "IfmamType size", unsafe.Sizeof((*new(IfmaMsghdr2)).IfmamType), 1}, + {"IfmaMsghdr2", "IfmamType alignment", unsafe.Alignof((*new(IfmaMsghdr2)).IfmamType), 1}, + {"IfmaMsghdr2", "IfmamAddrs offset", unsafe.Offsetof((*new(IfmaMsghdr2)).IfmamAddrs), 4}, + {"IfmaMsghdr2", "IfmamAddrs size", unsafe.Sizeof((*new(IfmaMsghdr2)).IfmamAddrs), 4}, + {"IfmaMsghdr2", "IfmamAddrs alignment", unsafe.Alignof((*new(IfmaMsghdr2)).IfmamAddrs), 4}, + {"IfmaMsghdr2", "IfmamFlags offset", unsafe.Offsetof((*new(IfmaMsghdr2)).IfmamFlags), 8}, + {"IfmaMsghdr2", "IfmamFlags size", unsafe.Sizeof((*new(IfmaMsghdr2)).IfmamFlags), 4}, + {"IfmaMsghdr2", "IfmamFlags alignment", unsafe.Alignof((*new(IfmaMsghdr2)).IfmamFlags), 4}, + {"IfmaMsghdr2", "IfmamIndex offset", unsafe.Offsetof((*new(IfmaMsghdr2)).IfmamIndex), 12}, + {"IfmaMsghdr2", "IfmamIndex size", unsafe.Sizeof((*new(IfmaMsghdr2)).IfmamIndex), 2}, + {"IfmaMsghdr2", "IfmamIndex alignment", unsafe.Alignof((*new(IfmaMsghdr2)).IfmamIndex), 2}, + {"IfmaMsghdr2", "IfmamRefcount offset", unsafe.Offsetof((*new(IfmaMsghdr2)).IfmamRefcount), 16}, + {"IfmaMsghdr2", "IfmamRefcount size", unsafe.Sizeof((*new(IfmaMsghdr2)).IfmamRefcount), 4}, + {"IfmaMsghdr2", "IfmamRefcount alignment", unsafe.Alignof((*new(IfmaMsghdr2)).IfmamRefcount), 4}, + {"Ifdevmtu", "size", unsafe.Sizeof(*new(Ifdevmtu)), 12}, + {"Ifdevmtu", "alignment", unsafe.Alignof(*new(Ifdevmtu)), 4}, + {"Ifdevmtu", "IfdmCurrent offset", unsafe.Offsetof((*new(Ifdevmtu)).IfdmCurrent), 0}, + {"Ifdevmtu", "IfdmCurrent size", unsafe.Sizeof((*new(Ifdevmtu)).IfdmCurrent), 4}, + {"Ifdevmtu", "IfdmCurrent alignment", unsafe.Alignof((*new(Ifdevmtu)).IfdmCurrent), 4}, + {"Ifdevmtu", "IfdmMin offset", unsafe.Offsetof((*new(Ifdevmtu)).IfdmMin), 4}, + {"Ifdevmtu", "IfdmMin size", unsafe.Sizeof((*new(Ifdevmtu)).IfdmMin), 4}, + {"Ifdevmtu", "IfdmMin alignment", unsafe.Alignof((*new(Ifdevmtu)).IfdmMin), 4}, + {"Ifdevmtu", "IfdmMax offset", unsafe.Offsetof((*new(Ifdevmtu)).IfdmMax), 8}, + {"Ifdevmtu", "IfdmMax size", unsafe.Sizeof((*new(Ifdevmtu)).IfdmMax), 4}, + {"Ifdevmtu", "IfdmMax alignment", unsafe.Alignof((*new(Ifdevmtu)).IfdmMax), 4}, + {"Ifaliasreq", "size", unsafe.Sizeof(*new(Ifaliasreq)), 64}, + {"Ifaliasreq", "alignment", unsafe.Alignof(*new(Ifaliasreq)), 1}, + {"Ifaliasreq", "IfraName offset", unsafe.Offsetof((*new(Ifaliasreq)).IfraName), 0}, + {"Ifaliasreq", "IfraName size", unsafe.Sizeof((*new(Ifaliasreq)).IfraName), 16}, + {"Ifaliasreq", "IfraName alignment", unsafe.Alignof((*new(Ifaliasreq)).IfraName), 1}, + {"Ifaliasreq", "IfraAddr offset", unsafe.Offsetof((*new(Ifaliasreq)).IfraAddr), 16}, + {"Ifaliasreq", "IfraAddr size", unsafe.Sizeof((*new(Ifaliasreq)).IfraAddr), 16}, + {"Ifaliasreq", "IfraAddr alignment", unsafe.Alignof((*new(Ifaliasreq)).IfraAddr), 1}, + {"Ifaliasreq", "IfraBroadaddr offset", unsafe.Offsetof((*new(Ifaliasreq)).IfraBroadaddr), 32}, + {"Ifaliasreq", "IfraBroadaddr size", unsafe.Sizeof((*new(Ifaliasreq)).IfraBroadaddr), 16}, + {"Ifaliasreq", "IfraBroadaddr alignment", unsafe.Alignof((*new(Ifaliasreq)).IfraBroadaddr), 1}, + {"Ifaliasreq", "IfraMask offset", unsafe.Offsetof((*new(Ifaliasreq)).IfraMask), 48}, + {"Ifaliasreq", "IfraMask size", unsafe.Sizeof((*new(Ifaliasreq)).IfraMask), 16}, + {"Ifaliasreq", "IfraMask alignment", unsafe.Alignof((*new(Ifaliasreq)).IfraMask), 1}, + {"RslvmultiReq", "size", unsafe.Sizeof(*new(RslvmultiReq)), 16}, + {"RslvmultiReq", "alignment", unsafe.Alignof(*new(RslvmultiReq)), 8}, + {"RslvmultiReq", "Sa offset", unsafe.Offsetof((*new(RslvmultiReq)).Sa), 0}, + {"RslvmultiReq", "Sa size", unsafe.Sizeof((*new(RslvmultiReq)).Sa), 8}, + {"RslvmultiReq", "Sa alignment", unsafe.Alignof((*new(RslvmultiReq)).Sa), 8}, + {"RslvmultiReq", "Llsa offset", unsafe.Offsetof((*new(RslvmultiReq)).Llsa), 8}, + {"RslvmultiReq", "Llsa size", unsafe.Sizeof((*new(RslvmultiReq)).Llsa), 8}, + {"RslvmultiReq", "Llsa alignment", unsafe.Alignof((*new(RslvmultiReq)).Llsa), 8}, + {"Ifstat", "size", unsafe.Sizeof(*new(Ifstat)), 817}, + {"Ifstat", "alignment", unsafe.Alignof(*new(Ifstat)), 1}, + {"Ifstat", "IfsName offset", unsafe.Offsetof((*new(Ifstat)).IfsName), 0}, + {"Ifstat", "IfsName size", unsafe.Sizeof((*new(Ifstat)).IfsName), 16}, + {"Ifstat", "IfsName alignment", unsafe.Alignof((*new(Ifstat)).IfsName), 1}, + {"Ifstat", "Ascii offset", unsafe.Offsetof((*new(Ifstat)).Ascii), 16}, + {"Ifstat", "Ascii size", unsafe.Sizeof((*new(Ifstat)).Ascii), 801}, + {"Ifstat", "Ascii alignment", unsafe.Alignof((*new(Ifstat)).Ascii), 1}, + {"KevDlProtoData", "size", unsafe.Sizeof(*new(KevDlProtoData)), 32}, + {"KevDlProtoData", "alignment", unsafe.Alignof(*new(KevDlProtoData)), 4}, + {"KevDlProtoData", "LinkData offset", unsafe.Offsetof((*new(KevDlProtoData)).LinkData), 0}, + {"KevDlProtoData", "LinkData size", unsafe.Sizeof((*new(KevDlProtoData)).LinkData), 24}, + {"KevDlProtoData", "LinkData alignment", unsafe.Alignof((*new(KevDlProtoData)).LinkData), 4}, + {"KevDlProtoData", "ProtoFamily offset", unsafe.Offsetof((*new(KevDlProtoData)).ProtoFamily), 24}, + {"KevDlProtoData", "ProtoFamily size", unsafe.Sizeof((*new(KevDlProtoData)).ProtoFamily), 4}, + {"KevDlProtoData", "ProtoFamily alignment", unsafe.Alignof((*new(KevDlProtoData)).ProtoFamily), 4}, + {"KevDlProtoData", "ProtoRemainingCount offset", unsafe.Offsetof((*new(KevDlProtoData)).ProtoRemainingCount), 28}, + {"KevDlProtoData", "ProtoRemainingCount size", unsafe.Sizeof((*new(KevDlProtoData)).ProtoRemainingCount), 4}, + {"KevDlProtoData", "ProtoRemainingCount alignment", unsafe.Alignof((*new(KevDlProtoData)).ProtoRemainingCount), 4}, + {"IfNameindexT", "size", unsafe.Sizeof(*new(IfNameindexT)), 16}, + {"IfNameindexT", "alignment", unsafe.Alignof(*new(IfNameindexT)), 8}, + {"IfNameindexT", "IfIndex offset", unsafe.Offsetof((*new(IfNameindexT)).IfIndex), 0}, + {"IfNameindexT", "IfIndex size", unsafe.Sizeof((*new(IfNameindexT)).IfIndex), 4}, + {"IfNameindexT", "IfIndex alignment", unsafe.Alignof((*new(IfNameindexT)).IfIndex), 4}, + {"IfNameindexT", "IfName offset", unsafe.Offsetof((*new(IfNameindexT)).IfName), 8}, + {"IfNameindexT", "IfName size", unsafe.Sizeof((*new(IfNameindexT)).IfName), 8}, + {"IfNameindexT", "IfName alignment", unsafe.Alignof((*new(IfNameindexT)).IfName), 8}, + {"NetEventData", "size", unsafe.Sizeof(*new(NetEventData)), 24}, + {"NetEventData", "alignment", unsafe.Alignof(*new(NetEventData)), 4}, + {"NetEventData", "IfFamily offset", unsafe.Offsetof((*new(NetEventData)).IfFamily), 0}, + {"NetEventData", "IfFamily size", unsafe.Sizeof((*new(NetEventData)).IfFamily), 4}, + {"NetEventData", "IfFamily alignment", unsafe.Alignof((*new(NetEventData)).IfFamily), 4}, + {"NetEventData", "IfUnit offset", unsafe.Offsetof((*new(NetEventData)).IfUnit), 4}, + {"NetEventData", "IfUnit size", unsafe.Sizeof((*new(NetEventData)).IfUnit), 4}, + {"NetEventData", "IfUnit alignment", unsafe.Alignof((*new(NetEventData)).IfUnit), 4}, + {"NetEventData", "IfName offset", unsafe.Offsetof((*new(NetEventData)).IfName), 8}, + {"NetEventData", "IfName size", unsafe.Sizeof((*new(NetEventData)).IfName), 16}, + {"NetEventData", "IfName alignment", unsafe.Alignof((*new(NetEventData)).IfName), 1}, + {"Ifqueue", "size", unsafe.Sizeof(*new(Ifqueue)), 32}, + {"Ifqueue", "alignment", unsafe.Alignof(*new(Ifqueue)), 8}, + {"Ifqueue", "IfqHead offset", unsafe.Offsetof((*new(Ifqueue)).IfqHead), 0}, + {"Ifqueue", "IfqHead size", unsafe.Sizeof((*new(Ifqueue)).IfqHead), 8}, + {"Ifqueue", "IfqHead alignment", unsafe.Alignof((*new(Ifqueue)).IfqHead), 8}, + {"Ifqueue", "IfqTail offset", unsafe.Offsetof((*new(Ifqueue)).IfqTail), 8}, + {"Ifqueue", "IfqTail size", unsafe.Sizeof((*new(Ifqueue)).IfqTail), 8}, + {"Ifqueue", "IfqTail alignment", unsafe.Alignof((*new(Ifqueue)).IfqTail), 8}, + {"Ifqueue", "IfqLen offset", unsafe.Offsetof((*new(Ifqueue)).IfqLen), 16}, + {"Ifqueue", "IfqLen size", unsafe.Sizeof((*new(Ifqueue)).IfqLen), 4}, + {"Ifqueue", "IfqLen alignment", unsafe.Alignof((*new(Ifqueue)).IfqLen), 4}, + {"Ifqueue", "IfqMaxlen offset", unsafe.Offsetof((*new(Ifqueue)).IfqMaxlen), 20}, + {"Ifqueue", "IfqMaxlen size", unsafe.Sizeof((*new(Ifqueue)).IfqMaxlen), 4}, + {"Ifqueue", "IfqMaxlen alignment", unsafe.Alignof((*new(Ifqueue)).IfqMaxlen), 4}, + {"Ifqueue", "IfqDrops offset", unsafe.Offsetof((*new(Ifqueue)).IfqDrops), 24}, + {"Ifqueue", "IfqDrops size", unsafe.Sizeof((*new(Ifqueue)).IfqDrops), 4}, + {"Ifqueue", "IfqDrops alignment", unsafe.Alignof((*new(Ifqueue)).IfqDrops), 4}, + {"IfnetInterfaceAdvisory", "pointer size", unsafe.Sizeof((*IfnetInterfaceAdvisory)(nil)), 8}, + {"IfnetInterfaceAdvisory", "pointer alignment", unsafe.Alignof((*IfnetInterfaceAdvisory)(nil)), 8}, + {"Hostent", "size", unsafe.Sizeof(*new(Hostent)), 32}, + {"Hostent", "alignment", unsafe.Alignof(*new(Hostent)), 8}, + {"Hostent", "Name offset", unsafe.Offsetof((*new(Hostent)).Name), 0}, + {"Hostent", "Name size", unsafe.Sizeof((*new(Hostent)).Name), 8}, + {"Hostent", "Name alignment", unsafe.Alignof((*new(Hostent)).Name), 8}, + {"Hostent", "Aliases offset", unsafe.Offsetof((*new(Hostent)).Aliases), 8}, + {"Hostent", "Aliases size", unsafe.Sizeof((*new(Hostent)).Aliases), 8}, + {"Hostent", "Aliases alignment", unsafe.Alignof((*new(Hostent)).Aliases), 8}, + {"Hostent", "AddrType offset", unsafe.Offsetof((*new(Hostent)).AddrType), 16}, + {"Hostent", "AddrType size", unsafe.Sizeof((*new(Hostent)).AddrType), 4}, + {"Hostent", "AddrType alignment", unsafe.Alignof((*new(Hostent)).AddrType), 4}, + {"Hostent", "Length offset", unsafe.Offsetof((*new(Hostent)).Length), 20}, + {"Hostent", "Length size", unsafe.Sizeof((*new(Hostent)).Length), 4}, + {"Hostent", "Length alignment", unsafe.Alignof((*new(Hostent)).Length), 4}, + {"Hostent", "AddrList offset", unsafe.Offsetof((*new(Hostent)).AddrList), 24}, + {"Hostent", "AddrList size", unsafe.Sizeof((*new(Hostent)).AddrList), 8}, + {"Hostent", "AddrList alignment", unsafe.Alignof((*new(Hostent)).AddrList), 8}, + {"Netent", "size", unsafe.Sizeof(*new(Netent)), 24}, + {"Netent", "alignment", unsafe.Alignof(*new(Netent)), 8}, + {"Netent", "NName offset", unsafe.Offsetof((*new(Netent)).NName), 0}, + {"Netent", "NName size", unsafe.Sizeof((*new(Netent)).NName), 8}, + {"Netent", "NName alignment", unsafe.Alignof((*new(Netent)).NName), 8}, + {"Netent", "NAliases offset", unsafe.Offsetof((*new(Netent)).NAliases), 8}, + {"Netent", "NAliases size", unsafe.Sizeof((*new(Netent)).NAliases), 8}, + {"Netent", "NAliases alignment", unsafe.Alignof((*new(Netent)).NAliases), 8}, + {"Netent", "NAddrtype offset", unsafe.Offsetof((*new(Netent)).NAddrtype), 16}, + {"Netent", "NAddrtype size", unsafe.Sizeof((*new(Netent)).NAddrtype), 4}, + {"Netent", "NAddrtype alignment", unsafe.Alignof((*new(Netent)).NAddrtype), 4}, + {"Netent", "NNet offset", unsafe.Offsetof((*new(Netent)).NNet), 20}, + {"Netent", "NNet size", unsafe.Sizeof((*new(Netent)).NNet), 4}, + {"Netent", "NNet alignment", unsafe.Alignof((*new(Netent)).NNet), 4}, + {"Servent", "size", unsafe.Sizeof(*new(Servent)), 32}, + {"Servent", "alignment", unsafe.Alignof(*new(Servent)), 8}, + {"Servent", "SName offset", unsafe.Offsetof((*new(Servent)).SName), 0}, + {"Servent", "SName size", unsafe.Sizeof((*new(Servent)).SName), 8}, + {"Servent", "SName alignment", unsafe.Alignof((*new(Servent)).SName), 8}, + {"Servent", "SAliases offset", unsafe.Offsetof((*new(Servent)).SAliases), 8}, + {"Servent", "SAliases size", unsafe.Sizeof((*new(Servent)).SAliases), 8}, + {"Servent", "SAliases alignment", unsafe.Alignof((*new(Servent)).SAliases), 8}, + {"Servent", "SPort offset", unsafe.Offsetof((*new(Servent)).SPort), 16}, + {"Servent", "SPort size", unsafe.Sizeof((*new(Servent)).SPort), 4}, + {"Servent", "SPort alignment", unsafe.Alignof((*new(Servent)).SPort), 4}, + {"Servent", "SProto offset", unsafe.Offsetof((*new(Servent)).SProto), 24}, + {"Servent", "SProto size", unsafe.Sizeof((*new(Servent)).SProto), 8}, + {"Servent", "SProto alignment", unsafe.Alignof((*new(Servent)).SProto), 8}, + {"Protoent", "size", unsafe.Sizeof(*new(Protoent)), 24}, + {"Protoent", "alignment", unsafe.Alignof(*new(Protoent)), 8}, + {"Protoent", "PName offset", unsafe.Offsetof((*new(Protoent)).PName), 0}, + {"Protoent", "PName size", unsafe.Sizeof((*new(Protoent)).PName), 8}, + {"Protoent", "PName alignment", unsafe.Alignof((*new(Protoent)).PName), 8}, + {"Protoent", "PAliases offset", unsafe.Offsetof((*new(Protoent)).PAliases), 8}, + {"Protoent", "PAliases size", unsafe.Sizeof((*new(Protoent)).PAliases), 8}, + {"Protoent", "PAliases alignment", unsafe.Alignof((*new(Protoent)).PAliases), 8}, + {"Protoent", "PProto offset", unsafe.Offsetof((*new(Protoent)).PProto), 16}, + {"Protoent", "PProto size", unsafe.Sizeof((*new(Protoent)).PProto), 4}, + {"Protoent", "PProto alignment", unsafe.Alignof((*new(Protoent)).PProto), 4}, + {"AddrInfo", "size", unsafe.Sizeof(*new(AddrInfo)), 48}, + {"AddrInfo", "alignment", unsafe.Alignof(*new(AddrInfo)), 8}, + {"AddrInfo", "Flags offset", unsafe.Offsetof((*new(AddrInfo)).Flags), 0}, + {"AddrInfo", "Flags size", unsafe.Sizeof((*new(AddrInfo)).Flags), 4}, + {"AddrInfo", "Flags alignment", unsafe.Alignof((*new(AddrInfo)).Flags), 4}, + {"AddrInfo", "Family offset", unsafe.Offsetof((*new(AddrInfo)).Family), 4}, + {"AddrInfo", "Family size", unsafe.Sizeof((*new(AddrInfo)).Family), 4}, + {"AddrInfo", "Family alignment", unsafe.Alignof((*new(AddrInfo)).Family), 4}, + {"AddrInfo", "SockType offset", unsafe.Offsetof((*new(AddrInfo)).SockType), 8}, + {"AddrInfo", "SockType size", unsafe.Sizeof((*new(AddrInfo)).SockType), 4}, + {"AddrInfo", "SockType alignment", unsafe.Alignof((*new(AddrInfo)).SockType), 4}, + {"AddrInfo", "Protocol offset", unsafe.Offsetof((*new(AddrInfo)).Protocol), 12}, + {"AddrInfo", "Protocol size", unsafe.Sizeof((*new(AddrInfo)).Protocol), 4}, + {"AddrInfo", "Protocol alignment", unsafe.Alignof((*new(AddrInfo)).Protocol), 4}, + {"AddrInfo", "AddrLen offset", unsafe.Offsetof((*new(AddrInfo)).AddrLen), 16}, + {"AddrInfo", "AddrLen size", unsafe.Sizeof((*new(AddrInfo)).AddrLen), 4}, + {"AddrInfo", "AddrLen alignment", unsafe.Alignof((*new(AddrInfo)).AddrLen), 4}, + {"AddrInfo", "CanOnName offset", unsafe.Offsetof((*new(AddrInfo)).CanOnName), 24}, + {"AddrInfo", "CanOnName size", unsafe.Sizeof((*new(AddrInfo)).CanOnName), 8}, + {"AddrInfo", "CanOnName alignment", unsafe.Alignof((*new(AddrInfo)).CanOnName), 8}, + {"AddrInfo", "Addr offset", unsafe.Offsetof((*new(AddrInfo)).Addr), 32}, + {"AddrInfo", "Addr size", unsafe.Sizeof((*new(AddrInfo)).Addr), 8}, + {"AddrInfo", "Addr alignment", unsafe.Alignof((*new(AddrInfo)).Addr), 8}, + {"AddrInfo", "Next offset", unsafe.Offsetof((*new(AddrInfo)).Next), 40}, + {"AddrInfo", "Next size", unsafe.Sizeof((*new(AddrInfo)).Next), 8}, + {"AddrInfo", "Next alignment", unsafe.Alignof((*new(AddrInfo)).Next), 8}, + {"Rpcent", "size", unsafe.Sizeof(*new(Rpcent)), 24}, + {"Rpcent", "alignment", unsafe.Alignof(*new(Rpcent)), 8}, + {"Rpcent", "RName offset", unsafe.Offsetof((*new(Rpcent)).RName), 0}, + {"Rpcent", "RName size", unsafe.Sizeof((*new(Rpcent)).RName), 8}, + {"Rpcent", "RName alignment", unsafe.Alignof((*new(Rpcent)).RName), 8}, + {"Rpcent", "RAliases offset", unsafe.Offsetof((*new(Rpcent)).RAliases), 8}, + {"Rpcent", "RAliases size", unsafe.Sizeof((*new(Rpcent)).RAliases), 8}, + {"Rpcent", "RAliases alignment", unsafe.Alignof((*new(Rpcent)).RAliases), 8}, + {"Rpcent", "RNumber offset", unsafe.Offsetof((*new(Rpcent)).RNumber), 16}, + {"Rpcent", "RNumber size", unsafe.Sizeof((*new(Rpcent)).RNumber), 4}, + {"Rpcent", "RNumber alignment", unsafe.Alignof((*new(Rpcent)).RNumber), 4}, + {"InAddr", "size", unsafe.Sizeof(*new(InAddr)), 4}, + {"InAddr", "alignment", unsafe.Alignof(*new(InAddr)), 4}, + {"InAddr", "Addr offset", unsafe.Offsetof((*new(InAddr)).Addr), 0}, + {"InAddr", "Addr size", unsafe.Sizeof((*new(InAddr)).Addr), 4}, + {"InAddr", "Addr alignment", unsafe.Alignof((*new(InAddr)).Addr), 4}, + {"SockaddrIn", "size", unsafe.Sizeof(*new(SockaddrIn)), 16}, + {"SockaddrIn", "alignment", unsafe.Alignof(*new(SockaddrIn)), 4}, + {"SockaddrIn", "Len offset", unsafe.Offsetof((*new(SockaddrIn)).Len), 0}, + {"SockaddrIn", "Len size", unsafe.Sizeof((*new(SockaddrIn)).Len), 1}, + {"SockaddrIn", "Len alignment", unsafe.Alignof((*new(SockaddrIn)).Len), 1}, + {"SockaddrIn", "Family offset", unsafe.Offsetof((*new(SockaddrIn)).Family), 1}, + {"SockaddrIn", "Family size", unsafe.Sizeof((*new(SockaddrIn)).Family), 1}, + {"SockaddrIn", "Family alignment", unsafe.Alignof((*new(SockaddrIn)).Family), 1}, + {"SockaddrIn", "Port offset", unsafe.Offsetof((*new(SockaddrIn)).Port), 2}, + {"SockaddrIn", "Port size", unsafe.Sizeof((*new(SockaddrIn)).Port), 2}, + {"SockaddrIn", "Port alignment", unsafe.Alignof((*new(SockaddrIn)).Port), 2}, + {"SockaddrIn", "Addr offset", unsafe.Offsetof((*new(SockaddrIn)).Addr), 4}, + {"SockaddrIn", "Addr size", unsafe.Sizeof((*new(SockaddrIn)).Addr), 4}, + {"SockaddrIn", "Addr alignment", unsafe.Alignof((*new(SockaddrIn)).Addr), 4}, + {"SockaddrIn", "Zero offset", unsafe.Offsetof((*new(SockaddrIn)).Zero), 8}, + {"SockaddrIn", "Zero size", unsafe.Sizeof((*new(SockaddrIn)).Zero), 8}, + {"SockaddrIn", "Zero alignment", unsafe.Alignof((*new(SockaddrIn)).Zero), 1}, + {"IpOpts", "size", unsafe.Sizeof(*new(IpOpts)), 44}, + {"IpOpts", "alignment", unsafe.Alignof(*new(IpOpts)), 4}, + {"IpOpts", "IpDst offset", unsafe.Offsetof((*new(IpOpts)).IpDst), 0}, + {"IpOpts", "IpDst size", unsafe.Sizeof((*new(IpOpts)).IpDst), 4}, + {"IpOpts", "IpDst alignment", unsafe.Alignof((*new(IpOpts)).IpDst), 4}, + {"IpOpts", "IpOpts offset", unsafe.Offsetof((*new(IpOpts)).IpOpts), 4}, + {"IpOpts", "IpOpts size", unsafe.Sizeof((*new(IpOpts)).IpOpts), 40}, + {"IpOpts", "IpOpts alignment", unsafe.Alignof((*new(IpOpts)).IpOpts), 1}, + {"IpMreq", "size", unsafe.Sizeof(*new(IpMreq)), 8}, + {"IpMreq", "alignment", unsafe.Alignof(*new(IpMreq)), 4}, + {"IpMreq", "ImrMultiaddr offset", unsafe.Offsetof((*new(IpMreq)).ImrMultiaddr), 0}, + {"IpMreq", "ImrMultiaddr size", unsafe.Sizeof((*new(IpMreq)).ImrMultiaddr), 4}, + {"IpMreq", "ImrMultiaddr alignment", unsafe.Alignof((*new(IpMreq)).ImrMultiaddr), 4}, + {"IpMreq", "ImrInterface offset", unsafe.Offsetof((*new(IpMreq)).ImrInterface), 4}, + {"IpMreq", "ImrInterface size", unsafe.Sizeof((*new(IpMreq)).ImrInterface), 4}, + {"IpMreq", "ImrInterface alignment", unsafe.Alignof((*new(IpMreq)).ImrInterface), 4}, + {"IpMreqn", "size", unsafe.Sizeof(*new(IpMreqn)), 12}, + {"IpMreqn", "alignment", unsafe.Alignof(*new(IpMreqn)), 4}, + {"IpMreqn", "ImrMultiaddr offset", unsafe.Offsetof((*new(IpMreqn)).ImrMultiaddr), 0}, + {"IpMreqn", "ImrMultiaddr size", unsafe.Sizeof((*new(IpMreqn)).ImrMultiaddr), 4}, + {"IpMreqn", "ImrMultiaddr alignment", unsafe.Alignof((*new(IpMreqn)).ImrMultiaddr), 4}, + {"IpMreqn", "ImrAddress offset", unsafe.Offsetof((*new(IpMreqn)).ImrAddress), 4}, + {"IpMreqn", "ImrAddress size", unsafe.Sizeof((*new(IpMreqn)).ImrAddress), 4}, + {"IpMreqn", "ImrAddress alignment", unsafe.Alignof((*new(IpMreqn)).ImrAddress), 4}, + {"IpMreqn", "ImrIfindex offset", unsafe.Offsetof((*new(IpMreqn)).ImrIfindex), 8}, + {"IpMreqn", "ImrIfindex size", unsafe.Sizeof((*new(IpMreqn)).ImrIfindex), 4}, + {"IpMreqn", "ImrIfindex alignment", unsafe.Alignof((*new(IpMreqn)).ImrIfindex), 4}, + {"InPktinfo", "size", unsafe.Sizeof(*new(InPktinfo)), 12}, + {"InPktinfo", "alignment", unsafe.Alignof(*new(InPktinfo)), 4}, + {"InPktinfo", "IpiIfindex offset", unsafe.Offsetof((*new(InPktinfo)).IpiIfindex), 0}, + {"InPktinfo", "IpiIfindex size", unsafe.Sizeof((*new(InPktinfo)).IpiIfindex), 4}, + {"InPktinfo", "IpiIfindex alignment", unsafe.Alignof((*new(InPktinfo)).IpiIfindex), 4}, + {"InPktinfo", "IpiSpecDst offset", unsafe.Offsetof((*new(InPktinfo)).IpiSpecDst), 4}, + {"InPktinfo", "IpiSpecDst size", unsafe.Sizeof((*new(InPktinfo)).IpiSpecDst), 4}, + {"InPktinfo", "IpiSpecDst alignment", unsafe.Alignof((*new(InPktinfo)).IpiSpecDst), 4}, + {"InPktinfo", "IpiAddr offset", unsafe.Offsetof((*new(InPktinfo)).IpiAddr), 8}, + {"InPktinfo", "IpiAddr size", unsafe.Sizeof((*new(InPktinfo)).IpiAddr), 4}, + {"InPktinfo", "IpiAddr alignment", unsafe.Alignof((*new(InPktinfo)).IpiAddr), 4}, + {"In6Addr", "size", unsafe.Sizeof(*new(In6Addr)), 16}, + {"In6Addr", "alignment", unsafe.Alignof(*new(In6Addr)), 4}, + {"In6Addr", "U6Addr offset", unsafe.Offsetof((*new(In6Addr)).U6Addr), 0}, + {"In6Addr", "U6Addr size", unsafe.Sizeof((*new(In6Addr)).U6Addr), 16}, + {"In6Addr", "U6Addr alignment", unsafe.Alignof((*new(In6Addr)).U6Addr), 1}, + {"SockaddrIn6", "size", unsafe.Sizeof(*new(SockaddrIn6)), 28}, + {"SockaddrIn6", "alignment", unsafe.Alignof(*new(SockaddrIn6)), 4}, + {"SockaddrIn6", "Len offset", unsafe.Offsetof((*new(SockaddrIn6)).Len), 0}, + {"SockaddrIn6", "Len size", unsafe.Sizeof((*new(SockaddrIn6)).Len), 1}, + {"SockaddrIn6", "Len alignment", unsafe.Alignof((*new(SockaddrIn6)).Len), 1}, + {"SockaddrIn6", "Family offset", unsafe.Offsetof((*new(SockaddrIn6)).Family), 1}, + {"SockaddrIn6", "Family size", unsafe.Sizeof((*new(SockaddrIn6)).Family), 1}, + {"SockaddrIn6", "Family alignment", unsafe.Alignof((*new(SockaddrIn6)).Family), 1}, + {"SockaddrIn6", "Port offset", unsafe.Offsetof((*new(SockaddrIn6)).Port), 2}, + {"SockaddrIn6", "Port size", unsafe.Sizeof((*new(SockaddrIn6)).Port), 2}, + {"SockaddrIn6", "Port alignment", unsafe.Alignof((*new(SockaddrIn6)).Port), 2}, + {"SockaddrIn6", "Flowinfo offset", unsafe.Offsetof((*new(SockaddrIn6)).Flowinfo), 4}, + {"SockaddrIn6", "Flowinfo size", unsafe.Sizeof((*new(SockaddrIn6)).Flowinfo), 4}, + {"SockaddrIn6", "Flowinfo alignment", unsafe.Alignof((*new(SockaddrIn6)).Flowinfo), 4}, + {"SockaddrIn6", "Addr offset", unsafe.Offsetof((*new(SockaddrIn6)).Addr), 8}, + {"SockaddrIn6", "Addr size", unsafe.Sizeof((*new(SockaddrIn6)).Addr), 16}, + {"SockaddrIn6", "Addr alignment", unsafe.Alignof((*new(SockaddrIn6)).Addr), 4}, + {"SockaddrIn6", "ScopeId offset", unsafe.Offsetof((*new(SockaddrIn6)).ScopeId), 24}, + {"SockaddrIn6", "ScopeId size", unsafe.Sizeof((*new(SockaddrIn6)).ScopeId), 4}, + {"SockaddrIn6", "ScopeId alignment", unsafe.Alignof((*new(SockaddrIn6)).ScopeId), 4}, + {"Ipv6Mreq", "size", unsafe.Sizeof(*new(Ipv6Mreq)), 20}, + {"Ipv6Mreq", "alignment", unsafe.Alignof(*new(Ipv6Mreq)), 4}, + {"Ipv6Mreq", "Ipv6mrMultiaddr offset", unsafe.Offsetof((*new(Ipv6Mreq)).Ipv6mrMultiaddr), 0}, + {"Ipv6Mreq", "Ipv6mrMultiaddr size", unsafe.Sizeof((*new(Ipv6Mreq)).Ipv6mrMultiaddr), 16}, + {"Ipv6Mreq", "Ipv6mrMultiaddr alignment", unsafe.Alignof((*new(Ipv6Mreq)).Ipv6mrMultiaddr), 4}, + {"Ipv6Mreq", "Ipv6mrInterface offset", unsafe.Offsetof((*new(Ipv6Mreq)).Ipv6mrInterface), 16}, + {"Ipv6Mreq", "Ipv6mrInterface size", unsafe.Sizeof((*new(Ipv6Mreq)).Ipv6mrInterface), 4}, + {"Ipv6Mreq", "Ipv6mrInterface alignment", unsafe.Alignof((*new(Ipv6Mreq)).Ipv6mrInterface), 4}, + {"In6Pktinfo", "size", unsafe.Sizeof(*new(In6Pktinfo)), 20}, + {"In6Pktinfo", "alignment", unsafe.Alignof(*new(In6Pktinfo)), 4}, + {"In6Pktinfo", "Ipi6Addr offset", unsafe.Offsetof((*new(In6Pktinfo)).Ipi6Addr), 0}, + {"In6Pktinfo", "Ipi6Addr size", unsafe.Sizeof((*new(In6Pktinfo)).Ipi6Addr), 16}, + {"In6Pktinfo", "Ipi6Addr alignment", unsafe.Alignof((*new(In6Pktinfo)).Ipi6Addr), 4}, + {"In6Pktinfo", "Ipi6Ifindex offset", unsafe.Offsetof((*new(In6Pktinfo)).Ipi6Ifindex), 16}, + {"In6Pktinfo", "Ipi6Ifindex size", unsafe.Sizeof((*new(In6Pktinfo)).Ipi6Ifindex), 4}, + {"In6Pktinfo", "Ipi6Ifindex alignment", unsafe.Alignof((*new(In6Pktinfo)).Ipi6Ifindex), 4}, + {"Ip6Mtuinfo", "size", unsafe.Sizeof(*new(Ip6Mtuinfo)), 32}, + {"Ip6Mtuinfo", "alignment", unsafe.Alignof(*new(Ip6Mtuinfo)), 4}, + {"Ip6Mtuinfo", "Ip6mAddr offset", unsafe.Offsetof((*new(Ip6Mtuinfo)).Ip6mAddr), 0}, + {"Ip6Mtuinfo", "Ip6mAddr size", unsafe.Sizeof((*new(Ip6Mtuinfo)).Ip6mAddr), 28}, + {"Ip6Mtuinfo", "Ip6mAddr alignment", unsafe.Alignof((*new(Ip6Mtuinfo)).Ip6mAddr), 4}, + {"Ip6Mtuinfo", "Ip6mMtu offset", unsafe.Offsetof((*new(Ip6Mtuinfo)).Ip6mMtu), 28}, + {"Ip6Mtuinfo", "Ip6mMtu size", unsafe.Sizeof((*new(Ip6Mtuinfo)).Ip6mMtu), 4}, + {"Ip6Mtuinfo", "Ip6mMtu alignment", unsafe.Alignof((*new(Ip6Mtuinfo)).Ip6mMtu), 4}, + {"In6AddrT", "size", unsafe.Sizeof(*new(In6AddrT)), 16}, + {"In6AddrT", "alignment", unsafe.Alignof(*new(In6AddrT)), 4}, + {"CaddrT", "size", unsafe.Sizeof(*new(CaddrT)), 8}, + {"CaddrT", "alignment", unsafe.Alignof(*new(CaddrT)), 8}, + {"InAddrT", "size", unsafe.Sizeof(*new(InAddrT)), 4}, + {"InAddrT", "alignment", unsafe.Alignof(*new(InAddrT)), 4}, + {"InPortT", "size", unsafe.Sizeof(*new(InPortT)), 2}, + {"InPortT", "alignment", unsafe.Alignof(*new(InPortT)), 2}, + {"Int32T", "size", unsafe.Sizeof(*new(Int32T)), 4}, + {"Int32T", "alignment", unsafe.Alignof(*new(Int32T)), 4}, + {"Iovec", "size", unsafe.Sizeof(*new(Iovec)), 16}, + {"Iovec", "alignment", unsafe.Alignof(*new(Iovec)), 8}, + {"Iovec", "IovBase offset", unsafe.Offsetof((*new(Iovec)).IovBase), 0}, + {"Iovec", "IovBase size", unsafe.Sizeof((*new(Iovec)).IovBase), 8}, + {"Iovec", "IovBase alignment", unsafe.Alignof((*new(Iovec)).IovBase), 8}, + {"Iovec", "IovLen offset", unsafe.Offsetof((*new(Iovec)).IovLen), 8}, + {"Iovec", "IovLen size", unsafe.Sizeof((*new(Iovec)).IovLen), 8}, + {"Iovec", "IovLen alignment", unsafe.Alignof((*new(Iovec)).IovLen), 8}, + {"OffT", "size", unsafe.Sizeof(*new(OffT)), 8}, + {"OffT", "alignment", unsafe.Alignof(*new(OffT)), 8}, + {"SaFamilyT", "size", unsafe.Sizeof(*new(SaFamilyT)), 1}, + {"SaFamilyT", "alignment", unsafe.Alignof(*new(SaFamilyT)), 1}, + {"SizeT", "size", unsafe.Sizeof(*new(SizeT)), 8}, + {"SizeT", "alignment", unsafe.Alignof(*new(SizeT)), 8}, + {"SocklenT", "size", unsafe.Sizeof(*new(SocklenT)), 4}, + {"SocklenT", "alignment", unsafe.Alignof(*new(SocklenT)), 4}, + {"SsizeT", "size", unsafe.Sizeof(*new(SsizeT)), 8}, + {"SsizeT", "alignment", unsafe.Alignof(*new(SsizeT)), 8}, + {"Timeval32", "size", unsafe.Sizeof(*new(Timeval32)), 8}, + {"Timeval32", "alignment", unsafe.Alignof(*new(Timeval32)), 4}, + {"Timeval32", "TvSec offset", unsafe.Offsetof((*new(Timeval32)).TvSec), 0}, + {"Timeval32", "TvSec size", unsafe.Sizeof((*new(Timeval32)).TvSec), 4}, + {"Timeval32", "TvSec alignment", unsafe.Alignof((*new(Timeval32)).TvSec), 4}, + {"Timeval32", "TvUsec offset", unsafe.Offsetof((*new(Timeval32)).TvUsec), 4}, + {"Timeval32", "TvUsec size", unsafe.Sizeof((*new(Timeval32)).TvUsec), 4}, + {"Timeval32", "TvUsec alignment", unsafe.Alignof((*new(Timeval32)).TvUsec), 4}, + {"UChar", "size", unsafe.Sizeof(*new(UChar)), 1}, + {"UChar", "alignment", unsafe.Alignof(*new(UChar)), 1}, + {"UInt32T", "size", unsafe.Sizeof(*new(UInt32T)), 4}, + {"UInt32T", "alignment", unsafe.Alignof(*new(UInt32T)), 4}, + {"UInt64T", "size", unsafe.Sizeof(*new(UInt64T)), 8}, + {"UInt64T", "alignment", unsafe.Alignof(*new(UInt64T)), 8}, + {"UShort", "size", unsafe.Sizeof(*new(UShort)), 2}, + {"UShort", "alignment", unsafe.Alignof(*new(UShort)), 2}, + {"X__DarwinBlkcntT", "size", unsafe.Sizeof(*new(X__DarwinBlkcntT)), 8}, + {"X__DarwinBlkcntT", "alignment", unsafe.Alignof(*new(X__DarwinBlkcntT)), 8}, + {"X__DarwinBlksizeT", "size", unsafe.Sizeof(*new(X__DarwinBlksizeT)), 4}, + {"X__DarwinBlksizeT", "alignment", unsafe.Alignof(*new(X__DarwinBlksizeT)), 4}, + {"X__DarwinDevT", "size", unsafe.Sizeof(*new(X__DarwinDevT)), 4}, + {"X__DarwinDevT", "alignment", unsafe.Alignof(*new(X__DarwinDevT)), 4}, + {"X__DarwinFsblkcntT", "size", unsafe.Sizeof(*new(X__DarwinFsblkcntT)), 4}, + {"X__DarwinFsblkcntT", "alignment", unsafe.Alignof(*new(X__DarwinFsblkcntT)), 4}, + {"X__DarwinFsfilcntT", "size", unsafe.Sizeof(*new(X__DarwinFsfilcntT)), 4}, + {"X__DarwinFsfilcntT", "alignment", unsafe.Alignof(*new(X__DarwinFsfilcntT)), 4}, + {"X__DarwinGidT", "size", unsafe.Sizeof(*new(X__DarwinGidT)), 4}, + {"X__DarwinGidT", "alignment", unsafe.Alignof(*new(X__DarwinGidT)), 4}, + {"X__DarwinIdT", "size", unsafe.Sizeof(*new(X__DarwinIdT)), 4}, + {"X__DarwinIdT", "alignment", unsafe.Alignof(*new(X__DarwinIdT)), 4}, + {"X__DarwinIno64T", "size", unsafe.Sizeof(*new(X__DarwinIno64T)), 8}, + {"X__DarwinIno64T", "alignment", unsafe.Alignof(*new(X__DarwinIno64T)), 8}, + {"X__DarwinInoT", "size", unsafe.Sizeof(*new(X__DarwinInoT)), 8}, + {"X__DarwinInoT", "alignment", unsafe.Alignof(*new(X__DarwinInoT)), 8}, + {"X__DarwinMachPortNameT", "size", unsafe.Sizeof(*new(X__DarwinMachPortNameT)), 4}, + {"X__DarwinMachPortNameT", "alignment", unsafe.Alignof(*new(X__DarwinMachPortNameT)), 4}, + {"X__DarwinMachPortT", "size", unsafe.Sizeof(*new(X__DarwinMachPortT)), 4}, + {"X__DarwinMachPortT", "alignment", unsafe.Alignof(*new(X__DarwinMachPortT)), 4}, + {"X__DarwinModeT", "size", unsafe.Sizeof(*new(X__DarwinModeT)), 2}, + {"X__DarwinModeT", "alignment", unsafe.Alignof(*new(X__DarwinModeT)), 2}, + {"X__DarwinOffT", "size", unsafe.Sizeof(*new(X__DarwinOffT)), 8}, + {"X__DarwinOffT", "alignment", unsafe.Alignof(*new(X__DarwinOffT)), 8}, + {"X__DarwinPidT", "size", unsafe.Sizeof(*new(X__DarwinPidT)), 4}, + {"X__DarwinPidT", "alignment", unsafe.Alignof(*new(X__DarwinPidT)), 4}, + {"X__DarwinSigsetT", "size", unsafe.Sizeof(*new(X__DarwinSigsetT)), 4}, + {"X__DarwinSigsetT", "alignment", unsafe.Alignof(*new(X__DarwinSigsetT)), 4}, + {"X__DarwinSusecondsT", "size", unsafe.Sizeof(*new(X__DarwinSusecondsT)), 4}, + {"X__DarwinSusecondsT", "alignment", unsafe.Alignof(*new(X__DarwinSusecondsT)), 4}, + {"X__DarwinUidT", "size", unsafe.Sizeof(*new(X__DarwinUidT)), 4}, + {"X__DarwinUidT", "alignment", unsafe.Alignof(*new(X__DarwinUidT)), 4}, + {"X__DarwinUsecondsT", "size", unsafe.Sizeof(*new(X__DarwinUsecondsT)), 4}, + {"X__DarwinUsecondsT", "alignment", unsafe.Alignof(*new(X__DarwinUsecondsT)), 4}, + {"X__DarwinUuidT", "size", unsafe.Sizeof(*new(X__DarwinUuidT)), 16}, + {"X__DarwinUuidT", "alignment", unsafe.Alignof(*new(X__DarwinUuidT)), 1}, + {"X__DarwinUuidStringT", "size", unsafe.Sizeof(*new(X__DarwinUuidStringT)), 37}, + {"X__DarwinUuidStringT", "alignment", unsafe.Alignof(*new(X__DarwinUuidStringT)), 1}, + {"SaEndpoints", "size", unsafe.Sizeof(*new(SaEndpoints)), 40}, + {"SaEndpoints", "alignment", unsafe.Alignof(*new(SaEndpoints)), 8}, + {"SaEndpoints", "SaeSrcif offset", unsafe.Offsetof((*new(SaEndpoints)).SaeSrcif), 0}, + {"SaEndpoints", "SaeSrcif size", unsafe.Sizeof((*new(SaEndpoints)).SaeSrcif), 4}, + {"SaEndpoints", "SaeSrcif alignment", unsafe.Alignof((*new(SaEndpoints)).SaeSrcif), 4}, + {"SaEndpoints", "SaeSrcaddr offset", unsafe.Offsetof((*new(SaEndpoints)).SaeSrcaddr), 8}, + {"SaEndpoints", "SaeSrcaddr size", unsafe.Sizeof((*new(SaEndpoints)).SaeSrcaddr), 8}, + {"SaEndpoints", "SaeSrcaddr alignment", unsafe.Alignof((*new(SaEndpoints)).SaeSrcaddr), 8}, + {"SaEndpoints", "SaeSrcaddrlen offset", unsafe.Offsetof((*new(SaEndpoints)).SaeSrcaddrlen), 16}, + {"SaEndpoints", "SaeSrcaddrlen size", unsafe.Sizeof((*new(SaEndpoints)).SaeSrcaddrlen), 4}, + {"SaEndpoints", "SaeSrcaddrlen alignment", unsafe.Alignof((*new(SaEndpoints)).SaeSrcaddrlen), 4}, + {"SaEndpoints", "SaeDstaddr offset", unsafe.Offsetof((*new(SaEndpoints)).SaeDstaddr), 24}, + {"SaEndpoints", "SaeDstaddr size", unsafe.Sizeof((*new(SaEndpoints)).SaeDstaddr), 8}, + {"SaEndpoints", "SaeDstaddr alignment", unsafe.Alignof((*new(SaEndpoints)).SaeDstaddr), 8}, + {"SaEndpoints", "SaeDstaddrlen offset", unsafe.Offsetof((*new(SaEndpoints)).SaeDstaddrlen), 32}, + {"SaEndpoints", "SaeDstaddrlen size", unsafe.Sizeof((*new(SaEndpoints)).SaeDstaddrlen), 4}, + {"SaEndpoints", "SaeDstaddrlen alignment", unsafe.Alignof((*new(SaEndpoints)).SaeDstaddrlen), 4}, + {"Linger", "size", unsafe.Sizeof(*new(Linger)), 8}, + {"Linger", "alignment", unsafe.Alignof(*new(Linger)), 4}, + {"Linger", "LOnoff offset", unsafe.Offsetof((*new(Linger)).LOnoff), 0}, + {"Linger", "LOnoff size", unsafe.Sizeof((*new(Linger)).LOnoff), 4}, + {"Linger", "LOnoff alignment", unsafe.Alignof((*new(Linger)).LOnoff), 4}, + {"Linger", "LLinger offset", unsafe.Offsetof((*new(Linger)).LLinger), 4}, + {"Linger", "LLinger size", unsafe.Sizeof((*new(Linger)).LLinger), 4}, + {"Linger", "LLinger alignment", unsafe.Alignof((*new(Linger)).LLinger), 4}, + {"SoNpExtensions", "size", unsafe.Sizeof(*new(SoNpExtensions)), 8}, + {"SoNpExtensions", "alignment", unsafe.Alignof(*new(SoNpExtensions)), 4}, + {"SoNpExtensions", "NpxFlags offset", unsafe.Offsetof((*new(SoNpExtensions)).NpxFlags), 0}, + {"SoNpExtensions", "NpxFlags size", unsafe.Sizeof((*new(SoNpExtensions)).NpxFlags), 4}, + {"SoNpExtensions", "NpxFlags alignment", unsafe.Alignof((*new(SoNpExtensions)).NpxFlags), 4}, + {"SoNpExtensions", "NpxMask offset", unsafe.Offsetof((*new(SoNpExtensions)).NpxMask), 4}, + {"SoNpExtensions", "NpxMask size", unsafe.Sizeof((*new(SoNpExtensions)).NpxMask), 4}, + {"SoNpExtensions", "NpxMask alignment", unsafe.Alignof((*new(SoNpExtensions)).NpxMask), 4}, + {"SockAddr", "size", unsafe.Sizeof(*new(SockAddr)), 16}, + {"SockAddr", "alignment", unsafe.Alignof(*new(SockAddr)), 1}, + {"SockAddr", "Len offset", unsafe.Offsetof((*new(SockAddr)).Len), 0}, + {"SockAddr", "Len size", unsafe.Sizeof((*new(SockAddr)).Len), 1}, + {"SockAddr", "Len alignment", unsafe.Alignof((*new(SockAddr)).Len), 1}, + {"SockAddr", "Family offset", unsafe.Offsetof((*new(SockAddr)).Family), 1}, + {"SockAddr", "Family size", unsafe.Sizeof((*new(SockAddr)).Family), 1}, + {"SockAddr", "Family alignment", unsafe.Alignof((*new(SockAddr)).Family), 1}, + {"SockAddr", "Data offset", unsafe.Offsetof((*new(SockAddr)).Data), 2}, + {"SockAddr", "Data size", unsafe.Sizeof((*new(SockAddr)).Data), 14}, + {"SockAddr", "Data alignment", unsafe.Alignof((*new(SockAddr)).Data), 1}, + {"X__SockaddrHeader", "size", unsafe.Sizeof(*new(X__SockaddrHeader)), 2}, + {"X__SockaddrHeader", "alignment", unsafe.Alignof(*new(X__SockaddrHeader)), 1}, + {"X__SockaddrHeader", "SaLen offset", unsafe.Offsetof((*new(X__SockaddrHeader)).SaLen), 0}, + {"X__SockaddrHeader", "SaLen size", unsafe.Sizeof((*new(X__SockaddrHeader)).SaLen), 1}, + {"X__SockaddrHeader", "SaLen alignment", unsafe.Alignof((*new(X__SockaddrHeader)).SaLen), 1}, + {"X__SockaddrHeader", "SaFamily offset", unsafe.Offsetof((*new(X__SockaddrHeader)).SaFamily), 1}, + {"X__SockaddrHeader", "SaFamily size", unsafe.Sizeof((*new(X__SockaddrHeader)).SaFamily), 1}, + {"X__SockaddrHeader", "SaFamily alignment", unsafe.Alignof((*new(X__SockaddrHeader)).SaFamily), 1}, + {"Sockproto", "size", unsafe.Sizeof(*new(Sockproto)), 4}, + {"Sockproto", "alignment", unsafe.Alignof(*new(Sockproto)), 2}, + {"Sockproto", "SpFamily offset", unsafe.Offsetof((*new(Sockproto)).SpFamily), 0}, + {"Sockproto", "SpFamily size", unsafe.Sizeof((*new(Sockproto)).SpFamily), 2}, + {"Sockproto", "SpFamily alignment", unsafe.Alignof((*new(Sockproto)).SpFamily), 2}, + {"Sockproto", "SpProtocol offset", unsafe.Offsetof((*new(Sockproto)).SpProtocol), 2}, + {"Sockproto", "SpProtocol size", unsafe.Sizeof((*new(Sockproto)).SpProtocol), 2}, + {"Sockproto", "SpProtocol alignment", unsafe.Alignof((*new(Sockproto)).SpProtocol), 2}, + {"SockaddrStorage", "size", unsafe.Sizeof(*new(SockaddrStorage)), 128}, + {"SockaddrStorage", "alignment", unsafe.Alignof(*new(SockaddrStorage)), 8}, + {"SockaddrStorage", "Len offset", unsafe.Offsetof((*new(SockaddrStorage)).Len), 0}, + {"SockaddrStorage", "Len size", unsafe.Sizeof((*new(SockaddrStorage)).Len), 1}, + {"SockaddrStorage", "Len alignment", unsafe.Alignof((*new(SockaddrStorage)).Len), 1}, + {"SockaddrStorage", "Family offset", unsafe.Offsetof((*new(SockaddrStorage)).Family), 1}, + {"SockaddrStorage", "Family size", unsafe.Sizeof((*new(SockaddrStorage)).Family), 1}, + {"SockaddrStorage", "Family alignment", unsafe.Alignof((*new(SockaddrStorage)).Family), 1}, + {"SockaddrStorage", "pad1 offset", unsafe.Offsetof((*new(SockaddrStorage)).pad1), 2}, + {"SockaddrStorage", "pad1 size", unsafe.Sizeof((*new(SockaddrStorage)).pad1), 6}, + {"SockaddrStorage", "pad1 alignment", unsafe.Alignof((*new(SockaddrStorage)).pad1), 1}, + {"SockaddrStorage", "align offset", unsafe.Offsetof((*new(SockaddrStorage)).align), 8}, + {"SockaddrStorage", "align size", unsafe.Sizeof((*new(SockaddrStorage)).align), 8}, + {"SockaddrStorage", "align alignment", unsafe.Alignof((*new(SockaddrStorage)).align), 8}, + {"SockaddrStorage", "pad2 offset", unsafe.Offsetof((*new(SockaddrStorage)).pad2), 16}, + {"SockaddrStorage", "pad2 size", unsafe.Sizeof((*new(SockaddrStorage)).pad2), 112}, + {"SockaddrStorage", "pad2 alignment", unsafe.Alignof((*new(SockaddrStorage)).pad2), 1}, + {"Msghdr", "size", unsafe.Sizeof(*new(Msghdr)), 48}, + {"Msghdr", "alignment", unsafe.Alignof(*new(Msghdr)), 8}, + {"Msghdr", "MsgName offset", unsafe.Offsetof((*new(Msghdr)).MsgName), 0}, + {"Msghdr", "MsgName size", unsafe.Sizeof((*new(Msghdr)).MsgName), 8}, + {"Msghdr", "MsgName alignment", unsafe.Alignof((*new(Msghdr)).MsgName), 8}, + {"Msghdr", "MsgNamelen offset", unsafe.Offsetof((*new(Msghdr)).MsgNamelen), 8}, + {"Msghdr", "MsgNamelen size", unsafe.Sizeof((*new(Msghdr)).MsgNamelen), 4}, + {"Msghdr", "MsgNamelen alignment", unsafe.Alignof((*new(Msghdr)).MsgNamelen), 4}, + {"Msghdr", "MsgIov offset", unsafe.Offsetof((*new(Msghdr)).MsgIov), 16}, + {"Msghdr", "MsgIov size", unsafe.Sizeof((*new(Msghdr)).MsgIov), 8}, + {"Msghdr", "MsgIov alignment", unsafe.Alignof((*new(Msghdr)).MsgIov), 8}, + {"Msghdr", "MsgIovlen offset", unsafe.Offsetof((*new(Msghdr)).MsgIovlen), 24}, + {"Msghdr", "MsgIovlen size", unsafe.Sizeof((*new(Msghdr)).MsgIovlen), 4}, + {"Msghdr", "MsgIovlen alignment", unsafe.Alignof((*new(Msghdr)).MsgIovlen), 4}, + {"Msghdr", "MsgControl offset", unsafe.Offsetof((*new(Msghdr)).MsgControl), 32}, + {"Msghdr", "MsgControl size", unsafe.Sizeof((*new(Msghdr)).MsgControl), 8}, + {"Msghdr", "MsgControl alignment", unsafe.Alignof((*new(Msghdr)).MsgControl), 8}, + {"Msghdr", "MsgControllen offset", unsafe.Offsetof((*new(Msghdr)).MsgControllen), 40}, + {"Msghdr", "MsgControllen size", unsafe.Sizeof((*new(Msghdr)).MsgControllen), 4}, + {"Msghdr", "MsgControllen alignment", unsafe.Alignof((*new(Msghdr)).MsgControllen), 4}, + {"Msghdr", "MsgFlags offset", unsafe.Offsetof((*new(Msghdr)).MsgFlags), 44}, + {"Msghdr", "MsgFlags size", unsafe.Sizeof((*new(Msghdr)).MsgFlags), 4}, + {"Msghdr", "MsgFlags alignment", unsafe.Alignof((*new(Msghdr)).MsgFlags), 4}, + {"Cmsghdr", "size", unsafe.Sizeof(*new(Cmsghdr)), 12}, + {"Cmsghdr", "alignment", unsafe.Alignof(*new(Cmsghdr)), 4}, + {"Cmsghdr", "CmsgLen offset", unsafe.Offsetof((*new(Cmsghdr)).CmsgLen), 0}, + {"Cmsghdr", "CmsgLen size", unsafe.Sizeof((*new(Cmsghdr)).CmsgLen), 4}, + {"Cmsghdr", "CmsgLen alignment", unsafe.Alignof((*new(Cmsghdr)).CmsgLen), 4}, + {"Cmsghdr", "CmsgLevel offset", unsafe.Offsetof((*new(Cmsghdr)).CmsgLevel), 4}, + {"Cmsghdr", "CmsgLevel size", unsafe.Sizeof((*new(Cmsghdr)).CmsgLevel), 4}, + {"Cmsghdr", "CmsgLevel alignment", unsafe.Alignof((*new(Cmsghdr)).CmsgLevel), 4}, + {"Cmsghdr", "CmsgType offset", unsafe.Offsetof((*new(Cmsghdr)).CmsgType), 8}, + {"Cmsghdr", "CmsgType size", unsafe.Sizeof((*new(Cmsghdr)).CmsgType), 4}, + {"Cmsghdr", "CmsgType alignment", unsafe.Alignof((*new(Cmsghdr)).CmsgType), 4}, + {"SfHdtr", "size", unsafe.Sizeof(*new(SfHdtr)), 32}, + {"SfHdtr", "alignment", unsafe.Alignof(*new(SfHdtr)), 8}, + {"SfHdtr", "Headers offset", unsafe.Offsetof((*new(SfHdtr)).Headers), 0}, + {"SfHdtr", "Headers size", unsafe.Sizeof((*new(SfHdtr)).Headers), 8}, + {"SfHdtr", "Headers alignment", unsafe.Alignof((*new(SfHdtr)).Headers), 8}, + {"SfHdtr", "HdrCnt offset", unsafe.Offsetof((*new(SfHdtr)).HdrCnt), 8}, + {"SfHdtr", "HdrCnt size", unsafe.Sizeof((*new(SfHdtr)).HdrCnt), 4}, + {"SfHdtr", "HdrCnt alignment", unsafe.Alignof((*new(SfHdtr)).HdrCnt), 4}, + {"SfHdtr", "Trailers offset", unsafe.Offsetof((*new(SfHdtr)).Trailers), 16}, + {"SfHdtr", "Trailers size", unsafe.Sizeof((*new(SfHdtr)).Trailers), 8}, + {"SfHdtr", "Trailers alignment", unsafe.Alignof((*new(SfHdtr)).Trailers), 8}, + {"SfHdtr", "TrlCnt offset", unsafe.Offsetof((*new(SfHdtr)).TrlCnt), 24}, + {"SfHdtr", "TrlCnt size", unsafe.Sizeof((*new(SfHdtr)).TrlCnt), 4}, + {"SfHdtr", "TrlCnt alignment", unsafe.Alignof((*new(SfHdtr)).TrlCnt), 4}, + {"SaeAssocidT", "size", unsafe.Sizeof(*new(SaeAssocidT)), 4}, + {"SaeAssocidT", "alignment", unsafe.Alignof(*new(SaeAssocidT)), 4}, + {"SaeConnidT", "size", unsafe.Sizeof(*new(SaeConnidT)), 4}, + {"SaeConnidT", "alignment", unsafe.Alignof(*new(SaeConnidT)), 4}, + {"SaEndpointsT", "size", unsafe.Sizeof(*new(SaEndpointsT)), 40}, + {"SaEndpointsT", "alignment", unsafe.Alignof(*new(SaEndpointsT)), 8}, + {"SockaddrUn", "size", unsafe.Sizeof(*new(SockaddrUn)), 106}, + {"SockaddrUn", "alignment", unsafe.Alignof(*new(SockaddrUn)), 1}, + {"SockaddrUn", "SunLen offset", unsafe.Offsetof((*new(SockaddrUn)).SunLen), 0}, + {"SockaddrUn", "SunLen size", unsafe.Sizeof((*new(SockaddrUn)).SunLen), 1}, + {"SockaddrUn", "SunLen alignment", unsafe.Alignof((*new(SockaddrUn)).SunLen), 1}, + {"SockaddrUn", "SunFamily offset", unsafe.Offsetof((*new(SockaddrUn)).SunFamily), 1}, + {"SockaddrUn", "SunFamily size", unsafe.Sizeof((*new(SockaddrUn)).SunFamily), 1}, + {"SockaddrUn", "SunFamily alignment", unsafe.Alignof((*new(SockaddrUn)).SunFamily), 1}, + {"SockaddrUn", "SunPath offset", unsafe.Offsetof((*new(SockaddrUn)).SunPath), 2}, + {"SockaddrUn", "SunPath size", unsafe.Sizeof((*new(SockaddrUn)).SunPath), 104}, + {"SockaddrUn", "SunPath alignment", unsafe.Alignof((*new(SockaddrUn)).SunPath), 1}, + {"Uint32T", "size", unsafe.Sizeof(*new(Uint32T)), 4}, + {"Uint32T", "alignment", unsafe.Alignof(*new(Uint32T)), 4}, + {"HErrno", "global size", unsafe.Sizeof(HErrno), 4}, + {"HErrno", "global alignment", unsafe.Alignof(HErrno), 4}, + {"In6addrAny", "global size", unsafe.Sizeof(In6addrAny), 16}, + {"In6addrAny", "global alignment", unsafe.Alignof(In6addrAny), 4}, + {"In6addrLoopback", "global size", unsafe.Sizeof(In6addrLoopback), 16}, + {"In6addrLoopback", "global alignment", unsafe.Alignof(In6addrLoopback), 4}, + {"In6addrNodelocalAllnodes", "global size", unsafe.Sizeof(In6addrNodelocalAllnodes), 16}, + {"In6addrNodelocalAllnodes", "global alignment", unsafe.Alignof(In6addrNodelocalAllnodes), 4}, + {"In6addrLinklocalAllnodes", "global size", unsafe.Sizeof(In6addrLinklocalAllnodes), 16}, + {"In6addrLinklocalAllnodes", "global alignment", unsafe.Alignof(In6addrLinklocalAllnodes), 4}, + {"In6addrLinklocalAllrouters", "global size", unsafe.Sizeof(In6addrLinklocalAllrouters), 16}, + {"In6addrLinklocalAllrouters", "global alignment", unsafe.Alignof(In6addrLinklocalAllrouters), 4}, + {"In6addrLinklocalAllv2routers", "global size", unsafe.Sizeof(In6addrLinklocalAllv2routers), 16}, + {"In6addrLinklocalAllv2routers", "global alignment", unsafe.Alignof(In6addrLinklocalAllv2routers), 4}, + } + var networkIntegerConstants = []struct { + name string + got, want int64 + }{ + {"IF_NAMESIZE", int64(IF_NAMESIZE), 16}, + {"IFF_UP", int64(IFF_UP), 1}, + {"IFF_BROADCAST", int64(IFF_BROADCAST), 2}, + {"IFF_DEBUG", int64(IFF_DEBUG), 4}, + {"IFF_LOOPBACK", int64(IFF_LOOPBACK), 8}, + {"IFF_POINTOPOINT", int64(IFF_POINTOPOINT), 16}, + {"IFF_NOTRAILERS", int64(IFF_NOTRAILERS), 32}, + {"IFF_RUNNING", int64(IFF_RUNNING), 64}, + {"IFF_NOARP", int64(IFF_NOARP), 128}, + {"IFF_PROMISC", int64(IFF_PROMISC), 256}, + {"IFF_ALLMULTI", int64(IFF_ALLMULTI), 512}, + {"IFF_OACTIVE", int64(IFF_OACTIVE), 1024}, + {"IFF_SIMPLEX", int64(IFF_SIMPLEX), 2048}, + {"IFF_LINK0", int64(IFF_LINK0), 4096}, + {"IFF_LINK1", int64(IFF_LINK1), 8192}, + {"IFF_LINK2", int64(IFF_LINK2), 16384}, + {"IFF_ALTPHYS", int64(IFF_ALTPHYS), 16384}, + {"IFF_MULTICAST", int64(IFF_MULTICAST), 32768}, + {"IFCAP_RXCSUM", int64(IFCAP_RXCSUM), 1}, + {"IFCAP_TXCSUM", int64(IFCAP_TXCSUM), 2}, + {"IFCAP_VLAN_MTU", int64(IFCAP_VLAN_MTU), 4}, + {"IFCAP_VLAN_HWTAGGING", int64(IFCAP_VLAN_HWTAGGING), 8}, + {"IFCAP_JUMBO_MTU", int64(IFCAP_JUMBO_MTU), 16}, + {"IFCAP_TSO4", int64(IFCAP_TSO4), 32}, + {"IFCAP_TSO6", int64(IFCAP_TSO6), 64}, + {"IFCAP_LRO", int64(IFCAP_LRO), 128}, + {"IFCAP_AV", int64(IFCAP_AV), 256}, + {"IFCAP_TXSTATUS", int64(IFCAP_TXSTATUS), 512}, + {"IFCAP_SKYWALK", int64(IFCAP_SKYWALK), 1024}, + {"IFCAP_HW_TIMESTAMP", int64(IFCAP_HW_TIMESTAMP), 2048}, + {"IFCAP_SW_TIMESTAMP", int64(IFCAP_SW_TIMESTAMP), 4096}, + {"IFCAP_CSUM_PARTIAL", int64(IFCAP_CSUM_PARTIAL), 8192}, + {"IFCAP_CSUM_ZERO_INVERT", int64(IFCAP_CSUM_ZERO_INVERT), 16384}, + {"IFCAP_HWCSUM", int64(IFCAP_HWCSUM), 3}, + {"IFCAP_TSO", int64(IFCAP_TSO), 96}, + {"IFCAP_VALID", int64(IFCAP_VALID), 32767}, + {"IFQ_MAXLEN", int64(IFQ_MAXLEN), 128}, + {"IFNET_SLOWHZ", int64(IFNET_SLOWHZ), 1}, + {"IF_WAKE_ON_MAGIC_PACKET", int64(IF_WAKE_ON_MAGIC_PACKET), 1}, + {"IFSTATMAX", int64(IFSTATMAX), 800}, + {"IFRTYPE_FUNCTIONAL_UNKNOWN", int64(IFRTYPE_FUNCTIONAL_UNKNOWN), 0}, + {"IFRTYPE_FUNCTIONAL_LOOPBACK", int64(IFRTYPE_FUNCTIONAL_LOOPBACK), 1}, + {"IFRTYPE_FUNCTIONAL_WIRED", int64(IFRTYPE_FUNCTIONAL_WIRED), 2}, + {"IFRTYPE_FUNCTIONAL_WIFI_INFRA", int64(IFRTYPE_FUNCTIONAL_WIFI_INFRA), 3}, + {"IFRTYPE_FUNCTIONAL_WIFI_AWDL", int64(IFRTYPE_FUNCTIONAL_WIFI_AWDL), 4}, + {"IFRTYPE_FUNCTIONAL_CELLULAR", int64(IFRTYPE_FUNCTIONAL_CELLULAR), 5}, + {"IFRTYPE_FUNCTIONAL_INTCOPROC", int64(IFRTYPE_FUNCTIONAL_INTCOPROC), 6}, + {"IFRTYPE_FUNCTIONAL_COMPANIONLINK", int64(IFRTYPE_FUNCTIONAL_COMPANIONLINK), 7}, + {"IFRTYPE_FUNCTIONAL_MANAGEMENT", int64(IFRTYPE_FUNCTIONAL_MANAGEMENT), 8}, + {"IFRTYPE_FUNCTIONAL_LAST", int64(IFRTYPE_FUNCTIONAL_LAST), 8}, + {"APPLE_IF_FAM_LOOPBACK", int64(APPLE_IF_FAM_LOOPBACK), 1}, + {"APPLE_IF_FAM_ETHERNET", int64(APPLE_IF_FAM_ETHERNET), 2}, + {"APPLE_IF_FAM_SLIP", int64(APPLE_IF_FAM_SLIP), 3}, + {"APPLE_IF_FAM_TUN", int64(APPLE_IF_FAM_TUN), 4}, + {"APPLE_IF_FAM_VLAN", int64(APPLE_IF_FAM_VLAN), 5}, + {"APPLE_IF_FAM_PPP", int64(APPLE_IF_FAM_PPP), 6}, + {"APPLE_IF_FAM_PVC", int64(APPLE_IF_FAM_PVC), 7}, + {"APPLE_IF_FAM_DISC", int64(APPLE_IF_FAM_DISC), 8}, + {"APPLE_IF_FAM_MDECAP", int64(APPLE_IF_FAM_MDECAP), 9}, + {"APPLE_IF_FAM_GIF", int64(APPLE_IF_FAM_GIF), 10}, + {"APPLE_IF_FAM_FAITH", int64(APPLE_IF_FAM_FAITH), 11}, + {"APPLE_IF_FAM_STF", int64(APPLE_IF_FAM_STF), 12}, + {"APPLE_IF_FAM_FIREWIRE", int64(APPLE_IF_FAM_FIREWIRE), 13}, + {"APPLE_IF_FAM_BOND", int64(APPLE_IF_FAM_BOND), 14}, + {"APPLE_IF_FAM_CELLULAR", int64(APPLE_IF_FAM_CELLULAR), 15}, + {"APPLE_IF_FAM_UNUSED_16", int64(APPLE_IF_FAM_UNUSED_16), 16}, + {"APPLE_IF_FAM_UTUN", int64(APPLE_IF_FAM_UTUN), 17}, + {"APPLE_IF_FAM_IPSEC", int64(APPLE_IF_FAM_IPSEC), 18}, + {"IF_MINMTU", int64(IF_MINMTU), 72}, + {"IF_MAXMTU", int64(IF_MAXMTU), 65535}, + {"IFNAMSIZ", int64(IFNAMSIZ), 16}, + {"KEV_INET_SUBCLASS", int64(KEV_INET_SUBCLASS), 1}, + {"KEV_INET_NEW_ADDR", int64(KEV_INET_NEW_ADDR), 1}, + {"KEV_INET_CHANGED_ADDR", int64(KEV_INET_CHANGED_ADDR), 2}, + {"KEV_INET_ADDR_DELETED", int64(KEV_INET_ADDR_DELETED), 3}, + {"KEV_INET_SIFDSTADDR", int64(KEV_INET_SIFDSTADDR), 4}, + {"KEV_INET_SIFBRDADDR", int64(KEV_INET_SIFBRDADDR), 5}, + {"KEV_INET_SIFNETMASK", int64(KEV_INET_SIFNETMASK), 6}, + {"KEV_INET_ARPCOLLISION", int64(KEV_INET_ARPCOLLISION), 7}, + {"KEV_INET_PORTINUSE", int64(KEV_INET_PORTINUSE), 8}, + {"KEV_INET_ARPRTRFAILURE", int64(KEV_INET_ARPRTRFAILURE), 9}, + {"KEV_INET_ARPRTRALIVE", int64(KEV_INET_ARPRTRALIVE), 10}, + {"KEV_DL_SUBCLASS", int64(KEV_DL_SUBCLASS), 2}, + {"KEV_DL_SIFFLAGS", int64(KEV_DL_SIFFLAGS), 1}, + {"KEV_DL_SIFMETRICS", int64(KEV_DL_SIFMETRICS), 2}, + {"KEV_DL_SIFMTU", int64(KEV_DL_SIFMTU), 3}, + {"KEV_DL_SIFPHYS", int64(KEV_DL_SIFPHYS), 4}, + {"KEV_DL_SIFMEDIA", int64(KEV_DL_SIFMEDIA), 5}, + {"KEV_DL_SIFGENERIC", int64(KEV_DL_SIFGENERIC), 6}, + {"KEV_DL_ADDMULTI", int64(KEV_DL_ADDMULTI), 7}, + {"KEV_DL_DELMULTI", int64(KEV_DL_DELMULTI), 8}, + {"KEV_DL_IF_ATTACHED", int64(KEV_DL_IF_ATTACHED), 9}, + {"KEV_DL_IF_DETACHING", int64(KEV_DL_IF_DETACHING), 10}, + {"KEV_DL_IF_DETACHED", int64(KEV_DL_IF_DETACHED), 11}, + {"KEV_DL_LINK_OFF", int64(KEV_DL_LINK_OFF), 12}, + {"KEV_DL_LINK_ON", int64(KEV_DL_LINK_ON), 13}, + {"KEV_DL_PROTO_ATTACHED", int64(KEV_DL_PROTO_ATTACHED), 14}, + {"KEV_DL_PROTO_DETACHED", int64(KEV_DL_PROTO_DETACHED), 15}, + {"KEV_DL_LINK_ADDRESS_CHANGED", int64(KEV_DL_LINK_ADDRESS_CHANGED), 16}, + {"KEV_DL_WAKEFLAGS_CHANGED", int64(KEV_DL_WAKEFLAGS_CHANGED), 17}, + {"KEV_DL_IF_IDLE_ROUTE_REFCNT", int64(KEV_DL_IF_IDLE_ROUTE_REFCNT), 18}, + {"KEV_DL_IFCAP_CHANGED", int64(KEV_DL_IFCAP_CHANGED), 19}, + {"KEV_DL_LINK_QUALITY_METRIC_CHANGED", int64(KEV_DL_LINK_QUALITY_METRIC_CHANGED), 20}, + {"KEV_DL_NODE_PRESENCE", int64(KEV_DL_NODE_PRESENCE), 21}, + {"KEV_DL_NODE_ABSENCE", int64(KEV_DL_NODE_ABSENCE), 22}, + {"KEV_DL_PRIMARY_ELECTED", int64(KEV_DL_PRIMARY_ELECTED), 23}, + {"KEV_DL_ISSUES", int64(KEV_DL_ISSUES), 24}, + {"KEV_DL_IFDELEGATE_CHANGED", int64(KEV_DL_IFDELEGATE_CHANGED), 25}, + {"KEV_DL_AWDL_RESTRICTED", int64(KEV_DL_AWDL_RESTRICTED), 26}, + {"KEV_DL_AWDL_UNRESTRICTED", int64(KEV_DL_AWDL_UNRESTRICTED), 27}, + {"KEV_DL_RRC_STATE_CHANGED", int64(KEV_DL_RRC_STATE_CHANGED), 28}, + {"KEV_DL_QOS_MODE_CHANGED", int64(KEV_DL_QOS_MODE_CHANGED), 29}, + {"KEV_DL_LOW_POWER_MODE_CHANGED", int64(KEV_DL_LOW_POWER_MODE_CHANGED), 30}, + {"KEV_INET6_SUBCLASS", int64(KEV_INET6_SUBCLASS), 6}, + {"KEV_INET6_NEW_USER_ADDR", int64(KEV_INET6_NEW_USER_ADDR), 1}, + {"KEV_INET6_CHANGED_ADDR", int64(KEV_INET6_CHANGED_ADDR), 2}, + {"KEV_INET6_ADDR_DELETED", int64(KEV_INET6_ADDR_DELETED), 3}, + {"KEV_INET6_NEW_LL_ADDR", int64(KEV_INET6_NEW_LL_ADDR), 4}, + {"KEV_INET6_NEW_RTADV_ADDR", int64(KEV_INET6_NEW_RTADV_ADDR), 5}, + {"KEV_INET6_DEFROUTER", int64(KEV_INET6_DEFROUTER), 6}, + {"KEV_INET6_REQUEST_NAT64_PREFIX", int64(KEV_INET6_REQUEST_NAT64_PREFIX), 7}, + {"NETDB_INTERNAL", int64(NETDB_INTERNAL), -1}, + {"NETDB_SUCCESS", int64(NETDB_SUCCESS), 0}, + {"HOST_NOT_FOUND", int64(HOST_NOT_FOUND), 1}, + {"TRY_AGAIN", int64(TRY_AGAIN), 2}, + {"NO_RECOVERY", int64(NO_RECOVERY), 3}, + {"NO_DATA", int64(NO_DATA), 4}, + {"NO_ADDRESS", int64(NO_ADDRESS), 4}, + {"EAI_ADDRFAMILY", int64(EAI_ADDRFAMILY), 1}, + {"EAI_AGAIN", int64(EAI_AGAIN), 2}, + {"EAI_BADFLAGS", int64(EAI_BADFLAGS), 3}, + {"EAI_FAIL", int64(EAI_FAIL), 4}, + {"EAI_FAMILY", int64(EAI_FAMILY), 5}, + {"EAI_MEMORY", int64(EAI_MEMORY), 6}, + {"EAI_NODATA", int64(EAI_NODATA), 7}, + {"EAI_NONAME", int64(EAI_NONAME), 8}, + {"EAI_SERVICE", int64(EAI_SERVICE), 9}, + {"EAI_SOCKTYPE", int64(EAI_SOCKTYPE), 10}, + {"EAI_SYSTEM", int64(EAI_SYSTEM), 11}, + {"EAI_BADHINTS", int64(EAI_BADHINTS), 12}, + {"EAI_PROTOCOL", int64(EAI_PROTOCOL), 13}, + {"EAI_OVERFLOW", int64(EAI_OVERFLOW), 14}, + {"EAI_MAX", int64(EAI_MAX), 15}, + {"AI_PASSIVE", int64(AI_PASSIVE), 1}, + {"AI_CANONNAME", int64(AI_CANONNAME), 2}, + {"AI_NUMERICHOST", int64(AI_NUMERICHOST), 4}, + {"AI_NUMERICSERV", int64(AI_NUMERICSERV), 4096}, + {"AI_ALL", int64(AI_ALL), 256}, + {"AI_V4MAPPED_CFG", int64(AI_V4MAPPED_CFG), 512}, + {"AI_ADDRCONFIG", int64(AI_ADDRCONFIG), 1024}, + {"AI_V4MAPPED", int64(AI_V4MAPPED), 2048}, + {"AI_DEFAULT", int64(AI_DEFAULT), 1536}, + {"AI_UNUSABLE", int64(AI_UNUSABLE), 268435456}, + {"NI_MAXHOST", int64(NI_MAXHOST), 1025}, + {"NI_MAXSERV", int64(NI_MAXSERV), 32}, + {"NI_NOFQDN", int64(NI_NOFQDN), 1}, + {"NI_NUMERICHOST", int64(NI_NUMERICHOST), 2}, + {"NI_NAMEREQD", int64(NI_NAMEREQD), 4}, + {"NI_NUMERICSERV", int64(NI_NUMERICSERV), 8}, + {"NI_NUMERICSCOPE", int64(NI_NUMERICSCOPE), 256}, + {"NI_DGRAM", int64(NI_DGRAM), 16}, + {"NI_WITHSCOPEID", int64(NI_WITHSCOPEID), 32}, + {"IPPROTO_IP", int64(IPPROTO_IP), 0}, + {"IPPROTO_HOPOPTS", int64(IPPROTO_HOPOPTS), 0}, + {"IPPROTO_ICMP", int64(IPPROTO_ICMP), 1}, + {"IPPROTO_IGMP", int64(IPPROTO_IGMP), 2}, + {"IPPROTO_GGP", int64(IPPROTO_GGP), 3}, + {"IPPROTO_IPV4", int64(IPPROTO_IPV4), 4}, + {"IPPROTO_IPIP", int64(IPPROTO_IPIP), 4}, + {"IPPROTO_TCP", int64(IPPROTO_TCP), 6}, + {"IPPROTO_ST", int64(IPPROTO_ST), 7}, + {"IPPROTO_EGP", int64(IPPROTO_EGP), 8}, + {"IPPROTO_PIGP", int64(IPPROTO_PIGP), 9}, + {"IPPROTO_RCCMON", int64(IPPROTO_RCCMON), 10}, + {"IPPROTO_NVPII", int64(IPPROTO_NVPII), 11}, + {"IPPROTO_PUP", int64(IPPROTO_PUP), 12}, + {"IPPROTO_ARGUS", int64(IPPROTO_ARGUS), 13}, + {"IPPROTO_EMCON", int64(IPPROTO_EMCON), 14}, + {"IPPROTO_XNET", int64(IPPROTO_XNET), 15}, + {"IPPROTO_CHAOS", int64(IPPROTO_CHAOS), 16}, + {"IPPROTO_UDP", int64(IPPROTO_UDP), 17}, + {"IPPROTO_MUX", int64(IPPROTO_MUX), 18}, + {"IPPROTO_MEAS", int64(IPPROTO_MEAS), 19}, + {"IPPROTO_HMP", int64(IPPROTO_HMP), 20}, + {"IPPROTO_PRM", int64(IPPROTO_PRM), 21}, + {"IPPROTO_IDP", int64(IPPROTO_IDP), 22}, + {"IPPROTO_TRUNK1", int64(IPPROTO_TRUNK1), 23}, + {"IPPROTO_TRUNK2", int64(IPPROTO_TRUNK2), 24}, + {"IPPROTO_LEAF1", int64(IPPROTO_LEAF1), 25}, + {"IPPROTO_LEAF2", int64(IPPROTO_LEAF2), 26}, + {"IPPROTO_RDP", int64(IPPROTO_RDP), 27}, + {"IPPROTO_IRTP", int64(IPPROTO_IRTP), 28}, + {"IPPROTO_TP", int64(IPPROTO_TP), 29}, + {"IPPROTO_BLT", int64(IPPROTO_BLT), 30}, + {"IPPROTO_NSP", int64(IPPROTO_NSP), 31}, + {"IPPROTO_INP", int64(IPPROTO_INP), 32}, + {"IPPROTO_SEP", int64(IPPROTO_SEP), 33}, + {"IPPROTO_3PC", int64(IPPROTO_3PC), 34}, + {"IPPROTO_IDPR", int64(IPPROTO_IDPR), 35}, + {"IPPROTO_XTP", int64(IPPROTO_XTP), 36}, + {"IPPROTO_DDP", int64(IPPROTO_DDP), 37}, + {"IPPROTO_CMTP", int64(IPPROTO_CMTP), 38}, + {"IPPROTO_TPXX", int64(IPPROTO_TPXX), 39}, + {"IPPROTO_IL", int64(IPPROTO_IL), 40}, + {"IPPROTO_IPV6", int64(IPPROTO_IPV6), 41}, + {"IPPROTO_SDRP", int64(IPPROTO_SDRP), 42}, + {"IPPROTO_ROUTING", int64(IPPROTO_ROUTING), 43}, + {"IPPROTO_FRAGMENT", int64(IPPROTO_FRAGMENT), 44}, + {"IPPROTO_IDRP", int64(IPPROTO_IDRP), 45}, + {"IPPROTO_RSVP", int64(IPPROTO_RSVP), 46}, + {"IPPROTO_GRE", int64(IPPROTO_GRE), 47}, + {"IPPROTO_MHRP", int64(IPPROTO_MHRP), 48}, + {"IPPROTO_BHA", int64(IPPROTO_BHA), 49}, + {"IPPROTO_ESP", int64(IPPROTO_ESP), 50}, + {"IPPROTO_AH", int64(IPPROTO_AH), 51}, + {"IPPROTO_INLSP", int64(IPPROTO_INLSP), 52}, + {"IPPROTO_SWIPE", int64(IPPROTO_SWIPE), 53}, + {"IPPROTO_NHRP", int64(IPPROTO_NHRP), 54}, + {"IPPROTO_ICMPV6", int64(IPPROTO_ICMPV6), 58}, + {"IPPROTO_NONE", int64(IPPROTO_NONE), 59}, + {"IPPROTO_DSTOPTS", int64(IPPROTO_DSTOPTS), 60}, + {"IPPROTO_AHIP", int64(IPPROTO_AHIP), 61}, + {"IPPROTO_CFTP", int64(IPPROTO_CFTP), 62}, + {"IPPROTO_HELLO", int64(IPPROTO_HELLO), 63}, + {"IPPROTO_SATEXPAK", int64(IPPROTO_SATEXPAK), 64}, + {"IPPROTO_KRYPTOLAN", int64(IPPROTO_KRYPTOLAN), 65}, + {"IPPROTO_RVD", int64(IPPROTO_RVD), 66}, + {"IPPROTO_IPPC", int64(IPPROTO_IPPC), 67}, + {"IPPROTO_ADFS", int64(IPPROTO_ADFS), 68}, + {"IPPROTO_SATMON", int64(IPPROTO_SATMON), 69}, + {"IPPROTO_VISA", int64(IPPROTO_VISA), 70}, + {"IPPROTO_IPCV", int64(IPPROTO_IPCV), 71}, + {"IPPROTO_CPNX", int64(IPPROTO_CPNX), 72}, + {"IPPROTO_CPHB", int64(IPPROTO_CPHB), 73}, + {"IPPROTO_WSN", int64(IPPROTO_WSN), 74}, + {"IPPROTO_PVP", int64(IPPROTO_PVP), 75}, + {"IPPROTO_BRSATMON", int64(IPPROTO_BRSATMON), 76}, + {"IPPROTO_ND", int64(IPPROTO_ND), 77}, + {"IPPROTO_WBMON", int64(IPPROTO_WBMON), 78}, + {"IPPROTO_WBEXPAK", int64(IPPROTO_WBEXPAK), 79}, + {"IPPROTO_EON", int64(IPPROTO_EON), 80}, + {"IPPROTO_VMTP", int64(IPPROTO_VMTP), 81}, + {"IPPROTO_SVMTP", int64(IPPROTO_SVMTP), 82}, + {"IPPROTO_VINES", int64(IPPROTO_VINES), 83}, + {"IPPROTO_TTP", int64(IPPROTO_TTP), 84}, + {"IPPROTO_IGP", int64(IPPROTO_IGP), 85}, + {"IPPROTO_DGP", int64(IPPROTO_DGP), 86}, + {"IPPROTO_TCF", int64(IPPROTO_TCF), 87}, + {"IPPROTO_IGRP", int64(IPPROTO_IGRP), 88}, + {"IPPROTO_OSPFIGP", int64(IPPROTO_OSPFIGP), 89}, + {"IPPROTO_SRPC", int64(IPPROTO_SRPC), 90}, + {"IPPROTO_LARP", int64(IPPROTO_LARP), 91}, + {"IPPROTO_MTP", int64(IPPROTO_MTP), 92}, + {"IPPROTO_AX25", int64(IPPROTO_AX25), 93}, + {"IPPROTO_IPEIP", int64(IPPROTO_IPEIP), 94}, + {"IPPROTO_MICP", int64(IPPROTO_MICP), 95}, + {"IPPROTO_SCCSP", int64(IPPROTO_SCCSP), 96}, + {"IPPROTO_ETHERIP", int64(IPPROTO_ETHERIP), 97}, + {"IPPROTO_ENCAP", int64(IPPROTO_ENCAP), 98}, + {"IPPROTO_APES", int64(IPPROTO_APES), 99}, + {"IPPROTO_GMTP", int64(IPPROTO_GMTP), 100}, + {"IPPROTO_PIM", int64(IPPROTO_PIM), 103}, + {"IPPROTO_IPCOMP", int64(IPPROTO_IPCOMP), 108}, + {"IPPROTO_PGM", int64(IPPROTO_PGM), 113}, + {"IPPROTO_SCTP", int64(IPPROTO_SCTP), 132}, + {"IPPROTO_DIVERT", int64(IPPROTO_DIVERT), 254}, + {"IPPROTO_RAW", int64(IPPROTO_RAW), 255}, + {"IPPROTO_MAX", int64(IPPROTO_MAX), 256}, + {"IPPROTO_DONE", int64(IPPROTO_DONE), 257}, + {"X__DARWIN_IPPORT_RESERVED", int64(X__DARWIN_IPPORT_RESERVED), 1024}, + {"IPPORT_RESERVED", int64(IPPORT_RESERVED), 1024}, + {"IPPORT_USERRESERVED", int64(IPPORT_USERRESERVED), 5000}, + {"IPPORT_HIFIRSTAUTO", int64(IPPORT_HIFIRSTAUTO), 49152}, + {"IPPORT_HILASTAUTO", int64(IPPORT_HILASTAUTO), 65535}, + {"IPPORT_RESERVEDSTART", int64(IPPORT_RESERVEDSTART), 600}, + {"IN_CLASSA_NET", int64(IN_CLASSA_NET), 4278190080}, + {"IN_CLASSA_NSHIFT", int64(IN_CLASSA_NSHIFT), 24}, + {"IN_CLASSA_HOST", int64(IN_CLASSA_HOST), 16777215}, + {"IN_CLASSA_MAX", int64(IN_CLASSA_MAX), 128}, + {"IN_CLASSB_NET", int64(IN_CLASSB_NET), 4294901760}, + {"IN_CLASSB_NSHIFT", int64(IN_CLASSB_NSHIFT), 16}, + {"IN_CLASSB_HOST", int64(IN_CLASSB_HOST), 65535}, + {"IN_CLASSB_MAX", int64(IN_CLASSB_MAX), 65536}, + {"IN_CLASSC_NET", int64(IN_CLASSC_NET), 4294967040}, + {"IN_CLASSC_NSHIFT", int64(IN_CLASSC_NSHIFT), 8}, + {"IN_CLASSC_HOST", int64(IN_CLASSC_HOST), 255}, + {"IN_CLASSD_NET", int64(IN_CLASSD_NET), 4026531840}, + {"IN_CLASSD_NSHIFT", int64(IN_CLASSD_NSHIFT), 28}, + {"IN_CLASSD_HOST", int64(IN_CLASSD_HOST), 268435455}, + {"INADDR_NONE", int64(INADDR_NONE), 4294967295}, + {"IN_LOOPBACKNET", int64(IN_LOOPBACKNET), 127}, + {"INET_ADDRSTRLEN", int64(INET_ADDRSTRLEN), 16}, + {"IP_OPTIONS", int64(IP_OPTIONS), 1}, + {"IP_HDRINCL", int64(IP_HDRINCL), 2}, + {"IP_TOS", int64(IP_TOS), 3}, + {"IP_TTL", int64(IP_TTL), 4}, + {"IP_RECVOPTS", int64(IP_RECVOPTS), 5}, + {"IP_RECVRETOPTS", int64(IP_RECVRETOPTS), 6}, + {"IP_RECVDSTADDR", int64(IP_RECVDSTADDR), 7}, + {"IP_RETOPTS", int64(IP_RETOPTS), 8}, + {"IP_MULTICAST_IF", int64(IP_MULTICAST_IF), 9}, + {"IP_MULTICAST_TTL", int64(IP_MULTICAST_TTL), 10}, + {"IP_MULTICAST_LOOP", int64(IP_MULTICAST_LOOP), 11}, + {"IP_ADD_MEMBERSHIP", int64(IP_ADD_MEMBERSHIP), 12}, + {"IP_DROP_MEMBERSHIP", int64(IP_DROP_MEMBERSHIP), 13}, + {"IP_MULTICAST_VIF", int64(IP_MULTICAST_VIF), 14}, + {"IP_RSVP_ON", int64(IP_RSVP_ON), 15}, + {"IP_RSVP_OFF", int64(IP_RSVP_OFF), 16}, + {"IP_RSVP_VIF_ON", int64(IP_RSVP_VIF_ON), 17}, + {"IP_RSVP_VIF_OFF", int64(IP_RSVP_VIF_OFF), 18}, + {"IP_PORTRANGE", int64(IP_PORTRANGE), 19}, + {"IP_RECVIF", int64(IP_RECVIF), 20}, + {"IP_IPSEC_POLICY", int64(IP_IPSEC_POLICY), 21}, + {"IP_FAITH", int64(IP_FAITH), 22}, + {"IP_STRIPHDR", int64(IP_STRIPHDR), 23}, + {"IP_RECVTTL", int64(IP_RECVTTL), 24}, + {"IP_BOUND_IF", int64(IP_BOUND_IF), 25}, + {"IP_PKTINFO", int64(IP_PKTINFO), 26}, + {"IP_RECVPKTINFO", int64(IP_RECVPKTINFO), 26}, + {"IP_RECVTOS", int64(IP_RECVTOS), 27}, + {"IP_DONTFRAG", int64(IP_DONTFRAG), 28}, + {"IP_FW_ADD", int64(IP_FW_ADD), 40}, + {"IP_FW_DEL", int64(IP_FW_DEL), 41}, + {"IP_FW_FLUSH", int64(IP_FW_FLUSH), 42}, + {"IP_FW_ZERO", int64(IP_FW_ZERO), 43}, + {"IP_FW_GET", int64(IP_FW_GET), 44}, + {"IP_FW_RESETLOG", int64(IP_FW_RESETLOG), 45}, + {"IP_OLD_FW_ADD", int64(IP_OLD_FW_ADD), 50}, + {"IP_OLD_FW_DEL", int64(IP_OLD_FW_DEL), 51}, + {"IP_OLD_FW_FLUSH", int64(IP_OLD_FW_FLUSH), 52}, + {"IP_OLD_FW_ZERO", int64(IP_OLD_FW_ZERO), 53}, + {"IP_OLD_FW_GET", int64(IP_OLD_FW_GET), 54}, + {"IP_NAT__XXX", int64(IP_NAT__XXX), 55}, + {"IP_OLD_FW_RESETLOG", int64(IP_OLD_FW_RESETLOG), 56}, + {"IP_DUMMYNET_CONFIGURE", int64(IP_DUMMYNET_CONFIGURE), 60}, + {"IP_DUMMYNET_DEL", int64(IP_DUMMYNET_DEL), 61}, + {"IP_DUMMYNET_FLUSH", int64(IP_DUMMYNET_FLUSH), 62}, + {"IP_DUMMYNET_GET", int64(IP_DUMMYNET_GET), 64}, + {"IP_TRAFFIC_MGT_BACKGROUND", int64(IP_TRAFFIC_MGT_BACKGROUND), 65}, + {"IP_MULTICAST_IFINDEX", int64(IP_MULTICAST_IFINDEX), 66}, + {"IP_ADD_SOURCE_MEMBERSHIP", int64(IP_ADD_SOURCE_MEMBERSHIP), 70}, + {"IP_DROP_SOURCE_MEMBERSHIP", int64(IP_DROP_SOURCE_MEMBERSHIP), 71}, + {"IP_BLOCK_SOURCE", int64(IP_BLOCK_SOURCE), 72}, + {"IP_UNBLOCK_SOURCE", int64(IP_UNBLOCK_SOURCE), 73}, + {"IP_MSFILTER", int64(IP_MSFILTER), 74}, + {"MCAST_JOIN_GROUP", int64(MCAST_JOIN_GROUP), 80}, + {"MCAST_LEAVE_GROUP", int64(MCAST_LEAVE_GROUP), 81}, + {"MCAST_JOIN_SOURCE_GROUP", int64(MCAST_JOIN_SOURCE_GROUP), 82}, + {"MCAST_LEAVE_SOURCE_GROUP", int64(MCAST_LEAVE_SOURCE_GROUP), 83}, + {"MCAST_BLOCK_SOURCE", int64(MCAST_BLOCK_SOURCE), 84}, + {"MCAST_UNBLOCK_SOURCE", int64(MCAST_UNBLOCK_SOURCE), 85}, + {"IP_DEFAULT_MULTICAST_TTL", int64(IP_DEFAULT_MULTICAST_TTL), 1}, + {"IP_DEFAULT_MULTICAST_LOOP", int64(IP_DEFAULT_MULTICAST_LOOP), 1}, + {"IP_MIN_MEMBERSHIPS", int64(IP_MIN_MEMBERSHIPS), 31}, + {"IP_MAX_MEMBERSHIPS", int64(IP_MAX_MEMBERSHIPS), 4095}, + {"IP_MAX_GROUP_SRC_FILTER", int64(IP_MAX_GROUP_SRC_FILTER), 512}, + {"IP_MAX_SOCK_SRC_FILTER", int64(IP_MAX_SOCK_SRC_FILTER), 128}, + {"IP_MAX_SOCK_MUTE_FILTER", int64(IP_MAX_SOCK_MUTE_FILTER), 128}, + {"MCAST_UNDEFINED", int64(MCAST_UNDEFINED), 0}, + {"MCAST_INCLUDE", int64(MCAST_INCLUDE), 1}, + {"MCAST_EXCLUDE", int64(MCAST_EXCLUDE), 2}, + {"IP_PORTRANGE_DEFAULT", int64(IP_PORTRANGE_DEFAULT), 0}, + {"IP_PORTRANGE_HIGH", int64(IP_PORTRANGE_HIGH), 1}, + {"IP_PORTRANGE_LOW", int64(IP_PORTRANGE_LOW), 2}, + {"IPPROTO_MAXID", int64(IPPROTO_MAXID), 52}, + {"IPCTL_FORWARDING", int64(IPCTL_FORWARDING), 1}, + {"IPCTL_SENDREDIRECTS", int64(IPCTL_SENDREDIRECTS), 2}, + {"IPCTL_DEFTTL", int64(IPCTL_DEFTTL), 3}, + {"IPCTL_RTEXPIRE", int64(IPCTL_RTEXPIRE), 5}, + {"IPCTL_RTMINEXPIRE", int64(IPCTL_RTMINEXPIRE), 6}, + {"IPCTL_RTMAXCACHE", int64(IPCTL_RTMAXCACHE), 7}, + {"IPCTL_SOURCEROUTE", int64(IPCTL_SOURCEROUTE), 8}, + {"IPCTL_DIRECTEDBROADCAST", int64(IPCTL_DIRECTEDBROADCAST), 9}, + {"IPCTL_INTRQMAXLEN", int64(IPCTL_INTRQMAXLEN), 10}, + {"IPCTL_INTRQDROPS", int64(IPCTL_INTRQDROPS), 11}, + {"IPCTL_STATS", int64(IPCTL_STATS), 12}, + {"IPCTL_ACCEPTSOURCEROUTE", int64(IPCTL_ACCEPTSOURCEROUTE), 13}, + {"IPCTL_FASTFORWARDING", int64(IPCTL_FASTFORWARDING), 14}, + {"IPCTL_KEEPFAITH", int64(IPCTL_KEEPFAITH), 15}, + {"IPCTL_GIF_TTL", int64(IPCTL_GIF_TTL), 16}, + {"IPCTL_MAXID", int64(IPCTL_MAXID), 17}, + {"IPV6PORT_RESERVED", int64(IPV6PORT_RESERVED), 1024}, + {"IPV6PORT_ANONMIN", int64(IPV6PORT_ANONMIN), 49152}, + {"IPV6PORT_ANONMAX", int64(IPV6PORT_ANONMAX), 65535}, + {"IPV6PORT_RESERVEDMIN", int64(IPV6PORT_RESERVEDMIN), 600}, + {"IPV6PORT_RESERVEDMAX", int64(IPV6PORT_RESERVEDMAX), 1023}, + {"INET6_ADDRSTRLEN", int64(INET6_ADDRSTRLEN), 46}, + {"X__IPV6_ADDR_SCOPE_NODELOCAL", int64(X__IPV6_ADDR_SCOPE_NODELOCAL), 1}, + {"X__IPV6_ADDR_SCOPE_INTFACELOCAL", int64(X__IPV6_ADDR_SCOPE_INTFACELOCAL), 1}, + {"X__IPV6_ADDR_SCOPE_LINKLOCAL", int64(X__IPV6_ADDR_SCOPE_LINKLOCAL), 2}, + {"X__IPV6_ADDR_SCOPE_SITELOCAL", int64(X__IPV6_ADDR_SCOPE_SITELOCAL), 5}, + {"X__IPV6_ADDR_SCOPE_ORGLOCAL", int64(X__IPV6_ADDR_SCOPE_ORGLOCAL), 8}, + {"X__IPV6_ADDR_SCOPE_GLOBAL", int64(X__IPV6_ADDR_SCOPE_GLOBAL), 14}, + {"IPV6_ADDR_MC_FLAGS_TRANSIENT", int64(IPV6_ADDR_MC_FLAGS_TRANSIENT), 16}, + {"IPV6_ADDR_MC_FLAGS_PREFIX", int64(IPV6_ADDR_MC_FLAGS_PREFIX), 32}, + {"IPV6_ADDR_MC_FLAGS_UNICAST_BASED", int64(IPV6_ADDR_MC_FLAGS_UNICAST_BASED), 48}, + {"IPV6_SOCKOPT_RESERVED1", int64(IPV6_SOCKOPT_RESERVED1), 3}, + {"IPV6_UNICAST_HOPS", int64(IPV6_UNICAST_HOPS), 4}, + {"IPV6_MULTICAST_IF", int64(IPV6_MULTICAST_IF), 9}, + {"IPV6_MULTICAST_HOPS", int64(IPV6_MULTICAST_HOPS), 10}, + {"IPV6_MULTICAST_LOOP", int64(IPV6_MULTICAST_LOOP), 11}, + {"IPV6_JOIN_GROUP", int64(IPV6_JOIN_GROUP), 12}, + {"IPV6_LEAVE_GROUP", int64(IPV6_LEAVE_GROUP), 13}, + {"IPV6_PORTRANGE", int64(IPV6_PORTRANGE), 14}, + {"ICMP6_FILTER", int64(ICMP6_FILTER), 18}, + {"IPV6_2292PKTINFO", int64(IPV6_2292PKTINFO), 19}, + {"IPV6_2292HOPLIMIT", int64(IPV6_2292HOPLIMIT), 20}, + {"IPV6_2292NEXTHOP", int64(IPV6_2292NEXTHOP), 21}, + {"IPV6_2292HOPOPTS", int64(IPV6_2292HOPOPTS), 22}, + {"IPV6_2292DSTOPTS", int64(IPV6_2292DSTOPTS), 23}, + {"IPV6_2292RTHDR", int64(IPV6_2292RTHDR), 24}, + {"IPV6_2292PKTOPTIONS", int64(IPV6_2292PKTOPTIONS), 25}, + {"IPV6_CHECKSUM", int64(IPV6_CHECKSUM), 26}, + {"IPV6_V6ONLY", int64(IPV6_V6ONLY), 27}, + {"IPV6_BINDV6ONLY", int64(IPV6_BINDV6ONLY), 27}, + {"IPV6_IPSEC_POLICY", int64(IPV6_IPSEC_POLICY), 28}, + {"IPV6_FAITH", int64(IPV6_FAITH), 29}, + {"IPV6_FW_ADD", int64(IPV6_FW_ADD), 30}, + {"IPV6_FW_DEL", int64(IPV6_FW_DEL), 31}, + {"IPV6_FW_FLUSH", int64(IPV6_FW_FLUSH), 32}, + {"IPV6_FW_ZERO", int64(IPV6_FW_ZERO), 33}, + {"IPV6_FW_GET", int64(IPV6_FW_GET), 34}, + {"IPV6_RECVTCLASS", int64(IPV6_RECVTCLASS), 35}, + {"IPV6_TCLASS", int64(IPV6_TCLASS), 36}, + {"IPV6_BOUND_IF", int64(IPV6_BOUND_IF), 125}, + {"IPV6_RTHDR_LOOSE", int64(IPV6_RTHDR_LOOSE), 0}, + {"IPV6_RTHDR_STRICT", int64(IPV6_RTHDR_STRICT), 1}, + {"IPV6_RTHDR_TYPE_0", int64(IPV6_RTHDR_TYPE_0), 0}, + {"IPV6_DEFAULT_MULTICAST_HOPS", int64(IPV6_DEFAULT_MULTICAST_HOPS), 1}, + {"IPV6_DEFAULT_MULTICAST_LOOP", int64(IPV6_DEFAULT_MULTICAST_LOOP), 1}, + {"IPV6_MIN_MEMBERSHIPS", int64(IPV6_MIN_MEMBERSHIPS), 31}, + {"IPV6_MAX_MEMBERSHIPS", int64(IPV6_MAX_MEMBERSHIPS), 4095}, + {"IPV6_MAX_GROUP_SRC_FILTER", int64(IPV6_MAX_GROUP_SRC_FILTER), 512}, + {"IPV6_MAX_SOCK_SRC_FILTER", int64(IPV6_MAX_SOCK_SRC_FILTER), 128}, + {"IPV6_PORTRANGE_DEFAULT", int64(IPV6_PORTRANGE_DEFAULT), 0}, + {"IPV6_PORTRANGE_HIGH", int64(IPV6_PORTRANGE_HIGH), 1}, + {"IPV6_PORTRANGE_LOW", int64(IPV6_PORTRANGE_LOW), 2}, + {"IPV6PROTO_MAXID", int64(IPV6PROTO_MAXID), 104}, + {"IPV6CTL_FORWARDING", int64(IPV6CTL_FORWARDING), 1}, + {"IPV6CTL_SENDREDIRECTS", int64(IPV6CTL_SENDREDIRECTS), 2}, + {"IPV6CTL_DEFHLIM", int64(IPV6CTL_DEFHLIM), 3}, + {"IPV6CTL_FORWSRCRT", int64(IPV6CTL_FORWSRCRT), 5}, + {"IPV6CTL_STATS", int64(IPV6CTL_STATS), 6}, + {"IPV6CTL_MRTSTATS", int64(IPV6CTL_MRTSTATS), 7}, + {"IPV6CTL_MRTPROTO", int64(IPV6CTL_MRTPROTO), 8}, + {"IPV6CTL_MAXFRAGPACKETS", int64(IPV6CTL_MAXFRAGPACKETS), 9}, + {"IPV6CTL_SOURCECHECK", int64(IPV6CTL_SOURCECHECK), 10}, + {"IPV6CTL_SOURCECHECK_LOGINT", int64(IPV6CTL_SOURCECHECK_LOGINT), 11}, + {"IPV6CTL_ACCEPT_RTADV", int64(IPV6CTL_ACCEPT_RTADV), 12}, + {"IPV6CTL_KEEPFAITH", int64(IPV6CTL_KEEPFAITH), 13}, + {"IPV6CTL_LOG_INTERVAL", int64(IPV6CTL_LOG_INTERVAL), 14}, + {"IPV6CTL_HDRNESTLIMIT", int64(IPV6CTL_HDRNESTLIMIT), 15}, + {"IPV6CTL_DAD_COUNT", int64(IPV6CTL_DAD_COUNT), 16}, + {"IPV6CTL_AUTO_FLOWLABEL", int64(IPV6CTL_AUTO_FLOWLABEL), 17}, + {"IPV6CTL_DEFMCASTHLIM", int64(IPV6CTL_DEFMCASTHLIM), 18}, + {"IPV6CTL_GIF_HLIM", int64(IPV6CTL_GIF_HLIM), 19}, + {"IPV6CTL_KAME_VERSION", int64(IPV6CTL_KAME_VERSION), 20}, + {"IPV6CTL_USE_DEPRECATED", int64(IPV6CTL_USE_DEPRECATED), 21}, + {"IPV6CTL_RR_PRUNE", int64(IPV6CTL_RR_PRUNE), 22}, + {"IPV6CTL_V6ONLY", int64(IPV6CTL_V6ONLY), 24}, + {"IPV6CTL_RTEXPIRE", int64(IPV6CTL_RTEXPIRE), 25}, + {"IPV6CTL_RTMINEXPIRE", int64(IPV6CTL_RTMINEXPIRE), 26}, + {"IPV6CTL_RTMAXCACHE", int64(IPV6CTL_RTMAXCACHE), 27}, + {"IPV6CTL_USETEMPADDR", int64(IPV6CTL_USETEMPADDR), 32}, + {"IPV6CTL_TEMPPLTIME", int64(IPV6CTL_TEMPPLTIME), 33}, + {"IPV6CTL_TEMPVLTIME", int64(IPV6CTL_TEMPVLTIME), 34}, + {"IPV6CTL_AUTO_LINKLOCAL", int64(IPV6CTL_AUTO_LINKLOCAL), 35}, + {"IPV6CTL_RIP6STATS", int64(IPV6CTL_RIP6STATS), 36}, + {"IPV6CTL_PREFER_TEMPADDR", int64(IPV6CTL_PREFER_TEMPADDR), 37}, + {"IPV6CTL_ADDRCTLPOLICY", int64(IPV6CTL_ADDRCTLPOLICY), 38}, + {"IPV6CTL_USE_DEFAULTZONE", int64(IPV6CTL_USE_DEFAULTZONE), 39}, + {"IPV6CTL_MAXFRAGS", int64(IPV6CTL_MAXFRAGS), 41}, + {"IPV6CTL_MCAST_PMTU", int64(IPV6CTL_MCAST_PMTU), 44}, + {"IPV6CTL_NEIGHBORGCTHRESH", int64(IPV6CTL_NEIGHBORGCTHRESH), 46}, + {"IPV6CTL_MAXIFPREFIXES", int64(IPV6CTL_MAXIFPREFIXES), 47}, + {"IPV6CTL_MAXIFDEFROUTERS", int64(IPV6CTL_MAXIFDEFROUTERS), 48}, + {"IPV6CTL_MAXDYNROUTES", int64(IPV6CTL_MAXDYNROUTES), 49}, + {"ICMPV6CTL_ND6_ONLINKNSRFC4861", int64(ICMPV6CTL_ND6_ONLINKNSRFC4861), 50}, + {"IPV6CTL_ULA_USETEMPADDR", int64(IPV6CTL_ULA_USETEMPADDR), 51}, + {"IPV6CTL_MAXID", int64(IPV6CTL_MAXID), 51}, + {"SO_DEBUG", int64(SO_DEBUG), 1}, + {"SO_ACCEPTCONN", int64(SO_ACCEPTCONN), 2}, + {"SO_REUSEADDR", int64(SO_REUSEADDR), 4}, + {"SO_KEEPALIVE", int64(SO_KEEPALIVE), 8}, + {"SO_DONTROUTE", int64(SO_DONTROUTE), 16}, + {"SO_BROADCAST", int64(SO_BROADCAST), 32}, + {"SO_USELOOPBACK", int64(SO_USELOOPBACK), 64}, + {"SO_LINGER", int64(SO_LINGER), 128}, + {"SO_LINGER_SEC", int64(SO_LINGER_SEC), 4224}, + {"SO_OOBINLINE", int64(SO_OOBINLINE), 256}, + {"SO_REUSEPORT", int64(SO_REUSEPORT), 512}, + {"SO_TIMESTAMP", int64(SO_TIMESTAMP), 1024}, + {"SO_TIMESTAMP_MONOTONIC", int64(SO_TIMESTAMP_MONOTONIC), 2048}, + {"SO_DONTTRUNC", int64(SO_DONTTRUNC), 8192}, + {"SO_WANTMORE", int64(SO_WANTMORE), 16384}, + {"SO_WANTOOBFLAG", int64(SO_WANTOOBFLAG), 32768}, + {"SO_SNDBUF", int64(SO_SNDBUF), 4097}, + {"SO_RCVBUF", int64(SO_RCVBUF), 4098}, + {"SO_SNDLOWAT", int64(SO_SNDLOWAT), 4099}, + {"SO_RCVLOWAT", int64(SO_RCVLOWAT), 4100}, + {"SO_SNDTIMEO", int64(SO_SNDTIMEO), 4101}, + {"SO_RCVTIMEO", int64(SO_RCVTIMEO), 4102}, + {"SO_ERROR", int64(SO_ERROR), 4103}, + {"SO_TYPE", int64(SO_TYPE), 4104}, + {"SO_LABEL", int64(SO_LABEL), 4112}, + {"SO_PEERLABEL", int64(SO_PEERLABEL), 4113}, + {"SO_NREAD", int64(SO_NREAD), 4128}, + {"SO_NKE", int64(SO_NKE), 4129}, + {"SO_NOSIGPIPE", int64(SO_NOSIGPIPE), 4130}, + {"SO_NOADDRERR", int64(SO_NOADDRERR), 4131}, + {"SO_NWRITE", int64(SO_NWRITE), 4132}, + {"SO_REUSESHAREUID", int64(SO_REUSESHAREUID), 4133}, + {"SO_NOTIFYCONFLICT", int64(SO_NOTIFYCONFLICT), 4134}, + {"SO_UPCALLCLOSEWAIT", int64(SO_UPCALLCLOSEWAIT), 4135}, + {"SO_RANDOMPORT", int64(SO_RANDOMPORT), 4226}, + {"SO_NP_EXTENSIONS", int64(SO_NP_EXTENSIONS), 4227}, + {"SO_NUMRCVPKT", int64(SO_NUMRCVPKT), 4370}, + {"SO_NET_SERVICE_TYPE", int64(SO_NET_SERVICE_TYPE), 4374}, + {"SO_NETSVC_MARKING_LEVEL", int64(SO_NETSVC_MARKING_LEVEL), 4377}, + {"SO_RESOLVER_SIGNATURE", int64(SO_RESOLVER_SIGNATURE), 4401}, + {"NET_SERVICE_TYPE_BE", int64(NET_SERVICE_TYPE_BE), 0}, + {"NET_SERVICE_TYPE_BK", int64(NET_SERVICE_TYPE_BK), 1}, + {"NET_SERVICE_TYPE_SIG", int64(NET_SERVICE_TYPE_SIG), 2}, + {"NET_SERVICE_TYPE_VI", int64(NET_SERVICE_TYPE_VI), 3}, + {"NET_SERVICE_TYPE_VO", int64(NET_SERVICE_TYPE_VO), 4}, + {"NET_SERVICE_TYPE_RV", int64(NET_SERVICE_TYPE_RV), 5}, + {"NET_SERVICE_TYPE_AV", int64(NET_SERVICE_TYPE_AV), 6}, + {"NET_SERVICE_TYPE_OAM", int64(NET_SERVICE_TYPE_OAM), 7}, + {"NET_SERVICE_TYPE_RD", int64(NET_SERVICE_TYPE_RD), 8}, + {"NETSVC_MRKNG_UNKNOWN", int64(NETSVC_MRKNG_UNKNOWN), 0}, + {"NETSVC_MRKNG_LVL_L2", int64(NETSVC_MRKNG_LVL_L2), 1}, + {"NETSVC_MRKNG_LVL_L3L2_ALL", int64(NETSVC_MRKNG_LVL_L3L2_ALL), 2}, + {"NETSVC_MRKNG_LVL_L3L2_BK", int64(NETSVC_MRKNG_LVL_L3L2_BK), 3}, + {"SAE_ASSOCID_ANY", int64(SAE_ASSOCID_ANY), 0}, + {"SAE_CONNID_ANY", int64(SAE_CONNID_ANY), 0}, + {"CONNECT_RESUME_ON_READ_WRITE", int64(CONNECT_RESUME_ON_READ_WRITE), 1}, + {"CONNECT_DATA_IDEMPOTENT", int64(CONNECT_DATA_IDEMPOTENT), 2}, + {"CONNECT_DATA_AUTHENTICATED", int64(CONNECT_DATA_AUTHENTICATED), 4}, + {"SONPX_SETOPTSHUT", int64(SONPX_SETOPTSHUT), 1}, + {"SOL_SOCKET", int64(SOL_SOCKET), 65535}, + {"AF_UNSPEC", int64(AF_UNSPEC), 0}, + {"AF_UNIX", int64(AF_UNIX), 1}, + {"AF_LOCAL", int64(AF_LOCAL), 1}, + {"AF_INET", int64(AF_INET), 2}, + {"AF_IMPLINK", int64(AF_IMPLINK), 3}, + {"AF_PUP", int64(AF_PUP), 4}, + {"AF_CHAOS", int64(AF_CHAOS), 5}, + {"AF_NS", int64(AF_NS), 6}, + {"AF_ISO", int64(AF_ISO), 7}, + {"AF_OSI", int64(AF_OSI), 7}, + {"AF_ECMA", int64(AF_ECMA), 8}, + {"AF_DATAKIT", int64(AF_DATAKIT), 9}, + {"AF_CCITT", int64(AF_CCITT), 10}, + {"AF_SNA", int64(AF_SNA), 11}, + {"AF_DECnet", int64(AF_DECnet), 12}, + {"AF_DLI", int64(AF_DLI), 13}, + {"AF_LAT", int64(AF_LAT), 14}, + {"AF_HYLINK", int64(AF_HYLINK), 15}, + {"AF_APPLETALK", int64(AF_APPLETALK), 16}, + {"AF_ROUTE", int64(AF_ROUTE), 17}, + {"AF_LINK", int64(AF_LINK), 18}, + {"Pseudo_AF_XTP", int64(Pseudo_AF_XTP), 19}, + {"AF_COIP", int64(AF_COIP), 20}, + {"AF_CNT", int64(AF_CNT), 21}, + {"Pseudo_AF_RTIP", int64(Pseudo_AF_RTIP), 22}, + {"AF_IPX", int64(AF_IPX), 23}, + {"AF_SIP", int64(AF_SIP), 24}, + {"Pseudo_AF_PIP", int64(Pseudo_AF_PIP), 25}, + {"AF_NDRV", int64(AF_NDRV), 27}, + {"AF_ISDN", int64(AF_ISDN), 28}, + {"AF_E164", int64(AF_E164), 28}, + {"Pseudo_AF_KEY", int64(Pseudo_AF_KEY), 29}, + {"AF_INET6", int64(AF_INET6), 30}, + {"AF_NATM", int64(AF_NATM), 31}, + {"AF_SYSTEM", int64(AF_SYSTEM), 32}, + {"AF_NETBIOS", int64(AF_NETBIOS), 33}, + {"AF_PPP", int64(AF_PPP), 34}, + {"Pseudo_AF_HDRCMPLT", int64(Pseudo_AF_HDRCMPLT), 35}, + {"AF_RESERVED_36", int64(AF_RESERVED_36), 36}, + {"AF_IEEE80211", int64(AF_IEEE80211), 37}, + {"AF_UTUN", int64(AF_UTUN), 38}, + {"AF_VSOCK", int64(AF_VSOCK), 40}, + {"AF_MAX", int64(AF_MAX), 41}, + {"SOCK_MAXADDRLEN", int64(SOCK_MAXADDRLEN), 255}, + {"X_SS_MAXSIZE", int64(X_SS_MAXSIZE), 128}, + {"PF_UNSPEC", int64(PF_UNSPEC), 0}, + {"PF_LOCAL", int64(PF_LOCAL), 1}, + {"PF_UNIX", int64(PF_UNIX), 1}, + {"PF_INET", int64(PF_INET), 2}, + {"PF_IMPLINK", int64(PF_IMPLINK), 3}, + {"PF_PUP", int64(PF_PUP), 4}, + {"PF_CHAOS", int64(PF_CHAOS), 5}, + {"PF_NS", int64(PF_NS), 6}, + {"PF_ISO", int64(PF_ISO), 7}, + {"PF_OSI", int64(PF_OSI), 7}, + {"PF_ECMA", int64(PF_ECMA), 8}, + {"PF_DATAKIT", int64(PF_DATAKIT), 9}, + {"PF_CCITT", int64(PF_CCITT), 10}, + {"PF_SNA", int64(PF_SNA), 11}, + {"PF_DECnet", int64(PF_DECnet), 12}, + {"PF_DLI", int64(PF_DLI), 13}, + {"PF_LAT", int64(PF_LAT), 14}, + {"PF_HYLINK", int64(PF_HYLINK), 15}, + {"PF_APPLETALK", int64(PF_APPLETALK), 16}, + {"PF_ROUTE", int64(PF_ROUTE), 17}, + {"PF_LINK", int64(PF_LINK), 18}, + {"PF_XTP", int64(PF_XTP), 19}, + {"PF_COIP", int64(PF_COIP), 20}, + {"PF_CNT", int64(PF_CNT), 21}, + {"PF_SIP", int64(PF_SIP), 24}, + {"PF_IPX", int64(PF_IPX), 23}, + {"PF_RTIP", int64(PF_RTIP), 22}, + {"PF_PIP", int64(PF_PIP), 25}, + {"PF_NDRV", int64(PF_NDRV), 27}, + {"PF_ISDN", int64(PF_ISDN), 28}, + {"PF_KEY", int64(PF_KEY), 29}, + {"PF_INET6", int64(PF_INET6), 30}, + {"PF_NATM", int64(PF_NATM), 31}, + {"PF_SYSTEM", int64(PF_SYSTEM), 32}, + {"PF_NETBIOS", int64(PF_NETBIOS), 33}, + {"PF_PPP", int64(PF_PPP), 34}, + {"PF_RESERVED_36", int64(PF_RESERVED_36), 36}, + {"PF_UTUN", int64(PF_UTUN), 38}, + {"PF_VSOCK", int64(PF_VSOCK), 40}, + {"PF_MAX", int64(PF_MAX), 41}, + {"NET_MAXID", int64(NET_MAXID), 41}, + {"NET_RT_DUMP", int64(NET_RT_DUMP), 1}, + {"NET_RT_FLAGS", int64(NET_RT_FLAGS), 2}, + {"NET_RT_IFLIST", int64(NET_RT_IFLIST), 3}, + {"NET_RT_STAT", int64(NET_RT_STAT), 4}, + {"NET_RT_TRASH", int64(NET_RT_TRASH), 5}, + {"NET_RT_IFLIST2", int64(NET_RT_IFLIST2), 6}, + {"NET_RT_DUMP2", int64(NET_RT_DUMP2), 7}, + {"NET_RT_FLAGS_PRIV", int64(NET_RT_FLAGS_PRIV), 10}, + {"NET_RT_MAXID", int64(NET_RT_MAXID), 11}, + {"SOMAXCONN", int64(SOMAXCONN), 128}, + {"MSG_OOB", int64(MSG_OOB), 1}, + {"MSG_PEEK", int64(MSG_PEEK), 2}, + {"MSG_DONTROUTE", int64(MSG_DONTROUTE), 4}, + {"MSG_EOR", int64(MSG_EOR), 8}, + {"MSG_TRUNC", int64(MSG_TRUNC), 16}, + {"MSG_CTRUNC", int64(MSG_CTRUNC), 32}, + {"MSG_WAITALL", int64(MSG_WAITALL), 64}, + {"MSG_DONTWAIT", int64(MSG_DONTWAIT), 128}, + {"MSG_EOF", int64(MSG_EOF), 256}, + {"MSG_WAITSTREAM", int64(MSG_WAITSTREAM), 512}, + {"MSG_FLUSH", int64(MSG_FLUSH), 1024}, + {"MSG_HOLD", int64(MSG_HOLD), 2048}, + {"MSG_SEND", int64(MSG_SEND), 4096}, + {"MSG_HAVEMORE", int64(MSG_HAVEMORE), 8192}, + {"MSG_RCVMORE", int64(MSG_RCVMORE), 16384}, + {"MSG_NEEDSA", int64(MSG_NEEDSA), 65536}, + {"MSG_NOSIGNAL", int64(MSG_NOSIGNAL), 524288}, + {"SCM_RIGHTS", int64(SCM_RIGHTS), 1}, + {"SCM_TIMESTAMP", int64(SCM_TIMESTAMP), 2}, + {"SCM_CREDS", int64(SCM_CREDS), 3}, + {"SCM_TIMESTAMP_MONOTONIC", int64(SCM_TIMESTAMP_MONOTONIC), 4}, + {"SHUT_RD", int64(SHUT_RD), 0}, + {"SHUT_WR", int64(SHUT_WR), 1}, + {"SHUT_RDWR", int64(SHUT_RDWR), 2}, + {"SOL_LOCAL", int64(SOL_LOCAL), 0}, + {"LOCAL_PEERCRED", int64(LOCAL_PEERCRED), 1}, + {"LOCAL_PEERPID", int64(LOCAL_PEERPID), 2}, + {"LOCAL_PEEREPID", int64(LOCAL_PEEREPID), 3}, + {"LOCAL_PEERUUID", int64(LOCAL_PEERUUID), 4}, + {"LOCAL_PEEREUUID", int64(LOCAL_PEEREUUID), 5}, + {"LOCAL_PEERTOKEN", int64(LOCAL_PEERTOKEN), 6}, + {"ALIGNSIZE", int64(ALIGNSIZE), 8}, + {"MAXSIZE", int64(MAXSIZE), 128}, + {"PAD1_SIZE", int64(PAD1_SIZE), 6}, + {"PAD2_SIZE", int64(PAD2_SIZE), 112}, + {"SOCK_STREAM", int64(SOCK_STREAM), 1}, + {"SOCK_DGRAM", int64(SOCK_DGRAM), 2}, + {"SOCK_RAW", int64(SOCK_RAW), 3}, + {"SOCK_RDM", int64(SOCK_RDM), 4}, + {"SOCK_SEQPACKET", int64(SOCK_SEQPACKET), 5}, + } + var networkStringConstants = []struct{ name, got, want string }{ + {"X_PATH_HEQUIV", X_PATH_HEQUIV, "/etc/hosts.equiv"}, + {"X_PATH_HOSTS", X_PATH_HOSTS, "/etc/hosts"}, + {"X_PATH_NETWORKS", X_PATH_NETWORKS, "/etc/networks"}, + {"X_PATH_PROTOCOLS", X_PATH_PROTOCOLS, "/etc/protocols"}, + {"X_PATH_SERVICES", X_PATH_SERVICES, "/etc/services"}, + {"X__KAME_VERSION", X__KAME_VERSION, "2009/apple-darwin"}, + } + var networkVariableSymbols = []struct { + name string + address unsafe.Pointer + }{ + {"HErrno", unsafe.Pointer(&HErrno)}, + {"In6addrAny", unsafe.Pointer(&In6addrAny)}, + {"In6addrLoopback", unsafe.Pointer(&In6addrLoopback)}, + {"In6addrNodelocalAllnodes", unsafe.Pointer(&In6addrNodelocalAllnodes)}, + {"In6addrLinklocalAllnodes", unsafe.Pointer(&In6addrLinklocalAllnodes)}, + {"In6addrLinklocalAllrouters", unsafe.Pointer(&In6addrLinklocalAllrouters)}, + {"In6addrLinklocalAllv2routers", unsafe.Pointer(&In6addrLinklocalAllv2routers)}, + } + var networkAccessorChecks = []struct { + name string + check func() (uintptr, uintptr, uintptr) + offset, size, align uintptr + }{} + + t.Run("function symbols", func(t *testing.T) { + for _, symbol := range networkFunctionSymbols { + t.Run(symbol.name, func(t *testing.T) { + if symbol.address == nil { + t.Fatal("C function address is nil") + } + t.Logf("C function address: %p", symbol.address) + }) + } + }) + t.Run("native prototypes", func(t *testing.T) { + check := func(name string, got reflect.Type, want networkABISlot) { + if got.Size() != want.size || uintptr(got.Align()) != want.align { + t.Errorf("%s size/alignment = %d/%d, C = %d/%d", name, got.Size(), got.Align(), want.size, want.align) + } + class := 0 + switch got.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + class = 1 + case reflect.Ptr, reflect.UnsafePointer, reflect.Func: + class = 5 + case reflect.Float32, reflect.Float64: + class = 8 + case reflect.Struct: + class = 12 + } + if class != want.class { + t.Errorf("%s ABI class = %d (%v), C = %d", name, class, got.Kind(), want.class) + } + } + for _, tc := range networkFunctionPrototypes { + t.Run(tc.name, func(t *testing.T) { + inputs := len(tc.inputs) + if tc.variadic { + inputs++ + } + if tc.signature.Kind() != reflect.Func || tc.signature.NumIn() != inputs || tc.signature.IsVariadic() != tc.variadic { + t.Fatalf("Go signature = %v, C fixed parameters = %d, variadic = %v", tc.signature, len(tc.inputs), tc.variadic) + } + for i, slot := range tc.inputs { + check(tc.name+" parameter", tc.signature.In(i), slot) + } + outputs := 0 + if tc.output != nil { + outputs = 1 + } + if tc.signature.NumOut() != outputs { + t.Fatalf("Go result count = %d, C = %d", tc.signature.NumOut(), outputs) + } + if tc.output != nil { + check(tc.name+" result", tc.signature.Out(0), *tc.output) + } + }) + } + }) + t.Run("native types and globals", func(t *testing.T) { + for _, tc := range networkTypeLayouts { + t.Run(tc.symbol+"/"+tc.property, func(t *testing.T) { + if tc.got != tc.want { + t.Fatalf("Go layout = %d, C headers = %d", tc.got, tc.want) + } + }) + } + for _, symbol := range networkVariableSymbols { + if symbol.address == nil { + t.Errorf("%s C variable address is nil", symbol.name) + } + t.Logf("%s C variable address: %p", symbol.name, symbol.address) + } + }) + t.Run("native constants", func(t *testing.T) { + for _, tc := range networkIntegerConstants { + t.Run(tc.name, func(t *testing.T) { + if tc.got != tc.want { + t.Fatalf("Go constant = %d, C headers = %d", tc.got, tc.want) + } + }) + } + for _, tc := range networkStringConstants { + t.Run(tc.name, func(t *testing.T) { + if tc.got != tc.want { + t.Fatalf("Go constant = %q, C headers = %q", tc.got, tc.want) + } + }) + } + }) + t.Run("union accessors", func(t *testing.T) { + for _, tc := range networkAccessorChecks { + t.Run(tc.name, func(t *testing.T) { + offset, size, align := tc.check() + if offset != tc.offset || size != tc.size || align != tc.align { + t.Fatalf("Go field offset/size/alignment = %d/%d/%d, C = %d/%d/%d", offset, size, align, tc.offset, tc.size, tc.align) + } + }) + } + }) + t.Run("symbol inventory", func(t *testing.T) { + functions, prototypes, types, constants, variables := map[string]bool{}, map[string]bool{}, map[string]bool{}, map[string]bool{}, map[string]bool{} + for _, tc := range networkFunctionPrototypes { + prototypes[tc.name] = true + } + for _, symbol := range networkFunctionSymbols { + functions[symbol.name] = true + if !prototypes[symbol.name] { + t.Errorf("%s has no native prototype test", symbol.name) + } + } + for _, tc := range networkAccessorChecks { + functions[tc.name] = true + } + for _, tc := range networkTypeLayouts { + types[tc.symbol] = true + } + for _, tc := range networkIntegerConstants { + constants[tc.name] = true + } + for _, tc := range networkStringConstants { + constants[tc.name] = true + } + for _, symbol := range networkVariableSymbols { + variables[symbol.name] = true + } + constants["XGoPackage"], constants["LLGoPackage"] = true, true + wantLink := "link: -lc -lresolv" + if runtime.GOOS == "darwin" { + wantLink = "link: -lSystem" + } + if !XGoPackage || LLGoPackage != wantLink { + t.Errorf("package metadata = %v/%q, want true/%q", XGoPackage, LLGoPackage, wantLink) + } + files := []string{"libc_" + runtime.GOOS + "_" + runtime.GOARCH + ".go", "legacy_native.go"} + if runtime.GOOS == "darwin" { + files = append(files, "legacy_darwin_arm64.go") + } + for _, filename := range files { + source, err := parser.ParseFile(token.NewFileSet(), filename, nil, parser.ParseComments) + if err != nil { + t.Fatal(err) + } + for _, declaration := range source.Decls { + switch decl := declaration.(type) { + case *ast.FuncDecl: + name := decl.Name.Name + if !ast.IsExported(name) { + continue + } + if decl.Recv != nil { + receiver, prefix := decl.Recv.List[0].Type, "" + if pointer, ok := receiver.(*ast.StarExpr); ok { + receiver, prefix = pointer.X, "*" + } + name = prefix + receiver.(*ast.Ident).Name + "." + name + } + if !functions[name] { + t.Errorf("%s: function %s has no test", filename, name) + } + if strings.HasPrefix(decl.Name.Name, "Native") { + t.Errorf("%s retains duplicate %s", filename, name) + } + if decl.Doc != nil { + for _, comment := range decl.Doc.List { + for _, private := range []string{"C.pfctlinput", "C.__h_errno_location", "C.__cmsg_nxthdr"} { + if strings.Contains(comment.Text, private) { + t.Errorf("%s still exposes private C entry point %s", filename, private) + } + } + } + } + case *ast.GenDecl: + for _, specification := range decl.Specs { + switch spec := specification.(type) { + case *ast.TypeSpec: + if ast.IsExported(spec.Name.Name) && !types[spec.Name.Name] { + t.Errorf("%s: type %s has no ABI test", filename, spec.Name.Name) + } + case *ast.ValueSpec: + for _, name := range spec.Names { + if !ast.IsExported(name.Name) { + continue + } + if decl.Tok == token.CONST && !constants[name.Name] { + t.Errorf("%s: constant %s has no test", filename, name.Name) + } + if decl.Tok == token.VAR && !variables[name.Name] { + t.Errorf("%s: variable %s has no test", filename, name.Name) + } + } + } + } + } + } + } + t.Logf("coverage: %d C functions, %d Go union accessors, %d types/global layouts, %d constants, %d globals", len(networkFunctionSymbols), len(networkAccessorChecks), len(networkTypeLayouts), len(constants), len(networkVariableSymbols)) + }) + +} diff --git a/c/net/libc_native_linux_amd64_llgo_test.go b/c/net/libc_native_linux_amd64_llgo_test.go new file mode 100644 index 00000000..2c8660c0 --- /dev/null +++ b/c/net/libc_native_linux_amd64_llgo_test.go @@ -0,0 +1,1531 @@ +//go:build llgo && linux && amd64 && !android + +package net + +import ( + "github.com/goplus/lib/c" + "go/ast" + "go/parser" + "go/token" + "reflect" + "runtime" + "strings" + "testing" + "unsafe" +) + +type nativeNetworkChar = c.Char + +func TestGeneratedNetworkLayouts(t *testing.T) { + // Expected values are compiled from the original Bootlin glibc 2.24 C headers. + var networkFunctionSymbols = []struct { + name string + address unsafe.Pointer + }{ + {"InetAddr", c.Func(InetAddr)}, + {"InAddr.InetLnaof", c.Func((InAddr).InetLnaof)}, + {"InetMakeaddr", c.Func(InetMakeaddr)}, + {"InAddr.InetNetof", c.Func((InAddr).InetNetof)}, + {"InetNetwork", c.Func(InetNetwork)}, + {"InAddr.InetNtoa", c.Func((InAddr).InetNtoa)}, + {"InetPton", c.Func(InetPton)}, + {"InetNtop", c.Func(InetNtop)}, + {"InetAton", c.Func(InetAton)}, + {"InetNeta", c.Func(InetNeta)}, + {"InetNetNtop", c.Func(InetNetNtop)}, + {"InetNetPton", c.Func(InetNetPton)}, + {"InetNsapAddr", c.Func(InetNsapAddr)}, + {"InetNsapNtoa", c.Func(InetNsapNtoa)}, + {"IfNametoindex", c.Func(IfNametoindex)}, + {"IfIndextoname", c.Func(IfIndextoname)}, + {"IfNameindex", c.Func(IfNameindex)}, + {"*IfNameindexT.IfFreenameindex", c.Func((*IfNameindexT).IfFreenameindex)}, + {"Herror", c.Func(Herror)}, + {"Hstrerror", c.Func(Hstrerror)}, + {"Sethostent", c.Func(Sethostent)}, + {"Endhostent", c.Func(Endhostent)}, + {"Gethostent", c.Func(Gethostent)}, + {"Gethostbyaddr", c.Func(Gethostbyaddr)}, + {"GetHostByName", c.Func(GetHostByName)}, + {"Gethostbyname2", c.Func(Gethostbyname2)}, + {"*Hostent.GethostentR", c.Func((*Hostent).GethostentR)}, + {"GethostbyaddrR", c.Func(GethostbyaddrR)}, + {"GethostbynameR", c.Func(GethostbynameR)}, + {"Gethostbyname2R", c.Func(Gethostbyname2R)}, + {"Setnetent", c.Func(Setnetent)}, + {"Endnetent", c.Func(Endnetent)}, + {"Getnetent", c.Func(Getnetent)}, + {"Getnetbyaddr", c.Func(Getnetbyaddr)}, + {"Getnetbyname", c.Func(Getnetbyname)}, + {"*Netent.GetnetentR", c.Func((*Netent).GetnetentR)}, + {"GetnetbyaddrR", c.Func(GetnetbyaddrR)}, + {"GetnetbynameR", c.Func(GetnetbynameR)}, + {"Setservent", c.Func(Setservent)}, + {"Endservent", c.Func(Endservent)}, + {"Getservent", c.Func(Getservent)}, + {"Getservbyname", c.Func(Getservbyname)}, + {"Getservbyport", c.Func(Getservbyport)}, + {"*Servent.GetserventR", c.Func((*Servent).GetserventR)}, + {"GetservbynameR", c.Func(GetservbynameR)}, + {"GetservbyportR", c.Func(GetservbyportR)}, + {"Setprotoent", c.Func(Setprotoent)}, + {"Endprotoent", c.Func(Endprotoent)}, + {"Getprotoent", c.Func(Getprotoent)}, + {"Getprotobyname", c.Func(Getprotobyname)}, + {"Getprotobynumber", c.Func(Getprotobynumber)}, + {"*Protoent.GetprotoentR", c.Func((*Protoent).GetprotoentR)}, + {"GetprotobynameR", c.Func(GetprotobynameR)}, + {"GetprotobynumberR", c.Func(GetprotobynumberR)}, + {"Setnetgrent", c.Func(Setnetgrent)}, + {"Endnetgrent", c.Func(Endnetgrent)}, + {"Getnetgrent", c.Func(Getnetgrent)}, + {"Innetgr", c.Func(Innetgr)}, + {"GetnetgrentR", c.Func(GetnetgrentR)}, + {"Rcmd", c.Func(Rcmd)}, + {"RcmdAf", c.Func(RcmdAf)}, + {"Rexec", c.Func(Rexec)}, + {"RexecAf", c.Func(RexecAf)}, + {"Ruserok", c.Func(Ruserok)}, + {"RuserokAf", c.Func(RuserokAf)}, + {"Iruserok", c.Func(Iruserok)}, + {"IruserokAf", c.Func(IruserokAf)}, + {"Rresvport", c.Func(Rresvport)}, + {"RresvportAf", c.Func(RresvportAf)}, + {"Getaddrinfo", c.Func(Getaddrinfo)}, + {"Freeaddrinfo", c.Func(Freeaddrinfo)}, + {"GaiStrerror", c.Func(GaiStrerror)}, + {"*SockAddr.Getnameinfo", c.Func((*SockAddr).Getnameinfo)}, + {"Ntohl", c.Func(Ntohl)}, + {"Ntohs", c.Func(Ntohs)}, + {"Htonl", c.Func(Htonl)}, + {"Htons", c.Func(Htons)}, + {"Bindresvport", c.Func(Bindresvport)}, + {"Setrpcent", c.Func(Setrpcent)}, + {"Endrpcent", c.Func(Endrpcent)}, + {"Getrpcbyname", c.Func(Getrpcbyname)}, + {"Getrpcbynumber", c.Func(Getrpcbynumber)}, + {"Getrpcent", c.Func(Getrpcent)}, + {"GetrpcbynameR", c.Func(GetrpcbynameR)}, + {"GetrpcbynumberR", c.Func(GetrpcbynumberR)}, + {"*Rpcent.GetrpcentR", c.Func((*Rpcent).GetrpcentR)}, + {"Socket", c.Func(Socket)}, + {"Socketpair", c.Func(Socketpair)}, + {"Bind", c.Func(Bind)}, + {"Getsockname", c.Func(Getsockname)}, + {"Connect", c.Func(Connect)}, + {"Getpeername", c.Func(Getpeername)}, + {"Send", c.Func(Send)}, + {"Recv", c.Func(Recv)}, + {"Sendto", c.Func(Sendto)}, + {"Recvfrom", c.Func(Recvfrom)}, + {"Sendmsg", c.Func(Sendmsg)}, + {"Recvmsg", c.Func(Recvmsg)}, + {"Getsockopt", c.Func(Getsockopt)}, + {"SetSockOpt", c.Func(SetSockOpt)}, + {"Listen", c.Func(Listen)}, + {"Accept", c.Func(Accept)}, + {"Shutdown", c.Func(Shutdown)}, + {"Sockatmark", c.Func(Sockatmark)}, + {"Isfdtype", c.Func(Isfdtype)}, + } + var networkFunctionPrototypes = []struct { + name string + signature reflect.Type + inputs []networkABISlot + output *networkABISlot + variadic bool + }{ + {"InetAddr", reflect.TypeOf(InetAddr), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"InAddr.InetLnaof", reflect.TypeOf((InAddr).InetLnaof), []networkABISlot{{4, 4, 12}}, &networkABISlot{4, 4, 1}, false}, + {"InetMakeaddr", reflect.TypeOf(InetMakeaddr), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 12}, false}, + {"InAddr.InetNetof", reflect.TypeOf((InAddr).InetNetof), []networkABISlot{{4, 4, 12}}, &networkABISlot{4, 4, 1}, false}, + {"InetNetwork", reflect.TypeOf(InetNetwork), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"InAddr.InetNtoa", reflect.TypeOf((InAddr).InetNtoa), []networkABISlot{{4, 4, 12}}, &networkABISlot{8, 8, 5}, false}, + {"InetPton", reflect.TypeOf(InetPton), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"InetNtop", reflect.TypeOf(InetNtop), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"InetAton", reflect.TypeOf(InetAton), []networkABISlot{{8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"InetNeta", reflect.TypeOf(InetNeta), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}}, &networkABISlot{8, 8, 5}, false}, + {"InetNetNtop", reflect.TypeOf(InetNetNtop), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 1}}, &networkABISlot{8, 8, 5}, false}, + {"InetNetPton", reflect.TypeOf(InetNetPton), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &networkABISlot{4, 4, 1}, false}, + {"InetNsapAddr", reflect.TypeOf(InetNsapAddr), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"InetNsapNtoa", reflect.TypeOf(InetNsapNtoa), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"IfNametoindex", reflect.TypeOf(IfNametoindex), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"IfIndextoname", reflect.TypeOf(IfIndextoname), []networkABISlot{{4, 4, 1}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"IfNameindex", reflect.TypeOf(IfNameindex), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"*IfNameindexT.IfFreenameindex", reflect.TypeOf((*IfNameindexT).IfFreenameindex), []networkABISlot{{8, 8, 5}}, nil, false}, + {"Herror", reflect.TypeOf(Herror), []networkABISlot{{8, 8, 5}}, nil, false}, + {"Hstrerror", reflect.TypeOf(Hstrerror), []networkABISlot{{4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"Sethostent", reflect.TypeOf(Sethostent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"Endhostent", reflect.TypeOf(Endhostent), []networkABISlot{}, nil, false}, + {"Gethostent", reflect.TypeOf(Gethostent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"Gethostbyaddr", reflect.TypeOf(Gethostbyaddr), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"GetHostByName", reflect.TypeOf(GetHostByName), []networkABISlot{{8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Gethostbyname2", reflect.TypeOf(Gethostbyname2), []networkABISlot{{8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"*Hostent.GethostentR", reflect.TypeOf((*Hostent).GethostentR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GethostbyaddrR", reflect.TypeOf(GethostbyaddrR), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GethostbynameR", reflect.TypeOf(GethostbynameR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Gethostbyname2R", reflect.TypeOf(Gethostbyname2R), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Setnetent", reflect.TypeOf(Setnetent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"Endnetent", reflect.TypeOf(Endnetent), []networkABISlot{}, nil, false}, + {"Getnetent", reflect.TypeOf(Getnetent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"Getnetbyaddr", reflect.TypeOf(Getnetbyaddr), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"Getnetbyname", reflect.TypeOf(Getnetbyname), []networkABISlot{{8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"*Netent.GetnetentR", reflect.TypeOf((*Netent).GetnetentR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetnetbyaddrR", reflect.TypeOf(GetnetbyaddrR), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetnetbynameR", reflect.TypeOf(GetnetbynameR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Setservent", reflect.TypeOf(Setservent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"Endservent", reflect.TypeOf(Endservent), []networkABISlot{}, nil, false}, + {"Getservent", reflect.TypeOf(Getservent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"Getservbyname", reflect.TypeOf(Getservbyname), []networkABISlot{{8, 8, 5}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Getservbyport", reflect.TypeOf(Getservbyport), []networkABISlot{{4, 4, 1}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"*Servent.GetserventR", reflect.TypeOf((*Servent).GetserventR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetservbynameR", reflect.TypeOf(GetservbynameR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetservbyportR", reflect.TypeOf(GetservbyportR), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Setprotoent", reflect.TypeOf(Setprotoent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"Endprotoent", reflect.TypeOf(Endprotoent), []networkABISlot{}, nil, false}, + {"Getprotoent", reflect.TypeOf(Getprotoent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"Getprotobyname", reflect.TypeOf(Getprotobyname), []networkABISlot{{8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Getprotobynumber", reflect.TypeOf(Getprotobynumber), []networkABISlot{{4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"*Protoent.GetprotoentR", reflect.TypeOf((*Protoent).GetprotoentR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetprotobynameR", reflect.TypeOf(GetprotobynameR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetprotobynumberR", reflect.TypeOf(GetprotobynumberR), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Setnetgrent", reflect.TypeOf(Setnetgrent), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Endnetgrent", reflect.TypeOf(Endnetgrent), []networkABISlot{}, nil, false}, + {"Getnetgrent", reflect.TypeOf(Getnetgrent), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Innetgr", reflect.TypeOf(Innetgr), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetnetgrentR", reflect.TypeOf(GetnetgrentR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Rcmd", reflect.TypeOf(Rcmd), []networkABISlot{{8, 8, 5}, {2, 2, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"RcmdAf", reflect.TypeOf(RcmdAf), []networkABISlot{{8, 8, 5}, {2, 2, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {2, 2, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Rexec", reflect.TypeOf(Rexec), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"RexecAf", reflect.TypeOf(RexecAf), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {2, 2, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Ruserok", reflect.TypeOf(Ruserok), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"RuserokAf", reflect.TypeOf(RuserokAf), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {2, 2, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Iruserok", reflect.TypeOf(Iruserok), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"IruserokAf", reflect.TypeOf(IruserokAf), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {2, 2, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Rresvport", reflect.TypeOf(Rresvport), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"RresvportAf", reflect.TypeOf(RresvportAf), []networkABISlot{{8, 8, 5}, {2, 2, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Getaddrinfo", reflect.TypeOf(Getaddrinfo), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Freeaddrinfo", reflect.TypeOf(Freeaddrinfo), []networkABISlot{{8, 8, 5}}, nil, false}, + {"GaiStrerror", reflect.TypeOf(GaiStrerror), []networkABISlot{{4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"*SockAddr.Getnameinfo", reflect.TypeOf((*SockAddr).Getnameinfo), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Ntohl", reflect.TypeOf(Ntohl), []networkABISlot{{4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Ntohs", reflect.TypeOf(Ntohs), []networkABISlot{{2, 2, 1}}, &networkABISlot{2, 2, 1}, false}, + {"Htonl", reflect.TypeOf(Htonl), []networkABISlot{{4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Htons", reflect.TypeOf(Htons), []networkABISlot{{2, 2, 1}}, &networkABISlot{2, 2, 1}, false}, + {"Bindresvport", reflect.TypeOf(Bindresvport), []networkABISlot{{4, 4, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Setrpcent", reflect.TypeOf(Setrpcent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"Endrpcent", reflect.TypeOf(Endrpcent), []networkABISlot{}, nil, false}, + {"Getrpcbyname", reflect.TypeOf(Getrpcbyname), []networkABISlot{{8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Getrpcbynumber", reflect.TypeOf(Getrpcbynumber), []networkABISlot{{4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"Getrpcent", reflect.TypeOf(Getrpcent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"GetrpcbynameR", reflect.TypeOf(GetrpcbynameR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetrpcbynumberR", reflect.TypeOf(GetrpcbynumberR), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"*Rpcent.GetrpcentR", reflect.TypeOf((*Rpcent).GetrpcentR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Socket", reflect.TypeOf(Socket), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Socketpair", reflect.TypeOf(Socketpair), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Bind", reflect.TypeOf(Bind), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Getsockname", reflect.TypeOf(Getsockname), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Connect", reflect.TypeOf(Connect), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Getpeername", reflect.TypeOf(Getpeername), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Send", reflect.TypeOf(Send), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Recv", reflect.TypeOf(Recv), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Sendto", reflect.TypeOf(Sendto), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Recvfrom", reflect.TypeOf(Recvfrom), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{8, 8, 1}, false}, + {"Sendmsg", reflect.TypeOf(Sendmsg), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Recvmsg", reflect.TypeOf(Recvmsg), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Getsockopt", reflect.TypeOf(Getsockopt), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"SetSockOpt", reflect.TypeOf(SetSockOpt), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Listen", reflect.TypeOf(Listen), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Accept", reflect.TypeOf(Accept), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Shutdown", reflect.TypeOf(Shutdown), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Sockatmark", reflect.TypeOf(Sockatmark), []networkABISlot{{4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Isfdtype", reflect.TypeOf(Isfdtype), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + } + var networkTypeLayouts = []struct { + symbol, property string + got, want uintptr + }{ + {"IpOpts", "size", unsafe.Sizeof(*new(IpOpts)), 44}, + {"IpOpts", "alignment", unsafe.Alignof(*new(IpOpts)), 4}, + {"IpOpts", "IpDst offset", unsafe.Offsetof((*new(IpOpts)).IpDst), 0}, + {"IpOpts", "IpDst size", unsafe.Sizeof((*new(IpOpts)).IpDst), 4}, + {"IpOpts", "IpDst alignment", unsafe.Alignof((*new(IpOpts)).IpDst), 4}, + {"IpOpts", "IpOpts offset", unsafe.Offsetof((*new(IpOpts)).IpOpts), 4}, + {"IpOpts", "IpOpts size", unsafe.Sizeof((*new(IpOpts)).IpOpts), 40}, + {"IpOpts", "IpOpts alignment", unsafe.Alignof((*new(IpOpts)).IpOpts), 1}, + {"IpMreqn", "size", unsafe.Sizeof(*new(IpMreqn)), 12}, + {"IpMreqn", "alignment", unsafe.Alignof(*new(IpMreqn)), 4}, + {"IpMreqn", "ImrMultiaddr offset", unsafe.Offsetof((*new(IpMreqn)).ImrMultiaddr), 0}, + {"IpMreqn", "ImrMultiaddr size", unsafe.Sizeof((*new(IpMreqn)).ImrMultiaddr), 4}, + {"IpMreqn", "ImrMultiaddr alignment", unsafe.Alignof((*new(IpMreqn)).ImrMultiaddr), 4}, + {"IpMreqn", "ImrAddress offset", unsafe.Offsetof((*new(IpMreqn)).ImrAddress), 4}, + {"IpMreqn", "ImrAddress size", unsafe.Sizeof((*new(IpMreqn)).ImrAddress), 4}, + {"IpMreqn", "ImrAddress alignment", unsafe.Alignof((*new(IpMreqn)).ImrAddress), 4}, + {"IpMreqn", "ImrIfindex offset", unsafe.Offsetof((*new(IpMreqn)).ImrIfindex), 8}, + {"IpMreqn", "ImrIfindex size", unsafe.Sizeof((*new(IpMreqn)).ImrIfindex), 4}, + {"IpMreqn", "ImrIfindex alignment", unsafe.Alignof((*new(IpMreqn)).ImrIfindex), 4}, + {"InPktinfo", "size", unsafe.Sizeof(*new(InPktinfo)), 12}, + {"InPktinfo", "alignment", unsafe.Alignof(*new(InPktinfo)), 4}, + {"InPktinfo", "IpiIfindex offset", unsafe.Offsetof((*new(InPktinfo)).IpiIfindex), 0}, + {"InPktinfo", "IpiIfindex size", unsafe.Sizeof((*new(InPktinfo)).IpiIfindex), 4}, + {"InPktinfo", "IpiIfindex alignment", unsafe.Alignof((*new(InPktinfo)).IpiIfindex), 4}, + {"InPktinfo", "IpiSpecDst offset", unsafe.Offsetof((*new(InPktinfo)).IpiSpecDst), 4}, + {"InPktinfo", "IpiSpecDst size", unsafe.Sizeof((*new(InPktinfo)).IpiSpecDst), 4}, + {"InPktinfo", "IpiSpecDst alignment", unsafe.Alignof((*new(InPktinfo)).IpiSpecDst), 4}, + {"InPktinfo", "IpiAddr offset", unsafe.Offsetof((*new(InPktinfo)).IpiAddr), 8}, + {"InPktinfo", "IpiAddr size", unsafe.Sizeof((*new(InPktinfo)).IpiAddr), 4}, + {"InPktinfo", "IpiAddr alignment", unsafe.Alignof((*new(InPktinfo)).IpiAddr), 4}, + {"Netent", "size", unsafe.Sizeof(*new(Netent)), 24}, + {"Netent", "alignment", unsafe.Alignof(*new(Netent)), 8}, + {"Netent", "NName offset", unsafe.Offsetof((*new(Netent)).NName), 0}, + {"Netent", "NName size", unsafe.Sizeof((*new(Netent)).NName), 8}, + {"Netent", "NName alignment", unsafe.Alignof((*new(Netent)).NName), 8}, + {"Netent", "NAliases offset", unsafe.Offsetof((*new(Netent)).NAliases), 8}, + {"Netent", "NAliases size", unsafe.Sizeof((*new(Netent)).NAliases), 8}, + {"Netent", "NAliases alignment", unsafe.Alignof((*new(Netent)).NAliases), 8}, + {"Netent", "NAddrtype offset", unsafe.Offsetof((*new(Netent)).NAddrtype), 16}, + {"Netent", "NAddrtype size", unsafe.Sizeof((*new(Netent)).NAddrtype), 4}, + {"Netent", "NAddrtype alignment", unsafe.Alignof((*new(Netent)).NAddrtype), 4}, + {"Netent", "NNet offset", unsafe.Offsetof((*new(Netent)).NNet), 20}, + {"Netent", "NNet size", unsafe.Sizeof((*new(Netent)).NNet), 4}, + {"Netent", "NNet alignment", unsafe.Alignof((*new(Netent)).NNet), 4}, + {"SaFamilyT", "size", unsafe.Sizeof(*new(SaFamilyT)), 2}, + {"SaFamilyT", "alignment", unsafe.Alignof(*new(SaFamilyT)), 2}, + {"SockAddr", "size", unsafe.Sizeof(*new(SockAddr)), 16}, + {"SockAddr", "alignment", unsafe.Alignof(*new(SockAddr)), 2}, + {"SockAddr", "Family offset", unsafe.Offsetof((*new(SockAddr)).Family), 0}, + {"SockAddr", "Family size", unsafe.Sizeof((*new(SockAddr)).Family), 2}, + {"SockAddr", "Family alignment", unsafe.Alignof((*new(SockAddr)).Family), 2}, + {"SockAddr", "Data offset", unsafe.Offsetof((*new(SockAddr)).Data), 2}, + {"SockAddr", "Data size", unsafe.Sizeof((*new(SockAddr)).Data), 14}, + {"SockAddr", "Data alignment", unsafe.Alignof((*new(SockAddr)).Data), 1}, + {"SockaddrStorage", "size", unsafe.Sizeof(*new(SockaddrStorage)), 128}, + {"SockaddrStorage", "alignment", unsafe.Alignof(*new(SockaddrStorage)), 8}, + {"SockaddrStorage", "Family offset", unsafe.Offsetof((*new(SockaddrStorage)).Family), 0}, + {"SockaddrStorage", "Family size", unsafe.Sizeof((*new(SockaddrStorage)).Family), 2}, + {"SockaddrStorage", "Family alignment", unsafe.Alignof((*new(SockaddrStorage)).Family), 2}, + {"SockaddrStorage", "pad offset", unsafe.Offsetof((*new(SockaddrStorage)).pad), 2}, + {"SockaddrStorage", "pad size", unsafe.Sizeof((*new(SockaddrStorage)).pad), 118}, + {"SockaddrStorage", "pad alignment", unsafe.Alignof((*new(SockaddrStorage)).pad), 1}, + {"SockaddrStorage", "align offset", unsafe.Offsetof((*new(SockaddrStorage)).align), 120}, + {"SockaddrStorage", "align size", unsafe.Sizeof((*new(SockaddrStorage)).align), 8}, + {"SockaddrStorage", "align alignment", unsafe.Alignof((*new(SockaddrStorage)).align), 8}, + {"Msghdr", "size", unsafe.Sizeof(*new(Msghdr)), 56}, + {"Msghdr", "alignment", unsafe.Alignof(*new(Msghdr)), 8}, + {"Msghdr", "MsgName offset", unsafe.Offsetof((*new(Msghdr)).MsgName), 0}, + {"Msghdr", "MsgName size", unsafe.Sizeof((*new(Msghdr)).MsgName), 8}, + {"Msghdr", "MsgName alignment", unsafe.Alignof((*new(Msghdr)).MsgName), 8}, + {"Msghdr", "MsgNamelen offset", unsafe.Offsetof((*new(Msghdr)).MsgNamelen), 8}, + {"Msghdr", "MsgNamelen size", unsafe.Sizeof((*new(Msghdr)).MsgNamelen), 4}, + {"Msghdr", "MsgNamelen alignment", unsafe.Alignof((*new(Msghdr)).MsgNamelen), 4}, + {"Msghdr", "MsgIov offset", unsafe.Offsetof((*new(Msghdr)).MsgIov), 16}, + {"Msghdr", "MsgIov size", unsafe.Sizeof((*new(Msghdr)).MsgIov), 8}, + {"Msghdr", "MsgIov alignment", unsafe.Alignof((*new(Msghdr)).MsgIov), 8}, + {"Msghdr", "MsgIovlen offset", unsafe.Offsetof((*new(Msghdr)).MsgIovlen), 24}, + {"Msghdr", "MsgIovlen size", unsafe.Sizeof((*new(Msghdr)).MsgIovlen), 8}, + {"Msghdr", "MsgIovlen alignment", unsafe.Alignof((*new(Msghdr)).MsgIovlen), 8}, + {"Msghdr", "MsgControl offset", unsafe.Offsetof((*new(Msghdr)).MsgControl), 32}, + {"Msghdr", "MsgControl size", unsafe.Sizeof((*new(Msghdr)).MsgControl), 8}, + {"Msghdr", "MsgControl alignment", unsafe.Alignof((*new(Msghdr)).MsgControl), 8}, + {"Msghdr", "MsgControllen offset", unsafe.Offsetof((*new(Msghdr)).MsgControllen), 40}, + {"Msghdr", "MsgControllen size", unsafe.Sizeof((*new(Msghdr)).MsgControllen), 8}, + {"Msghdr", "MsgControllen alignment", unsafe.Alignof((*new(Msghdr)).MsgControllen), 8}, + {"Msghdr", "MsgFlags offset", unsafe.Offsetof((*new(Msghdr)).MsgFlags), 48}, + {"Msghdr", "MsgFlags size", unsafe.Sizeof((*new(Msghdr)).MsgFlags), 4}, + {"Msghdr", "MsgFlags alignment", unsafe.Alignof((*new(Msghdr)).MsgFlags), 4}, + {"Cmsghdr", "size", unsafe.Sizeof(*new(Cmsghdr)), 16}, + {"Cmsghdr", "alignment", unsafe.Alignof(*new(Cmsghdr)), 8}, + {"Cmsghdr", "CmsgLen offset", unsafe.Offsetof((*new(Cmsghdr)).CmsgLen), 0}, + {"Cmsghdr", "CmsgLen size", unsafe.Sizeof((*new(Cmsghdr)).CmsgLen), 8}, + {"Cmsghdr", "CmsgLen alignment", unsafe.Alignof((*new(Cmsghdr)).CmsgLen), 8}, + {"Cmsghdr", "CmsgLevel offset", unsafe.Offsetof((*new(Cmsghdr)).CmsgLevel), 8}, + {"Cmsghdr", "CmsgLevel size", unsafe.Sizeof((*new(Cmsghdr)).CmsgLevel), 4}, + {"Cmsghdr", "CmsgLevel alignment", unsafe.Alignof((*new(Cmsghdr)).CmsgLevel), 4}, + {"Cmsghdr", "CmsgType offset", unsafe.Offsetof((*new(Cmsghdr)).CmsgType), 12}, + {"Cmsghdr", "CmsgType size", unsafe.Sizeof((*new(Cmsghdr)).CmsgType), 4}, + {"Cmsghdr", "CmsgType alignment", unsafe.Alignof((*new(Cmsghdr)).CmsgType), 4}, + {"Linger", "size", unsafe.Sizeof(*new(Linger)), 8}, + {"Linger", "alignment", unsafe.Alignof(*new(Linger)), 4}, + {"Linger", "LOnoff offset", unsafe.Offsetof((*new(Linger)).LOnoff), 0}, + {"Linger", "LOnoff size", unsafe.Sizeof((*new(Linger)).LOnoff), 4}, + {"Linger", "LOnoff alignment", unsafe.Alignof((*new(Linger)).LOnoff), 4}, + {"Linger", "LLinger offset", unsafe.Offsetof((*new(Linger)).LLinger), 4}, + {"Linger", "LLinger size", unsafe.Sizeof((*new(Linger)).LLinger), 4}, + {"Linger", "LLinger alignment", unsafe.Alignof((*new(Linger)).LLinger), 4}, + {"SocklenT", "size", unsafe.Sizeof(*new(SocklenT)), 4}, + {"SocklenT", "alignment", unsafe.Alignof(*new(SocklenT)), 4}, + {"X__SocketType", "size", unsafe.Sizeof(*new(X__SocketType)), 4}, + {"X__SocketType", "alignment", unsafe.Alignof(*new(X__SocketType)), 4}, + {"X__FsidT", "size", unsafe.Sizeof(*new(X__FsidT)), 8}, + {"X__FsidT", "alignment", unsafe.Alignof(*new(X__FsidT)), 4}, + {"X__FsidT", "X__Val offset", unsafe.Offsetof((*new(X__FsidT)).X__Val), 0}, + {"X__FsidT", "X__Val size", unsafe.Sizeof((*new(X__FsidT)).X__Val), 8}, + {"X__FsidT", "X__Val alignment", unsafe.Alignof((*new(X__FsidT)).X__Val), 4}, + {"X__UChar", "size", unsafe.Sizeof(*new(X__UChar)), 1}, + {"X__UChar", "alignment", unsafe.Alignof(*new(X__UChar)), 1}, + {"X__UShort", "size", unsafe.Sizeof(*new(X__UShort)), 2}, + {"X__UShort", "alignment", unsafe.Alignof(*new(X__UShort)), 2}, + {"X__UInt", "size", unsafe.Sizeof(*new(X__UInt)), 4}, + {"X__UInt", "alignment", unsafe.Alignof(*new(X__UInt)), 4}, + {"X__ULong", "size", unsafe.Sizeof(*new(X__ULong)), 8}, + {"X__ULong", "alignment", unsafe.Alignof(*new(X__ULong)), 8}, + {"X__Int8T", "size", unsafe.Sizeof(*new(X__Int8T)), 1}, + {"X__Int8T", "alignment", unsafe.Alignof(*new(X__Int8T)), 1}, + {"X__Uint8T", "size", unsafe.Sizeof(*new(X__Uint8T)), 1}, + {"X__Uint8T", "alignment", unsafe.Alignof(*new(X__Uint8T)), 1}, + {"X__Int16T", "size", unsafe.Sizeof(*new(X__Int16T)), 2}, + {"X__Int16T", "alignment", unsafe.Alignof(*new(X__Int16T)), 2}, + {"X__Uint16T", "size", unsafe.Sizeof(*new(X__Uint16T)), 2}, + {"X__Uint16T", "alignment", unsafe.Alignof(*new(X__Uint16T)), 2}, + {"X__Int32T", "size", unsafe.Sizeof(*new(X__Int32T)), 4}, + {"X__Int32T", "alignment", unsafe.Alignof(*new(X__Int32T)), 4}, + {"X__Uint32T", "size", unsafe.Sizeof(*new(X__Uint32T)), 4}, + {"X__Uint32T", "alignment", unsafe.Alignof(*new(X__Uint32T)), 4}, + {"X__Int64T", "size", unsafe.Sizeof(*new(X__Int64T)), 8}, + {"X__Int64T", "alignment", unsafe.Alignof(*new(X__Int64T)), 8}, + {"X__Uint64T", "size", unsafe.Sizeof(*new(X__Uint64T)), 8}, + {"X__Uint64T", "alignment", unsafe.Alignof(*new(X__Uint64T)), 8}, + {"X__QuadT", "size", unsafe.Sizeof(*new(X__QuadT)), 8}, + {"X__QuadT", "alignment", unsafe.Alignof(*new(X__QuadT)), 8}, + {"X__UQuadT", "size", unsafe.Sizeof(*new(X__UQuadT)), 8}, + {"X__UQuadT", "alignment", unsafe.Alignof(*new(X__UQuadT)), 8}, + {"X__DevT", "size", unsafe.Sizeof(*new(X__DevT)), 8}, + {"X__DevT", "alignment", unsafe.Alignof(*new(X__DevT)), 8}, + {"X__UidT", "size", unsafe.Sizeof(*new(X__UidT)), 4}, + {"X__UidT", "alignment", unsafe.Alignof(*new(X__UidT)), 4}, + {"X__GidT", "size", unsafe.Sizeof(*new(X__GidT)), 4}, + {"X__GidT", "alignment", unsafe.Alignof(*new(X__GidT)), 4}, + {"X__InoT", "size", unsafe.Sizeof(*new(X__InoT)), 8}, + {"X__InoT", "alignment", unsafe.Alignof(*new(X__InoT)), 8}, + {"X__Ino64T", "size", unsafe.Sizeof(*new(X__Ino64T)), 8}, + {"X__Ino64T", "alignment", unsafe.Alignof(*new(X__Ino64T)), 8}, + {"X__ModeT", "size", unsafe.Sizeof(*new(X__ModeT)), 4}, + {"X__ModeT", "alignment", unsafe.Alignof(*new(X__ModeT)), 4}, + {"X__NlinkT", "size", unsafe.Sizeof(*new(X__NlinkT)), 8}, + {"X__NlinkT", "alignment", unsafe.Alignof(*new(X__NlinkT)), 8}, + {"X__OffT", "size", unsafe.Sizeof(*new(X__OffT)), 8}, + {"X__OffT", "alignment", unsafe.Alignof(*new(X__OffT)), 8}, + {"X__Off64T", "size", unsafe.Sizeof(*new(X__Off64T)), 8}, + {"X__Off64T", "alignment", unsafe.Alignof(*new(X__Off64T)), 8}, + {"X__PidT", "size", unsafe.Sizeof(*new(X__PidT)), 4}, + {"X__PidT", "alignment", unsafe.Alignof(*new(X__PidT)), 4}, + {"X__ClockT", "size", unsafe.Sizeof(*new(X__ClockT)), 8}, + {"X__ClockT", "alignment", unsafe.Alignof(*new(X__ClockT)), 8}, + {"X__RlimT", "size", unsafe.Sizeof(*new(X__RlimT)), 8}, + {"X__RlimT", "alignment", unsafe.Alignof(*new(X__RlimT)), 8}, + {"X__Rlim64T", "size", unsafe.Sizeof(*new(X__Rlim64T)), 8}, + {"X__Rlim64T", "alignment", unsafe.Alignof(*new(X__Rlim64T)), 8}, + {"X__IdT", "size", unsafe.Sizeof(*new(X__IdT)), 4}, + {"X__IdT", "alignment", unsafe.Alignof(*new(X__IdT)), 4}, + {"X__TimeT", "size", unsafe.Sizeof(*new(X__TimeT)), 8}, + {"X__TimeT", "alignment", unsafe.Alignof(*new(X__TimeT)), 8}, + {"X__UsecondsT", "size", unsafe.Sizeof(*new(X__UsecondsT)), 4}, + {"X__UsecondsT", "alignment", unsafe.Alignof(*new(X__UsecondsT)), 4}, + {"X__SusecondsT", "size", unsafe.Sizeof(*new(X__SusecondsT)), 8}, + {"X__SusecondsT", "alignment", unsafe.Alignof(*new(X__SusecondsT)), 8}, + {"X__DaddrT", "size", unsafe.Sizeof(*new(X__DaddrT)), 4}, + {"X__DaddrT", "alignment", unsafe.Alignof(*new(X__DaddrT)), 4}, + {"X__KeyT", "size", unsafe.Sizeof(*new(X__KeyT)), 4}, + {"X__KeyT", "alignment", unsafe.Alignof(*new(X__KeyT)), 4}, + {"X__ClockidT", "size", unsafe.Sizeof(*new(X__ClockidT)), 4}, + {"X__ClockidT", "alignment", unsafe.Alignof(*new(X__ClockidT)), 4}, + {"X__TimerT", "size", unsafe.Sizeof(*new(X__TimerT)), 8}, + {"X__TimerT", "alignment", unsafe.Alignof(*new(X__TimerT)), 8}, + {"X__BlksizeT", "size", unsafe.Sizeof(*new(X__BlksizeT)), 8}, + {"X__BlksizeT", "alignment", unsafe.Alignof(*new(X__BlksizeT)), 8}, + {"X__BlkcntT", "size", unsafe.Sizeof(*new(X__BlkcntT)), 8}, + {"X__BlkcntT", "alignment", unsafe.Alignof(*new(X__BlkcntT)), 8}, + {"X__Blkcnt64T", "size", unsafe.Sizeof(*new(X__Blkcnt64T)), 8}, + {"X__Blkcnt64T", "alignment", unsafe.Alignof(*new(X__Blkcnt64T)), 8}, + {"X__FsblkcntT", "size", unsafe.Sizeof(*new(X__FsblkcntT)), 8}, + {"X__FsblkcntT", "alignment", unsafe.Alignof(*new(X__FsblkcntT)), 8}, + {"X__Fsblkcnt64T", "size", unsafe.Sizeof(*new(X__Fsblkcnt64T)), 8}, + {"X__Fsblkcnt64T", "alignment", unsafe.Alignof(*new(X__Fsblkcnt64T)), 8}, + {"X__FsfilcntT", "size", unsafe.Sizeof(*new(X__FsfilcntT)), 8}, + {"X__FsfilcntT", "alignment", unsafe.Alignof(*new(X__FsfilcntT)), 8}, + {"X__Fsfilcnt64T", "size", unsafe.Sizeof(*new(X__Fsfilcnt64T)), 8}, + {"X__Fsfilcnt64T", "alignment", unsafe.Alignof(*new(X__Fsfilcnt64T)), 8}, + {"X__FswordT", "size", unsafe.Sizeof(*new(X__FswordT)), 8}, + {"X__FswordT", "alignment", unsafe.Alignof(*new(X__FswordT)), 8}, + {"X__SsizeT", "size", unsafe.Sizeof(*new(X__SsizeT)), 8}, + {"X__SsizeT", "alignment", unsafe.Alignof(*new(X__SsizeT)), 8}, + {"X__SyscallSlongT", "size", unsafe.Sizeof(*new(X__SyscallSlongT)), 8}, + {"X__SyscallSlongT", "alignment", unsafe.Alignof(*new(X__SyscallSlongT)), 8}, + {"X__SyscallUlongT", "size", unsafe.Sizeof(*new(X__SyscallUlongT)), 8}, + {"X__SyscallUlongT", "alignment", unsafe.Alignof(*new(X__SyscallUlongT)), 8}, + {"X__LoffT", "size", unsafe.Sizeof(*new(X__LoffT)), 8}, + {"X__LoffT", "alignment", unsafe.Alignof(*new(X__LoffT)), 8}, + {"X__QaddrT", "size", unsafe.Sizeof(*new(X__QaddrT)), 8}, + {"X__QaddrT", "alignment", unsafe.Alignof(*new(X__QaddrT)), 8}, + {"X__CaddrT", "size", unsafe.Sizeof(*new(X__CaddrT)), 8}, + {"X__CaddrT", "alignment", unsafe.Alignof(*new(X__CaddrT)), 8}, + {"X__IntptrT", "size", unsafe.Sizeof(*new(X__IntptrT)), 8}, + {"X__IntptrT", "alignment", unsafe.Alignof(*new(X__IntptrT)), 8}, + {"X__SocklenT", "size", unsafe.Sizeof(*new(X__SocklenT)), 4}, + {"X__SocklenT", "alignment", unsafe.Alignof(*new(X__SocklenT)), 4}, + {"Iovec", "size", unsafe.Sizeof(*new(Iovec)), 16}, + {"Iovec", "alignment", unsafe.Alignof(*new(Iovec)), 8}, + {"Iovec", "IovBase offset", unsafe.Offsetof((*new(Iovec)).IovBase), 0}, + {"Iovec", "IovBase size", unsafe.Sizeof((*new(Iovec)).IovBase), 8}, + {"Iovec", "IovBase alignment", unsafe.Alignof((*new(Iovec)).IovBase), 8}, + {"Iovec", "IovLen offset", unsafe.Offsetof((*new(Iovec)).IovLen), 8}, + {"Iovec", "IovLen size", unsafe.Sizeof((*new(Iovec)).IovLen), 8}, + {"Iovec", "IovLen alignment", unsafe.Alignof((*new(Iovec)).IovLen), 8}, + {"SizeT", "size", unsafe.Sizeof(*new(SizeT)), 8}, + {"SizeT", "alignment", unsafe.Alignof(*new(SizeT)), 8}, + {"IfNameindexT", "size", unsafe.Sizeof(*new(IfNameindexT)), 16}, + {"IfNameindexT", "alignment", unsafe.Alignof(*new(IfNameindexT)), 8}, + {"IfNameindexT", "IfIndex offset", unsafe.Offsetof((*new(IfNameindexT)).IfIndex), 0}, + {"IfNameindexT", "IfIndex size", unsafe.Sizeof((*new(IfNameindexT)).IfIndex), 4}, + {"IfNameindexT", "IfIndex alignment", unsafe.Alignof((*new(IfNameindexT)).IfIndex), 4}, + {"IfNameindexT", "IfName offset", unsafe.Offsetof((*new(IfNameindexT)).IfName), 8}, + {"IfNameindexT", "IfName size", unsafe.Sizeof((*new(IfNameindexT)).IfName), 8}, + {"IfNameindexT", "IfName alignment", unsafe.Alignof((*new(IfNameindexT)).IfName), 8}, + {"Ifaddr", "size", unsafe.Sizeof(*new(Ifaddr)), 48}, + {"Ifaddr", "alignment", unsafe.Alignof(*new(Ifaddr)), 8}, + {"Ifaddr", "IfaAddr offset", unsafe.Offsetof((*new(Ifaddr)).IfaAddr), 0}, + {"Ifaddr", "IfaAddr size", unsafe.Sizeof((*new(Ifaddr)).IfaAddr), 16}, + {"Ifaddr", "IfaAddr alignment", unsafe.Alignof((*new(Ifaddr)).IfaAddr), 2}, + {"Ifaddr", "IfaIfu offset", unsafe.Offsetof((*new(Ifaddr)).IfaIfu), 16}, + {"Ifaddr", "IfaIfu size", unsafe.Sizeof((*new(Ifaddr)).IfaIfu), 16}, + {"Ifaddr", "IfaIfu alignment", unsafe.Alignof((*new(Ifaddr)).IfaIfu), 2}, + {"Ifaddr", "IfaIfp offset", unsafe.Offsetof((*new(Ifaddr)).IfaIfp), 32}, + {"Ifaddr", "IfaIfp size", unsafe.Sizeof((*new(Ifaddr)).IfaIfp), 8}, + {"Ifaddr", "IfaIfp alignment", unsafe.Alignof((*new(Ifaddr)).IfaIfp), 8}, + {"Ifaddr", "IfaNext offset", unsafe.Offsetof((*new(Ifaddr)).IfaNext), 40}, + {"Ifaddr", "IfaNext size", unsafe.Sizeof((*new(Ifaddr)).IfaNext), 8}, + {"Ifaddr", "IfaNext alignment", unsafe.Alignof((*new(Ifaddr)).IfaNext), 8}, + {"Ifmap", "size", unsafe.Sizeof(*new(Ifmap)), 24}, + {"Ifmap", "alignment", unsafe.Alignof(*new(Ifmap)), 8}, + {"Ifmap", "MemStart offset", unsafe.Offsetof((*new(Ifmap)).MemStart), 0}, + {"Ifmap", "MemStart size", unsafe.Sizeof((*new(Ifmap)).MemStart), 8}, + {"Ifmap", "MemStart alignment", unsafe.Alignof((*new(Ifmap)).MemStart), 8}, + {"Ifmap", "MemEnd offset", unsafe.Offsetof((*new(Ifmap)).MemEnd), 8}, + {"Ifmap", "MemEnd size", unsafe.Sizeof((*new(Ifmap)).MemEnd), 8}, + {"Ifmap", "MemEnd alignment", unsafe.Alignof((*new(Ifmap)).MemEnd), 8}, + {"Ifmap", "BaseAddr offset", unsafe.Offsetof((*new(Ifmap)).BaseAddr), 16}, + {"Ifmap", "BaseAddr size", unsafe.Sizeof((*new(Ifmap)).BaseAddr), 2}, + {"Ifmap", "BaseAddr alignment", unsafe.Alignof((*new(Ifmap)).BaseAddr), 2}, + {"Ifmap", "Irq offset", unsafe.Offsetof((*new(Ifmap)).Irq), 18}, + {"Ifmap", "Irq size", unsafe.Sizeof((*new(Ifmap)).Irq), 1}, + {"Ifmap", "Irq alignment", unsafe.Alignof((*new(Ifmap)).Irq), 1}, + {"Ifmap", "Dma offset", unsafe.Offsetof((*new(Ifmap)).Dma), 19}, + {"Ifmap", "Dma size", unsafe.Sizeof((*new(Ifmap)).Dma), 1}, + {"Ifmap", "Dma alignment", unsafe.Alignof((*new(Ifmap)).Dma), 1}, + {"Ifmap", "Port offset", unsafe.Offsetof((*new(Ifmap)).Port), 20}, + {"Ifmap", "Port size", unsafe.Sizeof((*new(Ifmap)).Port), 1}, + {"Ifmap", "Port alignment", unsafe.Alignof((*new(Ifmap)).Port), 1}, + {"Ifreq", "size", unsafe.Sizeof(*new(Ifreq)), 40}, + {"Ifreq", "alignment", unsafe.Alignof(*new(Ifreq)), 8}, + {"Ifreq", "IfrIfrn offset", unsafe.Offsetof((*new(Ifreq)).IfrIfrn), 0}, + {"Ifreq", "IfrIfrn size", unsafe.Sizeof((*new(Ifreq)).IfrIfrn), 16}, + {"Ifreq", "IfrIfrn alignment", unsafe.Alignof((*new(Ifreq)).IfrIfrn), 1}, + {"Ifreq", "IfrIfru offset", unsafe.Offsetof((*new(Ifreq)).IfrIfru), 16}, + {"Ifreq", "IfrIfru size", unsafe.Sizeof((*new(Ifreq)).IfrIfru), 24}, + {"Ifreq", "IfrIfru alignment", unsafe.Alignof((*new(Ifreq)).IfrIfru), 8}, + {"Ifconf", "size", unsafe.Sizeof(*new(Ifconf)), 16}, + {"Ifconf", "alignment", unsafe.Alignof(*new(Ifconf)), 8}, + {"Ifconf", "IfcLen offset", unsafe.Offsetof((*new(Ifconf)).IfcLen), 0}, + {"Ifconf", "IfcLen size", unsafe.Sizeof((*new(Ifconf)).IfcLen), 4}, + {"Ifconf", "IfcLen alignment", unsafe.Alignof((*new(Ifconf)).IfcLen), 4}, + {"Ifconf", "IfcIfcu offset", unsafe.Offsetof((*new(Ifconf)).IfcIfcu), 8}, + {"Ifconf", "IfcIfcu size", unsafe.Sizeof((*new(Ifconf)).IfcIfcu), 8}, + {"Ifconf", "IfcIfcu alignment", unsafe.Alignof((*new(Ifconf)).IfcIfcu), 8}, + {"Iface", "pointer size", unsafe.Sizeof((*Iface)(nil)), 8}, + {"Iface", "pointer alignment", unsafe.Alignof((*Iface)(nil)), 8}, + {"Hostent", "size", unsafe.Sizeof(*new(Hostent)), 32}, + {"Hostent", "alignment", unsafe.Alignof(*new(Hostent)), 8}, + {"Hostent", "Name offset", unsafe.Offsetof((*new(Hostent)).Name), 0}, + {"Hostent", "Name size", unsafe.Sizeof((*new(Hostent)).Name), 8}, + {"Hostent", "Name alignment", unsafe.Alignof((*new(Hostent)).Name), 8}, + {"Hostent", "Aliases offset", unsafe.Offsetof((*new(Hostent)).Aliases), 8}, + {"Hostent", "Aliases size", unsafe.Sizeof((*new(Hostent)).Aliases), 8}, + {"Hostent", "Aliases alignment", unsafe.Alignof((*new(Hostent)).Aliases), 8}, + {"Hostent", "AddrType offset", unsafe.Offsetof((*new(Hostent)).AddrType), 16}, + {"Hostent", "AddrType size", unsafe.Sizeof((*new(Hostent)).AddrType), 4}, + {"Hostent", "AddrType alignment", unsafe.Alignof((*new(Hostent)).AddrType), 4}, + {"Hostent", "Length offset", unsafe.Offsetof((*new(Hostent)).Length), 20}, + {"Hostent", "Length size", unsafe.Sizeof((*new(Hostent)).Length), 4}, + {"Hostent", "Length alignment", unsafe.Alignof((*new(Hostent)).Length), 4}, + {"Hostent", "AddrList offset", unsafe.Offsetof((*new(Hostent)).AddrList), 24}, + {"Hostent", "AddrList size", unsafe.Sizeof((*new(Hostent)).AddrList), 8}, + {"Hostent", "AddrList alignment", unsafe.Alignof((*new(Hostent)).AddrList), 8}, + {"Servent", "size", unsafe.Sizeof(*new(Servent)), 32}, + {"Servent", "alignment", unsafe.Alignof(*new(Servent)), 8}, + {"Servent", "SName offset", unsafe.Offsetof((*new(Servent)).SName), 0}, + {"Servent", "SName size", unsafe.Sizeof((*new(Servent)).SName), 8}, + {"Servent", "SName alignment", unsafe.Alignof((*new(Servent)).SName), 8}, + {"Servent", "SAliases offset", unsafe.Offsetof((*new(Servent)).SAliases), 8}, + {"Servent", "SAliases size", unsafe.Sizeof((*new(Servent)).SAliases), 8}, + {"Servent", "SAliases alignment", unsafe.Alignof((*new(Servent)).SAliases), 8}, + {"Servent", "SPort offset", unsafe.Offsetof((*new(Servent)).SPort), 16}, + {"Servent", "SPort size", unsafe.Sizeof((*new(Servent)).SPort), 4}, + {"Servent", "SPort alignment", unsafe.Alignof((*new(Servent)).SPort), 4}, + {"Servent", "SProto offset", unsafe.Offsetof((*new(Servent)).SProto), 24}, + {"Servent", "SProto size", unsafe.Sizeof((*new(Servent)).SProto), 8}, + {"Servent", "SProto alignment", unsafe.Alignof((*new(Servent)).SProto), 8}, + {"Protoent", "size", unsafe.Sizeof(*new(Protoent)), 24}, + {"Protoent", "alignment", unsafe.Alignof(*new(Protoent)), 8}, + {"Protoent", "PName offset", unsafe.Offsetof((*new(Protoent)).PName), 0}, + {"Protoent", "PName size", unsafe.Sizeof((*new(Protoent)).PName), 8}, + {"Protoent", "PName alignment", unsafe.Alignof((*new(Protoent)).PName), 8}, + {"Protoent", "PAliases offset", unsafe.Offsetof((*new(Protoent)).PAliases), 8}, + {"Protoent", "PAliases size", unsafe.Sizeof((*new(Protoent)).PAliases), 8}, + {"Protoent", "PAliases alignment", unsafe.Alignof((*new(Protoent)).PAliases), 8}, + {"Protoent", "PProto offset", unsafe.Offsetof((*new(Protoent)).PProto), 16}, + {"Protoent", "PProto size", unsafe.Sizeof((*new(Protoent)).PProto), 4}, + {"Protoent", "PProto alignment", unsafe.Alignof((*new(Protoent)).PProto), 4}, + {"AddrInfo", "size", unsafe.Sizeof(*new(AddrInfo)), 48}, + {"AddrInfo", "alignment", unsafe.Alignof(*new(AddrInfo)), 8}, + {"AddrInfo", "Flags offset", unsafe.Offsetof((*new(AddrInfo)).Flags), 0}, + {"AddrInfo", "Flags size", unsafe.Sizeof((*new(AddrInfo)).Flags), 4}, + {"AddrInfo", "Flags alignment", unsafe.Alignof((*new(AddrInfo)).Flags), 4}, + {"AddrInfo", "Family offset", unsafe.Offsetof((*new(AddrInfo)).Family), 4}, + {"AddrInfo", "Family size", unsafe.Sizeof((*new(AddrInfo)).Family), 4}, + {"AddrInfo", "Family alignment", unsafe.Alignof((*new(AddrInfo)).Family), 4}, + {"AddrInfo", "SockType offset", unsafe.Offsetof((*new(AddrInfo)).SockType), 8}, + {"AddrInfo", "SockType size", unsafe.Sizeof((*new(AddrInfo)).SockType), 4}, + {"AddrInfo", "SockType alignment", unsafe.Alignof((*new(AddrInfo)).SockType), 4}, + {"AddrInfo", "Protocol offset", unsafe.Offsetof((*new(AddrInfo)).Protocol), 12}, + {"AddrInfo", "Protocol size", unsafe.Sizeof((*new(AddrInfo)).Protocol), 4}, + {"AddrInfo", "Protocol alignment", unsafe.Alignof((*new(AddrInfo)).Protocol), 4}, + {"AddrInfo", "AddrLen offset", unsafe.Offsetof((*new(AddrInfo)).AddrLen), 16}, + {"AddrInfo", "AddrLen size", unsafe.Sizeof((*new(AddrInfo)).AddrLen), 4}, + {"AddrInfo", "AddrLen alignment", unsafe.Alignof((*new(AddrInfo)).AddrLen), 4}, + {"AddrInfo", "Addr offset", unsafe.Offsetof((*new(AddrInfo)).Addr), 24}, + {"AddrInfo", "Addr size", unsafe.Sizeof((*new(AddrInfo)).Addr), 8}, + {"AddrInfo", "Addr alignment", unsafe.Alignof((*new(AddrInfo)).Addr), 8}, + {"AddrInfo", "CanOnName offset", unsafe.Offsetof((*new(AddrInfo)).CanOnName), 32}, + {"AddrInfo", "CanOnName size", unsafe.Sizeof((*new(AddrInfo)).CanOnName), 8}, + {"AddrInfo", "CanOnName alignment", unsafe.Alignof((*new(AddrInfo)).CanOnName), 8}, + {"AddrInfo", "Next offset", unsafe.Offsetof((*new(AddrInfo)).Next), 40}, + {"AddrInfo", "Next size", unsafe.Sizeof((*new(AddrInfo)).Next), 8}, + {"AddrInfo", "Next alignment", unsafe.Alignof((*new(AddrInfo)).Next), 8}, + {"InAddr", "size", unsafe.Sizeof(*new(InAddr)), 4}, + {"InAddr", "alignment", unsafe.Alignof(*new(InAddr)), 4}, + {"InAddr", "Addr offset", unsafe.Offsetof((*new(InAddr)).Addr), 0}, + {"InAddr", "Addr size", unsafe.Sizeof((*new(InAddr)).Addr), 4}, + {"InAddr", "Addr alignment", unsafe.Alignof((*new(InAddr)).Addr), 4}, + {"In6Addr", "size", unsafe.Sizeof(*new(In6Addr)), 16}, + {"In6Addr", "alignment", unsafe.Alignof(*new(In6Addr)), 4}, + {"In6Addr", "U6Addr offset", unsafe.Offsetof((*new(In6Addr)).U6Addr), 0}, + {"In6Addr", "U6Addr size", unsafe.Sizeof((*new(In6Addr)).U6Addr), 16}, + {"In6Addr", "U6Addr alignment", unsafe.Alignof((*new(In6Addr)).U6Addr), 1}, + {"SockaddrIn", "size", unsafe.Sizeof(*new(SockaddrIn)), 16}, + {"SockaddrIn", "alignment", unsafe.Alignof(*new(SockaddrIn)), 4}, + {"SockaddrIn", "Family offset", unsafe.Offsetof((*new(SockaddrIn)).Family), 0}, + {"SockaddrIn", "Family size", unsafe.Sizeof((*new(SockaddrIn)).Family), 2}, + {"SockaddrIn", "Family alignment", unsafe.Alignof((*new(SockaddrIn)).Family), 2}, + {"SockaddrIn", "Port offset", unsafe.Offsetof((*new(SockaddrIn)).Port), 2}, + {"SockaddrIn", "Port size", unsafe.Sizeof((*new(SockaddrIn)).Port), 2}, + {"SockaddrIn", "Port alignment", unsafe.Alignof((*new(SockaddrIn)).Port), 2}, + {"SockaddrIn", "Addr offset", unsafe.Offsetof((*new(SockaddrIn)).Addr), 4}, + {"SockaddrIn", "Addr size", unsafe.Sizeof((*new(SockaddrIn)).Addr), 4}, + {"SockaddrIn", "Addr alignment", unsafe.Alignof((*new(SockaddrIn)).Addr), 4}, + {"SockaddrIn", "Zero offset", unsafe.Offsetof((*new(SockaddrIn)).Zero), 8}, + {"SockaddrIn", "Zero size", unsafe.Sizeof((*new(SockaddrIn)).Zero), 8}, + {"SockaddrIn", "Zero alignment", unsafe.Alignof((*new(SockaddrIn)).Zero), 1}, + {"SockaddrIn6", "size", unsafe.Sizeof(*new(SockaddrIn6)), 28}, + {"SockaddrIn6", "alignment", unsafe.Alignof(*new(SockaddrIn6)), 4}, + {"SockaddrIn6", "Family offset", unsafe.Offsetof((*new(SockaddrIn6)).Family), 0}, + {"SockaddrIn6", "Family size", unsafe.Sizeof((*new(SockaddrIn6)).Family), 2}, + {"SockaddrIn6", "Family alignment", unsafe.Alignof((*new(SockaddrIn6)).Family), 2}, + {"SockaddrIn6", "Port offset", unsafe.Offsetof((*new(SockaddrIn6)).Port), 2}, + {"SockaddrIn6", "Port size", unsafe.Sizeof((*new(SockaddrIn6)).Port), 2}, + {"SockaddrIn6", "Port alignment", unsafe.Alignof((*new(SockaddrIn6)).Port), 2}, + {"SockaddrIn6", "Flowinfo offset", unsafe.Offsetof((*new(SockaddrIn6)).Flowinfo), 4}, + {"SockaddrIn6", "Flowinfo size", unsafe.Sizeof((*new(SockaddrIn6)).Flowinfo), 4}, + {"SockaddrIn6", "Flowinfo alignment", unsafe.Alignof((*new(SockaddrIn6)).Flowinfo), 4}, + {"SockaddrIn6", "Addr offset", unsafe.Offsetof((*new(SockaddrIn6)).Addr), 8}, + {"SockaddrIn6", "Addr size", unsafe.Sizeof((*new(SockaddrIn6)).Addr), 16}, + {"SockaddrIn6", "Addr alignment", unsafe.Alignof((*new(SockaddrIn6)).Addr), 4}, + {"SockaddrIn6", "ScopeId offset", unsafe.Offsetof((*new(SockaddrIn6)).ScopeId), 24}, + {"SockaddrIn6", "ScopeId size", unsafe.Sizeof((*new(SockaddrIn6)).ScopeId), 4}, + {"SockaddrIn6", "ScopeId alignment", unsafe.Alignof((*new(SockaddrIn6)).ScopeId), 4}, + {"IpMreq", "size", unsafe.Sizeof(*new(IpMreq)), 8}, + {"IpMreq", "alignment", unsafe.Alignof(*new(IpMreq)), 4}, + {"IpMreq", "ImrMultiaddr offset", unsafe.Offsetof((*new(IpMreq)).ImrMultiaddr), 0}, + {"IpMreq", "ImrMultiaddr size", unsafe.Sizeof((*new(IpMreq)).ImrMultiaddr), 4}, + {"IpMreq", "ImrMultiaddr alignment", unsafe.Alignof((*new(IpMreq)).ImrMultiaddr), 4}, + {"IpMreq", "ImrInterface offset", unsafe.Offsetof((*new(IpMreq)).ImrInterface), 4}, + {"IpMreq", "ImrInterface size", unsafe.Sizeof((*new(IpMreq)).ImrInterface), 4}, + {"IpMreq", "ImrInterface alignment", unsafe.Alignof((*new(IpMreq)).ImrInterface), 4}, + {"IpMreqSource", "size", unsafe.Sizeof(*new(IpMreqSource)), 12}, + {"IpMreqSource", "alignment", unsafe.Alignof(*new(IpMreqSource)), 4}, + {"IpMreqSource", "ImrMultiaddr offset", unsafe.Offsetof((*new(IpMreqSource)).ImrMultiaddr), 0}, + {"IpMreqSource", "ImrMultiaddr size", unsafe.Sizeof((*new(IpMreqSource)).ImrMultiaddr), 4}, + {"IpMreqSource", "ImrMultiaddr alignment", unsafe.Alignof((*new(IpMreqSource)).ImrMultiaddr), 4}, + {"IpMreqSource", "ImrInterface offset", unsafe.Offsetof((*new(IpMreqSource)).ImrInterface), 4}, + {"IpMreqSource", "ImrInterface size", unsafe.Sizeof((*new(IpMreqSource)).ImrInterface), 4}, + {"IpMreqSource", "ImrInterface alignment", unsafe.Alignof((*new(IpMreqSource)).ImrInterface), 4}, + {"IpMreqSource", "ImrSourceaddr offset", unsafe.Offsetof((*new(IpMreqSource)).ImrSourceaddr), 8}, + {"IpMreqSource", "ImrSourceaddr size", unsafe.Sizeof((*new(IpMreqSource)).ImrSourceaddr), 4}, + {"IpMreqSource", "ImrSourceaddr alignment", unsafe.Alignof((*new(IpMreqSource)).ImrSourceaddr), 4}, + {"Ipv6Mreq", "size", unsafe.Sizeof(*new(Ipv6Mreq)), 20}, + {"Ipv6Mreq", "alignment", unsafe.Alignof(*new(Ipv6Mreq)), 4}, + {"Ipv6Mreq", "Ipv6mrMultiaddr offset", unsafe.Offsetof((*new(Ipv6Mreq)).Ipv6mrMultiaddr), 0}, + {"Ipv6Mreq", "Ipv6mrMultiaddr size", unsafe.Sizeof((*new(Ipv6Mreq)).Ipv6mrMultiaddr), 16}, + {"Ipv6Mreq", "Ipv6mrMultiaddr alignment", unsafe.Alignof((*new(Ipv6Mreq)).Ipv6mrMultiaddr), 4}, + {"Ipv6Mreq", "Ipv6mrInterface offset", unsafe.Offsetof((*new(Ipv6Mreq)).Ipv6mrInterface), 16}, + {"Ipv6Mreq", "Ipv6mrInterface size", unsafe.Sizeof((*new(Ipv6Mreq)).Ipv6mrInterface), 4}, + {"Ipv6Mreq", "Ipv6mrInterface alignment", unsafe.Alignof((*new(Ipv6Mreq)).Ipv6mrInterface), 4}, + {"GroupReq", "size", unsafe.Sizeof(*new(GroupReq)), 136}, + {"GroupReq", "alignment", unsafe.Alignof(*new(GroupReq)), 8}, + {"GroupReq", "GrInterface offset", unsafe.Offsetof((*new(GroupReq)).GrInterface), 0}, + {"GroupReq", "GrInterface size", unsafe.Sizeof((*new(GroupReq)).GrInterface), 4}, + {"GroupReq", "GrInterface alignment", unsafe.Alignof((*new(GroupReq)).GrInterface), 4}, + {"GroupReq", "GrGroup offset", unsafe.Offsetof((*new(GroupReq)).GrGroup), 8}, + {"GroupReq", "GrGroup size", unsafe.Sizeof((*new(GroupReq)).GrGroup), 128}, + {"GroupReq", "GrGroup alignment", unsafe.Alignof((*new(GroupReq)).GrGroup), 8}, + {"GroupSourceReq", "size", unsafe.Sizeof(*new(GroupSourceReq)), 264}, + {"GroupSourceReq", "alignment", unsafe.Alignof(*new(GroupSourceReq)), 8}, + {"GroupSourceReq", "GsrInterface offset", unsafe.Offsetof((*new(GroupSourceReq)).GsrInterface), 0}, + {"GroupSourceReq", "GsrInterface size", unsafe.Sizeof((*new(GroupSourceReq)).GsrInterface), 4}, + {"GroupSourceReq", "GsrInterface alignment", unsafe.Alignof((*new(GroupSourceReq)).GsrInterface), 4}, + {"GroupSourceReq", "GsrGroup offset", unsafe.Offsetof((*new(GroupSourceReq)).GsrGroup), 8}, + {"GroupSourceReq", "GsrGroup size", unsafe.Sizeof((*new(GroupSourceReq)).GsrGroup), 128}, + {"GroupSourceReq", "GsrGroup alignment", unsafe.Alignof((*new(GroupSourceReq)).GsrGroup), 8}, + {"GroupSourceReq", "GsrSource offset", unsafe.Offsetof((*new(GroupSourceReq)).GsrSource), 136}, + {"GroupSourceReq", "GsrSource size", unsafe.Sizeof((*new(GroupSourceReq)).GsrSource), 128}, + {"GroupSourceReq", "GsrSource alignment", unsafe.Alignof((*new(GroupSourceReq)).GsrSource), 8}, + {"IpMsfilter", "size", unsafe.Sizeof(*new(IpMsfilter)), 20}, + {"IpMsfilter", "alignment", unsafe.Alignof(*new(IpMsfilter)), 4}, + {"IpMsfilter", "ImsfMultiaddr offset", unsafe.Offsetof((*new(IpMsfilter)).ImsfMultiaddr), 0}, + {"IpMsfilter", "ImsfMultiaddr size", unsafe.Sizeof((*new(IpMsfilter)).ImsfMultiaddr), 4}, + {"IpMsfilter", "ImsfMultiaddr alignment", unsafe.Alignof((*new(IpMsfilter)).ImsfMultiaddr), 4}, + {"IpMsfilter", "ImsfInterface offset", unsafe.Offsetof((*new(IpMsfilter)).ImsfInterface), 4}, + {"IpMsfilter", "ImsfInterface size", unsafe.Sizeof((*new(IpMsfilter)).ImsfInterface), 4}, + {"IpMsfilter", "ImsfInterface alignment", unsafe.Alignof((*new(IpMsfilter)).ImsfInterface), 4}, + {"IpMsfilter", "ImsfFmode offset", unsafe.Offsetof((*new(IpMsfilter)).ImsfFmode), 8}, + {"IpMsfilter", "ImsfFmode size", unsafe.Sizeof((*new(IpMsfilter)).ImsfFmode), 4}, + {"IpMsfilter", "ImsfFmode alignment", unsafe.Alignof((*new(IpMsfilter)).ImsfFmode), 4}, + {"IpMsfilter", "ImsfNumsrc offset", unsafe.Offsetof((*new(IpMsfilter)).ImsfNumsrc), 12}, + {"IpMsfilter", "ImsfNumsrc size", unsafe.Sizeof((*new(IpMsfilter)).ImsfNumsrc), 4}, + {"IpMsfilter", "ImsfNumsrc alignment", unsafe.Alignof((*new(IpMsfilter)).ImsfNumsrc), 4}, + {"IpMsfilter", "ImsfSlist offset", unsafe.Offsetof((*new(IpMsfilter)).ImsfSlist), 16}, + {"IpMsfilter", "ImsfSlist size", unsafe.Sizeof((*new(IpMsfilter)).ImsfSlist), 4}, + {"IpMsfilter", "ImsfSlist alignment", unsafe.Alignof((*new(IpMsfilter)).ImsfSlist), 4}, + {"GroupFilter", "size", unsafe.Sizeof(*new(GroupFilter)), 272}, + {"GroupFilter", "alignment", unsafe.Alignof(*new(GroupFilter)), 8}, + {"GroupFilter", "GfInterface offset", unsafe.Offsetof((*new(GroupFilter)).GfInterface), 0}, + {"GroupFilter", "GfInterface size", unsafe.Sizeof((*new(GroupFilter)).GfInterface), 4}, + {"GroupFilter", "GfInterface alignment", unsafe.Alignof((*new(GroupFilter)).GfInterface), 4}, + {"GroupFilter", "GfGroup offset", unsafe.Offsetof((*new(GroupFilter)).GfGroup), 8}, + {"GroupFilter", "GfGroup size", unsafe.Sizeof((*new(GroupFilter)).GfGroup), 128}, + {"GroupFilter", "GfGroup alignment", unsafe.Alignof((*new(GroupFilter)).GfGroup), 8}, + {"GroupFilter", "GfFmode offset", unsafe.Offsetof((*new(GroupFilter)).GfFmode), 136}, + {"GroupFilter", "GfFmode size", unsafe.Sizeof((*new(GroupFilter)).GfFmode), 4}, + {"GroupFilter", "GfFmode alignment", unsafe.Alignof((*new(GroupFilter)).GfFmode), 4}, + {"GroupFilter", "GfNumsrc offset", unsafe.Offsetof((*new(GroupFilter)).GfNumsrc), 140}, + {"GroupFilter", "GfNumsrc size", unsafe.Sizeof((*new(GroupFilter)).GfNumsrc), 4}, + {"GroupFilter", "GfNumsrc alignment", unsafe.Alignof((*new(GroupFilter)).GfNumsrc), 4}, + {"GroupFilter", "GfSlist offset", unsafe.Offsetof((*new(GroupFilter)).GfSlist), 144}, + {"GroupFilter", "GfSlist size", unsafe.Sizeof((*new(GroupFilter)).GfSlist), 128}, + {"GroupFilter", "GfSlist alignment", unsafe.Alignof((*new(GroupFilter)).GfSlist), 8}, + {"InAddrT", "size", unsafe.Sizeof(*new(InAddrT)), 4}, + {"InAddrT", "alignment", unsafe.Alignof(*new(InAddrT)), 4}, + {"InPortT", "size", unsafe.Sizeof(*new(InPortT)), 2}, + {"InPortT", "alignment", unsafe.Alignof(*new(InPortT)), 2}, + {"Rpcent", "size", unsafe.Sizeof(*new(Rpcent)), 24}, + {"Rpcent", "alignment", unsafe.Alignof(*new(Rpcent)), 8}, + {"Rpcent", "RName offset", unsafe.Offsetof((*new(Rpcent)).RName), 0}, + {"Rpcent", "RName size", unsafe.Sizeof((*new(Rpcent)).RName), 8}, + {"Rpcent", "RName alignment", unsafe.Alignof((*new(Rpcent)).RName), 8}, + {"Rpcent", "RAliases offset", unsafe.Offsetof((*new(Rpcent)).RAliases), 8}, + {"Rpcent", "RAliases size", unsafe.Sizeof((*new(Rpcent)).RAliases), 8}, + {"Rpcent", "RAliases alignment", unsafe.Alignof((*new(Rpcent)).RAliases), 8}, + {"Rpcent", "RNumber offset", unsafe.Offsetof((*new(Rpcent)).RNumber), 16}, + {"Rpcent", "RNumber size", unsafe.Sizeof((*new(Rpcent)).RNumber), 4}, + {"Rpcent", "RNumber alignment", unsafe.Alignof((*new(Rpcent)).RNumber), 4}, + {"Uint16T", "size", unsafe.Sizeof(*new(Uint16T)), 2}, + {"Uint16T", "alignment", unsafe.Alignof(*new(Uint16T)), 2}, + {"Uint32T", "size", unsafe.Sizeof(*new(Uint32T)), 4}, + {"Uint32T", "alignment", unsafe.Alignof(*new(Uint32T)), 4}, + {"Osockaddr", "size", unsafe.Sizeof(*new(Osockaddr)), 16}, + {"Osockaddr", "alignment", unsafe.Alignof(*new(Osockaddr)), 2}, + {"Osockaddr", "SaFamily offset", unsafe.Offsetof((*new(Osockaddr)).SaFamily), 0}, + {"Osockaddr", "SaFamily size", unsafe.Sizeof((*new(Osockaddr)).SaFamily), 2}, + {"Osockaddr", "SaFamily alignment", unsafe.Alignof((*new(Osockaddr)).SaFamily), 2}, + {"Osockaddr", "SaData offset", unsafe.Offsetof((*new(Osockaddr)).SaData), 2}, + {"Osockaddr", "SaData size", unsafe.Sizeof((*new(Osockaddr)).SaData), 14}, + {"Osockaddr", "SaData alignment", unsafe.Alignof((*new(Osockaddr)).SaData), 1}, + {"SsizeT", "size", unsafe.Sizeof(*new(SsizeT)), 8}, + {"SsizeT", "alignment", unsafe.Alignof(*new(SsizeT)), 8}, + {"SockaddrUn", "size", unsafe.Sizeof(*new(SockaddrUn)), 110}, + {"SockaddrUn", "alignment", unsafe.Alignof(*new(SockaddrUn)), 2}, + {"SockaddrUn", "SunFamily offset", unsafe.Offsetof((*new(SockaddrUn)).SunFamily), 0}, + {"SockaddrUn", "SunFamily size", unsafe.Sizeof((*new(SockaddrUn)).SunFamily), 2}, + {"SockaddrUn", "SunFamily alignment", unsafe.Alignof((*new(SockaddrUn)).SunFamily), 2}, + {"SockaddrUn", "SunPath offset", unsafe.Offsetof((*new(SockaddrUn)).SunPath), 2}, + {"SockaddrUn", "SunPath size", unsafe.Sizeof((*new(SockaddrUn)).SunPath), 108}, + {"SockaddrUn", "SunPath alignment", unsafe.Alignof((*new(SockaddrUn)).SunPath), 1}, + {"In6addrAny", "global size", unsafe.Sizeof(In6addrAny), 16}, + {"In6addrAny", "global alignment", unsafe.Alignof(In6addrAny), 4}, + {"In6addrLoopback", "global size", unsafe.Sizeof(In6addrLoopback), 16}, + {"In6addrLoopback", "global alignment", unsafe.Alignof(In6addrLoopback), 4}, + } + var networkIntegerConstants = []struct { + name string + got, want int64 + }{ + {"X_ARPA_INET_H", int64(X_ARPA_INET_H), 1}, + {"SOL_SOCKET", int64(SOL_SOCKET), 1}, + {"SO_DEBUG", int64(SO_DEBUG), 1}, + {"SO_REUSEADDR", int64(SO_REUSEADDR), 2}, + {"SO_TYPE", int64(SO_TYPE), 3}, + {"SO_ERROR", int64(SO_ERROR), 4}, + {"SO_DONTROUTE", int64(SO_DONTROUTE), 5}, + {"SO_BROADCAST", int64(SO_BROADCAST), 6}, + {"SO_SNDBUF", int64(SO_SNDBUF), 7}, + {"SO_RCVBUF", int64(SO_RCVBUF), 8}, + {"SO_SNDBUFFORCE", int64(SO_SNDBUFFORCE), 32}, + {"SO_RCVBUFFORCE", int64(SO_RCVBUFFORCE), 33}, + {"SO_KEEPALIVE", int64(SO_KEEPALIVE), 9}, + {"SO_OOBINLINE", int64(SO_OOBINLINE), 10}, + {"SO_NO_CHECK", int64(SO_NO_CHECK), 11}, + {"SO_PRIORITY", int64(SO_PRIORITY), 12}, + {"SO_LINGER", int64(SO_LINGER), 13}, + {"SO_BSDCOMPAT", int64(SO_BSDCOMPAT), 14}, + {"SO_REUSEPORT", int64(SO_REUSEPORT), 15}, + {"SO_PASSCRED", int64(SO_PASSCRED), 16}, + {"SO_PEERCRED", int64(SO_PEERCRED), 17}, + {"SO_RCVLOWAT", int64(SO_RCVLOWAT), 18}, + {"SO_SNDLOWAT", int64(SO_SNDLOWAT), 19}, + {"SO_RCVTIMEO", int64(SO_RCVTIMEO), 20}, + {"SO_SNDTIMEO", int64(SO_SNDTIMEO), 21}, + {"SO_SECURITY_AUTHENTICATION", int64(SO_SECURITY_AUTHENTICATION), 22}, + {"SO_SECURITY_ENCRYPTION_TRANSPORT", int64(SO_SECURITY_ENCRYPTION_TRANSPORT), 23}, + {"SO_SECURITY_ENCRYPTION_NETWORK", int64(SO_SECURITY_ENCRYPTION_NETWORK), 24}, + {"SO_BINDTODEVICE", int64(SO_BINDTODEVICE), 25}, + {"SO_ATTACH_FILTER", int64(SO_ATTACH_FILTER), 26}, + {"SO_DETACH_FILTER", int64(SO_DETACH_FILTER), 27}, + {"SO_GET_FILTER", int64(SO_GET_FILTER), 26}, + {"SO_PEERNAME", int64(SO_PEERNAME), 28}, + {"SO_TIMESTAMP", int64(SO_TIMESTAMP), 29}, + {"SCM_TIMESTAMP", int64(SCM_TIMESTAMP), 29}, + {"SO_ACCEPTCONN", int64(SO_ACCEPTCONN), 30}, + {"SO_PEERSEC", int64(SO_PEERSEC), 31}, + {"SO_PASSSEC", int64(SO_PASSSEC), 34}, + {"SO_TIMESTAMPNS", int64(SO_TIMESTAMPNS), 35}, + {"SCM_TIMESTAMPNS", int64(SCM_TIMESTAMPNS), 35}, + {"SO_MARK", int64(SO_MARK), 36}, + {"SO_TIMESTAMPING", int64(SO_TIMESTAMPING), 37}, + {"SCM_TIMESTAMPING", int64(SCM_TIMESTAMPING), 37}, + {"SO_PROTOCOL", int64(SO_PROTOCOL), 38}, + {"SO_DOMAIN", int64(SO_DOMAIN), 39}, + {"SO_RXQ_OVFL", int64(SO_RXQ_OVFL), 40}, + {"SO_WIFI_STATUS", int64(SO_WIFI_STATUS), 41}, + {"SCM_WIFI_STATUS", int64(SCM_WIFI_STATUS), 41}, + {"SO_PEEK_OFF", int64(SO_PEEK_OFF), 42}, + {"SO_NOFCS", int64(SO_NOFCS), 43}, + {"SO_LOCK_FILTER", int64(SO_LOCK_FILTER), 44}, + {"SO_SELECT_ERR_QUEUE", int64(SO_SELECT_ERR_QUEUE), 45}, + {"FIOSETOWN", int64(FIOSETOWN), 35073}, + {"SIOCSPGRP", int64(SIOCSPGRP), 35074}, + {"FIOGETOWN", int64(FIOGETOWN), 35075}, + {"SIOCGPGRP", int64(SIOCGPGRP), 35076}, + {"SIOCATMARK", int64(SIOCATMARK), 35077}, + {"SIOCGSTAMP", int64(SIOCGSTAMP), 35078}, + {"SIOCGSTAMPNS", int64(SIOCGSTAMPNS), 35079}, + {"X__USE_KERNEL_IPV6_DEFS", int64(X__USE_KERNEL_IPV6_DEFS), 0}, + {"IP_OPTIONS", int64(IP_OPTIONS), 4}, + {"IP_HDRINCL", int64(IP_HDRINCL), 3}, + {"IP_TOS", int64(IP_TOS), 1}, + {"IP_TTL", int64(IP_TTL), 2}, + {"IP_RECVOPTS", int64(IP_RECVOPTS), 6}, + {"IP_RETOPTS", int64(IP_RETOPTS), 7}, + {"IP_MULTICAST_IF", int64(IP_MULTICAST_IF), 32}, + {"IP_MULTICAST_TTL", int64(IP_MULTICAST_TTL), 33}, + {"IP_MULTICAST_LOOP", int64(IP_MULTICAST_LOOP), 34}, + {"IP_ADD_MEMBERSHIP", int64(IP_ADD_MEMBERSHIP), 35}, + {"IP_DROP_MEMBERSHIP", int64(IP_DROP_MEMBERSHIP), 36}, + {"IP_UNBLOCK_SOURCE", int64(IP_UNBLOCK_SOURCE), 37}, + {"IP_BLOCK_SOURCE", int64(IP_BLOCK_SOURCE), 38}, + {"IP_ADD_SOURCE_MEMBERSHIP", int64(IP_ADD_SOURCE_MEMBERSHIP), 39}, + {"IP_DROP_SOURCE_MEMBERSHIP", int64(IP_DROP_SOURCE_MEMBERSHIP), 40}, + {"IP_MSFILTER", int64(IP_MSFILTER), 41}, + {"MCAST_JOIN_GROUP", int64(MCAST_JOIN_GROUP), 42}, + {"MCAST_BLOCK_SOURCE", int64(MCAST_BLOCK_SOURCE), 43}, + {"MCAST_UNBLOCK_SOURCE", int64(MCAST_UNBLOCK_SOURCE), 44}, + {"MCAST_LEAVE_GROUP", int64(MCAST_LEAVE_GROUP), 45}, + {"MCAST_JOIN_SOURCE_GROUP", int64(MCAST_JOIN_SOURCE_GROUP), 46}, + {"MCAST_LEAVE_SOURCE_GROUP", int64(MCAST_LEAVE_SOURCE_GROUP), 47}, + {"MCAST_MSFILTER", int64(MCAST_MSFILTER), 48}, + {"IP_MULTICAST_ALL", int64(IP_MULTICAST_ALL), 49}, + {"IP_UNICAST_IF", int64(IP_UNICAST_IF), 50}, + {"MCAST_EXCLUDE", int64(MCAST_EXCLUDE), 0}, + {"MCAST_INCLUDE", int64(MCAST_INCLUDE), 1}, + {"IP_ROUTER_ALERT", int64(IP_ROUTER_ALERT), 5}, + {"IP_PKTINFO", int64(IP_PKTINFO), 8}, + {"IP_PKTOPTIONS", int64(IP_PKTOPTIONS), 9}, + {"IP_PMTUDISC", int64(IP_PMTUDISC), 10}, + {"IP_MTU_DISCOVER", int64(IP_MTU_DISCOVER), 10}, + {"IP_RECVERR", int64(IP_RECVERR), 11}, + {"IP_RECVTTL", int64(IP_RECVTTL), 12}, + {"IP_RECVTOS", int64(IP_RECVTOS), 13}, + {"IP_MTU", int64(IP_MTU), 14}, + {"IP_FREEBIND", int64(IP_FREEBIND), 15}, + {"IP_IPSEC_POLICY", int64(IP_IPSEC_POLICY), 16}, + {"IP_XFRM_POLICY", int64(IP_XFRM_POLICY), 17}, + {"IP_PASSSEC", int64(IP_PASSSEC), 18}, + {"IP_TRANSPARENT", int64(IP_TRANSPARENT), 19}, + {"IP_ORIGDSTADDR", int64(IP_ORIGDSTADDR), 20}, + {"IP_RECVORIGDSTADDR", int64(IP_RECVORIGDSTADDR), 20}, + {"IP_MINTTL", int64(IP_MINTTL), 21}, + {"IP_NODEFRAG", int64(IP_NODEFRAG), 22}, + {"IP_CHECKSUM", int64(IP_CHECKSUM), 23}, + {"IP_BIND_ADDRESS_NO_PORT", int64(IP_BIND_ADDRESS_NO_PORT), 24}, + {"IP_PMTUDISC_DONT", int64(IP_PMTUDISC_DONT), 0}, + {"IP_PMTUDISC_WANT", int64(IP_PMTUDISC_WANT), 1}, + {"IP_PMTUDISC_DO", int64(IP_PMTUDISC_DO), 2}, + {"IP_PMTUDISC_PROBE", int64(IP_PMTUDISC_PROBE), 3}, + {"IP_PMTUDISC_INTERFACE", int64(IP_PMTUDISC_INTERFACE), 4}, + {"IP_PMTUDISC_OMIT", int64(IP_PMTUDISC_OMIT), 5}, + {"SOL_IP", int64(SOL_IP), 0}, + {"IP_DEFAULT_MULTICAST_TTL", int64(IP_DEFAULT_MULTICAST_TTL), 1}, + {"IP_DEFAULT_MULTICAST_LOOP", int64(IP_DEFAULT_MULTICAST_LOOP), 1}, + {"IP_MAX_MEMBERSHIPS", int64(IP_MAX_MEMBERSHIPS), 20}, + {"IPV6_ADDRFORM", int64(IPV6_ADDRFORM), 1}, + {"IPV6_2292PKTINFO", int64(IPV6_2292PKTINFO), 2}, + {"IPV6_2292HOPOPTS", int64(IPV6_2292HOPOPTS), 3}, + {"IPV6_2292DSTOPTS", int64(IPV6_2292DSTOPTS), 4}, + {"IPV6_2292RTHDR", int64(IPV6_2292RTHDR), 5}, + {"IPV6_2292PKTOPTIONS", int64(IPV6_2292PKTOPTIONS), 6}, + {"IPV6_CHECKSUM", int64(IPV6_CHECKSUM), 7}, + {"IPV6_2292HOPLIMIT", int64(IPV6_2292HOPLIMIT), 8}, + {"IPV6_NEXTHOP", int64(IPV6_NEXTHOP), 9}, + {"IPV6_AUTHHDR", int64(IPV6_AUTHHDR), 10}, + {"IPV6_UNICAST_HOPS", int64(IPV6_UNICAST_HOPS), 16}, + {"IPV6_MULTICAST_IF", int64(IPV6_MULTICAST_IF), 17}, + {"IPV6_MULTICAST_HOPS", int64(IPV6_MULTICAST_HOPS), 18}, + {"IPV6_MULTICAST_LOOP", int64(IPV6_MULTICAST_LOOP), 19}, + {"IPV6_JOIN_GROUP", int64(IPV6_JOIN_GROUP), 20}, + {"IPV6_LEAVE_GROUP", int64(IPV6_LEAVE_GROUP), 21}, + {"IPV6_ROUTER_ALERT", int64(IPV6_ROUTER_ALERT), 22}, + {"IPV6_MTU_DISCOVER", int64(IPV6_MTU_DISCOVER), 23}, + {"IPV6_MTU", int64(IPV6_MTU), 24}, + {"IPV6_RECVERR", int64(IPV6_RECVERR), 25}, + {"IPV6_V6ONLY", int64(IPV6_V6ONLY), 26}, + {"IPV6_JOIN_ANYCAST", int64(IPV6_JOIN_ANYCAST), 27}, + {"IPV6_LEAVE_ANYCAST", int64(IPV6_LEAVE_ANYCAST), 28}, + {"IPV6_IPSEC_POLICY", int64(IPV6_IPSEC_POLICY), 34}, + {"IPV6_XFRM_POLICY", int64(IPV6_XFRM_POLICY), 35}, + {"IPV6_HDRINCL", int64(IPV6_HDRINCL), 36}, + {"IPV6_RECVPKTINFO", int64(IPV6_RECVPKTINFO), 49}, + {"IPV6_PKTINFO", int64(IPV6_PKTINFO), 50}, + {"IPV6_RECVHOPLIMIT", int64(IPV6_RECVHOPLIMIT), 51}, + {"IPV6_HOPLIMIT", int64(IPV6_HOPLIMIT), 52}, + {"IPV6_RECVHOPOPTS", int64(IPV6_RECVHOPOPTS), 53}, + {"IPV6_HOPOPTS", int64(IPV6_HOPOPTS), 54}, + {"IPV6_RTHDRDSTOPTS", int64(IPV6_RTHDRDSTOPTS), 55}, + {"IPV6_RECVRTHDR", int64(IPV6_RECVRTHDR), 56}, + {"IPV6_RTHDR", int64(IPV6_RTHDR), 57}, + {"IPV6_RECVDSTOPTS", int64(IPV6_RECVDSTOPTS), 58}, + {"IPV6_DSTOPTS", int64(IPV6_DSTOPTS), 59}, + {"IPV6_RECVPATHMTU", int64(IPV6_RECVPATHMTU), 60}, + {"IPV6_PATHMTU", int64(IPV6_PATHMTU), 61}, + {"IPV6_DONTFRAG", int64(IPV6_DONTFRAG), 62}, + {"IPV6_RECVTCLASS", int64(IPV6_RECVTCLASS), 66}, + {"IPV6_TCLASS", int64(IPV6_TCLASS), 67}, + {"IPV6_ADD_MEMBERSHIP", int64(IPV6_ADD_MEMBERSHIP), 20}, + {"IPV6_DROP_MEMBERSHIP", int64(IPV6_DROP_MEMBERSHIP), 21}, + {"IPV6_RXHOPOPTS", int64(IPV6_RXHOPOPTS), 54}, + {"IPV6_RXDSTOPTS", int64(IPV6_RXDSTOPTS), 59}, + {"IPV6_PMTUDISC_DONT", int64(IPV6_PMTUDISC_DONT), 0}, + {"IPV6_PMTUDISC_WANT", int64(IPV6_PMTUDISC_WANT), 1}, + {"IPV6_PMTUDISC_DO", int64(IPV6_PMTUDISC_DO), 2}, + {"IPV6_PMTUDISC_PROBE", int64(IPV6_PMTUDISC_PROBE), 3}, + {"IPV6_PMTUDISC_INTERFACE", int64(IPV6_PMTUDISC_INTERFACE), 4}, + {"IPV6_PMTUDISC_OMIT", int64(IPV6_PMTUDISC_OMIT), 5}, + {"SOL_IPV6", int64(SOL_IPV6), 41}, + {"SOL_ICMPV6", int64(SOL_ICMPV6), 58}, + {"IPV6_RTHDR_LOOSE", int64(IPV6_RTHDR_LOOSE), 0}, + {"IPV6_RTHDR_STRICT", int64(IPV6_RTHDR_STRICT), 1}, + {"IPV6_RTHDR_TYPE_0", int64(IPV6_RTHDR_TYPE_0), 0}, + {"X_BITS_SOCKADDR_H", int64(X_BITS_SOCKADDR_H), 1}, + {"X_SS_SIZE", int64(X_SS_SIZE), 128}, + {"PF_UNSPEC", int64(PF_UNSPEC), 0}, + {"PF_LOCAL", int64(PF_LOCAL), 1}, + {"PF_UNIX", int64(PF_UNIX), 1}, + {"PF_FILE", int64(PF_FILE), 1}, + {"PF_INET", int64(PF_INET), 2}, + {"PF_AX25", int64(PF_AX25), 3}, + {"PF_IPX", int64(PF_IPX), 4}, + {"PF_APPLETALK", int64(PF_APPLETALK), 5}, + {"PF_NETROM", int64(PF_NETROM), 6}, + {"PF_BRIDGE", int64(PF_BRIDGE), 7}, + {"PF_ATMPVC", int64(PF_ATMPVC), 8}, + {"PF_X25", int64(PF_X25), 9}, + {"PF_INET6", int64(PF_INET6), 10}, + {"PF_ROSE", int64(PF_ROSE), 11}, + {"PF_DECnet", int64(PF_DECnet), 12}, + {"PF_NETBEUI", int64(PF_NETBEUI), 13}, + {"PF_SECURITY", int64(PF_SECURITY), 14}, + {"PF_KEY", int64(PF_KEY), 15}, + {"PF_NETLINK", int64(PF_NETLINK), 16}, + {"PF_ROUTE", int64(PF_ROUTE), 16}, + {"PF_PACKET", int64(PF_PACKET), 17}, + {"PF_ASH", int64(PF_ASH), 18}, + {"PF_ECONET", int64(PF_ECONET), 19}, + {"PF_ATMSVC", int64(PF_ATMSVC), 20}, + {"PF_RDS", int64(PF_RDS), 21}, + {"PF_SNA", int64(PF_SNA), 22}, + {"PF_IRDA", int64(PF_IRDA), 23}, + {"PF_PPPOX", int64(PF_PPPOX), 24}, + {"PF_WANPIPE", int64(PF_WANPIPE), 25}, + {"PF_LLC", int64(PF_LLC), 26}, + {"PF_IB", int64(PF_IB), 27}, + {"PF_MPLS", int64(PF_MPLS), 28}, + {"PF_CAN", int64(PF_CAN), 29}, + {"PF_TIPC", int64(PF_TIPC), 30}, + {"PF_BLUETOOTH", int64(PF_BLUETOOTH), 31}, + {"PF_IUCV", int64(PF_IUCV), 32}, + {"PF_RXRPC", int64(PF_RXRPC), 33}, + {"PF_ISDN", int64(PF_ISDN), 34}, + {"PF_PHONET", int64(PF_PHONET), 35}, + {"PF_IEEE802154", int64(PF_IEEE802154), 36}, + {"PF_CAIF", int64(PF_CAIF), 37}, + {"PF_ALG", int64(PF_ALG), 38}, + {"PF_NFC", int64(PF_NFC), 39}, + {"PF_VSOCK", int64(PF_VSOCK), 40}, + {"PF_KCM", int64(PF_KCM), 41}, + {"PF_MAX", int64(PF_MAX), 42}, + {"AF_UNSPEC", int64(AF_UNSPEC), 0}, + {"AF_LOCAL", int64(AF_LOCAL), 1}, + {"AF_UNIX", int64(AF_UNIX), 1}, + {"AF_FILE", int64(AF_FILE), 1}, + {"AF_INET", int64(AF_INET), 2}, + {"AF_AX25", int64(AF_AX25), 3}, + {"AF_IPX", int64(AF_IPX), 4}, + {"AF_APPLETALK", int64(AF_APPLETALK), 5}, + {"AF_NETROM", int64(AF_NETROM), 6}, + {"AF_BRIDGE", int64(AF_BRIDGE), 7}, + {"AF_ATMPVC", int64(AF_ATMPVC), 8}, + {"AF_X25", int64(AF_X25), 9}, + {"AF_INET6", int64(AF_INET6), 10}, + {"AF_ROSE", int64(AF_ROSE), 11}, + {"AF_DECnet", int64(AF_DECnet), 12}, + {"AF_NETBEUI", int64(AF_NETBEUI), 13}, + {"AF_SECURITY", int64(AF_SECURITY), 14}, + {"AF_KEY", int64(AF_KEY), 15}, + {"AF_NETLINK", int64(AF_NETLINK), 16}, + {"AF_ROUTE", int64(AF_ROUTE), 16}, + {"AF_PACKET", int64(AF_PACKET), 17}, + {"AF_ASH", int64(AF_ASH), 18}, + {"AF_ECONET", int64(AF_ECONET), 19}, + {"AF_ATMSVC", int64(AF_ATMSVC), 20}, + {"AF_RDS", int64(AF_RDS), 21}, + {"AF_SNA", int64(AF_SNA), 22}, + {"AF_IRDA", int64(AF_IRDA), 23}, + {"AF_PPPOX", int64(AF_PPPOX), 24}, + {"AF_WANPIPE", int64(AF_WANPIPE), 25}, + {"AF_LLC", int64(AF_LLC), 26}, + {"AF_IB", int64(AF_IB), 27}, + {"AF_MPLS", int64(AF_MPLS), 28}, + {"AF_CAN", int64(AF_CAN), 29}, + {"AF_TIPC", int64(AF_TIPC), 30}, + {"AF_BLUETOOTH", int64(AF_BLUETOOTH), 31}, + {"AF_IUCV", int64(AF_IUCV), 32}, + {"AF_RXRPC", int64(AF_RXRPC), 33}, + {"AF_ISDN", int64(AF_ISDN), 34}, + {"AF_PHONET", int64(AF_PHONET), 35}, + {"AF_IEEE802154", int64(AF_IEEE802154), 36}, + {"AF_CAIF", int64(AF_CAIF), 37}, + {"AF_ALG", int64(AF_ALG), 38}, + {"AF_NFC", int64(AF_NFC), 39}, + {"AF_VSOCK", int64(AF_VSOCK), 40}, + {"AF_KCM", int64(AF_KCM), 41}, + {"AF_MAX", int64(AF_MAX), 42}, + {"SOL_RAW", int64(SOL_RAW), 255}, + {"SOL_DECNET", int64(SOL_DECNET), 261}, + {"SOL_X25", int64(SOL_X25), 262}, + {"SOL_PACKET", int64(SOL_PACKET), 263}, + {"SOL_ATM", int64(SOL_ATM), 264}, + {"SOL_AAL", int64(SOL_AAL), 265}, + {"SOL_IRDA", int64(SOL_IRDA), 266}, + {"SOL_NETBEUI", int64(SOL_NETBEUI), 267}, + {"SOL_LLC", int64(SOL_LLC), 268}, + {"SOL_DCCP", int64(SOL_DCCP), 269}, + {"SOL_NETLINK", int64(SOL_NETLINK), 270}, + {"SOL_TIPC", int64(SOL_TIPC), 271}, + {"SOL_RXRPC", int64(SOL_RXRPC), 272}, + {"SOL_PPPOL2TP", int64(SOL_PPPOL2TP), 273}, + {"SOL_BLUETOOTH", int64(SOL_BLUETOOTH), 274}, + {"SOL_PNPIPE", int64(SOL_PNPIPE), 275}, + {"SOL_RDS", int64(SOL_RDS), 276}, + {"SOL_IUCV", int64(SOL_IUCV), 277}, + {"SOL_CAIF", int64(SOL_CAIF), 278}, + {"SOL_ALG", int64(SOL_ALG), 279}, + {"SOL_NFC", int64(SOL_NFC), 280}, + {"SOL_KCM", int64(SOL_KCM), 281}, + {"SOMAXCONN", int64(SOMAXCONN), 128}, + {"MSG_OOB", int64(MSG_OOB), 1}, + {"MSG_PEEK", int64(MSG_PEEK), 2}, + {"MSG_DONTROUTE", int64(MSG_DONTROUTE), 4}, + {"MSG_CTRUNC", int64(MSG_CTRUNC), 8}, + {"MSG_PROXY", int64(MSG_PROXY), 16}, + {"MSG_TRUNC", int64(MSG_TRUNC), 32}, + {"MSG_DONTWAIT", int64(MSG_DONTWAIT), 64}, + {"MSG_EOR", int64(MSG_EOR), 128}, + {"MSG_WAITALL", int64(MSG_WAITALL), 256}, + {"MSG_FIN", int64(MSG_FIN), 512}, + {"MSG_SYN", int64(MSG_SYN), 1024}, + {"MSG_CONFIRM", int64(MSG_CONFIRM), 2048}, + {"MSG_RST", int64(MSG_RST), 4096}, + {"MSG_ERRQUEUE", int64(MSG_ERRQUEUE), 8192}, + {"MSG_NOSIGNAL", int64(MSG_NOSIGNAL), 16384}, + {"MSG_MORE", int64(MSG_MORE), 32768}, + {"MSG_WAITFORONE", int64(MSG_WAITFORONE), 65536}, + {"MSG_BATCH", int64(MSG_BATCH), 262144}, + {"MSG_FASTOPEN", int64(MSG_FASTOPEN), 536870912}, + {"MSG_CMSG_CLOEXEC", int64(MSG_CMSG_CLOEXEC), 1073741824}, + {"SCM_RIGHTS", int64(SCM_RIGHTS), 1}, + {"SOCK_DCCP", int64(SOCK_DCCP), 6}, + {"SOCK_PACKET", int64(SOCK_PACKET), 10}, + {"SOCK_CLOEXEC", int64(SOCK_CLOEXEC), 524288}, + {"SOCK_NONBLOCK", int64(SOCK_NONBLOCK), 2048}, + {"X_NET_IF_H", int64(X_NET_IF_H), 1}, + {"IF_NAMESIZE", int64(IF_NAMESIZE), 16}, + {"IFHWADDRLEN", int64(IFHWADDRLEN), 6}, + {"IFNAMSIZ", int64(IFNAMSIZ), 16}, + {"IFF_UP", int64(IFF_UP), 1}, + {"IFF_BROADCAST", int64(IFF_BROADCAST), 2}, + {"IFF_DEBUG", int64(IFF_DEBUG), 4}, + {"IFF_LOOPBACK", int64(IFF_LOOPBACK), 8}, + {"IFF_POINTOPOINT", int64(IFF_POINTOPOINT), 16}, + {"IFF_NOTRAILERS", int64(IFF_NOTRAILERS), 32}, + {"IFF_RUNNING", int64(IFF_RUNNING), 64}, + {"IFF_NOARP", int64(IFF_NOARP), 128}, + {"IFF_PROMISC", int64(IFF_PROMISC), 256}, + {"IFF_ALLMULTI", int64(IFF_ALLMULTI), 512}, + {"IFF_MASTER", int64(IFF_MASTER), 1024}, + {"IFF_SLAVE", int64(IFF_SLAVE), 2048}, + {"IFF_MULTICAST", int64(IFF_MULTICAST), 4096}, + {"IFF_PORTSEL", int64(IFF_PORTSEL), 8192}, + {"IFF_AUTOMEDIA", int64(IFF_AUTOMEDIA), 16384}, + {"IFF_DYNAMIC", int64(IFF_DYNAMIC), 32768}, + {"X_NETDB_H", int64(X_NETDB_H), 1}, + {"HOST_NOT_FOUND", int64(HOST_NOT_FOUND), 1}, + {"TRY_AGAIN", int64(TRY_AGAIN), 2}, + {"NO_RECOVERY", int64(NO_RECOVERY), 3}, + {"NO_DATA", int64(NO_DATA), 4}, + {"NETDB_INTERNAL", int64(NETDB_INTERNAL), -1}, + {"NETDB_SUCCESS", int64(NETDB_SUCCESS), 0}, + {"NO_ADDRESS", int64(NO_ADDRESS), 4}, + {"AI_PASSIVE", int64(AI_PASSIVE), 1}, + {"AI_CANONNAME", int64(AI_CANONNAME), 2}, + {"AI_NUMERICHOST", int64(AI_NUMERICHOST), 4}, + {"AI_V4MAPPED", int64(AI_V4MAPPED), 8}, + {"AI_ALL", int64(AI_ALL), 16}, + {"AI_ADDRCONFIG", int64(AI_ADDRCONFIG), 32}, + {"AI_NUMERICSERV", int64(AI_NUMERICSERV), 1024}, + {"EAI_BADFLAGS", int64(EAI_BADFLAGS), -1}, + {"EAI_NONAME", int64(EAI_NONAME), -2}, + {"EAI_AGAIN", int64(EAI_AGAIN), -3}, + {"EAI_FAIL", int64(EAI_FAIL), -4}, + {"EAI_FAMILY", int64(EAI_FAMILY), -6}, + {"EAI_SOCKTYPE", int64(EAI_SOCKTYPE), -7}, + {"EAI_SERVICE", int64(EAI_SERVICE), -8}, + {"EAI_MEMORY", int64(EAI_MEMORY), -10}, + {"EAI_SYSTEM", int64(EAI_SYSTEM), -11}, + {"EAI_OVERFLOW", int64(EAI_OVERFLOW), -12}, + {"NI_MAXHOST", int64(NI_MAXHOST), 1025}, + {"NI_MAXSERV", int64(NI_MAXSERV), 32}, + {"NI_NUMERICHOST", int64(NI_NUMERICHOST), 1}, + {"NI_NUMERICSERV", int64(NI_NUMERICSERV), 2}, + {"NI_NOFQDN", int64(NI_NOFQDN), 4}, + {"NI_NAMEREQD", int64(NI_NAMEREQD), 8}, + {"NI_DGRAM", int64(NI_DGRAM), 16}, + {"X_NETINET_IN_H", int64(X_NETINET_IN_H), 1}, + {"IN_CLASSA_NET", int64(IN_CLASSA_NET), 4278190080}, + {"IN_CLASSA_NSHIFT", int64(IN_CLASSA_NSHIFT), 24}, + {"IN_CLASSA_HOST", int64(IN_CLASSA_HOST), 16777215}, + {"IN_CLASSA_MAX", int64(IN_CLASSA_MAX), 128}, + {"IN_CLASSB_NET", int64(IN_CLASSB_NET), 4294901760}, + {"IN_CLASSB_NSHIFT", int64(IN_CLASSB_NSHIFT), 16}, + {"IN_CLASSB_HOST", int64(IN_CLASSB_HOST), 65535}, + {"IN_CLASSB_MAX", int64(IN_CLASSB_MAX), 65536}, + {"IN_CLASSC_NET", int64(IN_CLASSC_NET), 4294967040}, + {"IN_CLASSC_NSHIFT", int64(IN_CLASSC_NSHIFT), 8}, + {"IN_CLASSC_HOST", int64(IN_CLASSC_HOST), 255}, + {"IN_LOOPBACKNET", int64(IN_LOOPBACKNET), 127}, + {"INET_ADDRSTRLEN", int64(INET_ADDRSTRLEN), 16}, + {"INET6_ADDRSTRLEN", int64(INET6_ADDRSTRLEN), 46}, + {"IPPROTO_IP", int64(IPPROTO_IP), 0}, + {"IPPROTO_ICMP", int64(IPPROTO_ICMP), 1}, + {"IPPROTO_IGMP", int64(IPPROTO_IGMP), 2}, + {"IPPROTO_IPIP", int64(IPPROTO_IPIP), 4}, + {"IPPROTO_TCP", int64(IPPROTO_TCP), 6}, + {"IPPROTO_EGP", int64(IPPROTO_EGP), 8}, + {"IPPROTO_PUP", int64(IPPROTO_PUP), 12}, + {"IPPROTO_UDP", int64(IPPROTO_UDP), 17}, + {"IPPROTO_IDP", int64(IPPROTO_IDP), 22}, + {"IPPROTO_TP", int64(IPPROTO_TP), 29}, + {"IPPROTO_DCCP", int64(IPPROTO_DCCP), 33}, + {"IPPROTO_IPV6", int64(IPPROTO_IPV6), 41}, + {"IPPROTO_RSVP", int64(IPPROTO_RSVP), 46}, + {"IPPROTO_GRE", int64(IPPROTO_GRE), 47}, + {"IPPROTO_ESP", int64(IPPROTO_ESP), 50}, + {"IPPROTO_AH", int64(IPPROTO_AH), 51}, + {"IPPROTO_MTP", int64(IPPROTO_MTP), 92}, + {"IPPROTO_BEETPH", int64(IPPROTO_BEETPH), 94}, + {"IPPROTO_ENCAP", int64(IPPROTO_ENCAP), 98}, + {"IPPROTO_PIM", int64(IPPROTO_PIM), 103}, + {"IPPROTO_COMP", int64(IPPROTO_COMP), 108}, + {"IPPROTO_SCTP", int64(IPPROTO_SCTP), 132}, + {"IPPROTO_UDPLITE", int64(IPPROTO_UDPLITE), 136}, + {"IPPROTO_MPLS", int64(IPPROTO_MPLS), 137}, + {"IPPROTO_RAW", int64(IPPROTO_RAW), 255}, + {"IPPROTO_MAX", int64(IPPROTO_MAX), 256}, + {"IPPROTO_HOPOPTS", int64(IPPROTO_HOPOPTS), 0}, + {"IPPROTO_ROUTING", int64(IPPROTO_ROUTING), 43}, + {"IPPROTO_FRAGMENT", int64(IPPROTO_FRAGMENT), 44}, + {"IPPROTO_ICMPV6", int64(IPPROTO_ICMPV6), 58}, + {"IPPROTO_NONE", int64(IPPROTO_NONE), 59}, + {"IPPROTO_DSTOPTS", int64(IPPROTO_DSTOPTS), 60}, + {"IPPROTO_MH", int64(IPPROTO_MH), 135}, + {"IPPORT_ECHO", int64(IPPORT_ECHO), 7}, + {"IPPORT_DISCARD", int64(IPPORT_DISCARD), 9}, + {"IPPORT_SYSTAT", int64(IPPORT_SYSTAT), 11}, + {"IPPORT_DAYTIME", int64(IPPORT_DAYTIME), 13}, + {"IPPORT_NETSTAT", int64(IPPORT_NETSTAT), 15}, + {"IPPORT_FTP", int64(IPPORT_FTP), 21}, + {"IPPORT_TELNET", int64(IPPORT_TELNET), 23}, + {"IPPORT_SMTP", int64(IPPORT_SMTP), 25}, + {"IPPORT_TIMESERVER", int64(IPPORT_TIMESERVER), 37}, + {"IPPORT_NAMESERVER", int64(IPPORT_NAMESERVER), 42}, + {"IPPORT_WHOIS", int64(IPPORT_WHOIS), 43}, + {"IPPORT_MTP", int64(IPPORT_MTP), 57}, + {"IPPORT_TFTP", int64(IPPORT_TFTP), 69}, + {"IPPORT_RJE", int64(IPPORT_RJE), 77}, + {"IPPORT_FINGER", int64(IPPORT_FINGER), 79}, + {"IPPORT_TTYLINK", int64(IPPORT_TTYLINK), 87}, + {"IPPORT_SUPDUP", int64(IPPORT_SUPDUP), 95}, + {"IPPORT_EXECSERVER", int64(IPPORT_EXECSERVER), 512}, + {"IPPORT_LOGINSERVER", int64(IPPORT_LOGINSERVER), 513}, + {"IPPORT_CMDSERVER", int64(IPPORT_CMDSERVER), 514}, + {"IPPORT_EFSSERVER", int64(IPPORT_EFSSERVER), 520}, + {"IPPORT_BIFFUDP", int64(IPPORT_BIFFUDP), 512}, + {"IPPORT_WHOSERVER", int64(IPPORT_WHOSERVER), 513}, + {"IPPORT_ROUTESERVER", int64(IPPORT_ROUTESERVER), 520}, + {"IPPORT_RESERVED", int64(IPPORT_RESERVED), 1024}, + {"IPPORT_USERRESERVED", int64(IPPORT_USERRESERVED), 5000}, + {"X_RPC_NETDB_H", int64(X_RPC_NETDB_H), 1}, + {"X_SYS_SOCKET_H", int64(X_SYS_SOCKET_H), 1}, + {"SHUT_RD", int64(SHUT_RD), 0}, + {"SHUT_WR", int64(SHUT_WR), 1}, + {"SHUT_RDWR", int64(SHUT_RDWR), 2}, + {"X_SYS_UN_H", int64(X_SYS_UN_H), 1}, + {"ALIGNSIZE", int64(ALIGNSIZE), 8}, + {"MAXSIZE", int64(MAXSIZE), 128}, + {"PAD1_SIZE", int64(PAD1_SIZE), 118}, + {"PAD2_SIZE", int64(PAD2_SIZE), 0}, + {"SOCK_STREAM", int64(SOCK_STREAM), 1}, + {"SOCK_DGRAM", int64(SOCK_DGRAM), 2}, + {"SOCK_RAW", int64(SOCK_RAW), 3}, + {"SOCK_RDM", int64(SOCK_RDM), 4}, + {"SOCK_SEQPACKET", int64(SOCK_SEQPACKET), 5}, + } + var networkStringConstants = []struct{ name, got, want string }{ + {"X_PATH_HEQUIV", X_PATH_HEQUIV, "/etc/hosts.equiv"}, + {"X_PATH_HOSTS", X_PATH_HOSTS, "/etc/hosts"}, + {"X_PATH_NETWORKS", X_PATH_NETWORKS, "/etc/networks"}, + {"X_PATH_NSSWITCH_CONF", X_PATH_NSSWITCH_CONF, "/etc/nsswitch.conf"}, + {"X_PATH_PROTOCOLS", X_PATH_PROTOCOLS, "/etc/protocols"}, + {"X_PATH_SERVICES", X_PATH_SERVICES, "/etc/services"}, + } + var networkVariableSymbols = []struct { + name string + address unsafe.Pointer + }{ + {"In6addrAny", unsafe.Pointer(&In6addrAny)}, + {"In6addrLoopback", unsafe.Pointer(&In6addrLoopback)}, + } + var networkAccessorChecks = []struct { + name string + check func() (uintptr, uintptr, uintptr) + offset, size, align uintptr + }{ + {"*_llcppg_anon_1.XGof_ref_ifu_broadaddr", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_1 + view := value.XGof_ref_ifu_broadaddr() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 2}, + {"*_llcppg_anon_1.XGof_ref_ifu_dstaddr", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_1 + view := value.XGof_ref_ifu_dstaddr() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 2}, + {"*_llcppg_anon_2.XGof_ref_ifrn_name", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_2 + view := value.XGof_ref_ifrn_name() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 1}, + {"*_llcppg_anon_3.XGof_ref_ifru_addr", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_addr() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 2}, + {"*_llcppg_anon_3.XGof_ref_ifru_dstaddr", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_dstaddr() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 2}, + {"*_llcppg_anon_3.XGof_ref_ifru_broadaddr", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_broadaddr() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 2}, + {"*_llcppg_anon_3.XGof_ref_ifru_netmask", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_netmask() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 2}, + {"*_llcppg_anon_3.XGof_ref_ifru_hwaddr", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_hwaddr() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 2}, + {"*_llcppg_anon_3.XGof_ref_ifru_flags", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_flags() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 2, 2}, + {"*_llcppg_anon_3.XGof_ref_ifru_ivalue", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_ivalue() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 4, 4}, + {"*_llcppg_anon_3.XGof_ref_ifru_mtu", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_mtu() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 4, 4}, + {"*_llcppg_anon_3.XGof_ref_ifru_map", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_map() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 24, 8}, + {"*_llcppg_anon_3.XGof_ref_ifru_slave", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_slave() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 1}, + {"*_llcppg_anon_3.XGof_ref_ifru_newname", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_newname() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 1}, + {"*_llcppg_anon_3.XGof_ref_ifru_data", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_data() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 8, 8}, + {"*_llcppg_anon_4.XGof_ref_ifcu_buf", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_4 + view := value.XGof_ref_ifcu_buf() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 8, 8}, + {"*_llcppg_anon_4.XGof_ref_ifcu_req", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_4 + view := value.XGof_ref_ifcu_req() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 8, 8}, + } + + t.Run("function symbols", func(t *testing.T) { + for _, symbol := range networkFunctionSymbols { + t.Run(symbol.name, func(t *testing.T) { + if symbol.address == nil { + t.Fatal("C function address is nil") + } + t.Logf("C function address: %p", symbol.address) + }) + } + }) + t.Run("native prototypes", func(t *testing.T) { + check := func(name string, got reflect.Type, want networkABISlot) { + if got.Size() != want.size || uintptr(got.Align()) != want.align { + t.Errorf("%s size/alignment = %d/%d, C = %d/%d", name, got.Size(), got.Align(), want.size, want.align) + } + class := 0 + switch got.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + class = 1 + case reflect.Ptr, reflect.UnsafePointer, reflect.Func: + class = 5 + case reflect.Float32, reflect.Float64: + class = 8 + case reflect.Struct: + class = 12 + } + if class != want.class { + t.Errorf("%s ABI class = %d (%v), C = %d", name, class, got.Kind(), want.class) + } + } + for _, tc := range networkFunctionPrototypes { + t.Run(tc.name, func(t *testing.T) { + inputs := len(tc.inputs) + if tc.variadic { + inputs++ + } + if tc.signature.Kind() != reflect.Func || tc.signature.NumIn() != inputs || tc.signature.IsVariadic() != tc.variadic { + t.Fatalf("Go signature = %v, C fixed parameters = %d, variadic = %v", tc.signature, len(tc.inputs), tc.variadic) + } + for i, slot := range tc.inputs { + check(tc.name+" parameter", tc.signature.In(i), slot) + } + outputs := 0 + if tc.output != nil { + outputs = 1 + } + if tc.signature.NumOut() != outputs { + t.Fatalf("Go result count = %d, C = %d", tc.signature.NumOut(), outputs) + } + if tc.output != nil { + check(tc.name+" result", tc.signature.Out(0), *tc.output) + } + }) + } + }) + t.Run("native types and globals", func(t *testing.T) { + for _, tc := range networkTypeLayouts { + t.Run(tc.symbol+"/"+tc.property, func(t *testing.T) { + if tc.got != tc.want { + t.Fatalf("Go layout = %d, C headers = %d", tc.got, tc.want) + } + }) + } + for _, symbol := range networkVariableSymbols { + if symbol.address == nil { + t.Errorf("%s C variable address is nil", symbol.name) + } + t.Logf("%s C variable address: %p", symbol.name, symbol.address) + } + }) + t.Run("native constants", func(t *testing.T) { + for _, tc := range networkIntegerConstants { + t.Run(tc.name, func(t *testing.T) { + if tc.got != tc.want { + t.Fatalf("Go constant = %d, C headers = %d", tc.got, tc.want) + } + }) + } + for _, tc := range networkStringConstants { + t.Run(tc.name, func(t *testing.T) { + if tc.got != tc.want { + t.Fatalf("Go constant = %q, C headers = %q", tc.got, tc.want) + } + }) + } + }) + t.Run("union accessors", func(t *testing.T) { + for _, tc := range networkAccessorChecks { + t.Run(tc.name, func(t *testing.T) { + offset, size, align := tc.check() + if offset != tc.offset || size != tc.size || align != tc.align { + t.Fatalf("Go field offset/size/alignment = %d/%d/%d, C = %d/%d/%d", offset, size, align, tc.offset, tc.size, tc.align) + } + }) + } + }) + t.Run("symbol inventory", func(t *testing.T) { + functions, prototypes, types, constants, variables := map[string]bool{}, map[string]bool{}, map[string]bool{}, map[string]bool{}, map[string]bool{} + for _, tc := range networkFunctionPrototypes { + prototypes[tc.name] = true + } + for _, symbol := range networkFunctionSymbols { + functions[symbol.name] = true + if !prototypes[symbol.name] { + t.Errorf("%s has no native prototype test", symbol.name) + } + } + for _, tc := range networkAccessorChecks { + functions[tc.name] = true + } + for _, tc := range networkTypeLayouts { + types[tc.symbol] = true + } + for _, tc := range networkIntegerConstants { + constants[tc.name] = true + } + for _, tc := range networkStringConstants { + constants[tc.name] = true + } + for _, symbol := range networkVariableSymbols { + variables[symbol.name] = true + } + constants["XGoPackage"], constants["LLGoPackage"] = true, true + wantLink := "link: -lc -lresolv" + if runtime.GOOS == "darwin" { + wantLink = "link: -lSystem" + } + if !XGoPackage || LLGoPackage != wantLink { + t.Errorf("package metadata = %v/%q, want true/%q", XGoPackage, LLGoPackage, wantLink) + } + files := []string{"libc_" + runtime.GOOS + "_" + runtime.GOARCH + ".go", "legacy_native.go"} + if runtime.GOOS == "darwin" { + files = append(files, "legacy_darwin_arm64.go") + } + for _, filename := range files { + source, err := parser.ParseFile(token.NewFileSet(), filename, nil, parser.ParseComments) + if err != nil { + t.Fatal(err) + } + for _, declaration := range source.Decls { + switch decl := declaration.(type) { + case *ast.FuncDecl: + name := decl.Name.Name + if !ast.IsExported(name) { + continue + } + if decl.Recv != nil { + receiver, prefix := decl.Recv.List[0].Type, "" + if pointer, ok := receiver.(*ast.StarExpr); ok { + receiver, prefix = pointer.X, "*" + } + name = prefix + receiver.(*ast.Ident).Name + "." + name + } + if !functions[name] { + t.Errorf("%s: function %s has no test", filename, name) + } + if strings.HasPrefix(decl.Name.Name, "Native") { + t.Errorf("%s retains duplicate %s", filename, name) + } + if decl.Doc != nil { + for _, comment := range decl.Doc.List { + for _, private := range []string{"C.pfctlinput", "C.__h_errno_location", "C.__cmsg_nxthdr"} { + if strings.Contains(comment.Text, private) { + t.Errorf("%s still exposes private C entry point %s", filename, private) + } + } + } + } + case *ast.GenDecl: + for _, specification := range decl.Specs { + switch spec := specification.(type) { + case *ast.TypeSpec: + if ast.IsExported(spec.Name.Name) && !types[spec.Name.Name] { + t.Errorf("%s: type %s has no ABI test", filename, spec.Name.Name) + } + case *ast.ValueSpec: + for _, name := range spec.Names { + if !ast.IsExported(name.Name) { + continue + } + if decl.Tok == token.CONST && !constants[name.Name] { + t.Errorf("%s: constant %s has no test", filename, name.Name) + } + if decl.Tok == token.VAR && !variables[name.Name] { + t.Errorf("%s: variable %s has no test", filename, name.Name) + } + } + } + } + } + } + } + t.Logf("coverage: %d C functions, %d Go union accessors, %d types/global layouts, %d constants, %d globals", len(networkFunctionSymbols), len(networkAccessorChecks), len(networkTypeLayouts), len(constants), len(networkVariableSymbols)) + }) + +} diff --git a/c/net/libc_native_linux_arm64_llgo_test.go b/c/net/libc_native_linux_arm64_llgo_test.go new file mode 100644 index 00000000..463743b8 --- /dev/null +++ b/c/net/libc_native_linux_arm64_llgo_test.go @@ -0,0 +1,1531 @@ +//go:build llgo && linux && arm64 && !android + +package net + +import ( + "github.com/goplus/lib/c" + "go/ast" + "go/parser" + "go/token" + "reflect" + "runtime" + "strings" + "testing" + "unsafe" +) + +type nativeNetworkChar = uint8 + +func TestGeneratedNetworkLayouts(t *testing.T) { + // Expected values are compiled from the original Bootlin glibc 2.24 C headers. + var networkFunctionSymbols = []struct { + name string + address unsafe.Pointer + }{ + {"InetAddr", c.Func(InetAddr)}, + {"InAddr.InetLnaof", c.Func((InAddr).InetLnaof)}, + {"InetMakeaddr", c.Func(InetMakeaddr)}, + {"InAddr.InetNetof", c.Func((InAddr).InetNetof)}, + {"InetNetwork", c.Func(InetNetwork)}, + {"InAddr.InetNtoa", c.Func((InAddr).InetNtoa)}, + {"InetPton", c.Func(InetPton)}, + {"InetNtop", c.Func(InetNtop)}, + {"InetAton", c.Func(InetAton)}, + {"InetNeta", c.Func(InetNeta)}, + {"InetNetNtop", c.Func(InetNetNtop)}, + {"InetNetPton", c.Func(InetNetPton)}, + {"InetNsapAddr", c.Func(InetNsapAddr)}, + {"InetNsapNtoa", c.Func(InetNsapNtoa)}, + {"IfNametoindex", c.Func(IfNametoindex)}, + {"IfIndextoname", c.Func(IfIndextoname)}, + {"IfNameindex", c.Func(IfNameindex)}, + {"*IfNameindexT.IfFreenameindex", c.Func((*IfNameindexT).IfFreenameindex)}, + {"Herror", c.Func(Herror)}, + {"Hstrerror", c.Func(Hstrerror)}, + {"Sethostent", c.Func(Sethostent)}, + {"Endhostent", c.Func(Endhostent)}, + {"Gethostent", c.Func(Gethostent)}, + {"Gethostbyaddr", c.Func(Gethostbyaddr)}, + {"GetHostByName", c.Func(GetHostByName)}, + {"Gethostbyname2", c.Func(Gethostbyname2)}, + {"*Hostent.GethostentR", c.Func((*Hostent).GethostentR)}, + {"GethostbyaddrR", c.Func(GethostbyaddrR)}, + {"GethostbynameR", c.Func(GethostbynameR)}, + {"Gethostbyname2R", c.Func(Gethostbyname2R)}, + {"Setnetent", c.Func(Setnetent)}, + {"Endnetent", c.Func(Endnetent)}, + {"Getnetent", c.Func(Getnetent)}, + {"Getnetbyaddr", c.Func(Getnetbyaddr)}, + {"Getnetbyname", c.Func(Getnetbyname)}, + {"*Netent.GetnetentR", c.Func((*Netent).GetnetentR)}, + {"GetnetbyaddrR", c.Func(GetnetbyaddrR)}, + {"GetnetbynameR", c.Func(GetnetbynameR)}, + {"Setservent", c.Func(Setservent)}, + {"Endservent", c.Func(Endservent)}, + {"Getservent", c.Func(Getservent)}, + {"Getservbyname", c.Func(Getservbyname)}, + {"Getservbyport", c.Func(Getservbyport)}, + {"*Servent.GetserventR", c.Func((*Servent).GetserventR)}, + {"GetservbynameR", c.Func(GetservbynameR)}, + {"GetservbyportR", c.Func(GetservbyportR)}, + {"Setprotoent", c.Func(Setprotoent)}, + {"Endprotoent", c.Func(Endprotoent)}, + {"Getprotoent", c.Func(Getprotoent)}, + {"Getprotobyname", c.Func(Getprotobyname)}, + {"Getprotobynumber", c.Func(Getprotobynumber)}, + {"*Protoent.GetprotoentR", c.Func((*Protoent).GetprotoentR)}, + {"GetprotobynameR", c.Func(GetprotobynameR)}, + {"GetprotobynumberR", c.Func(GetprotobynumberR)}, + {"Setnetgrent", c.Func(Setnetgrent)}, + {"Endnetgrent", c.Func(Endnetgrent)}, + {"Getnetgrent", c.Func(Getnetgrent)}, + {"Innetgr", c.Func(Innetgr)}, + {"GetnetgrentR", c.Func(GetnetgrentR)}, + {"Rcmd", c.Func(Rcmd)}, + {"RcmdAf", c.Func(RcmdAf)}, + {"Rexec", c.Func(Rexec)}, + {"RexecAf", c.Func(RexecAf)}, + {"Ruserok", c.Func(Ruserok)}, + {"RuserokAf", c.Func(RuserokAf)}, + {"Iruserok", c.Func(Iruserok)}, + {"IruserokAf", c.Func(IruserokAf)}, + {"Rresvport", c.Func(Rresvport)}, + {"RresvportAf", c.Func(RresvportAf)}, + {"Getaddrinfo", c.Func(Getaddrinfo)}, + {"Freeaddrinfo", c.Func(Freeaddrinfo)}, + {"GaiStrerror", c.Func(GaiStrerror)}, + {"*SockAddr.Getnameinfo", c.Func((*SockAddr).Getnameinfo)}, + {"Ntohl", c.Func(Ntohl)}, + {"Ntohs", c.Func(Ntohs)}, + {"Htonl", c.Func(Htonl)}, + {"Htons", c.Func(Htons)}, + {"Bindresvport", c.Func(Bindresvport)}, + {"Setrpcent", c.Func(Setrpcent)}, + {"Endrpcent", c.Func(Endrpcent)}, + {"Getrpcbyname", c.Func(Getrpcbyname)}, + {"Getrpcbynumber", c.Func(Getrpcbynumber)}, + {"Getrpcent", c.Func(Getrpcent)}, + {"GetrpcbynameR", c.Func(GetrpcbynameR)}, + {"GetrpcbynumberR", c.Func(GetrpcbynumberR)}, + {"*Rpcent.GetrpcentR", c.Func((*Rpcent).GetrpcentR)}, + {"Socket", c.Func(Socket)}, + {"Socketpair", c.Func(Socketpair)}, + {"Bind", c.Func(Bind)}, + {"Getsockname", c.Func(Getsockname)}, + {"Connect", c.Func(Connect)}, + {"Getpeername", c.Func(Getpeername)}, + {"Send", c.Func(Send)}, + {"Recv", c.Func(Recv)}, + {"Sendto", c.Func(Sendto)}, + {"Recvfrom", c.Func(Recvfrom)}, + {"Sendmsg", c.Func(Sendmsg)}, + {"Recvmsg", c.Func(Recvmsg)}, + {"Getsockopt", c.Func(Getsockopt)}, + {"SetSockOpt", c.Func(SetSockOpt)}, + {"Listen", c.Func(Listen)}, + {"Accept", c.Func(Accept)}, + {"Shutdown", c.Func(Shutdown)}, + {"Sockatmark", c.Func(Sockatmark)}, + {"Isfdtype", c.Func(Isfdtype)}, + } + var networkFunctionPrototypes = []struct { + name string + signature reflect.Type + inputs []networkABISlot + output *networkABISlot + variadic bool + }{ + {"InetAddr", reflect.TypeOf(InetAddr), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"InAddr.InetLnaof", reflect.TypeOf((InAddr).InetLnaof), []networkABISlot{{4, 4, 12}}, &networkABISlot{4, 4, 1}, false}, + {"InetMakeaddr", reflect.TypeOf(InetMakeaddr), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 12}, false}, + {"InAddr.InetNetof", reflect.TypeOf((InAddr).InetNetof), []networkABISlot{{4, 4, 12}}, &networkABISlot{4, 4, 1}, false}, + {"InetNetwork", reflect.TypeOf(InetNetwork), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"InAddr.InetNtoa", reflect.TypeOf((InAddr).InetNtoa), []networkABISlot{{4, 4, 12}}, &networkABISlot{8, 8, 5}, false}, + {"InetPton", reflect.TypeOf(InetPton), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"InetNtop", reflect.TypeOf(InetNtop), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"InetAton", reflect.TypeOf(InetAton), []networkABISlot{{8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"InetNeta", reflect.TypeOf(InetNeta), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}}, &networkABISlot{8, 8, 5}, false}, + {"InetNetNtop", reflect.TypeOf(InetNetNtop), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 1}}, &networkABISlot{8, 8, 5}, false}, + {"InetNetPton", reflect.TypeOf(InetNetPton), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &networkABISlot{4, 4, 1}, false}, + {"InetNsapAddr", reflect.TypeOf(InetNsapAddr), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"InetNsapNtoa", reflect.TypeOf(InetNsapNtoa), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"IfNametoindex", reflect.TypeOf(IfNametoindex), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"IfIndextoname", reflect.TypeOf(IfIndextoname), []networkABISlot{{4, 4, 1}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"IfNameindex", reflect.TypeOf(IfNameindex), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"*IfNameindexT.IfFreenameindex", reflect.TypeOf((*IfNameindexT).IfFreenameindex), []networkABISlot{{8, 8, 5}}, nil, false}, + {"Herror", reflect.TypeOf(Herror), []networkABISlot{{8, 8, 5}}, nil, false}, + {"Hstrerror", reflect.TypeOf(Hstrerror), []networkABISlot{{4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"Sethostent", reflect.TypeOf(Sethostent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"Endhostent", reflect.TypeOf(Endhostent), []networkABISlot{}, nil, false}, + {"Gethostent", reflect.TypeOf(Gethostent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"Gethostbyaddr", reflect.TypeOf(Gethostbyaddr), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"GetHostByName", reflect.TypeOf(GetHostByName), []networkABISlot{{8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Gethostbyname2", reflect.TypeOf(Gethostbyname2), []networkABISlot{{8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"*Hostent.GethostentR", reflect.TypeOf((*Hostent).GethostentR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GethostbyaddrR", reflect.TypeOf(GethostbyaddrR), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GethostbynameR", reflect.TypeOf(GethostbynameR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Gethostbyname2R", reflect.TypeOf(Gethostbyname2R), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Setnetent", reflect.TypeOf(Setnetent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"Endnetent", reflect.TypeOf(Endnetent), []networkABISlot{}, nil, false}, + {"Getnetent", reflect.TypeOf(Getnetent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"Getnetbyaddr", reflect.TypeOf(Getnetbyaddr), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"Getnetbyname", reflect.TypeOf(Getnetbyname), []networkABISlot{{8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"*Netent.GetnetentR", reflect.TypeOf((*Netent).GetnetentR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetnetbyaddrR", reflect.TypeOf(GetnetbyaddrR), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetnetbynameR", reflect.TypeOf(GetnetbynameR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Setservent", reflect.TypeOf(Setservent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"Endservent", reflect.TypeOf(Endservent), []networkABISlot{}, nil, false}, + {"Getservent", reflect.TypeOf(Getservent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"Getservbyname", reflect.TypeOf(Getservbyname), []networkABISlot{{8, 8, 5}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Getservbyport", reflect.TypeOf(Getservbyport), []networkABISlot{{4, 4, 1}, {8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"*Servent.GetserventR", reflect.TypeOf((*Servent).GetserventR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetservbynameR", reflect.TypeOf(GetservbynameR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetservbyportR", reflect.TypeOf(GetservbyportR), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Setprotoent", reflect.TypeOf(Setprotoent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"Endprotoent", reflect.TypeOf(Endprotoent), []networkABISlot{}, nil, false}, + {"Getprotoent", reflect.TypeOf(Getprotoent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"Getprotobyname", reflect.TypeOf(Getprotobyname), []networkABISlot{{8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Getprotobynumber", reflect.TypeOf(Getprotobynumber), []networkABISlot{{4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"*Protoent.GetprotoentR", reflect.TypeOf((*Protoent).GetprotoentR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetprotobynameR", reflect.TypeOf(GetprotobynameR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetprotobynumberR", reflect.TypeOf(GetprotobynumberR), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Setnetgrent", reflect.TypeOf(Setnetgrent), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Endnetgrent", reflect.TypeOf(Endnetgrent), []networkABISlot{}, nil, false}, + {"Getnetgrent", reflect.TypeOf(Getnetgrent), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Innetgr", reflect.TypeOf(Innetgr), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetnetgrentR", reflect.TypeOf(GetnetgrentR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Rcmd", reflect.TypeOf(Rcmd), []networkABISlot{{8, 8, 5}, {2, 2, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"RcmdAf", reflect.TypeOf(RcmdAf), []networkABISlot{{8, 8, 5}, {2, 2, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {2, 2, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Rexec", reflect.TypeOf(Rexec), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"RexecAf", reflect.TypeOf(RexecAf), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {2, 2, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Ruserok", reflect.TypeOf(Ruserok), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"RuserokAf", reflect.TypeOf(RuserokAf), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {2, 2, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Iruserok", reflect.TypeOf(Iruserok), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"IruserokAf", reflect.TypeOf(IruserokAf), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {2, 2, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Rresvport", reflect.TypeOf(Rresvport), []networkABISlot{{8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"RresvportAf", reflect.TypeOf(RresvportAf), []networkABISlot{{8, 8, 5}, {2, 2, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Getaddrinfo", reflect.TypeOf(Getaddrinfo), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Freeaddrinfo", reflect.TypeOf(Freeaddrinfo), []networkABISlot{{8, 8, 5}}, nil, false}, + {"GaiStrerror", reflect.TypeOf(GaiStrerror), []networkABISlot{{4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"*SockAddr.Getnameinfo", reflect.TypeOf((*SockAddr).Getnameinfo), []networkABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Ntohl", reflect.TypeOf(Ntohl), []networkABISlot{{4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Ntohs", reflect.TypeOf(Ntohs), []networkABISlot{{2, 2, 1}}, &networkABISlot{2, 2, 1}, false}, + {"Htonl", reflect.TypeOf(Htonl), []networkABISlot{{4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Htons", reflect.TypeOf(Htons), []networkABISlot{{2, 2, 1}}, &networkABISlot{2, 2, 1}, false}, + {"Bindresvport", reflect.TypeOf(Bindresvport), []networkABISlot{{4, 4, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Setrpcent", reflect.TypeOf(Setrpcent), []networkABISlot{{4, 4, 1}}, nil, false}, + {"Endrpcent", reflect.TypeOf(Endrpcent), []networkABISlot{}, nil, false}, + {"Getrpcbyname", reflect.TypeOf(Getrpcbyname), []networkABISlot{{8, 8, 5}}, &networkABISlot{8, 8, 5}, false}, + {"Getrpcbynumber", reflect.TypeOf(Getrpcbynumber), []networkABISlot{{4, 4, 1}}, &networkABISlot{8, 8, 5}, false}, + {"Getrpcent", reflect.TypeOf(Getrpcent), []networkABISlot{}, &networkABISlot{8, 8, 5}, false}, + {"GetrpcbynameR", reflect.TypeOf(GetrpcbynameR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"GetrpcbynumberR", reflect.TypeOf(GetrpcbynumberR), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"*Rpcent.GetrpcentR", reflect.TypeOf((*Rpcent).GetrpcentR), []networkABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Socket", reflect.TypeOf(Socket), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Socketpair", reflect.TypeOf(Socketpair), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Bind", reflect.TypeOf(Bind), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Getsockname", reflect.TypeOf(Getsockname), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Connect", reflect.TypeOf(Connect), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Getpeername", reflect.TypeOf(Getpeername), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Send", reflect.TypeOf(Send), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Recv", reflect.TypeOf(Recv), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Sendto", reflect.TypeOf(Sendto), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Recvfrom", reflect.TypeOf(Recvfrom), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{8, 8, 1}, false}, + {"Sendmsg", reflect.TypeOf(Sendmsg), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Recvmsg", reflect.TypeOf(Recvmsg), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{8, 8, 1}, false}, + {"Getsockopt", reflect.TypeOf(Getsockopt), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"SetSockOpt", reflect.TypeOf(SetSockOpt), []networkABISlot{{4, 4, 1}, {4, 4, 1}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Listen", reflect.TypeOf(Listen), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Accept", reflect.TypeOf(Accept), []networkABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &networkABISlot{4, 4, 1}, false}, + {"Shutdown", reflect.TypeOf(Shutdown), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Sockatmark", reflect.TypeOf(Sockatmark), []networkABISlot{{4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + {"Isfdtype", reflect.TypeOf(Isfdtype), []networkABISlot{{4, 4, 1}, {4, 4, 1}}, &networkABISlot{4, 4, 1}, false}, + } + var networkTypeLayouts = []struct { + symbol, property string + got, want uintptr + }{ + {"IpOpts", "size", unsafe.Sizeof(*new(IpOpts)), 44}, + {"IpOpts", "alignment", unsafe.Alignof(*new(IpOpts)), 4}, + {"IpOpts", "IpDst offset", unsafe.Offsetof((*new(IpOpts)).IpDst), 0}, + {"IpOpts", "IpDst size", unsafe.Sizeof((*new(IpOpts)).IpDst), 4}, + {"IpOpts", "IpDst alignment", unsafe.Alignof((*new(IpOpts)).IpDst), 4}, + {"IpOpts", "IpOpts offset", unsafe.Offsetof((*new(IpOpts)).IpOpts), 4}, + {"IpOpts", "IpOpts size", unsafe.Sizeof((*new(IpOpts)).IpOpts), 40}, + {"IpOpts", "IpOpts alignment", unsafe.Alignof((*new(IpOpts)).IpOpts), 1}, + {"IpMreqn", "size", unsafe.Sizeof(*new(IpMreqn)), 12}, + {"IpMreqn", "alignment", unsafe.Alignof(*new(IpMreqn)), 4}, + {"IpMreqn", "ImrMultiaddr offset", unsafe.Offsetof((*new(IpMreqn)).ImrMultiaddr), 0}, + {"IpMreqn", "ImrMultiaddr size", unsafe.Sizeof((*new(IpMreqn)).ImrMultiaddr), 4}, + {"IpMreqn", "ImrMultiaddr alignment", unsafe.Alignof((*new(IpMreqn)).ImrMultiaddr), 4}, + {"IpMreqn", "ImrAddress offset", unsafe.Offsetof((*new(IpMreqn)).ImrAddress), 4}, + {"IpMreqn", "ImrAddress size", unsafe.Sizeof((*new(IpMreqn)).ImrAddress), 4}, + {"IpMreqn", "ImrAddress alignment", unsafe.Alignof((*new(IpMreqn)).ImrAddress), 4}, + {"IpMreqn", "ImrIfindex offset", unsafe.Offsetof((*new(IpMreqn)).ImrIfindex), 8}, + {"IpMreqn", "ImrIfindex size", unsafe.Sizeof((*new(IpMreqn)).ImrIfindex), 4}, + {"IpMreqn", "ImrIfindex alignment", unsafe.Alignof((*new(IpMreqn)).ImrIfindex), 4}, + {"InPktinfo", "size", unsafe.Sizeof(*new(InPktinfo)), 12}, + {"InPktinfo", "alignment", unsafe.Alignof(*new(InPktinfo)), 4}, + {"InPktinfo", "IpiIfindex offset", unsafe.Offsetof((*new(InPktinfo)).IpiIfindex), 0}, + {"InPktinfo", "IpiIfindex size", unsafe.Sizeof((*new(InPktinfo)).IpiIfindex), 4}, + {"InPktinfo", "IpiIfindex alignment", unsafe.Alignof((*new(InPktinfo)).IpiIfindex), 4}, + {"InPktinfo", "IpiSpecDst offset", unsafe.Offsetof((*new(InPktinfo)).IpiSpecDst), 4}, + {"InPktinfo", "IpiSpecDst size", unsafe.Sizeof((*new(InPktinfo)).IpiSpecDst), 4}, + {"InPktinfo", "IpiSpecDst alignment", unsafe.Alignof((*new(InPktinfo)).IpiSpecDst), 4}, + {"InPktinfo", "IpiAddr offset", unsafe.Offsetof((*new(InPktinfo)).IpiAddr), 8}, + {"InPktinfo", "IpiAddr size", unsafe.Sizeof((*new(InPktinfo)).IpiAddr), 4}, + {"InPktinfo", "IpiAddr alignment", unsafe.Alignof((*new(InPktinfo)).IpiAddr), 4}, + {"Netent", "size", unsafe.Sizeof(*new(Netent)), 24}, + {"Netent", "alignment", unsafe.Alignof(*new(Netent)), 8}, + {"Netent", "NName offset", unsafe.Offsetof((*new(Netent)).NName), 0}, + {"Netent", "NName size", unsafe.Sizeof((*new(Netent)).NName), 8}, + {"Netent", "NName alignment", unsafe.Alignof((*new(Netent)).NName), 8}, + {"Netent", "NAliases offset", unsafe.Offsetof((*new(Netent)).NAliases), 8}, + {"Netent", "NAliases size", unsafe.Sizeof((*new(Netent)).NAliases), 8}, + {"Netent", "NAliases alignment", unsafe.Alignof((*new(Netent)).NAliases), 8}, + {"Netent", "NAddrtype offset", unsafe.Offsetof((*new(Netent)).NAddrtype), 16}, + {"Netent", "NAddrtype size", unsafe.Sizeof((*new(Netent)).NAddrtype), 4}, + {"Netent", "NAddrtype alignment", unsafe.Alignof((*new(Netent)).NAddrtype), 4}, + {"Netent", "NNet offset", unsafe.Offsetof((*new(Netent)).NNet), 20}, + {"Netent", "NNet size", unsafe.Sizeof((*new(Netent)).NNet), 4}, + {"Netent", "NNet alignment", unsafe.Alignof((*new(Netent)).NNet), 4}, + {"SaFamilyT", "size", unsafe.Sizeof(*new(SaFamilyT)), 2}, + {"SaFamilyT", "alignment", unsafe.Alignof(*new(SaFamilyT)), 2}, + {"SockAddr", "size", unsafe.Sizeof(*new(SockAddr)), 16}, + {"SockAddr", "alignment", unsafe.Alignof(*new(SockAddr)), 2}, + {"SockAddr", "Family offset", unsafe.Offsetof((*new(SockAddr)).Family), 0}, + {"SockAddr", "Family size", unsafe.Sizeof((*new(SockAddr)).Family), 2}, + {"SockAddr", "Family alignment", unsafe.Alignof((*new(SockAddr)).Family), 2}, + {"SockAddr", "Data offset", unsafe.Offsetof((*new(SockAddr)).Data), 2}, + {"SockAddr", "Data size", unsafe.Sizeof((*new(SockAddr)).Data), 14}, + {"SockAddr", "Data alignment", unsafe.Alignof((*new(SockAddr)).Data), 1}, + {"SockaddrStorage", "size", unsafe.Sizeof(*new(SockaddrStorage)), 128}, + {"SockaddrStorage", "alignment", unsafe.Alignof(*new(SockaddrStorage)), 8}, + {"SockaddrStorage", "Family offset", unsafe.Offsetof((*new(SockaddrStorage)).Family), 0}, + {"SockaddrStorage", "Family size", unsafe.Sizeof((*new(SockaddrStorage)).Family), 2}, + {"SockaddrStorage", "Family alignment", unsafe.Alignof((*new(SockaddrStorage)).Family), 2}, + {"SockaddrStorage", "pad offset", unsafe.Offsetof((*new(SockaddrStorage)).pad), 2}, + {"SockaddrStorage", "pad size", unsafe.Sizeof((*new(SockaddrStorage)).pad), 118}, + {"SockaddrStorage", "pad alignment", unsafe.Alignof((*new(SockaddrStorage)).pad), 1}, + {"SockaddrStorage", "align offset", unsafe.Offsetof((*new(SockaddrStorage)).align), 120}, + {"SockaddrStorage", "align size", unsafe.Sizeof((*new(SockaddrStorage)).align), 8}, + {"SockaddrStorage", "align alignment", unsafe.Alignof((*new(SockaddrStorage)).align), 8}, + {"Msghdr", "size", unsafe.Sizeof(*new(Msghdr)), 56}, + {"Msghdr", "alignment", unsafe.Alignof(*new(Msghdr)), 8}, + {"Msghdr", "MsgName offset", unsafe.Offsetof((*new(Msghdr)).MsgName), 0}, + {"Msghdr", "MsgName size", unsafe.Sizeof((*new(Msghdr)).MsgName), 8}, + {"Msghdr", "MsgName alignment", unsafe.Alignof((*new(Msghdr)).MsgName), 8}, + {"Msghdr", "MsgNamelen offset", unsafe.Offsetof((*new(Msghdr)).MsgNamelen), 8}, + {"Msghdr", "MsgNamelen size", unsafe.Sizeof((*new(Msghdr)).MsgNamelen), 4}, + {"Msghdr", "MsgNamelen alignment", unsafe.Alignof((*new(Msghdr)).MsgNamelen), 4}, + {"Msghdr", "MsgIov offset", unsafe.Offsetof((*new(Msghdr)).MsgIov), 16}, + {"Msghdr", "MsgIov size", unsafe.Sizeof((*new(Msghdr)).MsgIov), 8}, + {"Msghdr", "MsgIov alignment", unsafe.Alignof((*new(Msghdr)).MsgIov), 8}, + {"Msghdr", "MsgIovlen offset", unsafe.Offsetof((*new(Msghdr)).MsgIovlen), 24}, + {"Msghdr", "MsgIovlen size", unsafe.Sizeof((*new(Msghdr)).MsgIovlen), 8}, + {"Msghdr", "MsgIovlen alignment", unsafe.Alignof((*new(Msghdr)).MsgIovlen), 8}, + {"Msghdr", "MsgControl offset", unsafe.Offsetof((*new(Msghdr)).MsgControl), 32}, + {"Msghdr", "MsgControl size", unsafe.Sizeof((*new(Msghdr)).MsgControl), 8}, + {"Msghdr", "MsgControl alignment", unsafe.Alignof((*new(Msghdr)).MsgControl), 8}, + {"Msghdr", "MsgControllen offset", unsafe.Offsetof((*new(Msghdr)).MsgControllen), 40}, + {"Msghdr", "MsgControllen size", unsafe.Sizeof((*new(Msghdr)).MsgControllen), 8}, + {"Msghdr", "MsgControllen alignment", unsafe.Alignof((*new(Msghdr)).MsgControllen), 8}, + {"Msghdr", "MsgFlags offset", unsafe.Offsetof((*new(Msghdr)).MsgFlags), 48}, + {"Msghdr", "MsgFlags size", unsafe.Sizeof((*new(Msghdr)).MsgFlags), 4}, + {"Msghdr", "MsgFlags alignment", unsafe.Alignof((*new(Msghdr)).MsgFlags), 4}, + {"Cmsghdr", "size", unsafe.Sizeof(*new(Cmsghdr)), 16}, + {"Cmsghdr", "alignment", unsafe.Alignof(*new(Cmsghdr)), 8}, + {"Cmsghdr", "CmsgLen offset", unsafe.Offsetof((*new(Cmsghdr)).CmsgLen), 0}, + {"Cmsghdr", "CmsgLen size", unsafe.Sizeof((*new(Cmsghdr)).CmsgLen), 8}, + {"Cmsghdr", "CmsgLen alignment", unsafe.Alignof((*new(Cmsghdr)).CmsgLen), 8}, + {"Cmsghdr", "CmsgLevel offset", unsafe.Offsetof((*new(Cmsghdr)).CmsgLevel), 8}, + {"Cmsghdr", "CmsgLevel size", unsafe.Sizeof((*new(Cmsghdr)).CmsgLevel), 4}, + {"Cmsghdr", "CmsgLevel alignment", unsafe.Alignof((*new(Cmsghdr)).CmsgLevel), 4}, + {"Cmsghdr", "CmsgType offset", unsafe.Offsetof((*new(Cmsghdr)).CmsgType), 12}, + {"Cmsghdr", "CmsgType size", unsafe.Sizeof((*new(Cmsghdr)).CmsgType), 4}, + {"Cmsghdr", "CmsgType alignment", unsafe.Alignof((*new(Cmsghdr)).CmsgType), 4}, + {"Linger", "size", unsafe.Sizeof(*new(Linger)), 8}, + {"Linger", "alignment", unsafe.Alignof(*new(Linger)), 4}, + {"Linger", "LOnoff offset", unsafe.Offsetof((*new(Linger)).LOnoff), 0}, + {"Linger", "LOnoff size", unsafe.Sizeof((*new(Linger)).LOnoff), 4}, + {"Linger", "LOnoff alignment", unsafe.Alignof((*new(Linger)).LOnoff), 4}, + {"Linger", "LLinger offset", unsafe.Offsetof((*new(Linger)).LLinger), 4}, + {"Linger", "LLinger size", unsafe.Sizeof((*new(Linger)).LLinger), 4}, + {"Linger", "LLinger alignment", unsafe.Alignof((*new(Linger)).LLinger), 4}, + {"SocklenT", "size", unsafe.Sizeof(*new(SocklenT)), 4}, + {"SocklenT", "alignment", unsafe.Alignof(*new(SocklenT)), 4}, + {"X__SocketType", "size", unsafe.Sizeof(*new(X__SocketType)), 4}, + {"X__SocketType", "alignment", unsafe.Alignof(*new(X__SocketType)), 4}, + {"X__FsidT", "size", unsafe.Sizeof(*new(X__FsidT)), 8}, + {"X__FsidT", "alignment", unsafe.Alignof(*new(X__FsidT)), 4}, + {"X__FsidT", "X__Val offset", unsafe.Offsetof((*new(X__FsidT)).X__Val), 0}, + {"X__FsidT", "X__Val size", unsafe.Sizeof((*new(X__FsidT)).X__Val), 8}, + {"X__FsidT", "X__Val alignment", unsafe.Alignof((*new(X__FsidT)).X__Val), 4}, + {"X__UChar", "size", unsafe.Sizeof(*new(X__UChar)), 1}, + {"X__UChar", "alignment", unsafe.Alignof(*new(X__UChar)), 1}, + {"X__UShort", "size", unsafe.Sizeof(*new(X__UShort)), 2}, + {"X__UShort", "alignment", unsafe.Alignof(*new(X__UShort)), 2}, + {"X__UInt", "size", unsafe.Sizeof(*new(X__UInt)), 4}, + {"X__UInt", "alignment", unsafe.Alignof(*new(X__UInt)), 4}, + {"X__ULong", "size", unsafe.Sizeof(*new(X__ULong)), 8}, + {"X__ULong", "alignment", unsafe.Alignof(*new(X__ULong)), 8}, + {"X__Int8T", "size", unsafe.Sizeof(*new(X__Int8T)), 1}, + {"X__Int8T", "alignment", unsafe.Alignof(*new(X__Int8T)), 1}, + {"X__Uint8T", "size", unsafe.Sizeof(*new(X__Uint8T)), 1}, + {"X__Uint8T", "alignment", unsafe.Alignof(*new(X__Uint8T)), 1}, + {"X__Int16T", "size", unsafe.Sizeof(*new(X__Int16T)), 2}, + {"X__Int16T", "alignment", unsafe.Alignof(*new(X__Int16T)), 2}, + {"X__Uint16T", "size", unsafe.Sizeof(*new(X__Uint16T)), 2}, + {"X__Uint16T", "alignment", unsafe.Alignof(*new(X__Uint16T)), 2}, + {"X__Int32T", "size", unsafe.Sizeof(*new(X__Int32T)), 4}, + {"X__Int32T", "alignment", unsafe.Alignof(*new(X__Int32T)), 4}, + {"X__Uint32T", "size", unsafe.Sizeof(*new(X__Uint32T)), 4}, + {"X__Uint32T", "alignment", unsafe.Alignof(*new(X__Uint32T)), 4}, + {"X__Int64T", "size", unsafe.Sizeof(*new(X__Int64T)), 8}, + {"X__Int64T", "alignment", unsafe.Alignof(*new(X__Int64T)), 8}, + {"X__Uint64T", "size", unsafe.Sizeof(*new(X__Uint64T)), 8}, + {"X__Uint64T", "alignment", unsafe.Alignof(*new(X__Uint64T)), 8}, + {"X__QuadT", "size", unsafe.Sizeof(*new(X__QuadT)), 8}, + {"X__QuadT", "alignment", unsafe.Alignof(*new(X__QuadT)), 8}, + {"X__UQuadT", "size", unsafe.Sizeof(*new(X__UQuadT)), 8}, + {"X__UQuadT", "alignment", unsafe.Alignof(*new(X__UQuadT)), 8}, + {"X__DevT", "size", unsafe.Sizeof(*new(X__DevT)), 8}, + {"X__DevT", "alignment", unsafe.Alignof(*new(X__DevT)), 8}, + {"X__UidT", "size", unsafe.Sizeof(*new(X__UidT)), 4}, + {"X__UidT", "alignment", unsafe.Alignof(*new(X__UidT)), 4}, + {"X__GidT", "size", unsafe.Sizeof(*new(X__GidT)), 4}, + {"X__GidT", "alignment", unsafe.Alignof(*new(X__GidT)), 4}, + {"X__InoT", "size", unsafe.Sizeof(*new(X__InoT)), 8}, + {"X__InoT", "alignment", unsafe.Alignof(*new(X__InoT)), 8}, + {"X__Ino64T", "size", unsafe.Sizeof(*new(X__Ino64T)), 8}, + {"X__Ino64T", "alignment", unsafe.Alignof(*new(X__Ino64T)), 8}, + {"X__ModeT", "size", unsafe.Sizeof(*new(X__ModeT)), 4}, + {"X__ModeT", "alignment", unsafe.Alignof(*new(X__ModeT)), 4}, + {"X__NlinkT", "size", unsafe.Sizeof(*new(X__NlinkT)), 4}, + {"X__NlinkT", "alignment", unsafe.Alignof(*new(X__NlinkT)), 4}, + {"X__OffT", "size", unsafe.Sizeof(*new(X__OffT)), 8}, + {"X__OffT", "alignment", unsafe.Alignof(*new(X__OffT)), 8}, + {"X__Off64T", "size", unsafe.Sizeof(*new(X__Off64T)), 8}, + {"X__Off64T", "alignment", unsafe.Alignof(*new(X__Off64T)), 8}, + {"X__PidT", "size", unsafe.Sizeof(*new(X__PidT)), 4}, + {"X__PidT", "alignment", unsafe.Alignof(*new(X__PidT)), 4}, + {"X__ClockT", "size", unsafe.Sizeof(*new(X__ClockT)), 8}, + {"X__ClockT", "alignment", unsafe.Alignof(*new(X__ClockT)), 8}, + {"X__RlimT", "size", unsafe.Sizeof(*new(X__RlimT)), 8}, + {"X__RlimT", "alignment", unsafe.Alignof(*new(X__RlimT)), 8}, + {"X__Rlim64T", "size", unsafe.Sizeof(*new(X__Rlim64T)), 8}, + {"X__Rlim64T", "alignment", unsafe.Alignof(*new(X__Rlim64T)), 8}, + {"X__IdT", "size", unsafe.Sizeof(*new(X__IdT)), 4}, + {"X__IdT", "alignment", unsafe.Alignof(*new(X__IdT)), 4}, + {"X__TimeT", "size", unsafe.Sizeof(*new(X__TimeT)), 8}, + {"X__TimeT", "alignment", unsafe.Alignof(*new(X__TimeT)), 8}, + {"X__UsecondsT", "size", unsafe.Sizeof(*new(X__UsecondsT)), 4}, + {"X__UsecondsT", "alignment", unsafe.Alignof(*new(X__UsecondsT)), 4}, + {"X__SusecondsT", "size", unsafe.Sizeof(*new(X__SusecondsT)), 8}, + {"X__SusecondsT", "alignment", unsafe.Alignof(*new(X__SusecondsT)), 8}, + {"X__DaddrT", "size", unsafe.Sizeof(*new(X__DaddrT)), 4}, + {"X__DaddrT", "alignment", unsafe.Alignof(*new(X__DaddrT)), 4}, + {"X__KeyT", "size", unsafe.Sizeof(*new(X__KeyT)), 4}, + {"X__KeyT", "alignment", unsafe.Alignof(*new(X__KeyT)), 4}, + {"X__ClockidT", "size", unsafe.Sizeof(*new(X__ClockidT)), 4}, + {"X__ClockidT", "alignment", unsafe.Alignof(*new(X__ClockidT)), 4}, + {"X__TimerT", "size", unsafe.Sizeof(*new(X__TimerT)), 8}, + {"X__TimerT", "alignment", unsafe.Alignof(*new(X__TimerT)), 8}, + {"X__BlksizeT", "size", unsafe.Sizeof(*new(X__BlksizeT)), 4}, + {"X__BlksizeT", "alignment", unsafe.Alignof(*new(X__BlksizeT)), 4}, + {"X__BlkcntT", "size", unsafe.Sizeof(*new(X__BlkcntT)), 8}, + {"X__BlkcntT", "alignment", unsafe.Alignof(*new(X__BlkcntT)), 8}, + {"X__Blkcnt64T", "size", unsafe.Sizeof(*new(X__Blkcnt64T)), 8}, + {"X__Blkcnt64T", "alignment", unsafe.Alignof(*new(X__Blkcnt64T)), 8}, + {"X__FsblkcntT", "size", unsafe.Sizeof(*new(X__FsblkcntT)), 8}, + {"X__FsblkcntT", "alignment", unsafe.Alignof(*new(X__FsblkcntT)), 8}, + {"X__Fsblkcnt64T", "size", unsafe.Sizeof(*new(X__Fsblkcnt64T)), 8}, + {"X__Fsblkcnt64T", "alignment", unsafe.Alignof(*new(X__Fsblkcnt64T)), 8}, + {"X__FsfilcntT", "size", unsafe.Sizeof(*new(X__FsfilcntT)), 8}, + {"X__FsfilcntT", "alignment", unsafe.Alignof(*new(X__FsfilcntT)), 8}, + {"X__Fsfilcnt64T", "size", unsafe.Sizeof(*new(X__Fsfilcnt64T)), 8}, + {"X__Fsfilcnt64T", "alignment", unsafe.Alignof(*new(X__Fsfilcnt64T)), 8}, + {"X__FswordT", "size", unsafe.Sizeof(*new(X__FswordT)), 8}, + {"X__FswordT", "alignment", unsafe.Alignof(*new(X__FswordT)), 8}, + {"X__SsizeT", "size", unsafe.Sizeof(*new(X__SsizeT)), 8}, + {"X__SsizeT", "alignment", unsafe.Alignof(*new(X__SsizeT)), 8}, + {"X__SyscallSlongT", "size", unsafe.Sizeof(*new(X__SyscallSlongT)), 8}, + {"X__SyscallSlongT", "alignment", unsafe.Alignof(*new(X__SyscallSlongT)), 8}, + {"X__SyscallUlongT", "size", unsafe.Sizeof(*new(X__SyscallUlongT)), 8}, + {"X__SyscallUlongT", "alignment", unsafe.Alignof(*new(X__SyscallUlongT)), 8}, + {"X__LoffT", "size", unsafe.Sizeof(*new(X__LoffT)), 8}, + {"X__LoffT", "alignment", unsafe.Alignof(*new(X__LoffT)), 8}, + {"X__QaddrT", "size", unsafe.Sizeof(*new(X__QaddrT)), 8}, + {"X__QaddrT", "alignment", unsafe.Alignof(*new(X__QaddrT)), 8}, + {"X__CaddrT", "size", unsafe.Sizeof(*new(X__CaddrT)), 8}, + {"X__CaddrT", "alignment", unsafe.Alignof(*new(X__CaddrT)), 8}, + {"X__IntptrT", "size", unsafe.Sizeof(*new(X__IntptrT)), 8}, + {"X__IntptrT", "alignment", unsafe.Alignof(*new(X__IntptrT)), 8}, + {"X__SocklenT", "size", unsafe.Sizeof(*new(X__SocklenT)), 4}, + {"X__SocklenT", "alignment", unsafe.Alignof(*new(X__SocklenT)), 4}, + {"Iovec", "size", unsafe.Sizeof(*new(Iovec)), 16}, + {"Iovec", "alignment", unsafe.Alignof(*new(Iovec)), 8}, + {"Iovec", "IovBase offset", unsafe.Offsetof((*new(Iovec)).IovBase), 0}, + {"Iovec", "IovBase size", unsafe.Sizeof((*new(Iovec)).IovBase), 8}, + {"Iovec", "IovBase alignment", unsafe.Alignof((*new(Iovec)).IovBase), 8}, + {"Iovec", "IovLen offset", unsafe.Offsetof((*new(Iovec)).IovLen), 8}, + {"Iovec", "IovLen size", unsafe.Sizeof((*new(Iovec)).IovLen), 8}, + {"Iovec", "IovLen alignment", unsafe.Alignof((*new(Iovec)).IovLen), 8}, + {"SizeT", "size", unsafe.Sizeof(*new(SizeT)), 8}, + {"SizeT", "alignment", unsafe.Alignof(*new(SizeT)), 8}, + {"IfNameindexT", "size", unsafe.Sizeof(*new(IfNameindexT)), 16}, + {"IfNameindexT", "alignment", unsafe.Alignof(*new(IfNameindexT)), 8}, + {"IfNameindexT", "IfIndex offset", unsafe.Offsetof((*new(IfNameindexT)).IfIndex), 0}, + {"IfNameindexT", "IfIndex size", unsafe.Sizeof((*new(IfNameindexT)).IfIndex), 4}, + {"IfNameindexT", "IfIndex alignment", unsafe.Alignof((*new(IfNameindexT)).IfIndex), 4}, + {"IfNameindexT", "IfName offset", unsafe.Offsetof((*new(IfNameindexT)).IfName), 8}, + {"IfNameindexT", "IfName size", unsafe.Sizeof((*new(IfNameindexT)).IfName), 8}, + {"IfNameindexT", "IfName alignment", unsafe.Alignof((*new(IfNameindexT)).IfName), 8}, + {"Ifaddr", "size", unsafe.Sizeof(*new(Ifaddr)), 48}, + {"Ifaddr", "alignment", unsafe.Alignof(*new(Ifaddr)), 8}, + {"Ifaddr", "IfaAddr offset", unsafe.Offsetof((*new(Ifaddr)).IfaAddr), 0}, + {"Ifaddr", "IfaAddr size", unsafe.Sizeof((*new(Ifaddr)).IfaAddr), 16}, + {"Ifaddr", "IfaAddr alignment", unsafe.Alignof((*new(Ifaddr)).IfaAddr), 2}, + {"Ifaddr", "IfaIfu offset", unsafe.Offsetof((*new(Ifaddr)).IfaIfu), 16}, + {"Ifaddr", "IfaIfu size", unsafe.Sizeof((*new(Ifaddr)).IfaIfu), 16}, + {"Ifaddr", "IfaIfu alignment", unsafe.Alignof((*new(Ifaddr)).IfaIfu), 2}, + {"Ifaddr", "IfaIfp offset", unsafe.Offsetof((*new(Ifaddr)).IfaIfp), 32}, + {"Ifaddr", "IfaIfp size", unsafe.Sizeof((*new(Ifaddr)).IfaIfp), 8}, + {"Ifaddr", "IfaIfp alignment", unsafe.Alignof((*new(Ifaddr)).IfaIfp), 8}, + {"Ifaddr", "IfaNext offset", unsafe.Offsetof((*new(Ifaddr)).IfaNext), 40}, + {"Ifaddr", "IfaNext size", unsafe.Sizeof((*new(Ifaddr)).IfaNext), 8}, + {"Ifaddr", "IfaNext alignment", unsafe.Alignof((*new(Ifaddr)).IfaNext), 8}, + {"Ifmap", "size", unsafe.Sizeof(*new(Ifmap)), 24}, + {"Ifmap", "alignment", unsafe.Alignof(*new(Ifmap)), 8}, + {"Ifmap", "MemStart offset", unsafe.Offsetof((*new(Ifmap)).MemStart), 0}, + {"Ifmap", "MemStart size", unsafe.Sizeof((*new(Ifmap)).MemStart), 8}, + {"Ifmap", "MemStart alignment", unsafe.Alignof((*new(Ifmap)).MemStart), 8}, + {"Ifmap", "MemEnd offset", unsafe.Offsetof((*new(Ifmap)).MemEnd), 8}, + {"Ifmap", "MemEnd size", unsafe.Sizeof((*new(Ifmap)).MemEnd), 8}, + {"Ifmap", "MemEnd alignment", unsafe.Alignof((*new(Ifmap)).MemEnd), 8}, + {"Ifmap", "BaseAddr offset", unsafe.Offsetof((*new(Ifmap)).BaseAddr), 16}, + {"Ifmap", "BaseAddr size", unsafe.Sizeof((*new(Ifmap)).BaseAddr), 2}, + {"Ifmap", "BaseAddr alignment", unsafe.Alignof((*new(Ifmap)).BaseAddr), 2}, + {"Ifmap", "Irq offset", unsafe.Offsetof((*new(Ifmap)).Irq), 18}, + {"Ifmap", "Irq size", unsafe.Sizeof((*new(Ifmap)).Irq), 1}, + {"Ifmap", "Irq alignment", unsafe.Alignof((*new(Ifmap)).Irq), 1}, + {"Ifmap", "Dma offset", unsafe.Offsetof((*new(Ifmap)).Dma), 19}, + {"Ifmap", "Dma size", unsafe.Sizeof((*new(Ifmap)).Dma), 1}, + {"Ifmap", "Dma alignment", unsafe.Alignof((*new(Ifmap)).Dma), 1}, + {"Ifmap", "Port offset", unsafe.Offsetof((*new(Ifmap)).Port), 20}, + {"Ifmap", "Port size", unsafe.Sizeof((*new(Ifmap)).Port), 1}, + {"Ifmap", "Port alignment", unsafe.Alignof((*new(Ifmap)).Port), 1}, + {"Ifreq", "size", unsafe.Sizeof(*new(Ifreq)), 40}, + {"Ifreq", "alignment", unsafe.Alignof(*new(Ifreq)), 8}, + {"Ifreq", "IfrIfrn offset", unsafe.Offsetof((*new(Ifreq)).IfrIfrn), 0}, + {"Ifreq", "IfrIfrn size", unsafe.Sizeof((*new(Ifreq)).IfrIfrn), 16}, + {"Ifreq", "IfrIfrn alignment", unsafe.Alignof((*new(Ifreq)).IfrIfrn), 1}, + {"Ifreq", "IfrIfru offset", unsafe.Offsetof((*new(Ifreq)).IfrIfru), 16}, + {"Ifreq", "IfrIfru size", unsafe.Sizeof((*new(Ifreq)).IfrIfru), 24}, + {"Ifreq", "IfrIfru alignment", unsafe.Alignof((*new(Ifreq)).IfrIfru), 8}, + {"Ifconf", "size", unsafe.Sizeof(*new(Ifconf)), 16}, + {"Ifconf", "alignment", unsafe.Alignof(*new(Ifconf)), 8}, + {"Ifconf", "IfcLen offset", unsafe.Offsetof((*new(Ifconf)).IfcLen), 0}, + {"Ifconf", "IfcLen size", unsafe.Sizeof((*new(Ifconf)).IfcLen), 4}, + {"Ifconf", "IfcLen alignment", unsafe.Alignof((*new(Ifconf)).IfcLen), 4}, + {"Ifconf", "IfcIfcu offset", unsafe.Offsetof((*new(Ifconf)).IfcIfcu), 8}, + {"Ifconf", "IfcIfcu size", unsafe.Sizeof((*new(Ifconf)).IfcIfcu), 8}, + {"Ifconf", "IfcIfcu alignment", unsafe.Alignof((*new(Ifconf)).IfcIfcu), 8}, + {"Iface", "pointer size", unsafe.Sizeof((*Iface)(nil)), 8}, + {"Iface", "pointer alignment", unsafe.Alignof((*Iface)(nil)), 8}, + {"Hostent", "size", unsafe.Sizeof(*new(Hostent)), 32}, + {"Hostent", "alignment", unsafe.Alignof(*new(Hostent)), 8}, + {"Hostent", "Name offset", unsafe.Offsetof((*new(Hostent)).Name), 0}, + {"Hostent", "Name size", unsafe.Sizeof((*new(Hostent)).Name), 8}, + {"Hostent", "Name alignment", unsafe.Alignof((*new(Hostent)).Name), 8}, + {"Hostent", "Aliases offset", unsafe.Offsetof((*new(Hostent)).Aliases), 8}, + {"Hostent", "Aliases size", unsafe.Sizeof((*new(Hostent)).Aliases), 8}, + {"Hostent", "Aliases alignment", unsafe.Alignof((*new(Hostent)).Aliases), 8}, + {"Hostent", "AddrType offset", unsafe.Offsetof((*new(Hostent)).AddrType), 16}, + {"Hostent", "AddrType size", unsafe.Sizeof((*new(Hostent)).AddrType), 4}, + {"Hostent", "AddrType alignment", unsafe.Alignof((*new(Hostent)).AddrType), 4}, + {"Hostent", "Length offset", unsafe.Offsetof((*new(Hostent)).Length), 20}, + {"Hostent", "Length size", unsafe.Sizeof((*new(Hostent)).Length), 4}, + {"Hostent", "Length alignment", unsafe.Alignof((*new(Hostent)).Length), 4}, + {"Hostent", "AddrList offset", unsafe.Offsetof((*new(Hostent)).AddrList), 24}, + {"Hostent", "AddrList size", unsafe.Sizeof((*new(Hostent)).AddrList), 8}, + {"Hostent", "AddrList alignment", unsafe.Alignof((*new(Hostent)).AddrList), 8}, + {"Servent", "size", unsafe.Sizeof(*new(Servent)), 32}, + {"Servent", "alignment", unsafe.Alignof(*new(Servent)), 8}, + {"Servent", "SName offset", unsafe.Offsetof((*new(Servent)).SName), 0}, + {"Servent", "SName size", unsafe.Sizeof((*new(Servent)).SName), 8}, + {"Servent", "SName alignment", unsafe.Alignof((*new(Servent)).SName), 8}, + {"Servent", "SAliases offset", unsafe.Offsetof((*new(Servent)).SAliases), 8}, + {"Servent", "SAliases size", unsafe.Sizeof((*new(Servent)).SAliases), 8}, + {"Servent", "SAliases alignment", unsafe.Alignof((*new(Servent)).SAliases), 8}, + {"Servent", "SPort offset", unsafe.Offsetof((*new(Servent)).SPort), 16}, + {"Servent", "SPort size", unsafe.Sizeof((*new(Servent)).SPort), 4}, + {"Servent", "SPort alignment", unsafe.Alignof((*new(Servent)).SPort), 4}, + {"Servent", "SProto offset", unsafe.Offsetof((*new(Servent)).SProto), 24}, + {"Servent", "SProto size", unsafe.Sizeof((*new(Servent)).SProto), 8}, + {"Servent", "SProto alignment", unsafe.Alignof((*new(Servent)).SProto), 8}, + {"Protoent", "size", unsafe.Sizeof(*new(Protoent)), 24}, + {"Protoent", "alignment", unsafe.Alignof(*new(Protoent)), 8}, + {"Protoent", "PName offset", unsafe.Offsetof((*new(Protoent)).PName), 0}, + {"Protoent", "PName size", unsafe.Sizeof((*new(Protoent)).PName), 8}, + {"Protoent", "PName alignment", unsafe.Alignof((*new(Protoent)).PName), 8}, + {"Protoent", "PAliases offset", unsafe.Offsetof((*new(Protoent)).PAliases), 8}, + {"Protoent", "PAliases size", unsafe.Sizeof((*new(Protoent)).PAliases), 8}, + {"Protoent", "PAliases alignment", unsafe.Alignof((*new(Protoent)).PAliases), 8}, + {"Protoent", "PProto offset", unsafe.Offsetof((*new(Protoent)).PProto), 16}, + {"Protoent", "PProto size", unsafe.Sizeof((*new(Protoent)).PProto), 4}, + {"Protoent", "PProto alignment", unsafe.Alignof((*new(Protoent)).PProto), 4}, + {"AddrInfo", "size", unsafe.Sizeof(*new(AddrInfo)), 48}, + {"AddrInfo", "alignment", unsafe.Alignof(*new(AddrInfo)), 8}, + {"AddrInfo", "Flags offset", unsafe.Offsetof((*new(AddrInfo)).Flags), 0}, + {"AddrInfo", "Flags size", unsafe.Sizeof((*new(AddrInfo)).Flags), 4}, + {"AddrInfo", "Flags alignment", unsafe.Alignof((*new(AddrInfo)).Flags), 4}, + {"AddrInfo", "Family offset", unsafe.Offsetof((*new(AddrInfo)).Family), 4}, + {"AddrInfo", "Family size", unsafe.Sizeof((*new(AddrInfo)).Family), 4}, + {"AddrInfo", "Family alignment", unsafe.Alignof((*new(AddrInfo)).Family), 4}, + {"AddrInfo", "SockType offset", unsafe.Offsetof((*new(AddrInfo)).SockType), 8}, + {"AddrInfo", "SockType size", unsafe.Sizeof((*new(AddrInfo)).SockType), 4}, + {"AddrInfo", "SockType alignment", unsafe.Alignof((*new(AddrInfo)).SockType), 4}, + {"AddrInfo", "Protocol offset", unsafe.Offsetof((*new(AddrInfo)).Protocol), 12}, + {"AddrInfo", "Protocol size", unsafe.Sizeof((*new(AddrInfo)).Protocol), 4}, + {"AddrInfo", "Protocol alignment", unsafe.Alignof((*new(AddrInfo)).Protocol), 4}, + {"AddrInfo", "AddrLen offset", unsafe.Offsetof((*new(AddrInfo)).AddrLen), 16}, + {"AddrInfo", "AddrLen size", unsafe.Sizeof((*new(AddrInfo)).AddrLen), 4}, + {"AddrInfo", "AddrLen alignment", unsafe.Alignof((*new(AddrInfo)).AddrLen), 4}, + {"AddrInfo", "Addr offset", unsafe.Offsetof((*new(AddrInfo)).Addr), 24}, + {"AddrInfo", "Addr size", unsafe.Sizeof((*new(AddrInfo)).Addr), 8}, + {"AddrInfo", "Addr alignment", unsafe.Alignof((*new(AddrInfo)).Addr), 8}, + {"AddrInfo", "CanOnName offset", unsafe.Offsetof((*new(AddrInfo)).CanOnName), 32}, + {"AddrInfo", "CanOnName size", unsafe.Sizeof((*new(AddrInfo)).CanOnName), 8}, + {"AddrInfo", "CanOnName alignment", unsafe.Alignof((*new(AddrInfo)).CanOnName), 8}, + {"AddrInfo", "Next offset", unsafe.Offsetof((*new(AddrInfo)).Next), 40}, + {"AddrInfo", "Next size", unsafe.Sizeof((*new(AddrInfo)).Next), 8}, + {"AddrInfo", "Next alignment", unsafe.Alignof((*new(AddrInfo)).Next), 8}, + {"InAddr", "size", unsafe.Sizeof(*new(InAddr)), 4}, + {"InAddr", "alignment", unsafe.Alignof(*new(InAddr)), 4}, + {"InAddr", "Addr offset", unsafe.Offsetof((*new(InAddr)).Addr), 0}, + {"InAddr", "Addr size", unsafe.Sizeof((*new(InAddr)).Addr), 4}, + {"InAddr", "Addr alignment", unsafe.Alignof((*new(InAddr)).Addr), 4}, + {"In6Addr", "size", unsafe.Sizeof(*new(In6Addr)), 16}, + {"In6Addr", "alignment", unsafe.Alignof(*new(In6Addr)), 4}, + {"In6Addr", "U6Addr offset", unsafe.Offsetof((*new(In6Addr)).U6Addr), 0}, + {"In6Addr", "U6Addr size", unsafe.Sizeof((*new(In6Addr)).U6Addr), 16}, + {"In6Addr", "U6Addr alignment", unsafe.Alignof((*new(In6Addr)).U6Addr), 1}, + {"SockaddrIn", "size", unsafe.Sizeof(*new(SockaddrIn)), 16}, + {"SockaddrIn", "alignment", unsafe.Alignof(*new(SockaddrIn)), 4}, + {"SockaddrIn", "Family offset", unsafe.Offsetof((*new(SockaddrIn)).Family), 0}, + {"SockaddrIn", "Family size", unsafe.Sizeof((*new(SockaddrIn)).Family), 2}, + {"SockaddrIn", "Family alignment", unsafe.Alignof((*new(SockaddrIn)).Family), 2}, + {"SockaddrIn", "Port offset", unsafe.Offsetof((*new(SockaddrIn)).Port), 2}, + {"SockaddrIn", "Port size", unsafe.Sizeof((*new(SockaddrIn)).Port), 2}, + {"SockaddrIn", "Port alignment", unsafe.Alignof((*new(SockaddrIn)).Port), 2}, + {"SockaddrIn", "Addr offset", unsafe.Offsetof((*new(SockaddrIn)).Addr), 4}, + {"SockaddrIn", "Addr size", unsafe.Sizeof((*new(SockaddrIn)).Addr), 4}, + {"SockaddrIn", "Addr alignment", unsafe.Alignof((*new(SockaddrIn)).Addr), 4}, + {"SockaddrIn", "Zero offset", unsafe.Offsetof((*new(SockaddrIn)).Zero), 8}, + {"SockaddrIn", "Zero size", unsafe.Sizeof((*new(SockaddrIn)).Zero), 8}, + {"SockaddrIn", "Zero alignment", unsafe.Alignof((*new(SockaddrIn)).Zero), 1}, + {"SockaddrIn6", "size", unsafe.Sizeof(*new(SockaddrIn6)), 28}, + {"SockaddrIn6", "alignment", unsafe.Alignof(*new(SockaddrIn6)), 4}, + {"SockaddrIn6", "Family offset", unsafe.Offsetof((*new(SockaddrIn6)).Family), 0}, + {"SockaddrIn6", "Family size", unsafe.Sizeof((*new(SockaddrIn6)).Family), 2}, + {"SockaddrIn6", "Family alignment", unsafe.Alignof((*new(SockaddrIn6)).Family), 2}, + {"SockaddrIn6", "Port offset", unsafe.Offsetof((*new(SockaddrIn6)).Port), 2}, + {"SockaddrIn6", "Port size", unsafe.Sizeof((*new(SockaddrIn6)).Port), 2}, + {"SockaddrIn6", "Port alignment", unsafe.Alignof((*new(SockaddrIn6)).Port), 2}, + {"SockaddrIn6", "Flowinfo offset", unsafe.Offsetof((*new(SockaddrIn6)).Flowinfo), 4}, + {"SockaddrIn6", "Flowinfo size", unsafe.Sizeof((*new(SockaddrIn6)).Flowinfo), 4}, + {"SockaddrIn6", "Flowinfo alignment", unsafe.Alignof((*new(SockaddrIn6)).Flowinfo), 4}, + {"SockaddrIn6", "Addr offset", unsafe.Offsetof((*new(SockaddrIn6)).Addr), 8}, + {"SockaddrIn6", "Addr size", unsafe.Sizeof((*new(SockaddrIn6)).Addr), 16}, + {"SockaddrIn6", "Addr alignment", unsafe.Alignof((*new(SockaddrIn6)).Addr), 4}, + {"SockaddrIn6", "ScopeId offset", unsafe.Offsetof((*new(SockaddrIn6)).ScopeId), 24}, + {"SockaddrIn6", "ScopeId size", unsafe.Sizeof((*new(SockaddrIn6)).ScopeId), 4}, + {"SockaddrIn6", "ScopeId alignment", unsafe.Alignof((*new(SockaddrIn6)).ScopeId), 4}, + {"IpMreq", "size", unsafe.Sizeof(*new(IpMreq)), 8}, + {"IpMreq", "alignment", unsafe.Alignof(*new(IpMreq)), 4}, + {"IpMreq", "ImrMultiaddr offset", unsafe.Offsetof((*new(IpMreq)).ImrMultiaddr), 0}, + {"IpMreq", "ImrMultiaddr size", unsafe.Sizeof((*new(IpMreq)).ImrMultiaddr), 4}, + {"IpMreq", "ImrMultiaddr alignment", unsafe.Alignof((*new(IpMreq)).ImrMultiaddr), 4}, + {"IpMreq", "ImrInterface offset", unsafe.Offsetof((*new(IpMreq)).ImrInterface), 4}, + {"IpMreq", "ImrInterface size", unsafe.Sizeof((*new(IpMreq)).ImrInterface), 4}, + {"IpMreq", "ImrInterface alignment", unsafe.Alignof((*new(IpMreq)).ImrInterface), 4}, + {"IpMreqSource", "size", unsafe.Sizeof(*new(IpMreqSource)), 12}, + {"IpMreqSource", "alignment", unsafe.Alignof(*new(IpMreqSource)), 4}, + {"IpMreqSource", "ImrMultiaddr offset", unsafe.Offsetof((*new(IpMreqSource)).ImrMultiaddr), 0}, + {"IpMreqSource", "ImrMultiaddr size", unsafe.Sizeof((*new(IpMreqSource)).ImrMultiaddr), 4}, + {"IpMreqSource", "ImrMultiaddr alignment", unsafe.Alignof((*new(IpMreqSource)).ImrMultiaddr), 4}, + {"IpMreqSource", "ImrInterface offset", unsafe.Offsetof((*new(IpMreqSource)).ImrInterface), 4}, + {"IpMreqSource", "ImrInterface size", unsafe.Sizeof((*new(IpMreqSource)).ImrInterface), 4}, + {"IpMreqSource", "ImrInterface alignment", unsafe.Alignof((*new(IpMreqSource)).ImrInterface), 4}, + {"IpMreqSource", "ImrSourceaddr offset", unsafe.Offsetof((*new(IpMreqSource)).ImrSourceaddr), 8}, + {"IpMreqSource", "ImrSourceaddr size", unsafe.Sizeof((*new(IpMreqSource)).ImrSourceaddr), 4}, + {"IpMreqSource", "ImrSourceaddr alignment", unsafe.Alignof((*new(IpMreqSource)).ImrSourceaddr), 4}, + {"Ipv6Mreq", "size", unsafe.Sizeof(*new(Ipv6Mreq)), 20}, + {"Ipv6Mreq", "alignment", unsafe.Alignof(*new(Ipv6Mreq)), 4}, + {"Ipv6Mreq", "Ipv6mrMultiaddr offset", unsafe.Offsetof((*new(Ipv6Mreq)).Ipv6mrMultiaddr), 0}, + {"Ipv6Mreq", "Ipv6mrMultiaddr size", unsafe.Sizeof((*new(Ipv6Mreq)).Ipv6mrMultiaddr), 16}, + {"Ipv6Mreq", "Ipv6mrMultiaddr alignment", unsafe.Alignof((*new(Ipv6Mreq)).Ipv6mrMultiaddr), 4}, + {"Ipv6Mreq", "Ipv6mrInterface offset", unsafe.Offsetof((*new(Ipv6Mreq)).Ipv6mrInterface), 16}, + {"Ipv6Mreq", "Ipv6mrInterface size", unsafe.Sizeof((*new(Ipv6Mreq)).Ipv6mrInterface), 4}, + {"Ipv6Mreq", "Ipv6mrInterface alignment", unsafe.Alignof((*new(Ipv6Mreq)).Ipv6mrInterface), 4}, + {"GroupReq", "size", unsafe.Sizeof(*new(GroupReq)), 136}, + {"GroupReq", "alignment", unsafe.Alignof(*new(GroupReq)), 8}, + {"GroupReq", "GrInterface offset", unsafe.Offsetof((*new(GroupReq)).GrInterface), 0}, + {"GroupReq", "GrInterface size", unsafe.Sizeof((*new(GroupReq)).GrInterface), 4}, + {"GroupReq", "GrInterface alignment", unsafe.Alignof((*new(GroupReq)).GrInterface), 4}, + {"GroupReq", "GrGroup offset", unsafe.Offsetof((*new(GroupReq)).GrGroup), 8}, + {"GroupReq", "GrGroup size", unsafe.Sizeof((*new(GroupReq)).GrGroup), 128}, + {"GroupReq", "GrGroup alignment", unsafe.Alignof((*new(GroupReq)).GrGroup), 8}, + {"GroupSourceReq", "size", unsafe.Sizeof(*new(GroupSourceReq)), 264}, + {"GroupSourceReq", "alignment", unsafe.Alignof(*new(GroupSourceReq)), 8}, + {"GroupSourceReq", "GsrInterface offset", unsafe.Offsetof((*new(GroupSourceReq)).GsrInterface), 0}, + {"GroupSourceReq", "GsrInterface size", unsafe.Sizeof((*new(GroupSourceReq)).GsrInterface), 4}, + {"GroupSourceReq", "GsrInterface alignment", unsafe.Alignof((*new(GroupSourceReq)).GsrInterface), 4}, + {"GroupSourceReq", "GsrGroup offset", unsafe.Offsetof((*new(GroupSourceReq)).GsrGroup), 8}, + {"GroupSourceReq", "GsrGroup size", unsafe.Sizeof((*new(GroupSourceReq)).GsrGroup), 128}, + {"GroupSourceReq", "GsrGroup alignment", unsafe.Alignof((*new(GroupSourceReq)).GsrGroup), 8}, + {"GroupSourceReq", "GsrSource offset", unsafe.Offsetof((*new(GroupSourceReq)).GsrSource), 136}, + {"GroupSourceReq", "GsrSource size", unsafe.Sizeof((*new(GroupSourceReq)).GsrSource), 128}, + {"GroupSourceReq", "GsrSource alignment", unsafe.Alignof((*new(GroupSourceReq)).GsrSource), 8}, + {"IpMsfilter", "size", unsafe.Sizeof(*new(IpMsfilter)), 20}, + {"IpMsfilter", "alignment", unsafe.Alignof(*new(IpMsfilter)), 4}, + {"IpMsfilter", "ImsfMultiaddr offset", unsafe.Offsetof((*new(IpMsfilter)).ImsfMultiaddr), 0}, + {"IpMsfilter", "ImsfMultiaddr size", unsafe.Sizeof((*new(IpMsfilter)).ImsfMultiaddr), 4}, + {"IpMsfilter", "ImsfMultiaddr alignment", unsafe.Alignof((*new(IpMsfilter)).ImsfMultiaddr), 4}, + {"IpMsfilter", "ImsfInterface offset", unsafe.Offsetof((*new(IpMsfilter)).ImsfInterface), 4}, + {"IpMsfilter", "ImsfInterface size", unsafe.Sizeof((*new(IpMsfilter)).ImsfInterface), 4}, + {"IpMsfilter", "ImsfInterface alignment", unsafe.Alignof((*new(IpMsfilter)).ImsfInterface), 4}, + {"IpMsfilter", "ImsfFmode offset", unsafe.Offsetof((*new(IpMsfilter)).ImsfFmode), 8}, + {"IpMsfilter", "ImsfFmode size", unsafe.Sizeof((*new(IpMsfilter)).ImsfFmode), 4}, + {"IpMsfilter", "ImsfFmode alignment", unsafe.Alignof((*new(IpMsfilter)).ImsfFmode), 4}, + {"IpMsfilter", "ImsfNumsrc offset", unsafe.Offsetof((*new(IpMsfilter)).ImsfNumsrc), 12}, + {"IpMsfilter", "ImsfNumsrc size", unsafe.Sizeof((*new(IpMsfilter)).ImsfNumsrc), 4}, + {"IpMsfilter", "ImsfNumsrc alignment", unsafe.Alignof((*new(IpMsfilter)).ImsfNumsrc), 4}, + {"IpMsfilter", "ImsfSlist offset", unsafe.Offsetof((*new(IpMsfilter)).ImsfSlist), 16}, + {"IpMsfilter", "ImsfSlist size", unsafe.Sizeof((*new(IpMsfilter)).ImsfSlist), 4}, + {"IpMsfilter", "ImsfSlist alignment", unsafe.Alignof((*new(IpMsfilter)).ImsfSlist), 4}, + {"GroupFilter", "size", unsafe.Sizeof(*new(GroupFilter)), 272}, + {"GroupFilter", "alignment", unsafe.Alignof(*new(GroupFilter)), 8}, + {"GroupFilter", "GfInterface offset", unsafe.Offsetof((*new(GroupFilter)).GfInterface), 0}, + {"GroupFilter", "GfInterface size", unsafe.Sizeof((*new(GroupFilter)).GfInterface), 4}, + {"GroupFilter", "GfInterface alignment", unsafe.Alignof((*new(GroupFilter)).GfInterface), 4}, + {"GroupFilter", "GfGroup offset", unsafe.Offsetof((*new(GroupFilter)).GfGroup), 8}, + {"GroupFilter", "GfGroup size", unsafe.Sizeof((*new(GroupFilter)).GfGroup), 128}, + {"GroupFilter", "GfGroup alignment", unsafe.Alignof((*new(GroupFilter)).GfGroup), 8}, + {"GroupFilter", "GfFmode offset", unsafe.Offsetof((*new(GroupFilter)).GfFmode), 136}, + {"GroupFilter", "GfFmode size", unsafe.Sizeof((*new(GroupFilter)).GfFmode), 4}, + {"GroupFilter", "GfFmode alignment", unsafe.Alignof((*new(GroupFilter)).GfFmode), 4}, + {"GroupFilter", "GfNumsrc offset", unsafe.Offsetof((*new(GroupFilter)).GfNumsrc), 140}, + {"GroupFilter", "GfNumsrc size", unsafe.Sizeof((*new(GroupFilter)).GfNumsrc), 4}, + {"GroupFilter", "GfNumsrc alignment", unsafe.Alignof((*new(GroupFilter)).GfNumsrc), 4}, + {"GroupFilter", "GfSlist offset", unsafe.Offsetof((*new(GroupFilter)).GfSlist), 144}, + {"GroupFilter", "GfSlist size", unsafe.Sizeof((*new(GroupFilter)).GfSlist), 128}, + {"GroupFilter", "GfSlist alignment", unsafe.Alignof((*new(GroupFilter)).GfSlist), 8}, + {"InAddrT", "size", unsafe.Sizeof(*new(InAddrT)), 4}, + {"InAddrT", "alignment", unsafe.Alignof(*new(InAddrT)), 4}, + {"InPortT", "size", unsafe.Sizeof(*new(InPortT)), 2}, + {"InPortT", "alignment", unsafe.Alignof(*new(InPortT)), 2}, + {"Rpcent", "size", unsafe.Sizeof(*new(Rpcent)), 24}, + {"Rpcent", "alignment", unsafe.Alignof(*new(Rpcent)), 8}, + {"Rpcent", "RName offset", unsafe.Offsetof((*new(Rpcent)).RName), 0}, + {"Rpcent", "RName size", unsafe.Sizeof((*new(Rpcent)).RName), 8}, + {"Rpcent", "RName alignment", unsafe.Alignof((*new(Rpcent)).RName), 8}, + {"Rpcent", "RAliases offset", unsafe.Offsetof((*new(Rpcent)).RAliases), 8}, + {"Rpcent", "RAliases size", unsafe.Sizeof((*new(Rpcent)).RAliases), 8}, + {"Rpcent", "RAliases alignment", unsafe.Alignof((*new(Rpcent)).RAliases), 8}, + {"Rpcent", "RNumber offset", unsafe.Offsetof((*new(Rpcent)).RNumber), 16}, + {"Rpcent", "RNumber size", unsafe.Sizeof((*new(Rpcent)).RNumber), 4}, + {"Rpcent", "RNumber alignment", unsafe.Alignof((*new(Rpcent)).RNumber), 4}, + {"Uint16T", "size", unsafe.Sizeof(*new(Uint16T)), 2}, + {"Uint16T", "alignment", unsafe.Alignof(*new(Uint16T)), 2}, + {"Uint32T", "size", unsafe.Sizeof(*new(Uint32T)), 4}, + {"Uint32T", "alignment", unsafe.Alignof(*new(Uint32T)), 4}, + {"Osockaddr", "size", unsafe.Sizeof(*new(Osockaddr)), 16}, + {"Osockaddr", "alignment", unsafe.Alignof(*new(Osockaddr)), 2}, + {"Osockaddr", "SaFamily offset", unsafe.Offsetof((*new(Osockaddr)).SaFamily), 0}, + {"Osockaddr", "SaFamily size", unsafe.Sizeof((*new(Osockaddr)).SaFamily), 2}, + {"Osockaddr", "SaFamily alignment", unsafe.Alignof((*new(Osockaddr)).SaFamily), 2}, + {"Osockaddr", "SaData offset", unsafe.Offsetof((*new(Osockaddr)).SaData), 2}, + {"Osockaddr", "SaData size", unsafe.Sizeof((*new(Osockaddr)).SaData), 14}, + {"Osockaddr", "SaData alignment", unsafe.Alignof((*new(Osockaddr)).SaData), 1}, + {"SsizeT", "size", unsafe.Sizeof(*new(SsizeT)), 8}, + {"SsizeT", "alignment", unsafe.Alignof(*new(SsizeT)), 8}, + {"SockaddrUn", "size", unsafe.Sizeof(*new(SockaddrUn)), 110}, + {"SockaddrUn", "alignment", unsafe.Alignof(*new(SockaddrUn)), 2}, + {"SockaddrUn", "SunFamily offset", unsafe.Offsetof((*new(SockaddrUn)).SunFamily), 0}, + {"SockaddrUn", "SunFamily size", unsafe.Sizeof((*new(SockaddrUn)).SunFamily), 2}, + {"SockaddrUn", "SunFamily alignment", unsafe.Alignof((*new(SockaddrUn)).SunFamily), 2}, + {"SockaddrUn", "SunPath offset", unsafe.Offsetof((*new(SockaddrUn)).SunPath), 2}, + {"SockaddrUn", "SunPath size", unsafe.Sizeof((*new(SockaddrUn)).SunPath), 108}, + {"SockaddrUn", "SunPath alignment", unsafe.Alignof((*new(SockaddrUn)).SunPath), 1}, + {"In6addrAny", "global size", unsafe.Sizeof(In6addrAny), 16}, + {"In6addrAny", "global alignment", unsafe.Alignof(In6addrAny), 4}, + {"In6addrLoopback", "global size", unsafe.Sizeof(In6addrLoopback), 16}, + {"In6addrLoopback", "global alignment", unsafe.Alignof(In6addrLoopback), 4}, + } + var networkIntegerConstants = []struct { + name string + got, want int64 + }{ + {"X_ARPA_INET_H", int64(X_ARPA_INET_H), 1}, + {"SOL_SOCKET", int64(SOL_SOCKET), 1}, + {"SO_DEBUG", int64(SO_DEBUG), 1}, + {"SO_REUSEADDR", int64(SO_REUSEADDR), 2}, + {"SO_TYPE", int64(SO_TYPE), 3}, + {"SO_ERROR", int64(SO_ERROR), 4}, + {"SO_DONTROUTE", int64(SO_DONTROUTE), 5}, + {"SO_BROADCAST", int64(SO_BROADCAST), 6}, + {"SO_SNDBUF", int64(SO_SNDBUF), 7}, + {"SO_RCVBUF", int64(SO_RCVBUF), 8}, + {"SO_SNDBUFFORCE", int64(SO_SNDBUFFORCE), 32}, + {"SO_RCVBUFFORCE", int64(SO_RCVBUFFORCE), 33}, + {"SO_KEEPALIVE", int64(SO_KEEPALIVE), 9}, + {"SO_OOBINLINE", int64(SO_OOBINLINE), 10}, + {"SO_NO_CHECK", int64(SO_NO_CHECK), 11}, + {"SO_PRIORITY", int64(SO_PRIORITY), 12}, + {"SO_LINGER", int64(SO_LINGER), 13}, + {"SO_BSDCOMPAT", int64(SO_BSDCOMPAT), 14}, + {"SO_REUSEPORT", int64(SO_REUSEPORT), 15}, + {"SO_PASSCRED", int64(SO_PASSCRED), 16}, + {"SO_PEERCRED", int64(SO_PEERCRED), 17}, + {"SO_RCVLOWAT", int64(SO_RCVLOWAT), 18}, + {"SO_SNDLOWAT", int64(SO_SNDLOWAT), 19}, + {"SO_RCVTIMEO", int64(SO_RCVTIMEO), 20}, + {"SO_SNDTIMEO", int64(SO_SNDTIMEO), 21}, + {"SO_SECURITY_AUTHENTICATION", int64(SO_SECURITY_AUTHENTICATION), 22}, + {"SO_SECURITY_ENCRYPTION_TRANSPORT", int64(SO_SECURITY_ENCRYPTION_TRANSPORT), 23}, + {"SO_SECURITY_ENCRYPTION_NETWORK", int64(SO_SECURITY_ENCRYPTION_NETWORK), 24}, + {"SO_BINDTODEVICE", int64(SO_BINDTODEVICE), 25}, + {"SO_ATTACH_FILTER", int64(SO_ATTACH_FILTER), 26}, + {"SO_DETACH_FILTER", int64(SO_DETACH_FILTER), 27}, + {"SO_GET_FILTER", int64(SO_GET_FILTER), 26}, + {"SO_PEERNAME", int64(SO_PEERNAME), 28}, + {"SO_TIMESTAMP", int64(SO_TIMESTAMP), 29}, + {"SCM_TIMESTAMP", int64(SCM_TIMESTAMP), 29}, + {"SO_ACCEPTCONN", int64(SO_ACCEPTCONN), 30}, + {"SO_PEERSEC", int64(SO_PEERSEC), 31}, + {"SO_PASSSEC", int64(SO_PASSSEC), 34}, + {"SO_TIMESTAMPNS", int64(SO_TIMESTAMPNS), 35}, + {"SCM_TIMESTAMPNS", int64(SCM_TIMESTAMPNS), 35}, + {"SO_MARK", int64(SO_MARK), 36}, + {"SO_TIMESTAMPING", int64(SO_TIMESTAMPING), 37}, + {"SCM_TIMESTAMPING", int64(SCM_TIMESTAMPING), 37}, + {"SO_PROTOCOL", int64(SO_PROTOCOL), 38}, + {"SO_DOMAIN", int64(SO_DOMAIN), 39}, + {"SO_RXQ_OVFL", int64(SO_RXQ_OVFL), 40}, + {"SO_WIFI_STATUS", int64(SO_WIFI_STATUS), 41}, + {"SCM_WIFI_STATUS", int64(SCM_WIFI_STATUS), 41}, + {"SO_PEEK_OFF", int64(SO_PEEK_OFF), 42}, + {"SO_NOFCS", int64(SO_NOFCS), 43}, + {"SO_LOCK_FILTER", int64(SO_LOCK_FILTER), 44}, + {"SO_SELECT_ERR_QUEUE", int64(SO_SELECT_ERR_QUEUE), 45}, + {"FIOSETOWN", int64(FIOSETOWN), 35073}, + {"SIOCSPGRP", int64(SIOCSPGRP), 35074}, + {"FIOGETOWN", int64(FIOGETOWN), 35075}, + {"SIOCGPGRP", int64(SIOCGPGRP), 35076}, + {"SIOCATMARK", int64(SIOCATMARK), 35077}, + {"SIOCGSTAMP", int64(SIOCGSTAMP), 35078}, + {"SIOCGSTAMPNS", int64(SIOCGSTAMPNS), 35079}, + {"X__USE_KERNEL_IPV6_DEFS", int64(X__USE_KERNEL_IPV6_DEFS), 0}, + {"IP_OPTIONS", int64(IP_OPTIONS), 4}, + {"IP_HDRINCL", int64(IP_HDRINCL), 3}, + {"IP_TOS", int64(IP_TOS), 1}, + {"IP_TTL", int64(IP_TTL), 2}, + {"IP_RECVOPTS", int64(IP_RECVOPTS), 6}, + {"IP_RETOPTS", int64(IP_RETOPTS), 7}, + {"IP_MULTICAST_IF", int64(IP_MULTICAST_IF), 32}, + {"IP_MULTICAST_TTL", int64(IP_MULTICAST_TTL), 33}, + {"IP_MULTICAST_LOOP", int64(IP_MULTICAST_LOOP), 34}, + {"IP_ADD_MEMBERSHIP", int64(IP_ADD_MEMBERSHIP), 35}, + {"IP_DROP_MEMBERSHIP", int64(IP_DROP_MEMBERSHIP), 36}, + {"IP_UNBLOCK_SOURCE", int64(IP_UNBLOCK_SOURCE), 37}, + {"IP_BLOCK_SOURCE", int64(IP_BLOCK_SOURCE), 38}, + {"IP_ADD_SOURCE_MEMBERSHIP", int64(IP_ADD_SOURCE_MEMBERSHIP), 39}, + {"IP_DROP_SOURCE_MEMBERSHIP", int64(IP_DROP_SOURCE_MEMBERSHIP), 40}, + {"IP_MSFILTER", int64(IP_MSFILTER), 41}, + {"MCAST_JOIN_GROUP", int64(MCAST_JOIN_GROUP), 42}, + {"MCAST_BLOCK_SOURCE", int64(MCAST_BLOCK_SOURCE), 43}, + {"MCAST_UNBLOCK_SOURCE", int64(MCAST_UNBLOCK_SOURCE), 44}, + {"MCAST_LEAVE_GROUP", int64(MCAST_LEAVE_GROUP), 45}, + {"MCAST_JOIN_SOURCE_GROUP", int64(MCAST_JOIN_SOURCE_GROUP), 46}, + {"MCAST_LEAVE_SOURCE_GROUP", int64(MCAST_LEAVE_SOURCE_GROUP), 47}, + {"MCAST_MSFILTER", int64(MCAST_MSFILTER), 48}, + {"IP_MULTICAST_ALL", int64(IP_MULTICAST_ALL), 49}, + {"IP_UNICAST_IF", int64(IP_UNICAST_IF), 50}, + {"MCAST_EXCLUDE", int64(MCAST_EXCLUDE), 0}, + {"MCAST_INCLUDE", int64(MCAST_INCLUDE), 1}, + {"IP_ROUTER_ALERT", int64(IP_ROUTER_ALERT), 5}, + {"IP_PKTINFO", int64(IP_PKTINFO), 8}, + {"IP_PKTOPTIONS", int64(IP_PKTOPTIONS), 9}, + {"IP_PMTUDISC", int64(IP_PMTUDISC), 10}, + {"IP_MTU_DISCOVER", int64(IP_MTU_DISCOVER), 10}, + {"IP_RECVERR", int64(IP_RECVERR), 11}, + {"IP_RECVTTL", int64(IP_RECVTTL), 12}, + {"IP_RECVTOS", int64(IP_RECVTOS), 13}, + {"IP_MTU", int64(IP_MTU), 14}, + {"IP_FREEBIND", int64(IP_FREEBIND), 15}, + {"IP_IPSEC_POLICY", int64(IP_IPSEC_POLICY), 16}, + {"IP_XFRM_POLICY", int64(IP_XFRM_POLICY), 17}, + {"IP_PASSSEC", int64(IP_PASSSEC), 18}, + {"IP_TRANSPARENT", int64(IP_TRANSPARENT), 19}, + {"IP_ORIGDSTADDR", int64(IP_ORIGDSTADDR), 20}, + {"IP_RECVORIGDSTADDR", int64(IP_RECVORIGDSTADDR), 20}, + {"IP_MINTTL", int64(IP_MINTTL), 21}, + {"IP_NODEFRAG", int64(IP_NODEFRAG), 22}, + {"IP_CHECKSUM", int64(IP_CHECKSUM), 23}, + {"IP_BIND_ADDRESS_NO_PORT", int64(IP_BIND_ADDRESS_NO_PORT), 24}, + {"IP_PMTUDISC_DONT", int64(IP_PMTUDISC_DONT), 0}, + {"IP_PMTUDISC_WANT", int64(IP_PMTUDISC_WANT), 1}, + {"IP_PMTUDISC_DO", int64(IP_PMTUDISC_DO), 2}, + {"IP_PMTUDISC_PROBE", int64(IP_PMTUDISC_PROBE), 3}, + {"IP_PMTUDISC_INTERFACE", int64(IP_PMTUDISC_INTERFACE), 4}, + {"IP_PMTUDISC_OMIT", int64(IP_PMTUDISC_OMIT), 5}, + {"SOL_IP", int64(SOL_IP), 0}, + {"IP_DEFAULT_MULTICAST_TTL", int64(IP_DEFAULT_MULTICAST_TTL), 1}, + {"IP_DEFAULT_MULTICAST_LOOP", int64(IP_DEFAULT_MULTICAST_LOOP), 1}, + {"IP_MAX_MEMBERSHIPS", int64(IP_MAX_MEMBERSHIPS), 20}, + {"IPV6_ADDRFORM", int64(IPV6_ADDRFORM), 1}, + {"IPV6_2292PKTINFO", int64(IPV6_2292PKTINFO), 2}, + {"IPV6_2292HOPOPTS", int64(IPV6_2292HOPOPTS), 3}, + {"IPV6_2292DSTOPTS", int64(IPV6_2292DSTOPTS), 4}, + {"IPV6_2292RTHDR", int64(IPV6_2292RTHDR), 5}, + {"IPV6_2292PKTOPTIONS", int64(IPV6_2292PKTOPTIONS), 6}, + {"IPV6_CHECKSUM", int64(IPV6_CHECKSUM), 7}, + {"IPV6_2292HOPLIMIT", int64(IPV6_2292HOPLIMIT), 8}, + {"IPV6_NEXTHOP", int64(IPV6_NEXTHOP), 9}, + {"IPV6_AUTHHDR", int64(IPV6_AUTHHDR), 10}, + {"IPV6_UNICAST_HOPS", int64(IPV6_UNICAST_HOPS), 16}, + {"IPV6_MULTICAST_IF", int64(IPV6_MULTICAST_IF), 17}, + {"IPV6_MULTICAST_HOPS", int64(IPV6_MULTICAST_HOPS), 18}, + {"IPV6_MULTICAST_LOOP", int64(IPV6_MULTICAST_LOOP), 19}, + {"IPV6_JOIN_GROUP", int64(IPV6_JOIN_GROUP), 20}, + {"IPV6_LEAVE_GROUP", int64(IPV6_LEAVE_GROUP), 21}, + {"IPV6_ROUTER_ALERT", int64(IPV6_ROUTER_ALERT), 22}, + {"IPV6_MTU_DISCOVER", int64(IPV6_MTU_DISCOVER), 23}, + {"IPV6_MTU", int64(IPV6_MTU), 24}, + {"IPV6_RECVERR", int64(IPV6_RECVERR), 25}, + {"IPV6_V6ONLY", int64(IPV6_V6ONLY), 26}, + {"IPV6_JOIN_ANYCAST", int64(IPV6_JOIN_ANYCAST), 27}, + {"IPV6_LEAVE_ANYCAST", int64(IPV6_LEAVE_ANYCAST), 28}, + {"IPV6_IPSEC_POLICY", int64(IPV6_IPSEC_POLICY), 34}, + {"IPV6_XFRM_POLICY", int64(IPV6_XFRM_POLICY), 35}, + {"IPV6_HDRINCL", int64(IPV6_HDRINCL), 36}, + {"IPV6_RECVPKTINFO", int64(IPV6_RECVPKTINFO), 49}, + {"IPV6_PKTINFO", int64(IPV6_PKTINFO), 50}, + {"IPV6_RECVHOPLIMIT", int64(IPV6_RECVHOPLIMIT), 51}, + {"IPV6_HOPLIMIT", int64(IPV6_HOPLIMIT), 52}, + {"IPV6_RECVHOPOPTS", int64(IPV6_RECVHOPOPTS), 53}, + {"IPV6_HOPOPTS", int64(IPV6_HOPOPTS), 54}, + {"IPV6_RTHDRDSTOPTS", int64(IPV6_RTHDRDSTOPTS), 55}, + {"IPV6_RECVRTHDR", int64(IPV6_RECVRTHDR), 56}, + {"IPV6_RTHDR", int64(IPV6_RTHDR), 57}, + {"IPV6_RECVDSTOPTS", int64(IPV6_RECVDSTOPTS), 58}, + {"IPV6_DSTOPTS", int64(IPV6_DSTOPTS), 59}, + {"IPV6_RECVPATHMTU", int64(IPV6_RECVPATHMTU), 60}, + {"IPV6_PATHMTU", int64(IPV6_PATHMTU), 61}, + {"IPV6_DONTFRAG", int64(IPV6_DONTFRAG), 62}, + {"IPV6_RECVTCLASS", int64(IPV6_RECVTCLASS), 66}, + {"IPV6_TCLASS", int64(IPV6_TCLASS), 67}, + {"IPV6_ADD_MEMBERSHIP", int64(IPV6_ADD_MEMBERSHIP), 20}, + {"IPV6_DROP_MEMBERSHIP", int64(IPV6_DROP_MEMBERSHIP), 21}, + {"IPV6_RXHOPOPTS", int64(IPV6_RXHOPOPTS), 54}, + {"IPV6_RXDSTOPTS", int64(IPV6_RXDSTOPTS), 59}, + {"IPV6_PMTUDISC_DONT", int64(IPV6_PMTUDISC_DONT), 0}, + {"IPV6_PMTUDISC_WANT", int64(IPV6_PMTUDISC_WANT), 1}, + {"IPV6_PMTUDISC_DO", int64(IPV6_PMTUDISC_DO), 2}, + {"IPV6_PMTUDISC_PROBE", int64(IPV6_PMTUDISC_PROBE), 3}, + {"IPV6_PMTUDISC_INTERFACE", int64(IPV6_PMTUDISC_INTERFACE), 4}, + {"IPV6_PMTUDISC_OMIT", int64(IPV6_PMTUDISC_OMIT), 5}, + {"SOL_IPV6", int64(SOL_IPV6), 41}, + {"SOL_ICMPV6", int64(SOL_ICMPV6), 58}, + {"IPV6_RTHDR_LOOSE", int64(IPV6_RTHDR_LOOSE), 0}, + {"IPV6_RTHDR_STRICT", int64(IPV6_RTHDR_STRICT), 1}, + {"IPV6_RTHDR_TYPE_0", int64(IPV6_RTHDR_TYPE_0), 0}, + {"X_BITS_SOCKADDR_H", int64(X_BITS_SOCKADDR_H), 1}, + {"X_SS_SIZE", int64(X_SS_SIZE), 128}, + {"PF_UNSPEC", int64(PF_UNSPEC), 0}, + {"PF_LOCAL", int64(PF_LOCAL), 1}, + {"PF_UNIX", int64(PF_UNIX), 1}, + {"PF_FILE", int64(PF_FILE), 1}, + {"PF_INET", int64(PF_INET), 2}, + {"PF_AX25", int64(PF_AX25), 3}, + {"PF_IPX", int64(PF_IPX), 4}, + {"PF_APPLETALK", int64(PF_APPLETALK), 5}, + {"PF_NETROM", int64(PF_NETROM), 6}, + {"PF_BRIDGE", int64(PF_BRIDGE), 7}, + {"PF_ATMPVC", int64(PF_ATMPVC), 8}, + {"PF_X25", int64(PF_X25), 9}, + {"PF_INET6", int64(PF_INET6), 10}, + {"PF_ROSE", int64(PF_ROSE), 11}, + {"PF_DECnet", int64(PF_DECnet), 12}, + {"PF_NETBEUI", int64(PF_NETBEUI), 13}, + {"PF_SECURITY", int64(PF_SECURITY), 14}, + {"PF_KEY", int64(PF_KEY), 15}, + {"PF_NETLINK", int64(PF_NETLINK), 16}, + {"PF_ROUTE", int64(PF_ROUTE), 16}, + {"PF_PACKET", int64(PF_PACKET), 17}, + {"PF_ASH", int64(PF_ASH), 18}, + {"PF_ECONET", int64(PF_ECONET), 19}, + {"PF_ATMSVC", int64(PF_ATMSVC), 20}, + {"PF_RDS", int64(PF_RDS), 21}, + {"PF_SNA", int64(PF_SNA), 22}, + {"PF_IRDA", int64(PF_IRDA), 23}, + {"PF_PPPOX", int64(PF_PPPOX), 24}, + {"PF_WANPIPE", int64(PF_WANPIPE), 25}, + {"PF_LLC", int64(PF_LLC), 26}, + {"PF_IB", int64(PF_IB), 27}, + {"PF_MPLS", int64(PF_MPLS), 28}, + {"PF_CAN", int64(PF_CAN), 29}, + {"PF_TIPC", int64(PF_TIPC), 30}, + {"PF_BLUETOOTH", int64(PF_BLUETOOTH), 31}, + {"PF_IUCV", int64(PF_IUCV), 32}, + {"PF_RXRPC", int64(PF_RXRPC), 33}, + {"PF_ISDN", int64(PF_ISDN), 34}, + {"PF_PHONET", int64(PF_PHONET), 35}, + {"PF_IEEE802154", int64(PF_IEEE802154), 36}, + {"PF_CAIF", int64(PF_CAIF), 37}, + {"PF_ALG", int64(PF_ALG), 38}, + {"PF_NFC", int64(PF_NFC), 39}, + {"PF_VSOCK", int64(PF_VSOCK), 40}, + {"PF_KCM", int64(PF_KCM), 41}, + {"PF_MAX", int64(PF_MAX), 42}, + {"AF_UNSPEC", int64(AF_UNSPEC), 0}, + {"AF_LOCAL", int64(AF_LOCAL), 1}, + {"AF_UNIX", int64(AF_UNIX), 1}, + {"AF_FILE", int64(AF_FILE), 1}, + {"AF_INET", int64(AF_INET), 2}, + {"AF_AX25", int64(AF_AX25), 3}, + {"AF_IPX", int64(AF_IPX), 4}, + {"AF_APPLETALK", int64(AF_APPLETALK), 5}, + {"AF_NETROM", int64(AF_NETROM), 6}, + {"AF_BRIDGE", int64(AF_BRIDGE), 7}, + {"AF_ATMPVC", int64(AF_ATMPVC), 8}, + {"AF_X25", int64(AF_X25), 9}, + {"AF_INET6", int64(AF_INET6), 10}, + {"AF_ROSE", int64(AF_ROSE), 11}, + {"AF_DECnet", int64(AF_DECnet), 12}, + {"AF_NETBEUI", int64(AF_NETBEUI), 13}, + {"AF_SECURITY", int64(AF_SECURITY), 14}, + {"AF_KEY", int64(AF_KEY), 15}, + {"AF_NETLINK", int64(AF_NETLINK), 16}, + {"AF_ROUTE", int64(AF_ROUTE), 16}, + {"AF_PACKET", int64(AF_PACKET), 17}, + {"AF_ASH", int64(AF_ASH), 18}, + {"AF_ECONET", int64(AF_ECONET), 19}, + {"AF_ATMSVC", int64(AF_ATMSVC), 20}, + {"AF_RDS", int64(AF_RDS), 21}, + {"AF_SNA", int64(AF_SNA), 22}, + {"AF_IRDA", int64(AF_IRDA), 23}, + {"AF_PPPOX", int64(AF_PPPOX), 24}, + {"AF_WANPIPE", int64(AF_WANPIPE), 25}, + {"AF_LLC", int64(AF_LLC), 26}, + {"AF_IB", int64(AF_IB), 27}, + {"AF_MPLS", int64(AF_MPLS), 28}, + {"AF_CAN", int64(AF_CAN), 29}, + {"AF_TIPC", int64(AF_TIPC), 30}, + {"AF_BLUETOOTH", int64(AF_BLUETOOTH), 31}, + {"AF_IUCV", int64(AF_IUCV), 32}, + {"AF_RXRPC", int64(AF_RXRPC), 33}, + {"AF_ISDN", int64(AF_ISDN), 34}, + {"AF_PHONET", int64(AF_PHONET), 35}, + {"AF_IEEE802154", int64(AF_IEEE802154), 36}, + {"AF_CAIF", int64(AF_CAIF), 37}, + {"AF_ALG", int64(AF_ALG), 38}, + {"AF_NFC", int64(AF_NFC), 39}, + {"AF_VSOCK", int64(AF_VSOCK), 40}, + {"AF_KCM", int64(AF_KCM), 41}, + {"AF_MAX", int64(AF_MAX), 42}, + {"SOL_RAW", int64(SOL_RAW), 255}, + {"SOL_DECNET", int64(SOL_DECNET), 261}, + {"SOL_X25", int64(SOL_X25), 262}, + {"SOL_PACKET", int64(SOL_PACKET), 263}, + {"SOL_ATM", int64(SOL_ATM), 264}, + {"SOL_AAL", int64(SOL_AAL), 265}, + {"SOL_IRDA", int64(SOL_IRDA), 266}, + {"SOL_NETBEUI", int64(SOL_NETBEUI), 267}, + {"SOL_LLC", int64(SOL_LLC), 268}, + {"SOL_DCCP", int64(SOL_DCCP), 269}, + {"SOL_NETLINK", int64(SOL_NETLINK), 270}, + {"SOL_TIPC", int64(SOL_TIPC), 271}, + {"SOL_RXRPC", int64(SOL_RXRPC), 272}, + {"SOL_PPPOL2TP", int64(SOL_PPPOL2TP), 273}, + {"SOL_BLUETOOTH", int64(SOL_BLUETOOTH), 274}, + {"SOL_PNPIPE", int64(SOL_PNPIPE), 275}, + {"SOL_RDS", int64(SOL_RDS), 276}, + {"SOL_IUCV", int64(SOL_IUCV), 277}, + {"SOL_CAIF", int64(SOL_CAIF), 278}, + {"SOL_ALG", int64(SOL_ALG), 279}, + {"SOL_NFC", int64(SOL_NFC), 280}, + {"SOL_KCM", int64(SOL_KCM), 281}, + {"SOMAXCONN", int64(SOMAXCONN), 128}, + {"MSG_OOB", int64(MSG_OOB), 1}, + {"MSG_PEEK", int64(MSG_PEEK), 2}, + {"MSG_DONTROUTE", int64(MSG_DONTROUTE), 4}, + {"MSG_CTRUNC", int64(MSG_CTRUNC), 8}, + {"MSG_PROXY", int64(MSG_PROXY), 16}, + {"MSG_TRUNC", int64(MSG_TRUNC), 32}, + {"MSG_DONTWAIT", int64(MSG_DONTWAIT), 64}, + {"MSG_EOR", int64(MSG_EOR), 128}, + {"MSG_WAITALL", int64(MSG_WAITALL), 256}, + {"MSG_FIN", int64(MSG_FIN), 512}, + {"MSG_SYN", int64(MSG_SYN), 1024}, + {"MSG_CONFIRM", int64(MSG_CONFIRM), 2048}, + {"MSG_RST", int64(MSG_RST), 4096}, + {"MSG_ERRQUEUE", int64(MSG_ERRQUEUE), 8192}, + {"MSG_NOSIGNAL", int64(MSG_NOSIGNAL), 16384}, + {"MSG_MORE", int64(MSG_MORE), 32768}, + {"MSG_WAITFORONE", int64(MSG_WAITFORONE), 65536}, + {"MSG_BATCH", int64(MSG_BATCH), 262144}, + {"MSG_FASTOPEN", int64(MSG_FASTOPEN), 536870912}, + {"MSG_CMSG_CLOEXEC", int64(MSG_CMSG_CLOEXEC), 1073741824}, + {"SCM_RIGHTS", int64(SCM_RIGHTS), 1}, + {"SOCK_DCCP", int64(SOCK_DCCP), 6}, + {"SOCK_PACKET", int64(SOCK_PACKET), 10}, + {"SOCK_CLOEXEC", int64(SOCK_CLOEXEC), 524288}, + {"SOCK_NONBLOCK", int64(SOCK_NONBLOCK), 2048}, + {"X_NET_IF_H", int64(X_NET_IF_H), 1}, + {"IF_NAMESIZE", int64(IF_NAMESIZE), 16}, + {"IFHWADDRLEN", int64(IFHWADDRLEN), 6}, + {"IFNAMSIZ", int64(IFNAMSIZ), 16}, + {"IFF_UP", int64(IFF_UP), 1}, + {"IFF_BROADCAST", int64(IFF_BROADCAST), 2}, + {"IFF_DEBUG", int64(IFF_DEBUG), 4}, + {"IFF_LOOPBACK", int64(IFF_LOOPBACK), 8}, + {"IFF_POINTOPOINT", int64(IFF_POINTOPOINT), 16}, + {"IFF_NOTRAILERS", int64(IFF_NOTRAILERS), 32}, + {"IFF_RUNNING", int64(IFF_RUNNING), 64}, + {"IFF_NOARP", int64(IFF_NOARP), 128}, + {"IFF_PROMISC", int64(IFF_PROMISC), 256}, + {"IFF_ALLMULTI", int64(IFF_ALLMULTI), 512}, + {"IFF_MASTER", int64(IFF_MASTER), 1024}, + {"IFF_SLAVE", int64(IFF_SLAVE), 2048}, + {"IFF_MULTICAST", int64(IFF_MULTICAST), 4096}, + {"IFF_PORTSEL", int64(IFF_PORTSEL), 8192}, + {"IFF_AUTOMEDIA", int64(IFF_AUTOMEDIA), 16384}, + {"IFF_DYNAMIC", int64(IFF_DYNAMIC), 32768}, + {"X_NETDB_H", int64(X_NETDB_H), 1}, + {"HOST_NOT_FOUND", int64(HOST_NOT_FOUND), 1}, + {"TRY_AGAIN", int64(TRY_AGAIN), 2}, + {"NO_RECOVERY", int64(NO_RECOVERY), 3}, + {"NO_DATA", int64(NO_DATA), 4}, + {"NETDB_INTERNAL", int64(NETDB_INTERNAL), -1}, + {"NETDB_SUCCESS", int64(NETDB_SUCCESS), 0}, + {"NO_ADDRESS", int64(NO_ADDRESS), 4}, + {"AI_PASSIVE", int64(AI_PASSIVE), 1}, + {"AI_CANONNAME", int64(AI_CANONNAME), 2}, + {"AI_NUMERICHOST", int64(AI_NUMERICHOST), 4}, + {"AI_V4MAPPED", int64(AI_V4MAPPED), 8}, + {"AI_ALL", int64(AI_ALL), 16}, + {"AI_ADDRCONFIG", int64(AI_ADDRCONFIG), 32}, + {"AI_NUMERICSERV", int64(AI_NUMERICSERV), 1024}, + {"EAI_BADFLAGS", int64(EAI_BADFLAGS), -1}, + {"EAI_NONAME", int64(EAI_NONAME), -2}, + {"EAI_AGAIN", int64(EAI_AGAIN), -3}, + {"EAI_FAIL", int64(EAI_FAIL), -4}, + {"EAI_FAMILY", int64(EAI_FAMILY), -6}, + {"EAI_SOCKTYPE", int64(EAI_SOCKTYPE), -7}, + {"EAI_SERVICE", int64(EAI_SERVICE), -8}, + {"EAI_MEMORY", int64(EAI_MEMORY), -10}, + {"EAI_SYSTEM", int64(EAI_SYSTEM), -11}, + {"EAI_OVERFLOW", int64(EAI_OVERFLOW), -12}, + {"NI_MAXHOST", int64(NI_MAXHOST), 1025}, + {"NI_MAXSERV", int64(NI_MAXSERV), 32}, + {"NI_NUMERICHOST", int64(NI_NUMERICHOST), 1}, + {"NI_NUMERICSERV", int64(NI_NUMERICSERV), 2}, + {"NI_NOFQDN", int64(NI_NOFQDN), 4}, + {"NI_NAMEREQD", int64(NI_NAMEREQD), 8}, + {"NI_DGRAM", int64(NI_DGRAM), 16}, + {"X_NETINET_IN_H", int64(X_NETINET_IN_H), 1}, + {"IN_CLASSA_NET", int64(IN_CLASSA_NET), 4278190080}, + {"IN_CLASSA_NSHIFT", int64(IN_CLASSA_NSHIFT), 24}, + {"IN_CLASSA_HOST", int64(IN_CLASSA_HOST), 16777215}, + {"IN_CLASSA_MAX", int64(IN_CLASSA_MAX), 128}, + {"IN_CLASSB_NET", int64(IN_CLASSB_NET), 4294901760}, + {"IN_CLASSB_NSHIFT", int64(IN_CLASSB_NSHIFT), 16}, + {"IN_CLASSB_HOST", int64(IN_CLASSB_HOST), 65535}, + {"IN_CLASSB_MAX", int64(IN_CLASSB_MAX), 65536}, + {"IN_CLASSC_NET", int64(IN_CLASSC_NET), 4294967040}, + {"IN_CLASSC_NSHIFT", int64(IN_CLASSC_NSHIFT), 8}, + {"IN_CLASSC_HOST", int64(IN_CLASSC_HOST), 255}, + {"IN_LOOPBACKNET", int64(IN_LOOPBACKNET), 127}, + {"INET_ADDRSTRLEN", int64(INET_ADDRSTRLEN), 16}, + {"INET6_ADDRSTRLEN", int64(INET6_ADDRSTRLEN), 46}, + {"IPPROTO_IP", int64(IPPROTO_IP), 0}, + {"IPPROTO_ICMP", int64(IPPROTO_ICMP), 1}, + {"IPPROTO_IGMP", int64(IPPROTO_IGMP), 2}, + {"IPPROTO_IPIP", int64(IPPROTO_IPIP), 4}, + {"IPPROTO_TCP", int64(IPPROTO_TCP), 6}, + {"IPPROTO_EGP", int64(IPPROTO_EGP), 8}, + {"IPPROTO_PUP", int64(IPPROTO_PUP), 12}, + {"IPPROTO_UDP", int64(IPPROTO_UDP), 17}, + {"IPPROTO_IDP", int64(IPPROTO_IDP), 22}, + {"IPPROTO_TP", int64(IPPROTO_TP), 29}, + {"IPPROTO_DCCP", int64(IPPROTO_DCCP), 33}, + {"IPPROTO_IPV6", int64(IPPROTO_IPV6), 41}, + {"IPPROTO_RSVP", int64(IPPROTO_RSVP), 46}, + {"IPPROTO_GRE", int64(IPPROTO_GRE), 47}, + {"IPPROTO_ESP", int64(IPPROTO_ESP), 50}, + {"IPPROTO_AH", int64(IPPROTO_AH), 51}, + {"IPPROTO_MTP", int64(IPPROTO_MTP), 92}, + {"IPPROTO_BEETPH", int64(IPPROTO_BEETPH), 94}, + {"IPPROTO_ENCAP", int64(IPPROTO_ENCAP), 98}, + {"IPPROTO_PIM", int64(IPPROTO_PIM), 103}, + {"IPPROTO_COMP", int64(IPPROTO_COMP), 108}, + {"IPPROTO_SCTP", int64(IPPROTO_SCTP), 132}, + {"IPPROTO_UDPLITE", int64(IPPROTO_UDPLITE), 136}, + {"IPPROTO_MPLS", int64(IPPROTO_MPLS), 137}, + {"IPPROTO_RAW", int64(IPPROTO_RAW), 255}, + {"IPPROTO_MAX", int64(IPPROTO_MAX), 256}, + {"IPPROTO_HOPOPTS", int64(IPPROTO_HOPOPTS), 0}, + {"IPPROTO_ROUTING", int64(IPPROTO_ROUTING), 43}, + {"IPPROTO_FRAGMENT", int64(IPPROTO_FRAGMENT), 44}, + {"IPPROTO_ICMPV6", int64(IPPROTO_ICMPV6), 58}, + {"IPPROTO_NONE", int64(IPPROTO_NONE), 59}, + {"IPPROTO_DSTOPTS", int64(IPPROTO_DSTOPTS), 60}, + {"IPPROTO_MH", int64(IPPROTO_MH), 135}, + {"IPPORT_ECHO", int64(IPPORT_ECHO), 7}, + {"IPPORT_DISCARD", int64(IPPORT_DISCARD), 9}, + {"IPPORT_SYSTAT", int64(IPPORT_SYSTAT), 11}, + {"IPPORT_DAYTIME", int64(IPPORT_DAYTIME), 13}, + {"IPPORT_NETSTAT", int64(IPPORT_NETSTAT), 15}, + {"IPPORT_FTP", int64(IPPORT_FTP), 21}, + {"IPPORT_TELNET", int64(IPPORT_TELNET), 23}, + {"IPPORT_SMTP", int64(IPPORT_SMTP), 25}, + {"IPPORT_TIMESERVER", int64(IPPORT_TIMESERVER), 37}, + {"IPPORT_NAMESERVER", int64(IPPORT_NAMESERVER), 42}, + {"IPPORT_WHOIS", int64(IPPORT_WHOIS), 43}, + {"IPPORT_MTP", int64(IPPORT_MTP), 57}, + {"IPPORT_TFTP", int64(IPPORT_TFTP), 69}, + {"IPPORT_RJE", int64(IPPORT_RJE), 77}, + {"IPPORT_FINGER", int64(IPPORT_FINGER), 79}, + {"IPPORT_TTYLINK", int64(IPPORT_TTYLINK), 87}, + {"IPPORT_SUPDUP", int64(IPPORT_SUPDUP), 95}, + {"IPPORT_EXECSERVER", int64(IPPORT_EXECSERVER), 512}, + {"IPPORT_LOGINSERVER", int64(IPPORT_LOGINSERVER), 513}, + {"IPPORT_CMDSERVER", int64(IPPORT_CMDSERVER), 514}, + {"IPPORT_EFSSERVER", int64(IPPORT_EFSSERVER), 520}, + {"IPPORT_BIFFUDP", int64(IPPORT_BIFFUDP), 512}, + {"IPPORT_WHOSERVER", int64(IPPORT_WHOSERVER), 513}, + {"IPPORT_ROUTESERVER", int64(IPPORT_ROUTESERVER), 520}, + {"IPPORT_RESERVED", int64(IPPORT_RESERVED), 1024}, + {"IPPORT_USERRESERVED", int64(IPPORT_USERRESERVED), 5000}, + {"X_RPC_NETDB_H", int64(X_RPC_NETDB_H), 1}, + {"X_SYS_SOCKET_H", int64(X_SYS_SOCKET_H), 1}, + {"SHUT_RD", int64(SHUT_RD), 0}, + {"SHUT_WR", int64(SHUT_WR), 1}, + {"SHUT_RDWR", int64(SHUT_RDWR), 2}, + {"X_SYS_UN_H", int64(X_SYS_UN_H), 1}, + {"ALIGNSIZE", int64(ALIGNSIZE), 8}, + {"MAXSIZE", int64(MAXSIZE), 128}, + {"PAD1_SIZE", int64(PAD1_SIZE), 118}, + {"PAD2_SIZE", int64(PAD2_SIZE), 0}, + {"SOCK_STREAM", int64(SOCK_STREAM), 1}, + {"SOCK_DGRAM", int64(SOCK_DGRAM), 2}, + {"SOCK_RAW", int64(SOCK_RAW), 3}, + {"SOCK_RDM", int64(SOCK_RDM), 4}, + {"SOCK_SEQPACKET", int64(SOCK_SEQPACKET), 5}, + } + var networkStringConstants = []struct{ name, got, want string }{ + {"X_PATH_HEQUIV", X_PATH_HEQUIV, "/etc/hosts.equiv"}, + {"X_PATH_HOSTS", X_PATH_HOSTS, "/etc/hosts"}, + {"X_PATH_NETWORKS", X_PATH_NETWORKS, "/etc/networks"}, + {"X_PATH_NSSWITCH_CONF", X_PATH_NSSWITCH_CONF, "/etc/nsswitch.conf"}, + {"X_PATH_PROTOCOLS", X_PATH_PROTOCOLS, "/etc/protocols"}, + {"X_PATH_SERVICES", X_PATH_SERVICES, "/etc/services"}, + } + var networkVariableSymbols = []struct { + name string + address unsafe.Pointer + }{ + {"In6addrAny", unsafe.Pointer(&In6addrAny)}, + {"In6addrLoopback", unsafe.Pointer(&In6addrLoopback)}, + } + var networkAccessorChecks = []struct { + name string + check func() (uintptr, uintptr, uintptr) + offset, size, align uintptr + }{ + {"*_llcppg_anon_1.XGof_ref_ifu_broadaddr", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_1 + view := value.XGof_ref_ifu_broadaddr() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 2}, + {"*_llcppg_anon_1.XGof_ref_ifu_dstaddr", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_1 + view := value.XGof_ref_ifu_dstaddr() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 2}, + {"*_llcppg_anon_2.XGof_ref_ifrn_name", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_2 + view := value.XGof_ref_ifrn_name() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 1}, + {"*_llcppg_anon_3.XGof_ref_ifru_addr", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_addr() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 2}, + {"*_llcppg_anon_3.XGof_ref_ifru_dstaddr", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_dstaddr() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 2}, + {"*_llcppg_anon_3.XGof_ref_ifru_broadaddr", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_broadaddr() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 2}, + {"*_llcppg_anon_3.XGof_ref_ifru_netmask", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_netmask() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 2}, + {"*_llcppg_anon_3.XGof_ref_ifru_hwaddr", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_hwaddr() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 2}, + {"*_llcppg_anon_3.XGof_ref_ifru_flags", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_flags() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 2, 2}, + {"*_llcppg_anon_3.XGof_ref_ifru_ivalue", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_ivalue() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 4, 4}, + {"*_llcppg_anon_3.XGof_ref_ifru_mtu", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_mtu() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 4, 4}, + {"*_llcppg_anon_3.XGof_ref_ifru_map", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_map() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 24, 8}, + {"*_llcppg_anon_3.XGof_ref_ifru_slave", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_slave() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 1}, + {"*_llcppg_anon_3.XGof_ref_ifru_newname", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_newname() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 16, 1}, + {"*_llcppg_anon_3.XGof_ref_ifru_data", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_3 + view := value.XGof_ref_ifru_data() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 8, 8}, + {"*_llcppg_anon_4.XGof_ref_ifcu_buf", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_4 + view := value.XGof_ref_ifcu_buf() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 8, 8}, + {"*_llcppg_anon_4.XGof_ref_ifcu_req", func() (uintptr, uintptr, uintptr) { + var value _llcppg_anon_4 + view := value.XGof_ref_ifcu_req() + return uintptr(unsafe.Pointer(view)) - uintptr(unsafe.Pointer(&value)), unsafe.Sizeof(*view), unsafe.Alignof(*view) + }, 0, 8, 8}, + } + + t.Run("function symbols", func(t *testing.T) { + for _, symbol := range networkFunctionSymbols { + t.Run(symbol.name, func(t *testing.T) { + if symbol.address == nil { + t.Fatal("C function address is nil") + } + t.Logf("C function address: %p", symbol.address) + }) + } + }) + t.Run("native prototypes", func(t *testing.T) { + check := func(name string, got reflect.Type, want networkABISlot) { + if got.Size() != want.size || uintptr(got.Align()) != want.align { + t.Errorf("%s size/alignment = %d/%d, C = %d/%d", name, got.Size(), got.Align(), want.size, want.align) + } + class := 0 + switch got.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + class = 1 + case reflect.Ptr, reflect.UnsafePointer, reflect.Func: + class = 5 + case reflect.Float32, reflect.Float64: + class = 8 + case reflect.Struct: + class = 12 + } + if class != want.class { + t.Errorf("%s ABI class = %d (%v), C = %d", name, class, got.Kind(), want.class) + } + } + for _, tc := range networkFunctionPrototypes { + t.Run(tc.name, func(t *testing.T) { + inputs := len(tc.inputs) + if tc.variadic { + inputs++ + } + if tc.signature.Kind() != reflect.Func || tc.signature.NumIn() != inputs || tc.signature.IsVariadic() != tc.variadic { + t.Fatalf("Go signature = %v, C fixed parameters = %d, variadic = %v", tc.signature, len(tc.inputs), tc.variadic) + } + for i, slot := range tc.inputs { + check(tc.name+" parameter", tc.signature.In(i), slot) + } + outputs := 0 + if tc.output != nil { + outputs = 1 + } + if tc.signature.NumOut() != outputs { + t.Fatalf("Go result count = %d, C = %d", tc.signature.NumOut(), outputs) + } + if tc.output != nil { + check(tc.name+" result", tc.signature.Out(0), *tc.output) + } + }) + } + }) + t.Run("native types and globals", func(t *testing.T) { + for _, tc := range networkTypeLayouts { + t.Run(tc.symbol+"/"+tc.property, func(t *testing.T) { + if tc.got != tc.want { + t.Fatalf("Go layout = %d, C headers = %d", tc.got, tc.want) + } + }) + } + for _, symbol := range networkVariableSymbols { + if symbol.address == nil { + t.Errorf("%s C variable address is nil", symbol.name) + } + t.Logf("%s C variable address: %p", symbol.name, symbol.address) + } + }) + t.Run("native constants", func(t *testing.T) { + for _, tc := range networkIntegerConstants { + t.Run(tc.name, func(t *testing.T) { + if tc.got != tc.want { + t.Fatalf("Go constant = %d, C headers = %d", tc.got, tc.want) + } + }) + } + for _, tc := range networkStringConstants { + t.Run(tc.name, func(t *testing.T) { + if tc.got != tc.want { + t.Fatalf("Go constant = %q, C headers = %q", tc.got, tc.want) + } + }) + } + }) + t.Run("union accessors", func(t *testing.T) { + for _, tc := range networkAccessorChecks { + t.Run(tc.name, func(t *testing.T) { + offset, size, align := tc.check() + if offset != tc.offset || size != tc.size || align != tc.align { + t.Fatalf("Go field offset/size/alignment = %d/%d/%d, C = %d/%d/%d", offset, size, align, tc.offset, tc.size, tc.align) + } + }) + } + }) + t.Run("symbol inventory", func(t *testing.T) { + functions, prototypes, types, constants, variables := map[string]bool{}, map[string]bool{}, map[string]bool{}, map[string]bool{}, map[string]bool{} + for _, tc := range networkFunctionPrototypes { + prototypes[tc.name] = true + } + for _, symbol := range networkFunctionSymbols { + functions[symbol.name] = true + if !prototypes[symbol.name] { + t.Errorf("%s has no native prototype test", symbol.name) + } + } + for _, tc := range networkAccessorChecks { + functions[tc.name] = true + } + for _, tc := range networkTypeLayouts { + types[tc.symbol] = true + } + for _, tc := range networkIntegerConstants { + constants[tc.name] = true + } + for _, tc := range networkStringConstants { + constants[tc.name] = true + } + for _, symbol := range networkVariableSymbols { + variables[symbol.name] = true + } + constants["XGoPackage"], constants["LLGoPackage"] = true, true + wantLink := "link: -lc -lresolv" + if runtime.GOOS == "darwin" { + wantLink = "link: -lSystem" + } + if !XGoPackage || LLGoPackage != wantLink { + t.Errorf("package metadata = %v/%q, want true/%q", XGoPackage, LLGoPackage, wantLink) + } + files := []string{"libc_" + runtime.GOOS + "_" + runtime.GOARCH + ".go", "legacy_native.go"} + if runtime.GOOS == "darwin" { + files = append(files, "legacy_darwin_arm64.go") + } + for _, filename := range files { + source, err := parser.ParseFile(token.NewFileSet(), filename, nil, parser.ParseComments) + if err != nil { + t.Fatal(err) + } + for _, declaration := range source.Decls { + switch decl := declaration.(type) { + case *ast.FuncDecl: + name := decl.Name.Name + if !ast.IsExported(name) { + continue + } + if decl.Recv != nil { + receiver, prefix := decl.Recv.List[0].Type, "" + if pointer, ok := receiver.(*ast.StarExpr); ok { + receiver, prefix = pointer.X, "*" + } + name = prefix + receiver.(*ast.Ident).Name + "." + name + } + if !functions[name] { + t.Errorf("%s: function %s has no test", filename, name) + } + if strings.HasPrefix(decl.Name.Name, "Native") { + t.Errorf("%s retains duplicate %s", filename, name) + } + if decl.Doc != nil { + for _, comment := range decl.Doc.List { + for _, private := range []string{"C.pfctlinput", "C.__h_errno_location", "C.__cmsg_nxthdr"} { + if strings.Contains(comment.Text, private) { + t.Errorf("%s still exposes private C entry point %s", filename, private) + } + } + } + } + case *ast.GenDecl: + for _, specification := range decl.Specs { + switch spec := specification.(type) { + case *ast.TypeSpec: + if ast.IsExported(spec.Name.Name) && !types[spec.Name.Name] { + t.Errorf("%s: type %s has no ABI test", filename, spec.Name.Name) + } + case *ast.ValueSpec: + for _, name := range spec.Names { + if !ast.IsExported(name.Name) { + continue + } + if decl.Tok == token.CONST && !constants[name.Name] { + t.Errorf("%s: constant %s has no test", filename, name.Name) + } + if decl.Tok == token.VAR && !variables[name.Name] { + t.Errorf("%s: variable %s has no test", filename, name.Name) + } + } + } + } + } + } + } + t.Logf("coverage: %d C functions, %d Go union accessors, %d types/global layouts, %d constants, %d globals", len(networkFunctionSymbols), len(networkAccessorChecks), len(networkTypeLayouts), len(constants), len(networkVariableSymbols)) + }) + +} From 228bc015b489bcaf08d110bb758a1f3ba67c18ed Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Thu, 22 Oct 2026 13:04:29 +0800 Subject: [PATCH 8/8] Restore legacy Bind and Accept address parameters --- c/net/README.md | 4 ++-- c/net/generated_native_llgo_test.go | 8 ++++---- c/net/libc_darwin_arm64.go | 4 ++-- c/net/libc_linux_amd64.go | 4 ++-- c/net/libc_linux_arm64.go | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/c/net/README.md b/c/net/README.md index 06850077..01477d32 100644 --- a/c/net/README.md +++ b/c/net/README.md @@ -10,7 +10,7 @@ This package binds `arpa/inet.h`, `net/if.h`, `netdb.h`, `netinet/in.h`, `sys/so Linux support assumes glibc. Existing implementations remain selected for other targets. -Generated declarations use the existing public function names, including `Bind`, `Accept`, `GetHostByName`, `InetAddr`, `InetNtop`, `Getaddrinfo`, `Send`, and `Recv`. Duplicate `Native` declarations have been removed. `Bind` and `Accept` now accept the generic `*SockAddr` rather than restricting their address argument to `*SockaddrIn`. `Send` and `Recv` retain `c.SizeT` (`uintptr`) for their lengths. Existing string entry points retain `*c.Char`, including on Linux arm64. `legacy_native.go` retains the five untyped socket constants; `legacy_darwin_arm64.go` retains the four native byte-order declarations whose macOS headers expose macros. The root package `c.Char` and `c.Printf` remain unchanged. +Generated declarations use the existing public function names, including `Bind`, `Accept`, `GetHostByName`, `InetAddr`, `InetNtop`, `Getaddrinfo`, `Send`, and `Recv`. Duplicate `Native` declarations have been removed. `Bind` and `Accept` retain their existing `*SockaddrIn` address parameters, preserving IPv4 caller compatibility while using the corrected native address layouts. `Send` and `Recv` retain `c.SizeT` (`uintptr`) for their lengths. Existing string entry points retain `*c.Char`, including on Linux arm64. `legacy_native.go` retains the five untyped socket constants; `legacy_darwin_arm64.go` retains the four native byte-order declarations whose macOS headers expose macros. The root package `c.Char` and `c.Printf` remain unchanged. Address types retain the existing field names for corresponding C fields. Linux address families use a 16-bit field without the BSD length byte, and Linux `AddrInfo` places `Addr` before `CanOnName`. `In6Addr.U6Addr` remains a byte array with native IPv6 alignment. `Iovec` aliases the shared `c.Iovec` definition from the root C package. The compatibility padding constants follow the native `SockaddrStorage`: `PAD1_SIZE`/`PAD2_SIZE` are 6/112 on macOS and 118/0 on Linux. @@ -18,6 +18,6 @@ The directory `llcppg.cfg` contains only `Dir`, used by the existing local direc The kernel-only macOS `pfctlinput` entry point and the Linux implementation helpers `__h_errno_location` and `__cmsg_nxthdr` are excluded. Types needed to express native layouts, including anonymous union storage and its generated field accessors, remain available. Existing approved generation-error and unsupported-layout exclusions remain recorded in the local generation inputs. `Cmsghdr` contains only its fixed C header fields: 16 bytes with 8-byte alignment on Linux and 12 bytes with 4-byte alignment on macOS. The interface enumeration function is `IfNameindex`; its record is `IfNameindexT`. Linux resolver declarations link `libresolv`. This remains a selection of common native APIs rather than the entire libc API. -The tests compare every retained C function's parameter/result ABI against independently compiled native prototypes and take its address to require symbol resolution. They also check native type sizes, alignments and field offsets, constant values, global symbols and layouts, and generated union accessors. A source inventory check rejects missing coverage. Runtime tests exercise binary socket I/O, IPv4/IPv6 numeric conversion and resolution, interface enumeration/freeing, and TCP loopback through the generic `Bind`/`Accept` signatures. +The tests compare every retained C function's parameter/result ABI against independently compiled native prototypes and take its address to require symbol resolution. They also check native type sizes, alignments and field offsets, constant values, global symbols and layouts, and generated union accessors. A source inventory check rejects missing coverage. Runtime tests exercise binary socket I/O, IPv4/IPv6 numeric conversion and resolution, interface enumeration/freeing, and TCP loopback using the existing `Bind`/`Accept` IPv4 signatures without pointer casts. The independent native C link check passes for macOS. Linux excludes `bindresvport6` with explicit approval: glibc 2.24's header declares it, but neither its original libc nor the validation environment's libc exports it. macOS arm64 and Linux amd64/arm64 pass `llgo test -count=1 -v ./c/net` with GC and `nogc` using LLGo v1.0.8 (`c171abfa130108bc6451e01fcf15a8a3474eb0a7`). The macOS runs use LLD 23.1.3 with the compiler on LLVM 22. Tests use the root C bindings from dependent PR #45, which supplies `c.Iovec`. The glibc 2.24 and macOS 14 SDK header baselines do not establish minimum executable runtime versions. diff --git a/c/net/generated_native_llgo_test.go b/c/net/generated_native_llgo_test.go index 3f1dd1fe..a0383517 100644 --- a/c/net/generated_native_llgo_test.go +++ b/c/net/generated_native_llgo_test.go @@ -142,7 +142,7 @@ func TestGeneratedSocketIO(t *testing.T) { t.Fatal("loopback interface is absent from if_nameindex") } }) - t.Run("TCP loopback generic sockaddr", func(t *testing.T) { + t.Run("TCP loopback IPv4 compatibility", func(t *testing.T) { listener := Socket(AF_INET, SOCK_STREAM, 0) if listener < 0 { t.Fatal("listener socket failed") @@ -152,7 +152,7 @@ func TestGeneratedSocketIO(t *testing.T) { if runtime.GOOS == "darwin" { *(*uint8)(unsafe.Pointer(&address)) = uint8(unsafe.Sizeof(address)) } - if result := Bind(listener, (*SockAddr)(unsafe.Pointer(&address)), SocklenT(unsafe.Sizeof(address))); result != 0 { + if result := Bind(listener, &address, SocklenT(unsafe.Sizeof(address))); result != 0 { t.Fatalf("bind = %d", result) } if result := Listen(listener, 1); result != 0 { @@ -173,9 +173,9 @@ func TestGeneratedSocketIO(t *testing.T) { if result := Connect(client, (*SockAddr)(unsafe.Pointer(&address)), length); result != 0 { t.Fatalf("connect = %d", result) } - var peer SockaddrStorage + var peer SockaddrIn peerLength := SocklenT(unsafe.Sizeof(peer)) - accepted := Accept(listener, (*SockAddr)(unsafe.Pointer(&peer)), &peerLength) + accepted := Accept(listener, &peer, &peerLength) if accepted < 0 { t.Fatalf("accept = %d", accepted) } diff --git a/c/net/libc_darwin_arm64.go b/c/net/libc_darwin_arm64.go index 30c633ce..c812ea6d 100644 --- a/c/net/libc_darwin_arm64.go +++ b/c/net/libc_darwin_arm64.go @@ -2405,10 +2405,10 @@ type SaeConnidT = X__Uint32T type SaEndpointsT = SaEndpoints //go:linkname Accept C.accept -func Accept(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 *SocklenT) c.Int +func Accept(_llcppg_param1 c.Int, _llcppg_param2 *SockaddrIn, _llcppg_param3 *SocklenT) c.Int //go:linkname Bind C.bind -func Bind(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 SocklenT) c.Int +func Bind(_llcppg_param1 c.Int, _llcppg_param2 *SockaddrIn, _llcppg_param3 SocklenT) c.Int //go:linkname Connect C.connect func Connect(_llcppg_param1 c.Int, _llcppg_param2 *SockAddr, _llcppg_param3 SocklenT) c.Int diff --git a/c/net/libc_linux_amd64.go b/c/net/libc_linux_amd64.go index d46d70eb..cd8addb0 100644 --- a/c/net/libc_linux_amd64.go +++ b/c/net/libc_linux_amd64.go @@ -1954,7 +1954,7 @@ func Socketpair(__domain c.Int, __type c.Int, __protocol c.Int, __fds *c.Int) c. // Give the socket FD the local address ADDR (which is LEN bytes long). // //go:linkname Bind C.bind -func Bind(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int +func Bind(__fd c.Int, __addr *SockaddrIn, __len SocklenT) c.Int // Put the local address of FD into *ADDR and its length in *LEN. // @@ -2064,7 +2064,7 @@ func Listen(__fd c.Int, __n c.Int) c.Int // __THROW. // //go:linkname Accept C.accept -func Accept(__fd c.Int, __addr *SockAddr, __addr_len *SocklenT) c.Int +func Accept(__fd c.Int, __addr *SockaddrIn, __addr_len *SocklenT) c.Int // Shut down all or part of the connection open on socket FD. // HOW determines what to shut down: diff --git a/c/net/libc_linux_arm64.go b/c/net/libc_linux_arm64.go index 645ae98e..85537427 100644 --- a/c/net/libc_linux_arm64.go +++ b/c/net/libc_linux_arm64.go @@ -1954,7 +1954,7 @@ func Socketpair(__domain c.Int, __type c.Int, __protocol c.Int, __fds *c.Int) c. // Give the socket FD the local address ADDR (which is LEN bytes long). // //go:linkname Bind C.bind -func Bind(__fd c.Int, __addr *SockAddr, __len SocklenT) c.Int +func Bind(__fd c.Int, __addr *SockaddrIn, __len SocklenT) c.Int // Put the local address of FD into *ADDR and its length in *LEN. // @@ -2064,7 +2064,7 @@ func Listen(__fd c.Int, __n c.Int) c.Int // __THROW. // //go:linkname Accept C.accept -func Accept(__fd c.Int, __addr *SockAddr, __addr_len *SocklenT) c.Int +func Accept(__fd c.Int, __addr *SockaddrIn, __addr_len *SocklenT) c.Int // Shut down all or part of the connection open on socket FD. // HOW determines what to shut down: