All Downloads are FREE. Search and download functionalities are using the official Maven repository.

me.bechberger.ebpf.bpf.raw.__sk_buff Maven / Gradle / Ivy

The newest version!
// Generated by jextract

package me.bechberger.ebpf.bpf.raw;

import java.lang.invoke.*;
import java.lang.foreign.*;
import java.nio.ByteOrder;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

import static java.lang.foreign.ValueLayout.*;
import static java.lang.foreign.MemoryLayout.PathElement.*;

/**
 * {@snippet lang=c :
 * struct __sk_buff {
 *     __u32 len;
 *     __u32 pkt_type;
 *     __u32 mark;
 *     __u32 queue_mapping;
 *     __u32 protocol;
 *     __u32 vlan_present;
 *     __u32 vlan_tci;
 *     __u32 vlan_proto;
 *     __u32 priority;
 *     __u32 ingress_ifindex;
 *     __u32 ifindex;
 *     __u32 tc_index;
 *     __u32 cb[5];
 *     __u32 hash;
 *     __u32 tc_classid;
 *     __u32 data;
 *     __u32 data_end;
 *     __u32 napi_id;
 *     __u32 family;
 *     __u32 remote_ip4;
 *     __u32 local_ip4;
 *     __u32 remote_ip6[4];
 *     __u32 local_ip6[4];
 *     __u32 remote_port;
 *     __u32 local_port;
 *     __u32 data_meta;
 *     union {
 *         struct bpf_flow_keys *flow_keys;
 *         __u64 : 64;
 *     };
 *     __u64 tstamp;
 *     __u32 wire_len;
 *     __u32 gso_segs;
 *     union {
 *         struct bpf_sock *sk;
 *         __u64 : 64;
 *     };
 *     __u32 gso_size;
 *     __u8 tstamp_type;
 *     __u32 : 24;
 *     __u64 hwtstamp;
 * }
 * }
 */
public class __sk_buff {

