me.bechberger.ebpf.bpf.raw.bpf_object_skeleton 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_object_skeleton {
* size_t sz;
* const char *name;
* const void *data;
* size_t data_sz;
* struct bpf_object **obj;
* int map_cnt;
* int map_skel_sz;
* struct bpf_map_skeleton *maps;
* int prog_cnt;
* int prog_skel_sz;
* struct bpf_prog_skeleton *progs;
* }
* }
*/
public class bpf_object_skeleton {
bpf_object_skeleton() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
Lib.C_LONG.withName("sz"),
Lib.C_POINTER.withName("name"),
Lib.C_POINTER.withName("data"),
Lib.C_LONG.withName("data_sz"),
Lib.C_POINTER.withName("obj"),
Lib.C_INT.withName("map_cnt"),
Lib.C_INT.withName("map_skel_sz"),
Lib.C_POINTER.withName("maps"),
Lib.C_INT.withName("prog_cnt"),
Lib.C_INT.withName("prog_skel_sz"),
Lib.C_POINTER.withName("progs")
).withName("bpf_object_skeleton");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfLong sz$LAYOUT = (OfLong)$LAYOUT.select(groupElement("sz"));
/**
* Layout for field:
* {@snippet lang=c :
* size_t sz
* }
*/
public static final OfLong sz$layout() {
return sz$LAYOUT;
}
private static final long sz$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* size_t sz
* }
*/
public static final long sz$offset() {
return sz$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* size_t sz
* }
*/
public static long sz(MemorySegment struct) {
return struct.get(sz$LAYOUT, sz$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* size_t sz
* }
*/
public static void sz(MemorySegment struct, long fieldValue) {
struct.set(sz$LAYOUT, sz$OFFSET, fieldValue);
}
private static final AddressLayout name$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("name"));
/**
* Layout for field:
* {@snippet lang=c :
* const char *name
* }
*/
public static final AddressLayout name$layout() {
return name$LAYOUT;
}
private static final long name$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* const char *name
* }
*/
public static final long name$offset() {
return name$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const char *name
* }
*/
public static MemorySegment name(MemorySegment struct) {
return struct.get(name$LAYOUT, name$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const char *name
* }
*/
public static void name(MemorySegment struct, MemorySegment fieldValue) {
struct.set(name$LAYOUT, name$OFFSET, fieldValue);
}
private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data"));
/**
* Layout for field:
* {@snippet lang=c :
* const void *data
* }
*/
public static final AddressLayout data$layout() {
return data$LAYOUT;
}
private static final long data$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* const void *data
* }
*/
public static final long data$offset() {
return data$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const void *data
* }
*/
public static MemorySegment data(MemorySegment struct) {
return struct.get(data$LAYOUT, data$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const void *data
* }
*/
public static void data(MemorySegment struct, MemorySegment fieldValue) {
struct.set(data$LAYOUT, data$OFFSET, fieldValue);
}
private static final OfLong data_sz$LAYOUT = (OfLong)$LAYOUT.select(groupElement("data_sz"));
/**
* Layout for field:
* {@snippet lang=c :
* size_t data_sz
* }
*/
public static final OfLong data_sz$layout() {
return data_sz$LAYOUT;
}
private static final long data_sz$OFFSET = 24;
/**
* Offset for field:
* {@snippet lang=c :
* size_t data_sz
* }
*/
public static final long data_sz$offset() {
return data_sz$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* size_t data_sz
* }
*/
public static long data_sz(MemorySegment struct) {
return struct.get(data_sz$LAYOUT, data_sz$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* size_t data_sz
* }
*/
public static void data_sz(MemorySegment struct, long fieldValue) {
struct.set(data_sz$LAYOUT, data_sz$OFFSET, fieldValue);
}
private static final AddressLayout obj$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("obj"));
/**
* Layout for field:
* {@snippet lang=c :
* struct bpf_object **obj
* }
*/
public static final AddressLayout obj$layout() {
return obj$LAYOUT;
}
private static final long obj$OFFSET = 32;
/**
* Offset for field:
* {@snippet lang=c :
* struct bpf_object **obj
* }
*/
public static final long obj$offset() {
return obj$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* struct bpf_object **obj
* }
*/
public static MemorySegment obj(MemorySegment struct) {
return struct.get(obj$LAYOUT, obj$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* struct bpf_object **obj
* }
*/
public static void obj(MemorySegment struct, MemorySegment fieldValue) {
struct.set(obj$LAYOUT, obj$OFFSET, fieldValue);
}
private static final OfInt map_cnt$LAYOUT = (OfInt)$LAYOUT.select(groupElement("map_cnt"));
/**
* Layout for field:
* {@snippet lang=c :
* int map_cnt
* }
*/
public static final OfInt map_cnt$layout() {
return map_cnt$LAYOUT;
}
private static final long map_cnt$OFFSET = 40;
/**
* Offset for field:
* {@snippet lang=c :
* int map_cnt
* }
*/
public static final long map_cnt$offset() {
return map_cnt$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int map_cnt
* }
*/
public static int map_cnt(MemorySegment struct) {
return struct.get(map_cnt$LAYOUT, map_cnt$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int map_cnt
* }
*/
public static void map_cnt(MemorySegment struct, int fieldValue) {
struct.set(map_cnt$LAYOUT, map_cnt$OFFSET, fieldValue);
}
private static final OfInt map_skel_sz$LAYOUT = (OfInt)$LAYOUT.select(groupElement("map_skel_sz"));
/**
* Layout for field:
* {@snippet lang=c :
* int map_skel_sz
* }
*/
public static final OfInt map_skel_sz$layout() {
return map_skel_sz$LAYOUT;
}
private static final long map_skel_sz$OFFSET = 44;
/**
* Offset for field:
* {@snippet lang=c :
* int map_skel_sz
* }
*/
public static final long map_skel_sz$offset() {
return map_skel_sz$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int map_skel_sz
* }
*/
public static int map_skel_sz(MemorySegment struct) {
return struct.get(map_skel_sz$LAYOUT, map_skel_sz$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int map_skel_sz
* }
*/
public static void map_skel_sz(MemorySegment struct, int fieldValue) {
struct.set(map_skel_sz$LAYOUT, map_skel_sz$OFFSET, fieldValue);
}
private static final AddressLayout maps$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("maps"));
/**
* Layout for field:
* {@snippet lang=c :
* struct bpf_map_skeleton *maps
* }
*/
public static final AddressLayout maps$layout() {
return maps$LAYOUT;
}
private static final long maps$OFFSET = 48;
/**
* Offset for field:
* {@snippet lang=c :
* struct bpf_map_skeleton *maps
* }
*/
public static final long maps$offset() {
return maps$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* struct bpf_map_skeleton *maps
* }
*/
public static MemorySegment maps(MemorySegment struct) {
return struct.get(maps$LAYOUT, maps$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* struct bpf_map_skeleton *maps
* }
*/
public static void maps(MemorySegment struct, MemorySegment fieldValue) {
struct.set(maps$LAYOUT, maps$OFFSET, fieldValue);
}
private static final OfInt prog_cnt$LAYOUT = (OfInt)$LAYOUT.select(groupElement("prog_cnt"));
/**
* Layout for field:
* {@snippet lang=c :
* int prog_cnt
* }
*/
public static final OfInt prog_cnt$layout() {
return prog_cnt$LAYOUT;
}
private static final long prog_cnt$OFFSET = 56;
/**
* Offset for field:
* {@snippet lang=c :
* int prog_cnt
* }
*/
public static final long prog_cnt$offset() {
return prog_cnt$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int prog_cnt
* }
*/
public static int prog_cnt(MemorySegment struct) {
return struct.get(prog_cnt$LAYOUT, prog_cnt$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int prog_cnt
* }
*/
public static void prog_cnt(MemorySegment struct, int fieldValue) {
struct.set(prog_cnt$LAYOUT, prog_cnt$OFFSET, fieldValue);
}
private static final OfInt prog_skel_sz$LAYOUT = (OfInt)$LAYOUT.select(groupElement("prog_skel_sz"));
/**
* Layout for field:
* {@snippet lang=c :
* int prog_skel_sz
* }
*/
public static final OfInt prog_skel_sz$layout() {
return prog_skel_sz$LAYOUT;
}
private static final long prog_skel_sz$OFFSET = 60;
/**
* Offset for field:
* {@snippet lang=c :
* int prog_skel_sz
* }
*/
public static final long prog_skel_sz$offset() {
return prog_skel_sz$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int prog_skel_sz
* }
*/
public static int prog_skel_sz(MemorySegment struct) {
return struct.get(prog_skel_sz$LAYOUT, prog_skel_sz$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int prog_skel_sz
* }
*/
public static void prog_skel_sz(MemorySegment struct, int fieldValue) {
struct.set(prog_skel_sz$LAYOUT, prog_skel_sz$OFFSET, fieldValue);
}
private static final AddressLayout progs$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("progs"));
/**
* Layout for field:
* {@snippet lang=c :
* struct bpf_prog_skeleton *progs
* }
*/
public static final AddressLayout progs$layout() {
return progs$LAYOUT;
}
private static final long progs$OFFSET = 64;
/**
* Offset for field:
* {@snippet lang=c :
* struct bpf_prog_skeleton *progs
* }
*/
public static final long progs$offset() {
return progs$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* struct bpf_prog_skeleton *progs
* }
*/
public static MemorySegment progs(MemorySegment struct) {
return struct.get(progs$LAYOUT, progs$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* struct bpf_prog_skeleton *progs
* }
*/
public static void progs(MemorySegment struct, MemorySegment fieldValue) {
struct.set(progs$LAYOUT, progs$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);
}
}