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