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

me.bechberger.ebpf.bpf.raw.tcp_repair_window 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_repair_window {
 *     __u32 snd_wl1;
 *     __u32 snd_wnd;
 *     __u32 max_window;
 *     __u32 rcv_wnd;
 *     __u32 rcv_wup;
 * }
 * }
 */
public class tcp_repair_window {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        Lib.C_INT.withName("snd_wl1"),
        Lib.C_INT.withName("snd_wnd"),
        Lib.C_INT.withName("max_window"),
        Lib.C_INT.withName("rcv_wnd"),
        Lib.C_INT.withName("rcv_wup")
    ).withName("tcp_repair_window");

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

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

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

    private static final long snd_wl1$OFFSET = 0;

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

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

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

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

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

    private static final long snd_wnd$OFFSET = 4;

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

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

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

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

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

    private static final long max_window$OFFSET = 8;

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

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

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

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

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

    private static final long rcv_wnd$OFFSET = 12;

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

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

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

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

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

    private static final long rcv_wup$OFFSET = 16;

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

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

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