me.bechberger.ebpf.bpf.raw.bpf_map_info Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rawbpf Show documentation
Show all versions of rawbpf Show documentation
Raw Panama bindings for libbpf generated for jextract on 64-bit Linux
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 bpf_map_info {
* __u32 type;
* __u32 id;
* __u32 key_size;
* __u32 value_size;
* __u32 max_entries;
* __u32 map_flags;
* char name[16];
* __u32 ifindex;
* __u32 btf_vmlinux_value_type_id;
* __u64 netns_dev;
* __u64 netns_ino;
* __u32 btf_id;
* __u32 btf_key_type_id;
* __u32 btf_value_type_id;
* __u32 btf_vmlinux_id;
* __u64 map_extra;
* }
* }
*/
public class bpf_map_info {
bpf_map_info() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
Lib.C_INT.withName("type"),
Lib.C_INT.withName("id"),
Lib.C_INT.withName("key_size"),
Lib.C_INT.withName("value_size"),
Lib.C_INT.withName("max_entries"),
Lib.C_INT.withName("map_flags"),
MemoryLayout.sequenceLayout(16, Lib.C_CHAR).withName("name"),
Lib.C_INT.withName("ifindex"),
Lib.C_INT.withName("btf_vmlinux_value_type_id"),
Lib.C_LONG_LONG.withName("netns_dev"),
Lib.C_LONG_LONG.withName("netns_ino"),
Lib.C_INT.withName("btf_id"),
Lib.C_INT.withName("btf_key_type_id"),
Lib.C_INT.withName("btf_value_type_id"),
Lib.C_INT.withName("btf_vmlinux_id"),
Lib.C_LONG_LONG.withName("map_extra")
).withName("bpf_map_info");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfInt type$LAYOUT = (OfInt)$LAYOUT.select(groupElement("type"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 type
* }
*/
public static final OfInt type$layout() {
return type$LAYOUT;
}
private static final long type$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 type
* }
*/
public static final long type$offset() {
return type$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 type
* }
*/
public static int type(MemorySegment struct) {
return struct.get(type$LAYOUT, type$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 type
* }
*/
public static void type(MemorySegment struct, int fieldValue) {
struct.set(type$LAYOUT, type$OFFSET, fieldValue);
}
private static final OfInt id$LAYOUT = (OfInt)$LAYOUT.select(groupElement("id"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 id
* }
*/
public static final OfInt id$layout() {
return id$LAYOUT;
}
private static final long id$OFFSET = 4;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 id
* }
*/
public static final long id$offset() {
return id$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 id
* }
*/
public static int id(MemorySegment struct) {
return struct.get(id$LAYOUT, id$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 id
* }
*/
public static void id(MemorySegment struct, int fieldValue) {
struct.set(id$LAYOUT, id$OFFSET, fieldValue);
}
private static final OfInt key_size$LAYOUT = (OfInt)$LAYOUT.select(groupElement("key_size"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 key_size
* }
*/
public static final OfInt key_size$layout() {
return key_size$LAYOUT;
}
private static final long key_size$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 key_size
* }
*/
public static final long key_size$offset() {
return key_size$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 key_size
* }
*/
public static int key_size(MemorySegment struct) {
return struct.get(key_size$LAYOUT, key_size$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 key_size
* }
*/
public static void key_size(MemorySegment struct, int fieldValue) {
struct.set(key_size$LAYOUT, key_size$OFFSET, fieldValue);
}
private static final OfInt value_size$LAYOUT = (OfInt)$LAYOUT.select(groupElement("value_size"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 value_size
* }
*/
public static final OfInt value_size$layout() {
return value_size$LAYOUT;
}
private static final long value_size$OFFSET = 12;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 value_size
* }
*/
public static final long value_size$offset() {
return value_size$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 value_size
* }
*/
public static int value_size(MemorySegment struct) {
return struct.get(value_size$LAYOUT, value_size$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 value_size
* }
*/
public static void value_size(MemorySegment struct, int fieldValue) {
struct.set(value_size$LAYOUT, value_size$OFFSET, fieldValue);
}
private static final OfInt max_entries$LAYOUT = (OfInt)$LAYOUT.select(groupElement("max_entries"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 max_entries
* }
*/
public static final OfInt max_entries$layout() {
return max_entries$LAYOUT;
}
private static final long max_entries$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 max_entries
* }
*/
public static final long max_entries$offset() {
return max_entries$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 max_entries
* }
*/
public static int max_entries(MemorySegment struct) {
return struct.get(max_entries$LAYOUT, max_entries$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 max_entries
* }
*/
public static void max_entries(MemorySegment struct, int fieldValue) {
struct.set(max_entries$LAYOUT, max_entries$OFFSET, fieldValue);
}
private static final OfInt map_flags$LAYOUT = (OfInt)$LAYOUT.select(groupElement("map_flags"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 map_flags
* }
*/
public static final OfInt map_flags$layout() {
return map_flags$LAYOUT;
}
private static final long map_flags$OFFSET = 20;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 map_flags
* }
*/
public static final long map_flags$offset() {
return map_flags$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 map_flags
* }
*/
public static int map_flags(MemorySegment struct) {
return struct.get(map_flags$LAYOUT, map_flags$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 map_flags
* }
*/
public static void map_flags(MemorySegment struct, int fieldValue) {
struct.set(map_flags$LAYOUT, map_flags$OFFSET, fieldValue);
}
private static final SequenceLayout name$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("name"));
/**
* Layout for field:
* {@snippet lang=c :
* char name[16]
* }
*/
public static final SequenceLayout name$layout() {
return name$LAYOUT;
}
private static final long name$OFFSET = 24;
/**
* Offset for field:
* {@snippet lang=c :
* char name[16]
* }
*/
public static final long name$offset() {
return name$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* char name[16]
* }
*/
public static MemorySegment name(MemorySegment struct) {
return struct.asSlice(name$OFFSET, name$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* char name[16]
* }
*/
public static void name(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, name$OFFSET, name$LAYOUT.byteSize());
}
private static long[] name$DIMS = { 16 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* char name[16]
* }
*/
public static long[] name$dimensions() {
return name$DIMS;
}
private static final VarHandle name$ELEM_HANDLE = name$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* char name[16]
* }
*/
public static byte name(MemorySegment struct, long index0) {
return (byte)name$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* char name[16]
* }
*/
public static void name(MemorySegment struct, long index0, byte fieldValue) {
name$ELEM_HANDLE.set(struct, 0L, index0, 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 btf_vmlinux_value_type_id$LAYOUT = (OfInt)$LAYOUT.select(groupElement("btf_vmlinux_value_type_id"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 btf_vmlinux_value_type_id
* }
*/
public static final OfInt btf_vmlinux_value_type_id$layout() {
return btf_vmlinux_value_type_id$LAYOUT;
}
private static final long btf_vmlinux_value_type_id$OFFSET = 44;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 btf_vmlinux_value_type_id
* }
*/
public static final long btf_vmlinux_value_type_id$offset() {
return btf_vmlinux_value_type_id$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 btf_vmlinux_value_type_id
* }
*/
public static int btf_vmlinux_value_type_id(MemorySegment struct) {
return struct.get(btf_vmlinux_value_type_id$LAYOUT, btf_vmlinux_value_type_id$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 btf_vmlinux_value_type_id
* }
*/
public static void btf_vmlinux_value_type_id(MemorySegment struct, int fieldValue) {
struct.set(btf_vmlinux_value_type_id$LAYOUT, btf_vmlinux_value_type_id$OFFSET, fieldValue);
}
private static final OfLong netns_dev$LAYOUT = (OfLong)$LAYOUT.select(groupElement("netns_dev"));
/**
* Layout for field:
* {@snippet lang=c :
* __u64 netns_dev
* }
*/
public static final OfLong netns_dev$layout() {
return netns_dev$LAYOUT;
}
private static final long netns_dev$OFFSET = 48;
/**
* Offset for field:
* {@snippet lang=c :
* __u64 netns_dev
* }
*/
public static final long netns_dev$offset() {
return netns_dev$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u64 netns_dev
* }
*/
public static long netns_dev(MemorySegment struct) {
return struct.get(netns_dev$LAYOUT, netns_dev$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u64 netns_dev
* }
*/
public static void netns_dev(MemorySegment struct, long fieldValue) {
struct.set(netns_dev$LAYOUT, netns_dev$OFFSET, fieldValue);
}
private static final OfLong netns_ino$LAYOUT = (OfLong)$LAYOUT.select(groupElement("netns_ino"));
/**
* Layout for field:
* {@snippet lang=c :
* __u64 netns_ino
* }
*/
public static final OfLong netns_ino$layout() {
return netns_ino$LAYOUT;
}
private static final long netns_ino$OFFSET = 56;
/**
* Offset for field:
* {@snippet lang=c :
* __u64 netns_ino
* }
*/
public static final long netns_ino$offset() {
return netns_ino$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u64 netns_ino
* }
*/
public static long netns_ino(MemorySegment struct) {
return struct.get(netns_ino$LAYOUT, netns_ino$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u64 netns_ino
* }
*/
public static void netns_ino(MemorySegment struct, long fieldValue) {
struct.set(netns_ino$LAYOUT, netns_ino$OFFSET, fieldValue);
}
private static final OfInt btf_id$LAYOUT = (OfInt)$LAYOUT.select(groupElement("btf_id"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 btf_id
* }
*/
public static final OfInt btf_id$layout() {
return btf_id$LAYOUT;
}
private static final long btf_id$OFFSET = 64;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 btf_id
* }
*/
public static final long btf_id$offset() {
return btf_id$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 btf_id
* }
*/
public static int btf_id(MemorySegment struct) {
return struct.get(btf_id$LAYOUT, btf_id$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 btf_id
* }
*/
public static void btf_id(MemorySegment struct, int fieldValue) {
struct.set(btf_id$LAYOUT, btf_id$OFFSET, fieldValue);
}
private static final OfInt btf_key_type_id$LAYOUT = (OfInt)$LAYOUT.select(groupElement("btf_key_type_id"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 btf_key_type_id
* }
*/
public static final OfInt btf_key_type_id$layout() {
return btf_key_type_id$LAYOUT;
}
private static final long btf_key_type_id$OFFSET = 68;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 btf_key_type_id
* }
*/
public static final long btf_key_type_id$offset() {
return btf_key_type_id$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 btf_key_type_id
* }
*/
public static int btf_key_type_id(MemorySegment struct) {
return struct.get(btf_key_type_id$LAYOUT, btf_key_type_id$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 btf_key_type_id
* }
*/
public static void btf_key_type_id(MemorySegment struct, int fieldValue) {
struct.set(btf_key_type_id$LAYOUT, btf_key_type_id$OFFSET, fieldValue);
}
private static final OfInt btf_value_type_id$LAYOUT = (OfInt)$LAYOUT.select(groupElement("btf_value_type_id"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 btf_value_type_id
* }
*/
public static final OfInt btf_value_type_id$layout() {
return btf_value_type_id$LAYOUT;
}
private static final long btf_value_type_id$OFFSET = 72;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 btf_value_type_id
* }
*/
public static final long btf_value_type_id$offset() {
return btf_value_type_id$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 btf_value_type_id
* }
*/
public static int btf_value_type_id(MemorySegment struct) {
return struct.get(btf_value_type_id$LAYOUT, btf_value_type_id$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 btf_value_type_id
* }
*/
public static void btf_value_type_id(MemorySegment struct, int fieldValue) {
struct.set(btf_value_type_id$LAYOUT, btf_value_type_id$OFFSET, fieldValue);
}
private static final OfInt btf_vmlinux_id$LAYOUT = (OfInt)$LAYOUT.select(groupElement("btf_vmlinux_id"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 btf_vmlinux_id
* }
*/
public static final OfInt btf_vmlinux_id$layout() {
return btf_vmlinux_id$LAYOUT;
}
private static final long btf_vmlinux_id$OFFSET = 76;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 btf_vmlinux_id
* }
*/
public static final long btf_vmlinux_id$offset() {
return btf_vmlinux_id$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 btf_vmlinux_id
* }
*/
public static int btf_vmlinux_id(MemorySegment struct) {
return struct.get(btf_vmlinux_id$LAYOUT, btf_vmlinux_id$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 btf_vmlinux_id
* }
*/
public static void btf_vmlinux_id(MemorySegment struct, int fieldValue) {
struct.set(btf_vmlinux_id$LAYOUT, btf_vmlinux_id$OFFSET, fieldValue);
}
private static final OfLong map_extra$LAYOUT = (OfLong)$LAYOUT.select(groupElement("map_extra"));
/**
* Layout for field:
* {@snippet lang=c :
* __u64 map_extra
* }
*/
public static final OfLong map_extra$layout() {
return map_extra$LAYOUT;
}
private static final long map_extra$OFFSET = 80;
/**
* Offset for field:
* {@snippet lang=c :
* __u64 map_extra
* }
*/
public static final long map_extra$offset() {
return map_extra$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u64 map_extra
* }
*/
public static long map_extra(MemorySegment struct) {
return struct.get(map_extra$LAYOUT, map_extra$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u64 map_extra
* }
*/
public static void map_extra(MemorySegment struct, long fieldValue) {
struct.set(map_extra$LAYOUT, map_extra$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);
}
}