me.bechberger.ebpf.bpf.raw.bpf_object_subskeleton 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_subskeleton {
* size_t sz;
* const 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;
* int var_cnt;
* int var_skel_sz;
* struct bpf_var_skeleton *vars;
* }
* }
*/
public class bpf_object_subskeleton {
bpf_object_subskeleton() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
Lib.C_LONG.withName("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"),
Lib.C_INT.withName("var_cnt"),
Lib.C_INT.withName("var_skel_sz"),
Lib.C_POINTER.withName("vars")
).withName("bpf_object_subskeleton");
/**
* 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 obj$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("obj"));
/**
* Layout for field:
* {@snippet lang=c :
* const struct bpf_object *obj
* }
*/
public static final AddressLayout obj$layout() {
return obj$LAYOUT;
}
private static final long obj$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* const struct bpf_object *obj
* }
*/
public static final long obj$offset() {
return obj$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* const struct bpf_object *obj
* }
*/
public static MemorySegment obj(MemorySegment struct) {
return struct.get(obj$LAYOUT, obj$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* const 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 = 16;
/**
* 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 = 20;
/**
* 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 = 24;
/**
* 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 = 32;
/**
* 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 = 36;
/**
* 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 = 40;
/**
* 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);
}
private static final OfInt var_cnt$LAYOUT = (OfInt)$LAYOUT.select(groupElement("var_cnt"));
/**
* Layout for field:
* {@snippet lang=c :
* int var_cnt
* }
*/
public static final OfInt var_cnt$layout() {
return var_cnt$LAYOUT;
}
private static final long var_cnt$OFFSET = 48;
/**
* Offset for field:
* {@snippet lang=c :
* int var_cnt
* }
*/
public static final long var_cnt$offset() {
return var_cnt$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int var_cnt
* }
*/
public static int var_cnt(MemorySegment struct) {
return struct.get(var_cnt$LAYOUT, var_cnt$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int var_cnt
* }
*/
public static void var_cnt(MemorySegment struct, int fieldValue) {
struct.set(var_cnt$LAYOUT, var_cnt$OFFSET, fieldValue);
}
private static final OfInt var_skel_sz$LAYOUT = (OfInt)$LAYOUT.select(groupElement("var_skel_sz"));
/**
* Layout for field:
* {@snippet lang=c :
* int var_skel_sz
* }
*/
public static final OfInt var_skel_sz$layout() {
return var_skel_sz$LAYOUT;
}
private static final long var_skel_sz$OFFSET = 52;
/**
* Offset for field:
* {@snippet lang=c :
* int var_skel_sz
* }
*/
public static final long var_skel_sz$offset() {
return var_skel_sz$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int var_skel_sz
* }
*/
public static int var_skel_sz(MemorySegment struct) {
return struct.get(var_skel_sz$LAYOUT, var_skel_sz$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int var_skel_sz
* }
*/
public static void var_skel_sz(MemorySegment struct, int fieldValue) {
struct.set(var_skel_sz$LAYOUT, var_skel_sz$OFFSET, fieldValue);
}
private static final AddressLayout vars$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("vars"));
/**
* Layout for field:
* {@snippet lang=c :
* struct bpf_var_skeleton *vars
* }
*/
public static final AddressLayout vars$layout() {
return vars$LAYOUT;
}
private static final long vars$OFFSET = 56;
/**
* Offset for field:
* {@snippet lang=c :
* struct bpf_var_skeleton *vars
* }
*/
public static final long vars$offset() {
return vars$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* struct bpf_var_skeleton *vars
* }
*/
public static MemorySegment vars(MemorySegment struct) {
return struct.get(vars$LAYOUT, vars$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* struct bpf_var_skeleton *vars
* }
*/
public static void vars(MemorySegment struct, MemorySegment fieldValue) {
struct.set(vars$LAYOUT, vars$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);
}
}