me.bechberger.ebpf.bpf.raw.tpacket_auxdata 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 tpacket_auxdata {
* __u32 tp_status;
* __u32 tp_len;
* __u32 tp_snaplen;
* __u16 tp_mac;
* __u16 tp_net;
* __u16 tp_vlan_tci;
* __u16 tp_vlan_tpid;
* }
* }
*/
public class tpacket_auxdata {
tpacket_auxdata() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
Lib.C_INT.withName("tp_status"),
Lib.C_INT.withName("tp_len"),
Lib.C_INT.withName("tp_snaplen"),
Lib.C_SHORT.withName("tp_mac"),
Lib.C_SHORT.withName("tp_net"),
Lib.C_SHORT.withName("tp_vlan_tci"),
Lib.C_SHORT.withName("tp_vlan_tpid")
).withName("tpacket_auxdata");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfInt tp_status$LAYOUT = (OfInt)$LAYOUT.select(groupElement("tp_status"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 tp_status
* }
*/
public static final OfInt tp_status$layout() {
return tp_status$LAYOUT;
}
private static final long tp_status$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 tp_status
* }
*/
public static final long tp_status$offset() {
return tp_status$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 tp_status
* }
*/
public static int tp_status(MemorySegment struct) {
return struct.get(tp_status$LAYOUT, tp_status$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 tp_status
* }
*/
public static void tp_status(MemorySegment struct, int fieldValue) {
struct.set(tp_status$LAYOUT, tp_status$OFFSET, fieldValue);
}
private static final OfInt tp_len$LAYOUT = (OfInt)$LAYOUT.select(groupElement("tp_len"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 tp_len
* }
*/
public static final OfInt tp_len$layout() {
return tp_len$LAYOUT;
}
private static final long tp_len$OFFSET = 4;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 tp_len
* }
*/
public static final long tp_len$offset() {
return tp_len$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 tp_len
* }
*/
public static int tp_len(MemorySegment struct) {
return struct.get(tp_len$LAYOUT, tp_len$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 tp_len
* }
*/
public static void tp_len(MemorySegment struct, int fieldValue) {
struct.set(tp_len$LAYOUT, tp_len$OFFSET, fieldValue);
}
private static final OfInt tp_snaplen$LAYOUT = (OfInt)$LAYOUT.select(groupElement("tp_snaplen"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 tp_snaplen
* }
*/
public static final OfInt tp_snaplen$layout() {
return tp_snaplen$LAYOUT;
}
private static final long tp_snaplen$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 tp_snaplen
* }
*/
public static final long tp_snaplen$offset() {
return tp_snaplen$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 tp_snaplen
* }
*/
public static int tp_snaplen(MemorySegment struct) {
return struct.get(tp_snaplen$LAYOUT, tp_snaplen$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 tp_snaplen
* }
*/
public static void tp_snaplen(MemorySegment struct, int fieldValue) {
struct.set(tp_snaplen$LAYOUT, tp_snaplen$OFFSET, fieldValue);
}
private static final OfShort tp_mac$LAYOUT = (OfShort)$LAYOUT.select(groupElement("tp_mac"));
/**
* Layout for field:
* {@snippet lang=c :
* __u16 tp_mac
* }
*/
public static final OfShort tp_mac$layout() {
return tp_mac$LAYOUT;
}
private static final long tp_mac$OFFSET = 12;
/**
* Offset for field:
* {@snippet lang=c :
* __u16 tp_mac
* }
*/
public static final long tp_mac$offset() {
return tp_mac$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u16 tp_mac
* }
*/
public static short tp_mac(MemorySegment struct) {
return struct.get(tp_mac$LAYOUT, tp_mac$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u16 tp_mac
* }
*/
public static void tp_mac(MemorySegment struct, short fieldValue) {
struct.set(tp_mac$LAYOUT, tp_mac$OFFSET, fieldValue);
}
private static final OfShort tp_net$LAYOUT = (OfShort)$LAYOUT.select(groupElement("tp_net"));
/**
* Layout for field:
* {@snippet lang=c :
* __u16 tp_net
* }
*/
public static final OfShort tp_net$layout() {
return tp_net$LAYOUT;
}
private static final long tp_net$OFFSET = 14;
/**
* Offset for field:
* {@snippet lang=c :
* __u16 tp_net
* }
*/
public static final long tp_net$offset() {
return tp_net$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u16 tp_net
* }
*/
public static short tp_net(MemorySegment struct) {
return struct.get(tp_net$LAYOUT, tp_net$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u16 tp_net
* }
*/
public static void tp_net(MemorySegment struct, short fieldValue) {
struct.set(tp_net$LAYOUT, tp_net$OFFSET, fieldValue);
}
private static final OfShort tp_vlan_tci$LAYOUT = (OfShort)$LAYOUT.select(groupElement("tp_vlan_tci"));
/**
* Layout for field:
* {@snippet lang=c :
* __u16 tp_vlan_tci
* }
*/
public static final OfShort tp_vlan_tci$layout() {
return tp_vlan_tci$LAYOUT;
}
private static final long tp_vlan_tci$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* __u16 tp_vlan_tci
* }
*/
public static final long tp_vlan_tci$offset() {
return tp_vlan_tci$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u16 tp_vlan_tci
* }
*/
public static short tp_vlan_tci(MemorySegment struct) {
return struct.get(tp_vlan_tci$LAYOUT, tp_vlan_tci$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u16 tp_vlan_tci
* }
*/
public static void tp_vlan_tci(MemorySegment struct, short fieldValue) {
struct.set(tp_vlan_tci$LAYOUT, tp_vlan_tci$OFFSET, fieldValue);
}
private static final OfShort tp_vlan_tpid$LAYOUT = (OfShort)$LAYOUT.select(groupElement("tp_vlan_tpid"));
/**
* Layout for field:
* {@snippet lang=c :
* __u16 tp_vlan_tpid
* }
*/
public static final OfShort tp_vlan_tpid$layout() {
return tp_vlan_tpid$LAYOUT;
}
private static final long tp_vlan_tpid$OFFSET = 18;
/**
* Offset for field:
* {@snippet lang=c :
* __u16 tp_vlan_tpid
* }
*/
public static final long tp_vlan_tpid$offset() {
return tp_vlan_tpid$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u16 tp_vlan_tpid
* }
*/
public static short tp_vlan_tpid(MemorySegment struct) {
return struct.get(tp_vlan_tpid$LAYOUT, tp_vlan_tpid$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u16 tp_vlan_tpid
* }
*/
public static void tp_vlan_tpid(MemorySegment struct, short fieldValue) {
struct.set(tp_vlan_tpid$LAYOUT, tp_vlan_tpid$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);
}
}