me.bechberger.ebpf.bpf.raw.if_settings 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 if_settings {
* unsigned int type;
* unsigned int size;
* union {
* raw_hdlc_proto *raw_hdlc;
* cisco_proto *cisco;
* fr_proto *fr;
* fr_proto_pvc *fr_pvc;
* fr_proto_pvc_info *fr_pvc_info;
* x25_hdlc_proto *x25;
* sync_serial_settings *sync;
* te1_settings *te1;
* } ifs_ifsu;
* }
* }
*/
public class if_settings {
if_settings() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
Lib.C_INT.withName("type"),
Lib.C_INT.withName("size"),
if_settings.ifs_ifsu.layout().withName("ifs_ifsu")
).withName("if_settings");
/**
* 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 :
* unsigned int type
* }
*/
public static final OfInt type$layout() {
return type$LAYOUT;
}
private static final long type$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned int type
* }
*/
public static final long type$offset() {
return type$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned int type
* }
*/
public static int type(MemorySegment struct) {
return struct.get(type$LAYOUT, type$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned int type
* }
*/
public static void type(MemorySegment struct, int fieldValue) {
struct.set(type$LAYOUT, type$OFFSET, fieldValue);
}
private static final OfInt size$LAYOUT = (OfInt)$LAYOUT.select(groupElement("size"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned int size
* }
*/
public static final OfInt size$layout() {
return size$LAYOUT;
}
private static final long size$OFFSET = 4;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned int size
* }
*/
public static final long size$offset() {
return size$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned int size
* }
*/
public static int size(MemorySegment struct) {
return struct.get(size$LAYOUT, size$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned int size
* }
*/
public static void size(MemorySegment struct, int fieldValue) {
struct.set(size$LAYOUT, size$OFFSET, fieldValue);
}
/**
* {@snippet lang=c :
* union {
* raw_hdlc_proto *raw_hdlc;
* cisco_proto *cisco;
* fr_proto *fr;
* fr_proto_pvc *fr_pvc;
* fr_proto_pvc_info *fr_pvc_info;
* x25_hdlc_proto *x25;
* sync_serial_settings *sync;
* te1_settings *te1;
* }
* }
*/
public static class ifs_ifsu {
ifs_ifsu() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout(
Lib.C_POINTER.withName("raw_hdlc"),
Lib.C_POINTER.withName("cisco"),
Lib.C_POINTER.withName("fr"),
Lib.C_POINTER.withName("fr_pvc"),
Lib.C_POINTER.withName("fr_pvc_info"),
Lib.C_POINTER.withName("x25"),
Lib.C_POINTER.withName("sync"),
Lib.C_POINTER.withName("te1")
).withName("$anon$208:2");
/**
* The layout of this union
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final AddressLayout raw_hdlc$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("raw_hdlc"));
/**
* Layout for field:
* {@snippet lang=c :
* raw_hdlc_proto *raw_hdlc
* }
*/
public static final AddressLayout raw_hdlc$layout() {
return raw_hdlc$LAYOUT;
}
private static final long raw_hdlc$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* raw_hdlc_proto *raw_hdlc
* }
*/
public static final long raw_hdlc$offset() {
return raw_hdlc$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* raw_hdlc_proto *raw_hdlc
* }
*/
public static MemorySegment raw_hdlc(MemorySegment union) {
return union.get(raw_hdlc$LAYOUT, raw_hdlc$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* raw_hdlc_proto *raw_hdlc
* }
*/
public static void raw_hdlc(MemorySegment union, MemorySegment fieldValue) {
union.set(raw_hdlc$LAYOUT, raw_hdlc$OFFSET, fieldValue);
}
private static final AddressLayout cisco$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("cisco"));
/**
* Layout for field:
* {@snippet lang=c :
* cisco_proto *cisco
* }
*/
public static final AddressLayout cisco$layout() {
return cisco$LAYOUT;
}
private static final long cisco$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* cisco_proto *cisco
* }
*/
public static final long cisco$offset() {
return cisco$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* cisco_proto *cisco
* }
*/
public static MemorySegment cisco(MemorySegment union) {
return union.get(cisco$LAYOUT, cisco$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* cisco_proto *cisco
* }
*/
public static void cisco(MemorySegment union, MemorySegment fieldValue) {
union.set(cisco$LAYOUT, cisco$OFFSET, fieldValue);
}
private static final AddressLayout fr$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("fr"));
/**
* Layout for field:
* {@snippet lang=c :
* fr_proto *fr
* }
*/
public static final AddressLayout fr$layout() {
return fr$LAYOUT;
}
private static final long fr$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* fr_proto *fr
* }
*/
public static final long fr$offset() {
return fr$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* fr_proto *fr
* }
*/
public static MemorySegment fr(MemorySegment union) {
return union.get(fr$LAYOUT, fr$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* fr_proto *fr
* }
*/
public static void fr(MemorySegment union, MemorySegment fieldValue) {
union.set(fr$LAYOUT, fr$OFFSET, fieldValue);
}
private static final AddressLayout fr_pvc$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("fr_pvc"));
/**
* Layout for field:
* {@snippet lang=c :
* fr_proto_pvc *fr_pvc
* }
*/
public static final AddressLayout fr_pvc$layout() {
return fr_pvc$LAYOUT;
}
private static final long fr_pvc$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* fr_proto_pvc *fr_pvc
* }
*/
public static final long fr_pvc$offset() {
return fr_pvc$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* fr_proto_pvc *fr_pvc
* }
*/
public static MemorySegment fr_pvc(MemorySegment union) {
return union.get(fr_pvc$LAYOUT, fr_pvc$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* fr_proto_pvc *fr_pvc
* }
*/
public static void fr_pvc(MemorySegment union, MemorySegment fieldValue) {
union.set(fr_pvc$LAYOUT, fr_pvc$OFFSET, fieldValue);
}
private static final AddressLayout fr_pvc_info$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("fr_pvc_info"));
/**
* Layout for field:
* {@snippet lang=c :
* fr_proto_pvc_info *fr_pvc_info
* }
*/
public static final AddressLayout fr_pvc_info$layout() {
return fr_pvc_info$LAYOUT;
}
private static final long fr_pvc_info$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* fr_proto_pvc_info *fr_pvc_info
* }
*/
public static final long fr_pvc_info$offset() {
return fr_pvc_info$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* fr_proto_pvc_info *fr_pvc_info
* }
*/
public static MemorySegment fr_pvc_info(MemorySegment union) {
return union.get(fr_pvc_info$LAYOUT, fr_pvc_info$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* fr_proto_pvc_info *fr_pvc_info
* }
*/
public static void fr_pvc_info(MemorySegment union, MemorySegment fieldValue) {
union.set(fr_pvc_info$LAYOUT, fr_pvc_info$OFFSET, fieldValue);
}
private static final AddressLayout x25$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("x25"));
/**
* Layout for field:
* {@snippet lang=c :
* x25_hdlc_proto *x25
* }
*/
public static final AddressLayout x25$layout() {
return x25$LAYOUT;
}
private static final long x25$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* x25_hdlc_proto *x25
* }
*/
public static final long x25$offset() {
return x25$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* x25_hdlc_proto *x25
* }
*/
public static MemorySegment x25(MemorySegment union) {
return union.get(x25$LAYOUT, x25$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* x25_hdlc_proto *x25
* }
*/
public static void x25(MemorySegment union, MemorySegment fieldValue) {
union.set(x25$LAYOUT, x25$OFFSET, fieldValue);
}
private static final AddressLayout sync$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("sync"));
/**
* Layout for field:
* {@snippet lang=c :
* sync_serial_settings *sync
* }
*/
public static final AddressLayout sync$layout() {
return sync$LAYOUT;
}
private static final long sync$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* sync_serial_settings *sync
* }
*/
public static final long sync$offset() {
return sync$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* sync_serial_settings *sync
* }
*/
public static MemorySegment sync(MemorySegment union) {
return union.get(sync$LAYOUT, sync$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* sync_serial_settings *sync
* }
*/
public static void sync(MemorySegment union, MemorySegment fieldValue) {
union.set(sync$LAYOUT, sync$OFFSET, fieldValue);
}
private static final AddressLayout te1$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("te1"));
/**
* Layout for field:
* {@snippet lang=c :
* te1_settings *te1
* }
*/
public static final AddressLayout te1$layout() {
return te1$LAYOUT;
}
private static final long te1$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* te1_settings *te1
* }
*/
public static final long te1$offset() {
return te1$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* te1_settings *te1
* }
*/
public static MemorySegment te1(MemorySegment union) {
return union.get(te1$LAYOUT, te1$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* te1_settings *te1
* }
*/
public static void te1(MemorySegment union, MemorySegment fieldValue) {
union.set(te1$LAYOUT, te1$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 union
*/
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);
}
}
private static final GroupLayout ifs_ifsu$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("ifs_ifsu"));
/**
* Layout for field:
* {@snippet lang=c :
* union {
* raw_hdlc_proto *raw_hdlc;
* cisco_proto *cisco;
* fr_proto *fr;
* fr_proto_pvc *fr_pvc;
* fr_proto_pvc_info *fr_pvc_info;
* x25_hdlc_proto *x25;
* sync_serial_settings *sync;
* te1_settings *te1;
* } ifs_ifsu
* }
*/
public static final GroupLayout ifs_ifsu$layout() {
return ifs_ifsu$LAYOUT;
}
private static final long ifs_ifsu$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* union {
* raw_hdlc_proto *raw_hdlc;
* cisco_proto *cisco;
* fr_proto *fr;
* fr_proto_pvc *fr_pvc;
* fr_proto_pvc_info *fr_pvc_info;
* x25_hdlc_proto *x25;
* sync_serial_settings *sync;
* te1_settings *te1;
* } ifs_ifsu
* }
*/
public static final long ifs_ifsu$offset() {
return ifs_ifsu$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* union {
* raw_hdlc_proto *raw_hdlc;
* cisco_proto *cisco;
* fr_proto *fr;
* fr_proto_pvc *fr_pvc;
* fr_proto_pvc_info *fr_pvc_info;
* x25_hdlc_proto *x25;
* sync_serial_settings *sync;
* te1_settings *te1;
* } ifs_ifsu
* }
*/
public static MemorySegment ifs_ifsu(MemorySegment struct) {
return struct.asSlice(ifs_ifsu$OFFSET, ifs_ifsu$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* union {
* raw_hdlc_proto *raw_hdlc;
* cisco_proto *cisco;
* fr_proto *fr;
* fr_proto_pvc *fr_pvc;
* fr_proto_pvc_info *fr_pvc_info;
* x25_hdlc_proto *x25;
* sync_serial_settings *sync;
* te1_settings *te1;
* } ifs_ifsu
* }
*/
public static void ifs_ifsu(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, ifs_ifsu$OFFSET, ifs_ifsu$LAYOUT.byteSize());
}
/**
* 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);
}
}