me.bechberger.ebpf.bpf.raw.sk_reuseport_md 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 sk_reuseport_md {
* union {
* void *data;
* __u64 : 64;
* };
* union {
* void *data_end;
* __u64 : 64;
* };
* __u32 len;
* __u32 eth_protocol;
* __u32 ip_protocol;
* __u32 bind_inany;
* __u32 hash;
* union {
* struct bpf_sock *sk;
* __u64 : 64;
* };
* union {
* struct bpf_sock *migrating_sk;
* __u64 : 64;
* };
* }
* }
*/
public class sk_reuseport_md {
sk_reuseport_md() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
MemoryLayout.unionLayout(
Lib.C_POINTER.withName("data")
).withName("$anon$6508:2"),
MemoryLayout.unionLayout(
Lib.C_POINTER.withName("data_end")
).withName("$anon$6510:2"),
Lib.C_INT.withName("len"),
Lib.C_INT.withName("eth_protocol"),
Lib.C_INT.withName("ip_protocol"),
Lib.C_INT.withName("bind_inany"),
Lib.C_INT.withName("hash"),
MemoryLayout.paddingLayout(4),
MemoryLayout.unionLayout(
Lib.C_POINTER.withName("sk")
).withName("$anon$6538:2"),
MemoryLayout.unionLayout(
Lib.C_POINTER.withName("migrating_sk")
).withName("$anon$6539:2")
).withName("sk_reuseport_md");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("$anon$6508:2"), groupElement("data"));
/**
* Layout for field:
* {@snippet lang=c :
* void *data
* }
*/
public static final AddressLayout data$layout() {
return data$LAYOUT;
}
private static final long data$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* void *data
* }
*/
public static final long data$offset() {
return data$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* void *data
* }
*/
public static MemorySegment data(MemorySegment struct) {
return struct.get(data$LAYOUT, data$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* void *data
* }
*/
public static void data(MemorySegment struct, MemorySegment fieldValue) {
struct.set(data$LAYOUT, data$OFFSET, fieldValue);
}
private static final AddressLayout data_end$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("$anon$6510:2"), groupElement("data_end"));
/**
* Layout for field:
* {@snippet lang=c :
* void *data_end
* }
*/
public static final AddressLayout data_end$layout() {
return data_end$LAYOUT;
}
private static final long data_end$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* void *data_end
* }
*/
public static final long data_end$offset() {
return data_end$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* void *data_end
* }
*/
public static MemorySegment data_end(MemorySegment struct) {
return struct.get(data_end$LAYOUT, data_end$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* void *data_end
* }
*/
public static void data_end(MemorySegment struct, MemorySegment fieldValue) {
struct.set(data_end$LAYOUT, data_end$OFFSET, fieldValue);
}
private static final OfInt len$LAYOUT = (OfInt)$LAYOUT.select(groupElement("len"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 len
* }
*/
public static final OfInt len$layout() {
return len$LAYOUT;
}
private static final long len$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 len
* }
*/
public static final long len$offset() {
return len$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 len
* }
*/
public static int len(MemorySegment struct) {
return struct.get(len$LAYOUT, len$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 len
* }
*/
public static void len(MemorySegment struct, int fieldValue) {
struct.set(len$LAYOUT, len$OFFSET, fieldValue);
}
private static final OfInt eth_protocol$LAYOUT = (OfInt)$LAYOUT.select(groupElement("eth_protocol"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 eth_protocol
* }
*/
public static final OfInt eth_protocol$layout() {
return eth_protocol$LAYOUT;
}
private static final long eth_protocol$OFFSET = 20;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 eth_protocol
* }
*/
public static final long eth_protocol$offset() {
return eth_protocol$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 eth_protocol
* }
*/
public static int eth_protocol(MemorySegment struct) {
return struct.get(eth_protocol$LAYOUT, eth_protocol$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 eth_protocol
* }
*/
public static void eth_protocol(MemorySegment struct, int fieldValue) {
struct.set(eth_protocol$LAYOUT, eth_protocol$OFFSET, fieldValue);
}
private static final OfInt ip_protocol$LAYOUT = (OfInt)$LAYOUT.select(groupElement("ip_protocol"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 ip_protocol
* }
*/
public static final OfInt ip_protocol$layout() {
return ip_protocol$LAYOUT;
}
private static final long ip_protocol$OFFSET = 24;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 ip_protocol
* }
*/
public static final long ip_protocol$offset() {
return ip_protocol$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 ip_protocol
* }
*/
public static int ip_protocol(MemorySegment struct) {
return struct.get(ip_protocol$LAYOUT, ip_protocol$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 ip_protocol
* }
*/
public static void ip_protocol(MemorySegment struct, int fieldValue) {
struct.set(ip_protocol$LAYOUT, ip_protocol$OFFSET, fieldValue);
}
private static final OfInt bind_inany$LAYOUT = (OfInt)$LAYOUT.select(groupElement("bind_inany"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 bind_inany
* }
*/
public static final OfInt bind_inany$layout() {
return bind_inany$LAYOUT;
}
private static final long bind_inany$OFFSET = 28;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 bind_inany
* }
*/
public static final long bind_inany$offset() {
return bind_inany$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 bind_inany
* }
*/
public static int bind_inany(MemorySegment struct) {
return struct.get(bind_inany$LAYOUT, bind_inany$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 bind_inany
* }
*/
public static void bind_inany(MemorySegment struct, int fieldValue) {
struct.set(bind_inany$LAYOUT, bind_inany$OFFSET, fieldValue);
}
private static final OfInt hash$LAYOUT = (OfInt)$LAYOUT.select(groupElement("hash"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 hash
* }
*/
public static final OfInt hash$layout() {
return hash$LAYOUT;
}
private static final long hash$OFFSET = 32;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 hash
* }
*/
public static final long hash$offset() {
return hash$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 hash
* }
*/
public static int hash(MemorySegment struct) {
return struct.get(hash$LAYOUT, hash$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 hash
* }
*/
public static void hash(MemorySegment struct, int fieldValue) {
struct.set(hash$LAYOUT, hash$OFFSET, fieldValue);
}
private static final AddressLayout sk$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("$anon$6538:2"), groupElement("sk"));
/**
* Layout for field:
* {@snippet lang=c :
* struct bpf_sock *sk
* }
*/
public static final AddressLayout sk$layout() {
return sk$LAYOUT;
}
private static final long sk$OFFSET = 40;
/**
* Offset for field:
* {@snippet lang=c :
* struct bpf_sock *sk
* }
*/
public static final long sk$offset() {
return sk$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* struct bpf_sock *sk
* }
*/
public static MemorySegment sk(MemorySegment struct) {
return struct.get(sk$LAYOUT, sk$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* struct bpf_sock *sk
* }
*/
public static void sk(MemorySegment struct, MemorySegment fieldValue) {
struct.set(sk$LAYOUT, sk$OFFSET, fieldValue);
}
private static final AddressLayout migrating_sk$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("$anon$6539:2"), groupElement("migrating_sk"));
/**
* Layout for field:
* {@snippet lang=c :
* struct bpf_sock *migrating_sk
* }
*/
public static final AddressLayout migrating_sk$layout() {
return migrating_sk$LAYOUT;
}
private static final long migrating_sk$OFFSET = 48;
/**
* Offset for field:
* {@snippet lang=c :
* struct bpf_sock *migrating_sk
* }
*/
public static final long migrating_sk$offset() {
return migrating_sk$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* struct bpf_sock *migrating_sk
* }
*/
public static MemorySegment migrating_sk(MemorySegment struct) {
return struct.get(migrating_sk$LAYOUT, migrating_sk$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* struct bpf_sock *migrating_sk
* }
*/
public static void migrating_sk(MemorySegment struct, MemorySegment fieldValue) {
struct.set(migrating_sk$LAYOUT, migrating_sk$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);
}
}