me.bechberger.ebpf.bpf.raw.fr_proto 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 {
* unsigned int t391;
* unsigned int t392;
* unsigned int n391;
* unsigned int n392;
* unsigned int n393;
* unsigned short lmi;
* unsigned short dce;
* }
* }
*/
public class fr_proto {
fr_proto() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
Lib.C_INT.withName("t391"),
Lib.C_INT.withName("t392"),
Lib.C_INT.withName("n391"),
Lib.C_INT.withName("n392"),
Lib.C_INT.withName("n393"),
Lib.C_SHORT.withName("lmi"),
Lib.C_SHORT.withName("dce")
).withName("$anon$58:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfInt t391$LAYOUT = (OfInt)$LAYOUT.select(groupElement("t391"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned int t391
* }
*/
public static final OfInt t391$layout() {
return t391$LAYOUT;
}
private static final long t391$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned int t391
* }
*/
public static final long t391$offset() {
return t391$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned int t391
* }
*/
public static int t391(MemorySegment struct) {
return struct.get(t391$LAYOUT, t391$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned int t391
* }
*/
public static void t391(MemorySegment struct, int fieldValue) {
struct.set(t391$LAYOUT, t391$OFFSET, fieldValue);
}
private static final OfInt t392$LAYOUT = (OfInt)$LAYOUT.select(groupElement("t392"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned int t392
* }
*/
public static final OfInt t392$layout() {
return t392$LAYOUT;
}
private static final long t392$OFFSET = 4;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned int t392
* }
*/
public static final long t392$offset() {
return t392$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned int t392
* }
*/
public static int t392(MemorySegment struct) {
return struct.get(t392$LAYOUT, t392$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned int t392
* }
*/
public static void t392(MemorySegment struct, int fieldValue) {
struct.set(t392$LAYOUT, t392$OFFSET, fieldValue);
}
private static final OfInt n391$LAYOUT = (OfInt)$LAYOUT.select(groupElement("n391"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned int n391
* }
*/
public static final OfInt n391$layout() {
return n391$LAYOUT;
}
private static final long n391$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned int n391
* }
*/
public static final long n391$offset() {
return n391$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned int n391
* }
*/
public static int n391(MemorySegment struct) {
return struct.get(n391$LAYOUT, n391$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned int n391
* }
*/
public static void n391(MemorySegment struct, int fieldValue) {
struct.set(n391$LAYOUT, n391$OFFSET, fieldValue);
}
private static final OfInt n392$LAYOUT = (OfInt)$LAYOUT.select(groupElement("n392"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned int n392
* }
*/
public static final OfInt n392$layout() {
return n392$LAYOUT;
}
private static final long n392$OFFSET = 12;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned int n392
* }
*/
public static final long n392$offset() {
return n392$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned int n392
* }
*/
public static int n392(MemorySegment struct) {
return struct.get(n392$LAYOUT, n392$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned int n392
* }
*/
public static void n392(MemorySegment struct, int fieldValue) {
struct.set(n392$LAYOUT, n392$OFFSET, fieldValue);
}
private static final OfInt n393$LAYOUT = (OfInt)$LAYOUT.select(groupElement("n393"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned int n393
* }
*/
public static final OfInt n393$layout() {
return n393$LAYOUT;
}
private static final long n393$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned int n393
* }
*/
public static final long n393$offset() {
return n393$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned int n393
* }
*/
public static int n393(MemorySegment struct) {
return struct.get(n393$LAYOUT, n393$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned int n393
* }
*/
public static void n393(MemorySegment struct, int fieldValue) {
struct.set(n393$LAYOUT, n393$OFFSET, fieldValue);
}
private static final OfShort lmi$LAYOUT = (OfShort)$LAYOUT.select(groupElement("lmi"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned short lmi
* }
*/
public static final OfShort lmi$layout() {
return lmi$LAYOUT;
}
private static final long lmi$OFFSET = 20;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned short lmi
* }
*/
public static final long lmi$offset() {
return lmi$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned short lmi
* }
*/
public static short lmi(MemorySegment struct) {
return struct.get(lmi$LAYOUT, lmi$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned short lmi
* }
*/
public static void lmi(MemorySegment struct, short fieldValue) {
struct.set(lmi$LAYOUT, lmi$OFFSET, fieldValue);
}
private static final OfShort dce$LAYOUT = (OfShort)$LAYOUT.select(groupElement("dce"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned short dce
* }
*/
public static final OfShort dce$layout() {
return dce$LAYOUT;
}
private static final long dce$OFFSET = 22;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned short dce
* }
*/
public static final long dce$offset() {
return dce$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned short dce
* }
*/
public static short dce(MemorySegment struct) {
return struct.get(dce$LAYOUT, dce$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned short dce
* }
*/
public static void dce(MemorySegment struct, short fieldValue) {
struct.set(dce$LAYOUT, dce$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);
}
}