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

me.bechberger.ebpf.bpf.raw.tcp_ao_info_opt 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 tcp_ao_info_opt {
 *     __u32 set_current : 1;
 *     __u32 set_rnext : 1;
 *     __u32 ao_required : 1;
 *     __u32 set_counters : 1;
 *     __u32 accept_icmps : 1;
 *     __u32 reserved : 27;
 *     __u16 reserved2;
 *     __u8 current_key;
 *     __u8 rnext;
 *     __u64 pkt_good;
 *     __u64 pkt_bad;
 *     __u64 pkt_key_not_found;
 *     __u64 pkt_ao_required;
 *     __u64 pkt_dropped_icmp;
 * }
 * }
 */
public class tcp_ao_info_opt {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        MemoryLayout.paddingLayout(4),
        Lib.C_SHORT.withName("reserved2"),
        Lib.C_CHAR.withName("current_key"),
        Lib.C_CHAR.withName("rnext"),
        Lib.C_LONG_LONG.withName("pkt_good"),
        Lib.C_LONG_LONG.withName("pkt_bad"),
        Lib.C_LONG_LONG.withName("pkt_key_not_found"),
        Lib.C_LONG_LONG.withName("pkt_ao_required"),
        Lib.C_LONG_LONG.withName("pkt_dropped_icmp")
    ).withName("tcp_ao_info_opt");

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

    private static final OfShort reserved2$LAYOUT = (OfShort)$LAYOUT.select(groupElement("reserved2"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * __u16 reserved2
     * }
     */
    public static final OfShort reserved2$layout() {
        return reserved2$LAYOUT;
    }

    private static final long reserved2$OFFSET = 4;

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

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

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

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

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

    private static final long current_key$OFFSET = 6;

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

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

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

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

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

    private static final long rnext$OFFSET = 7;

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

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

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

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

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

    private static final long pkt_good$OFFSET = 8;

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

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

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

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

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

    private static final long pkt_bad$OFFSET = 16;

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

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

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

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

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

    private static final long pkt_key_not_found$OFFSET = 24;

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

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

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

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

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

    private static final long pkt_ao_required$OFFSET = 32;

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

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

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

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

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

    private static final long pkt_dropped_icmp$OFFSET = 40;

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

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

    /**
     * Setter for field:
     * {@snippet lang=c :
     * __u64 pkt_dropped_icmp
     * }
     */
    public static void pkt_dropped_icmp(MemorySegment struct, long fieldValue) {
        struct.set(pkt_dropped_icmp$LAYOUT, pkt_dropped_icmp$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