    __sk_buff() {
        // Should not be called directly
    }

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        Lib.C_INT.withName("len"),
        Lib.C_INT.withName("pkt_type"),
        Lib.C_INT.withName("mark"),
        Lib.C_INT.withName("queue_mapping"),
        Lib.C_INT.withName("protocol"),
        Lib.C_INT.withName("vlan_present"),
        Lib.C_INT.withName("vlan_tci"),
        Lib.C_INT.withName("vlan_proto"),
        Lib.C_INT.withName("priority"),
        Lib.C_INT.withName("ingress_ifindex"),
        Lib.C_INT.withName("ifindex"),
        Lib.C_INT.withName("tc_index"),
        MemoryLayout.sequenceLayout(5, Lib.C_INT).withName("cb"),
        Lib.C_INT.withName("hash"),
        Lib.C_INT.withName("tc_classid"),
        Lib.C_INT.withName("data"),
        Lib.C_INT.withName("data_end"),
        Lib.C_INT.withName("napi_id"),
        Lib.C_INT.withName("family"),
        Lib.C_INT.withName("remote_ip4"),
        Lib.C_INT.withName("local_ip4"),
        MemoryLayout.sequenceLayout(4, Lib.C_INT).withName("remote_ip6"),
        MemoryLayout.sequenceLayout(4, Lib.C_INT).withName("local_ip6"),
        Lib.C_INT.withName("remote_port"),
        Lib.C_INT.withName("local_port"),
        Lib.C_INT.withName("data_meta"),
        MemoryLayout.unionLayout(
            Lib.C_POINTER.withName("flow_keys")
        ).withName("$anon$6253:2"),
        Lib.C_LONG_LONG.withName("tstamp"),
        Lib.C_INT.withName("wire_len"),
        Lib.C_INT.withName("gso_segs"),
        MemoryLayout.unionLayout(
            Lib.C_POINTER.withName("sk")
        ).withName("$anon$6257:2"),
        Lib.C_INT.withName("gso_size"),
        Lib.C_CHAR.withName("tstamp_type"),
        MemoryLayout.paddingLayout(3),
        Lib.C_LONG_LONG.withName("hwtstamp")
    ).withName("__sk_buff");

    /**
     * The layout of this struct
     */
    public static final GroupLayout layout() {
        return $LAYOUT;
    }

    private static final OfInt len$LAYOUT = (OfInt)$LAYOUT.select(groupElement("len"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 len
     * }
     */
    public static final OfInt len$layout() {
        return len$LAYOUT;
    }

    private static final long len$OFFSET = 0;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 len
     * }
     */
    public static final long len$offset() {
        return len$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 len
     * }
     */
    public static int len(MemorySegment struct) {
        return struct.get(len$LAYOUT, len$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 len
     * }
     */
    public static void len(MemorySegment struct, int fieldValue) {
        struct.set(len$LAYOUT, len$OFFSET, fieldValue);
    }

    private static final OfInt pkt_type$LAYOUT = (OfInt)$LAYOUT.select(groupElement("pkt_type"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 pkt_type
     * }
     */
    public static final OfInt pkt_type$layout() {
        return pkt_type$LAYOUT;
    }

    private static final long pkt_type$OFFSET = 4;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 pkt_type
     * }
     */
    public static final long pkt_type$offset() {
        return pkt_type$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 pkt_type
     * }
     */
    public static int pkt_type(MemorySegment struct) {
        return struct.get(pkt_type$LAYOUT, pkt_type$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 pkt_type
     * }
     */
    public static void pkt_type(MemorySegment struct, int fieldValue) {
        struct.set(pkt_type$LAYOUT, pkt_type$OFFSET, fieldValue);
    }

    private static final OfInt mark$LAYOUT = (OfInt)$LAYOUT.select(groupElement("mark"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 mark
     * }
     */
    public static final OfInt mark$layout() {
        return mark$LAYOUT;
    }

    private static final long mark$OFFSET = 8;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 mark
     * }
     */
    public static final long mark$offset() {
        return mark$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 mark
     * }
     */
    public static int mark(MemorySegment struct) {
        return struct.get(mark$LAYOUT, mark$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 mark
     * }
     */
    public static void mark(MemorySegment struct, int fieldValue) {
        struct.set(mark$LAYOUT, mark$OFFSET, fieldValue);
    }

    private static final OfInt queue_mapping$LAYOUT = (OfInt)$LAYOUT.select(groupElement("queue_mapping"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 queue_mapping
     * }
     */
    public static final OfInt queue_mapping$layout() {
        return queue_mapping$LAYOUT;
    }

    private static final long queue_mapping$OFFSET = 12;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 queue_mapping
     * }
     */
    public static final long queue_mapping$offset() {
        return queue_mapping$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 queue_mapping
     * }
     */
    public static int queue_mapping(MemorySegment struct) {
        return struct.get(queue_mapping$LAYOUT, queue_mapping$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 queue_mapping
     * }
     */
    public static void queue_mapping(MemorySegment struct, int fieldValue) {
        struct.set(queue_mapping$LAYOUT, queue_mapping$OFFSET, fieldValue);
    }

    private static final OfInt protocol$LAYOUT = (OfInt)$LAYOUT.select(groupElement("protocol"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 protocol
     * }
     */
    public static final OfInt protocol$layout() {
        return protocol$LAYOUT;
    }

    private static final long protocol$OFFSET = 16;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 protocol
     * }
     */
    public static final long protocol$offset() {
        return protocol$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 protocol
     * }
     */
    public static int protocol(MemorySegment struct) {
        return struct.get(protocol$LAYOUT, protocol$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 protocol
     * }
     */
    public static void protocol(MemorySegment struct, int fieldValue) {
        struct.set(protocol$LAYOUT, protocol$OFFSET, fieldValue);
    }

    private static final OfInt vlan_present$LAYOUT = (OfInt)$LAYOUT.select(groupElement("vlan_present"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 vlan_present
     * }
     */
    public static final OfInt vlan_present$layout() {
        return vlan_present$LAYOUT;
    }

    private static final long vlan_present$OFFSET = 20;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 vlan_present
     * }
     */
    public static final long vlan_present$offset() {
        return vlan_present$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 vlan_present
     * }
     */
    public static int vlan_present(MemorySegment struct) {
        return struct.get(vlan_present$LAYOUT, vlan_present$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 vlan_present
     * }
     */
    public static void vlan_present(MemorySegment struct, int fieldValue) {
        struct.set(vlan_present$LAYOUT, vlan_present$OFFSET, fieldValue);
    }

    private static final OfInt vlan_tci$LAYOUT = (OfInt)$LAYOUT.select(groupElement("vlan_tci"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 vlan_tci
     * }
     */
    public static final OfInt vlan_tci$layout() {
        return vlan_tci$LAYOUT;
    }

    private static final long vlan_tci$OFFSET = 24;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 vlan_tci
     * }
     */
    public static final long vlan_tci$offset() {
        return vlan_tci$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 vlan_tci
     * }
     */
    public static int vlan_tci(MemorySegment struct) {
        return struct.get(vlan_tci$LAYOUT, vlan_tci$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 vlan_tci
     * }
     */
    public static void vlan_tci(MemorySegment struct, int fieldValue) {
        struct.set(vlan_tci$LAYOUT, vlan_tci$OFFSET, fieldValue);
    }

    private static final OfInt vlan_proto$LAYOUT = (OfInt)$LAYOUT.select(groupElement("vlan_proto"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 vlan_proto
     * }
     */
    public static final OfInt vlan_proto$layout() {
        return vlan_proto$LAYOUT;
    }

    private static final long vlan_proto$OFFSET = 28;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 vlan_proto
     * }
     */
    public static final long vlan_proto$offset() {
        return vlan_proto$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 vlan_proto
     * }
     */
    public static int vlan_proto(MemorySegment struct) {
        return struct.get(vlan_proto$LAYOUT, vlan_proto$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 vlan_proto
     * }
     */
    public static void vlan_proto(MemorySegment struct, int fieldValue) {
        struct.set(vlan_proto$LAYOUT, vlan_proto$OFFSET, fieldValue);
    }

    private static final OfInt priority$LAYOUT = (OfInt)$LAYOUT.select(groupElement("priority"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 priority
     * }
     */
    public static final OfInt priority$layout() {
        return priority$LAYOUT;
    }

    private static final long priority$OFFSET = 32;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 priority
     * }
     */
    public static final long priority$offset() {
        return priority$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 priority
     * }
     */
    public static int priority(MemorySegment struct) {
        return struct.get(priority$LAYOUT, priority$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 priority
     * }
     */
    public static void priority(MemorySegment struct, int fieldValue) {
        struct.set(priority$LAYOUT, priority$OFFSET, fieldValue);
    }

    private static final OfInt ingress_ifindex$LAYOUT = (OfInt)$LAYOUT.select(groupElement("ingress_ifindex"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 ingress_ifindex
     * }
     */
    public static final OfInt ingress_ifindex$layout() {
        return ingress_ifindex$LAYOUT;
    }

    private static final long ingress_ifindex$OFFSET = 36;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 ingress_ifindex
     * }
     */
    public static final long ingress_ifindex$offset() {
        return ingress_ifindex$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 ingress_ifindex
     * }
     */
    public static int ingress_ifindex(MemorySegment struct) {
        return struct.get(ingress_ifindex$LAYOUT, ingress_ifindex$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 ingress_ifindex
     * }
     */
    public static void ingress_ifindex(MemorySegment struct, int fieldValue) {
        struct.set(ingress_ifindex$LAYOUT, ingress_ifindex$OFFSET, fieldValue);
    }

    private static final OfInt ifindex$LAYOUT = (OfInt)$LAYOUT.select(groupElement("ifindex"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 ifindex
     * }
     */
    public static final OfInt ifindex$layout() {
        return ifindex$LAYOUT;
    }

    private static final long ifindex$OFFSET = 40;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 ifindex
     * }
     */
    public static final long ifindex$offset() {
        return ifindex$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 ifindex
     * }
     */
    public static int ifindex(MemorySegment struct) {
        return struct.get(ifindex$LAYOUT, ifindex$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 ifindex
     * }
     */
    public static void ifindex(MemorySegment struct, int fieldValue) {
        struct.set(ifindex$LAYOUT, ifindex$OFFSET, fieldValue);
    }

    private static final OfInt tc_index$LAYOUT = (OfInt)$LAYOUT.select(groupElement("tc_index"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 tc_index
     * }
     */
    public static final OfInt tc_index$layout() {
        return tc_index$LAYOUT;
    }

    private static final long tc_index$OFFSET = 44;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 tc_index
     * }
     */
    public static final long tc_index$offset() {
        return tc_index$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 tc_index
     * }
     */
    public static int tc_index(MemorySegment struct) {
        return struct.get(tc_index$LAYOUT, tc_index$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 tc_index
     * }
     */
    public static void tc_index(MemorySegment struct, int fieldValue) {
        struct.set(tc_index$LAYOUT, tc_index$OFFSET, fieldValue);
    }

    private static final SequenceLayout cb$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("cb"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 cb[5]
     * }
     */
    public static final SequenceLayout cb$layout() {
        return cb$LAYOUT;
    }

    private static final long cb$OFFSET = 48;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 cb[5]
     * }
     */
    public static final long cb$offset() {
        return cb$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 cb[5]
     * }
     */
    public static MemorySegment cb(MemorySegment struct) {
        return struct.asSlice(cb$OFFSET, cb$LAYOUT.byteSize());
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 cb[5]
     * }
     */
    public static void cb(MemorySegment struct, MemorySegment fieldValue) {
        MemorySegment.copy(fieldValue, 0L, struct, cb$OFFSET, cb$LAYOUT.byteSize());
    }

    private static long[] cb$DIMS = { 5 };

    /**
     * Dimensions for array field:
     * {@snippet lang=c :
     * __u32 cb[5]
     * }
     */
    public static long[] cb$dimensions() {
        return cb$DIMS;
    }
    private static final VarHandle cb$ELEM_HANDLE = cb$LAYOUT.varHandle(sequenceElement());

    /**
     * Indexed getter for field:
     * {@snippet lang=c :
     * __u32 cb[5]
     * }
     */
    public static int cb(MemorySegment struct, long index0) {
        return (int)cb$ELEM_HANDLE.get(struct, 0L, index0);
    }

    /**
     * Indexed setter for field:
     * {@snippet lang=c :
     * __u32 cb[5]
     * }
     */
    public static void cb(MemorySegment struct, long index0, int fieldValue) {
        cb$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
    }

    private static final OfInt hash$LAYOUT = (OfInt)$LAYOUT.select(groupElement("hash"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 hash
     * }
     */
    public static final OfInt hash$layout() {
        return hash$LAYOUT;
    }

    private static final long hash$OFFSET = 68;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 hash
     * }
     */
    public static final long hash$offset() {
        return hash$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 hash
     * }
     */
    public static int hash(MemorySegment struct) {
        return struct.get(hash$LAYOUT, hash$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 hash
     * }
     */
    public static void hash(MemorySegment struct, int fieldValue) {
        struct.set(hash$LAYOUT, hash$OFFSET, fieldValue);
    }

    private static final OfInt tc_classid$LAYOUT = (OfInt)$LAYOUT.select(groupElement("tc_classid"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 tc_classid
     * }
     */
    public static final OfInt tc_classid$layout() {
        return tc_classid$LAYOUT;
    }

    private static final long tc_classid$OFFSET = 72;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 tc_classid
     * }
     */
    public static final long tc_classid$offset() {
        return tc_classid$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 tc_classid
     * }
     */
    public static int tc_classid(MemorySegment struct) {
        return struct.get(tc_classid$LAYOUT, tc_classid$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 tc_classid
     * }
     */
    public static void tc_classid(MemorySegment struct, int fieldValue) {
        struct.set(tc_classid$LAYOUT, tc_classid$OFFSET, fieldValue);
    }

    private static final OfInt data$LAYOUT = (OfInt)$LAYOUT.select(groupElement("data"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 data
     * }
     */
    public static final OfInt data$layout() {
        return data$LAYOUT;
    }

    private static final long data$OFFSET = 76;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 data
     * }
     */
    public static final long data$offset() {
        return data$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 data
     * }
     */
    public static int data(MemorySegment struct) {
        return struct.get(data$LAYOUT, data$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 data
     * }
     */
    public static void data(MemorySegment struct, int fieldValue) {
        struct.set(data$LAYOUT, data$OFFSET, fieldValue);
    }

    private static final OfInt data_end$LAYOUT = (OfInt)$LAYOUT.select(groupElement("data_end"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 data_end
     * }
     */
    public static final OfInt data_end$layout() {
        return data_end$LAYOUT;
    }

    private static final long data_end$OFFSET = 80;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 data_end
     * }
     */
    public static final long data_end$offset() {
        return data_end$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 data_end
     * }
     */
    public static int data_end(MemorySegment struct) {
        return struct.get(data_end$LAYOUT, data_end$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 data_end
     * }
     */
    public static void data_end(MemorySegment struct, int fieldValue) {
        struct.set(data_end$LAYOUT, data_end$OFFSET, fieldValue);
    }

    private static final OfInt napi_id$LAYOUT = (OfInt)$LAYOUT.select(groupElement("napi_id"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 napi_id
     * }
     */
    public static final OfInt napi_id$layout() {
        return napi_id$LAYOUT;
    }

    private static final long napi_id$OFFSET = 84;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 napi_id
     * }
     */
    public static final long napi_id$offset() {
        return napi_id$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 napi_id
     * }
     */
    public static int napi_id(MemorySegment struct) {
        return struct.get(napi_id$LAYOUT, napi_id$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 napi_id
     * }
     */
    public static void napi_id(MemorySegment struct, int fieldValue) {
        struct.set(napi_id$LAYOUT, napi_id$OFFSET, fieldValue);
    }

    private static final OfInt family$LAYOUT = (OfInt)$LAYOUT.select(groupElement("family"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 family
     * }
     */
    public static final OfInt family$layout() {
        return family$LAYOUT;
    }

    private static final long family$OFFSET = 88;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 family
     * }
     */
    public static final long family$offset() {
        return family$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 family
     * }
     */
    public static int family(MemorySegment struct) {
        return struct.get(family$LAYOUT, family$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 family
     * }
     */
    public static void family(MemorySegment struct, int fieldValue) {
        struct.set(family$LAYOUT, family$OFFSET, fieldValue);
    }

    private static final OfInt remote_ip4$LAYOUT = (OfInt)$LAYOUT.select(groupElement("remote_ip4"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 remote_ip4
     * }
     */
    public static final OfInt remote_ip4$layout() {
        return remote_ip4$LAYOUT;
    }

    private static final long remote_ip4$OFFSET = 92;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 remote_ip4
     * }
     */
    public static final long remote_ip4$offset() {
        return remote_ip4$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 remote_ip4
     * }
     */
    public static int remote_ip4(MemorySegment struct) {
        return struct.get(remote_ip4$LAYOUT, remote_ip4$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 remote_ip4
     * }
     */
    public static void remote_ip4(MemorySegment struct, int fieldValue) {
        struct.set(remote_ip4$LAYOUT, remote_ip4$OFFSET, fieldValue);
    }

    private static final OfInt local_ip4$LAYOUT = (OfInt)$LAYOUT.select(groupElement("local_ip4"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 local_ip4
     * }
     */
    public static final OfInt local_ip4$layout() {
        return local_ip4$LAYOUT;
    }

    private static final long local_ip4$OFFSET = 96;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 local_ip4
     * }
     */
    public static final long local_ip4$offset() {
        return local_ip4$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 local_ip4
     * }
     */
    public static int local_ip4(MemorySegment struct) {
        return struct.get(local_ip4$LAYOUT, local_ip4$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 local_ip4
     * }
     */
    public static void local_ip4(MemorySegment struct, int fieldValue) {
        struct.set(local_ip4$LAYOUT, local_ip4$OFFSET, fieldValue);
    }

    private static final SequenceLayout remote_ip6$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("remote_ip6"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 remote_ip6[4]
     * }
     */
    public static final SequenceLayout remote_ip6$layout() {
        return remote_ip6$LAYOUT;
    }

    private static final long remote_ip6$OFFSET = 100;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 remote_ip6[4]
     * }
     */
    public static final long remote_ip6$offset() {
        return remote_ip6$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 remote_ip6[4]
     * }
     */
    public static MemorySegment remote_ip6(MemorySegment struct) {
        return struct.asSlice(remote_ip6$OFFSET, remote_ip6$LAYOUT.byteSize());
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 remote_ip6[4]
     * }
     */
    public static void remote_ip6(MemorySegment struct, MemorySegment fieldValue) {
        MemorySegment.copy(fieldValue, 0L, struct, remote_ip6$OFFSET, remote_ip6$LAYOUT.byteSize());
    }

    private static long[] remote_ip6$DIMS = { 4 };

    /**
     * Dimensions for array field:
     * {@snippet lang=c :
     * __u32 remote_ip6[4]
     * }
     */
    public static long[] remote_ip6$dimensions() {
        return remote_ip6$DIMS;
    }
    private static final VarHandle remote_ip6$ELEM_HANDLE = remote_ip6$LAYOUT.varHandle(sequenceElement());

    /**
     * Indexed getter for field:
     * {@snippet lang=c :
     * __u32 remote_ip6[4]
     * }
     */
    public static int remote_ip6(MemorySegment struct, long index0) {
        return (int)remote_ip6$ELEM_HANDLE.get(struct, 0L, index0);
    }

    /**
     * Indexed setter for field:
     * {@snippet lang=c :
     * __u32 remote_ip6[4]
     * }
     */
    public static void remote_ip6(MemorySegment struct, long index0, int fieldValue) {
        remote_ip6$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
    }

    private static final SequenceLayout local_ip6$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("local_ip6"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 local_ip6[4]
     * }
     */
    public static final SequenceLayout local_ip6$layout() {
        return local_ip6$LAYOUT;
    }

    private static final long local_ip6$OFFSET = 116;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 local_ip6[4]
     * }
     */
    public static final long local_ip6$offset() {
        return local_ip6$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 local_ip6[4]
     * }
     */
    public static MemorySegment local_ip6(MemorySegment struct) {
        return struct.asSlice(local_ip6$OFFSET, local_ip6$LAYOUT.byteSize());
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 local_ip6[4]
     * }
     */
    public static void local_ip6(MemorySegment struct, MemorySegment fieldValue) {
        MemorySegment.copy(fieldValue, 0L, struct, local_ip6$OFFSET, local_ip6$LAYOUT.byteSize());
    }

    private static long[] local_ip6$DIMS = { 4 };

    /**
     * Dimensions for array field:
     * {@snippet lang=c :
     * __u32 local_ip6[4]
     * }
     */
    public static long[] local_ip6$dimensions() {
        return local_ip6$DIMS;
    }
    private static final VarHandle local_ip6$ELEM_HANDLE = local_ip6$LAYOUT.varHandle(sequenceElement());

    /**
     * Indexed getter for field:
     * {@snippet lang=c :
     * __u32 local_ip6[4]
     * }
     */
    public static int local_ip6(MemorySegment struct, long index0) {
        return (int)local_ip6$ELEM_HANDLE.get(struct, 0L, index0);
    }

    /**
     * Indexed setter for field:
     * {@snippet lang=c :
     * __u32 local_ip6[4]
     * }
     */
    public static void local_ip6(MemorySegment struct, long index0, int fieldValue) {
        local_ip6$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
    }

    private static final OfInt remote_port$LAYOUT = (OfInt)$LAYOUT.select(groupElement("remote_port"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 remote_port
     * }
     */
    public static final OfInt remote_port$layout() {
        return remote_port$LAYOUT;
    }

    private static final long remote_port$OFFSET = 132;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 remote_port
     * }
     */
    public static final long remote_port$offset() {
        return remote_port$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 remote_port
     * }
     */
    public static int remote_port(MemorySegment struct) {
        return struct.get(remote_port$LAYOUT, remote_port$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 remote_port
     * }
     */
    public static void remote_port(MemorySegment struct, int fieldValue) {
        struct.set(remote_port$LAYOUT, remote_port$OFFSET, fieldValue);
    }

    private static final OfInt local_port$LAYOUT = (OfInt)$LAYOUT.select(groupElement("local_port"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 local_port
     * }
     */
    public static final OfInt local_port$layout() {
        return local_port$LAYOUT;
    }

    private static final long local_port$OFFSET = 136;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 local_port
     * }
     */
    public static final long local_port$offset() {
        return local_port$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 local_port
     * }
     */
    public static int local_port(MemorySegment struct) {
        return struct.get(local_port$LAYOUT, local_port$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 local_port
     * }
     */
    public static void local_port(MemorySegment struct, int fieldValue) {
        struct.set(local_port$LAYOUT, local_port$OFFSET, fieldValue);
    }

    private static final OfInt data_meta$LAYOUT = (OfInt)$LAYOUT.select(groupElement("data_meta"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 data_meta
     * }
     */
    public static final OfInt data_meta$layout() {
        return data_meta$LAYOUT;
    }

    private static final long data_meta$OFFSET = 140;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 data_meta
     * }
     */
    public static final long data_meta$offset() {
        return data_meta$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 data_meta
     * }
     */
    public static int data_meta(MemorySegment struct) {
        return struct.get(data_meta$LAYOUT, data_meta$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 data_meta
     * }
     */
    public static void data_meta(MemorySegment struct, int fieldValue) {
        struct.set(data_meta$LAYOUT, data_meta$OFFSET, fieldValue);
    }

    private static final AddressLayout flow_keys$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("$anon$6253:2"), groupElement("flow_keys"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * struct bpf_flow_keys *flow_keys
     * }
     */
    public static final AddressLayout flow_keys$layout() {
        return flow_keys$LAYOUT;
    }

    private static final long flow_keys$OFFSET = 144;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * struct bpf_flow_keys *flow_keys
     * }
     */
    public static final long flow_keys$offset() {
        return flow_keys$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * struct bpf_flow_keys *flow_keys
     * }
     */
    public static MemorySegment flow_keys(MemorySegment struct) {
        return struct.get(flow_keys$LAYOUT, flow_keys$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * struct bpf_flow_keys *flow_keys
     * }
     */
    public static void flow_keys(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(flow_keys$LAYOUT, flow_keys$OFFSET, fieldValue);
    }

    private static final OfLong tstamp$LAYOUT = (OfLong)$LAYOUT.select(groupElement("tstamp"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u64 tstamp
     * }
     */
    public static final OfLong tstamp$layout() {
        return tstamp$LAYOUT;
    }

    private static final long tstamp$OFFSET = 152;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u64 tstamp
     * }
     */
    public static final long tstamp$offset() {
        return tstamp$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u64 tstamp
     * }
     */
    public static long tstamp(MemorySegment struct) {
        return struct.get(tstamp$LAYOUT, tstamp$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u64 tstamp
     * }
     */
    public static void tstamp(MemorySegment struct, long fieldValue) {
        struct.set(tstamp$LAYOUT, tstamp$OFFSET, fieldValue);
    }

    private static final OfInt wire_len$LAYOUT = (OfInt)$LAYOUT.select(groupElement("wire_len"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 wire_len
     * }
     */
    public static final OfInt wire_len$layout() {
        return wire_len$LAYOUT;
    }

    private static final long wire_len$OFFSET = 160;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 wire_len
     * }
     */
    public static final long wire_len$offset() {
        return wire_len$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 wire_len
     * }
     */
    public static int wire_len(MemorySegment struct) {
        return struct.get(wire_len$LAYOUT, wire_len$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 wire_len
     * }
     */
    public static void wire_len(MemorySegment struct, int fieldValue) {
        struct.set(wire_len$LAYOUT, wire_len$OFFSET, fieldValue);
    }

    private static final OfInt gso_segs$LAYOUT = (OfInt)$LAYOUT.select(groupElement("gso_segs"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 gso_segs
     * }
     */
    public static final OfInt gso_segs$layout() {
        return gso_segs$LAYOUT;
    }

    private static final long gso_segs$OFFSET = 164;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 gso_segs
     * }
     */
    public static final long gso_segs$offset() {
        return gso_segs$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 gso_segs
     * }
     */
    public static int gso_segs(MemorySegment struct) {
        return struct.get(gso_segs$LAYOUT, gso_segs$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 gso_segs
     * }
     */
    public static void gso_segs(MemorySegment struct, int fieldValue) {
        struct.set(gso_segs$LAYOUT, gso_segs$OFFSET, fieldValue);
    }

    private static final AddressLayout sk$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("$anon$6257:2"), groupElement("sk"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * struct bpf_sock *sk
     * }
     */
    public static final AddressLayout sk$layout() {
        return sk$LAYOUT;
    }

    private static final long sk$OFFSET = 168;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * struct bpf_sock *sk
     * }
     */
    public static final long sk$offset() {
        return sk$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * struct bpf_sock *sk
     * }
     */
    public static MemorySegment sk(MemorySegment struct) {
        return struct.get(sk$LAYOUT, sk$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * struct bpf_sock *sk
     * }
     */
    public static void sk(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(sk$LAYOUT, sk$OFFSET, fieldValue);
    }

    private static final OfInt gso_size$LAYOUT = (OfInt)$LAYOUT.select(groupElement("gso_size"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u32 gso_size
     * }
     */
    public static final OfInt gso_size$layout() {
        return gso_size$LAYOUT;
    }

    private static final long gso_size$OFFSET = 176;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u32 gso_size
     * }
     */
    public static final long gso_size$offset() {
        return gso_size$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u32 gso_size
     * }
     */
    public static int gso_size(MemorySegment struct) {
        return struct.get(gso_size$LAYOUT, gso_size$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u32 gso_size
     * }
     */
    public static void gso_size(MemorySegment struct, int fieldValue) {
        struct.set(gso_size$LAYOUT, gso_size$OFFSET, fieldValue);
    }

    private static final OfByte tstamp_type$LAYOUT = (OfByte)$LAYOUT.select(groupElement("tstamp_type"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u8 tstamp_type
     * }
     */
    public static final OfByte tstamp_type$layout() {
        return tstamp_type$LAYOUT;
    }

    private static final long tstamp_type$OFFSET = 180;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u8 tstamp_type
     * }
     */
    public static final long tstamp_type$offset() {
        return tstamp_type$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u8 tstamp_type
     * }
     */
    public static byte tstamp_type(MemorySegment struct) {
        return struct.get(tstamp_type$LAYOUT, tstamp_type$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u8 tstamp_type
     * }
     */
    public static void tstamp_type(MemorySegment struct, byte fieldValue) {
        struct.set(tstamp_type$LAYOUT, tstamp_type$OFFSET, fieldValue);
    }

    private static final OfLong hwtstamp$LAYOUT = (OfLong)$LAYOUT.select(groupElement("hwtstamp"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u64 hwtstamp
     * }
     */
    public static final OfLong hwtstamp$layout() {
        return hwtstamp$LAYOUT;
    }

    private static final long hwtstamp$OFFSET = 184;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * __u64 hwtstamp
     * }
     */
    public static final long hwtstamp$offset() {
        return hwtstamp$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * __u64 hwtstamp
     * }
     */
    public static long hwtstamp(MemorySegment struct) {
        return struct.get(hwtstamp$LAYOUT, hwtstamp$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u64 hwtstamp
     * }
     */
    public static void hwtstamp(MemorySegment struct, long fieldValue) {
        struct.set(hwtstamp$LAYOUT, hwtstamp$OFFSET, fieldValue);
    }

    /**
     * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
     * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
     */
    public static MemorySegment asSlice(MemorySegment array, long index) {
        return array.asSlice(layout().byteSize() * index);
    }

    /**
     * The size (in bytes) of this struct
     */
    public static long sizeof() { return layout().byteSize(); }

    /**
     * Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
     */
    public static MemorySegment allocate(SegmentAllocator allocator) {
        return allocator.allocate(layout());
    }

    /**
     * Allocate an array of size {@code elementCount} using {@code allocator}.
     * The returned segment has size {@code elementCount * layout().byteSize()}.
     */
    public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
        return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
    }

    /**
     * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
     * The returned segment has size {@code layout().byteSize()}
     */
    public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) {
        return reinterpret(addr, 1, arena, cleanup);
    }

    /**
     * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
     * The returned segment has size {@code elementCount * layout().byteSize()}
     */
    public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) {
        return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy