me.bechberger.ebpf.bpf.raw.bpf_fib_lookup 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 bpf_fib_lookup {
* __u8 family;
* __u8 l4_protocol;
* __be16 sport;
* __be16 dport;
* union {
* __u16 tot_len;
* __u16 mtu_result;
* };
* __u32 ifindex;
* union {
* __u8 tos;
* __be32 flowinfo;
* __u32 rt_metric;
* };
* union {
* __be32 ipv4_src;
* __u32 ipv6_src[4];
* };
* union {
* __be32 ipv4_dst;
* __u32 ipv6_dst[4];
* };
* union {
* struct {
* __be16 h_vlan_proto;
* __be16 h_vlan_TCI;
* };
* __u32 tbid;
* };
* union {
* struct {
* __u32 mark;
* };
* struct {
* __u8 smac[6];
* __u8 dmac[6];
* };
* };
* }
* }
*/
public class bpf_fib_lookup {
bpf_fib_lookup() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
Lib.C_CHAR.withName("family"),
Lib.C_CHAR.withName("l4_protocol"),
Lib.C_SHORT.withName("sport"),
Lib.C_SHORT.withName("dport"),
MemoryLayout.unionLayout(
Lib.C_SHORT.withName("tot_len"),
Lib.C_SHORT.withName("mtu_result")
).withName("$anon$7162:2"),
Lib.C_INT.withName("ifindex"),
MemoryLayout.unionLayout(
Lib.C_CHAR.withName("tos"),
Lib.C_INT.withName("flowinfo"),
Lib.C_INT.withName("rt_metric")
).withName("$anon$7174:2"),
MemoryLayout.unionLayout(
Lib.C_INT.withName("ipv4_src"),
MemoryLayout.sequenceLayout(4, Lib.C_INT).withName("ipv6_src")
).withName("$anon$7186:2"),
MemoryLayout.unionLayout(
Lib.C_INT.withName("ipv4_dst"),
MemoryLayout.sequenceLayout(4, Lib.C_INT).withName("ipv6_dst")
).withName("$anon$7195:2"),
MemoryLayout.unionLayout(
MemoryLayout.structLayout(
Lib.C_SHORT.withName("h_vlan_proto"),
Lib.C_SHORT.withName("h_vlan_TCI")
).withName("$anon$7201:3"),
Lib.C_INT.withName("tbid")
).withName("$anon$7200:2"),
MemoryLayout.unionLayout(
MemoryLayout.structLayout(
Lib.C_INT.withName("mark")
).withName("$anon$7215:3"),
MemoryLayout.structLayout(
MemoryLayout.sequenceLayout(6, Lib.C_CHAR).withName("smac"),
MemoryLayout.sequenceLayout(6, Lib.C_CHAR).withName("dmac")
).withName("$anon$7221:3")
).withName("$anon$7213:2")
).withName("bpf_fib_lookup");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfByte family$LAYOUT = (OfByte)$LAYOUT.select(groupElement("family"));
/**
* Layout for field:
* {@snippet lang=c :
* __u8 family
* }
*/
public static final OfByte family$layout() {
return family$LAYOUT;
}
private static final long family$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* __u8 family
* }
*/
public static final long family$offset() {
return family$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u8 family
* }
*/
public static byte family(MemorySegment struct) {
return struct.get(family$LAYOUT, family$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u8 family
* }
*/
public static void family(MemorySegment struct, byte fieldValue) {
struct.set(family$LAYOUT, family$OFFSET, fieldValue);
}
private static final OfByte l4_protocol$LAYOUT = (OfByte)$LAYOUT.select(groupElement("l4_protocol"));
/**
* Layout for field:
* {@snippet lang=c :
* __u8 l4_protocol
* }
*/
public static final OfByte l4_protocol$layout() {
return l4_protocol$LAYOUT;
}
private static final long l4_protocol$OFFSET = 1;
/**
* Offset for field:
* {@snippet lang=c :
* __u8 l4_protocol
* }
*/
public static final long l4_protocol$offset() {
return l4_protocol$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u8 l4_protocol
* }
*/
public static byte l4_protocol(MemorySegment struct) {
return struct.get(l4_protocol$LAYOUT, l4_protocol$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u8 l4_protocol
* }
*/
public static void l4_protocol(MemorySegment struct, byte fieldValue) {
struct.set(l4_protocol$LAYOUT, l4_protocol$OFFSET, fieldValue);
}
private static final OfShort sport$LAYOUT = (OfShort)$LAYOUT.select(groupElement("sport"));
/**
* Layout for field:
* {@snippet lang=c :
* __be16 sport
* }
*/
public static final OfShort sport$layout() {
return sport$LAYOUT;
}
private static final long sport$OFFSET = 2;
/**
* Offset for field:
* {@snippet lang=c :
* __be16 sport
* }
*/
public static final long sport$offset() {
return sport$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __be16 sport
* }
*/
public static short sport(MemorySegment struct) {
return struct.get(sport$LAYOUT, sport$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __be16 sport
* }
*/
public static void sport(MemorySegment struct, short fieldValue) {
struct.set(sport$LAYOUT, sport$OFFSET, fieldValue);
}
private static final OfShort dport$LAYOUT = (OfShort)$LAYOUT.select(groupElement("dport"));
/**
* Layout for field:
* {@snippet lang=c :
* __be16 dport
* }
*/
public static final OfShort dport$layout() {
return dport$LAYOUT;
}
private static final long dport$OFFSET = 4;
/**
* Offset for field:
* {@snippet lang=c :
* __be16 dport
* }
*/
public static final long dport$offset() {
return dport$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __be16 dport
* }
*/
public static short dport(MemorySegment struct) {
return struct.get(dport$LAYOUT, dport$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __be16 dport
* }
*/
public static void dport(MemorySegment struct, short fieldValue) {
struct.set(dport$LAYOUT, dport$OFFSET, fieldValue);
}
private static final OfShort tot_len$LAYOUT = (OfShort)$LAYOUT.select(groupElement("$anon$7162:2"), groupElement("tot_len"));
/**
* Layout for field:
* {@snippet lang=c :
* __u16 tot_len
* }
*/
public static final OfShort tot_len$layout() {
return tot_len$LAYOUT;
}
private static final long tot_len$OFFSET = 6;
/**
* Offset for field:
* {@snippet lang=c :
* __u16 tot_len
* }
*/
public static final long tot_len$offset() {
return tot_len$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u16 tot_len
* }
*/
public static short tot_len(MemorySegment struct) {
return struct.get(tot_len$LAYOUT, tot_len$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u16 tot_len
* }
*/
public static void tot_len(MemorySegment struct, short fieldValue) {
struct.set(tot_len$LAYOUT, tot_len$OFFSET, fieldValue);
}
private static final OfShort mtu_result$LAYOUT = (OfShort)$LAYOUT.select(groupElement("$anon$7162:2"), groupElement("mtu_result"));
/**
* Layout for field:
* {@snippet lang=c :
* __u16 mtu_result
* }
*/
public static final OfShort mtu_result$layout() {
return mtu_result$LAYOUT;
}
private static final long mtu_result$OFFSET = 6;
/**
* Offset for field:
* {@snippet lang=c :
* __u16 mtu_result
* }
*/
public static final long mtu_result$offset() {
return mtu_result$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u16 mtu_result
* }
*/
public static short mtu_result(MemorySegment struct) {
return struct.get(mtu_result$LAYOUT, mtu_result$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u16 mtu_result
* }
*/
public static void mtu_result(MemorySegment struct, short fieldValue) {
struct.set(mtu_result$LAYOUT, mtu_result$OFFSET, fieldValue);
}
private static final OfInt ifindex$LAYOUT = (OfInt)$LAYOUT.select(groupElement("ifindex"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 ifindex
* }
*/
public static final OfInt ifindex$layout() {
return ifindex$LAYOUT;
}
private static final long ifindex$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 ifindex
* }
*/
public static final long ifindex$offset() {
return ifindex$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 ifindex
* }
*/
public static int ifindex(MemorySegment struct) {
return struct.get(ifindex$LAYOUT, ifindex$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 ifindex
* }
*/
public static void ifindex(MemorySegment struct, int fieldValue) {
struct.set(ifindex$LAYOUT, ifindex$OFFSET, fieldValue);
}
private static final OfByte tos$LAYOUT = (OfByte)$LAYOUT.select(groupElement("$anon$7174:2"), groupElement("tos"));
/**
* Layout for field:
* {@snippet lang=c :
* __u8 tos
* }
*/
public static final OfByte tos$layout() {
return tos$LAYOUT;
}
private static final long tos$OFFSET = 12;
/**
* Offset for field:
* {@snippet lang=c :
* __u8 tos
* }
*/
public static final long tos$offset() {
return tos$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u8 tos
* }
*/
public static byte tos(MemorySegment struct) {
return struct.get(tos$LAYOUT, tos$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u8 tos
* }
*/
public static void tos(MemorySegment struct, byte fieldValue) {
struct.set(tos$LAYOUT, tos$OFFSET, fieldValue);
}
private static final OfInt flowinfo$LAYOUT = (OfInt)$LAYOUT.select(groupElement("$anon$7174:2"), groupElement("flowinfo"));
/**
* Layout for field:
* {@snippet lang=c :
* __be32 flowinfo
* }
*/
public static final OfInt flowinfo$layout() {
return flowinfo$LAYOUT;
}
private static final long flowinfo$OFFSET = 12;
/**
* Offset for field:
* {@snippet lang=c :
* __be32 flowinfo
* }
*/
public static final long flowinfo$offset() {
return flowinfo$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __be32 flowinfo
* }
*/
public static int flowinfo(MemorySegment struct) {
return struct.get(flowinfo$LAYOUT, flowinfo$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __be32 flowinfo
* }
*/
public static void flowinfo(MemorySegment struct, int fieldValue) {
struct.set(flowinfo$LAYOUT, flowinfo$OFFSET, fieldValue);
}
private static final OfInt rt_metric$LAYOUT = (OfInt)$LAYOUT.select(groupElement("$anon$7174:2"), groupElement("rt_metric"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 rt_metric
* }
*/
public static final OfInt rt_metric$layout() {
return rt_metric$LAYOUT;
}
private static final long rt_metric$OFFSET = 12;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 rt_metric
* }
*/
public static final long rt_metric$offset() {
return rt_metric$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 rt_metric
* }
*/
public static int rt_metric(MemorySegment struct) {
return struct.get(rt_metric$LAYOUT, rt_metric$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 rt_metric
* }
*/
public static void rt_metric(MemorySegment struct, int fieldValue) {
struct.set(rt_metric$LAYOUT, rt_metric$OFFSET, fieldValue);
}
private static final OfInt ipv4_src$LAYOUT = (OfInt)$LAYOUT.select(groupElement("$anon$7186:2"), groupElement("ipv4_src"));
/**
* Layout for field:
* {@snippet lang=c :
* __be32 ipv4_src
* }
*/
public static final OfInt ipv4_src$layout() {
return ipv4_src$LAYOUT;
}
private static final long ipv4_src$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* __be32 ipv4_src
* }
*/
public static final long ipv4_src$offset() {
return ipv4_src$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __be32 ipv4_src
* }
*/
public static int ipv4_src(MemorySegment struct) {
return struct.get(ipv4_src$LAYOUT, ipv4_src$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __be32 ipv4_src
* }
*/
public static void ipv4_src(MemorySegment struct, int fieldValue) {
struct.set(ipv4_src$LAYOUT, ipv4_src$OFFSET, fieldValue);
}
private static final SequenceLayout ipv6_src$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("$anon$7186:2"), groupElement("ipv6_src"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 ipv6_src[4]
* }
*/
public static final SequenceLayout ipv6_src$layout() {
return ipv6_src$LAYOUT;
}
private static final long ipv6_src$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 ipv6_src[4]
* }
*/
public static final long ipv6_src$offset() {
return ipv6_src$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 ipv6_src[4]
* }
*/
public static MemorySegment ipv6_src(MemorySegment struct) {
return struct.asSlice(ipv6_src$OFFSET, ipv6_src$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 ipv6_src[4]
* }
*/
public static void ipv6_src(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, ipv6_src$OFFSET, ipv6_src$LAYOUT.byteSize());
}
private static long[] ipv6_src$DIMS = { 4 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* __u32 ipv6_src[4]
* }
*/
public static long[] ipv6_src$dimensions() {
return ipv6_src$DIMS;
}
private static final VarHandle ipv6_src$ELEM_HANDLE = ipv6_src$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* __u32 ipv6_src[4]
* }
*/
public static int ipv6_src(MemorySegment struct, long index0) {
return (int)ipv6_src$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* __u32 ipv6_src[4]
* }
*/
public static void ipv6_src(MemorySegment struct, long index0, int fieldValue) {
ipv6_src$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
}
private static final OfInt ipv4_dst$LAYOUT = (OfInt)$LAYOUT.select(groupElement("$anon$7195:2"), groupElement("ipv4_dst"));
/**
* Layout for field:
* {@snippet lang=c :
* __be32 ipv4_dst
* }
*/
public static final OfInt ipv4_dst$layout() {
return ipv4_dst$LAYOUT;
}
private static final long ipv4_dst$OFFSET = 32;
/**
* Offset for field:
* {@snippet lang=c :
* __be32 ipv4_dst
* }
*/
public static final long ipv4_dst$offset() {
return ipv4_dst$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __be32 ipv4_dst
* }
*/
public static int ipv4_dst(MemorySegment struct) {
return struct.get(ipv4_dst$LAYOUT, ipv4_dst$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __be32 ipv4_dst
* }
*/
public static void ipv4_dst(MemorySegment struct, int fieldValue) {
struct.set(ipv4_dst$LAYOUT, ipv4_dst$OFFSET, fieldValue);
}
private static final SequenceLayout ipv6_dst$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("$anon$7195:2"), groupElement("ipv6_dst"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 ipv6_dst[4]
* }
*/
public static final SequenceLayout ipv6_dst$layout() {
return ipv6_dst$LAYOUT;
}
private static final long ipv6_dst$OFFSET = 32;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 ipv6_dst[4]
* }
*/
public static final long ipv6_dst$offset() {
return ipv6_dst$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 ipv6_dst[4]
* }
*/
public static MemorySegment ipv6_dst(MemorySegment struct) {
return struct.asSlice(ipv6_dst$OFFSET, ipv6_dst$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 ipv6_dst[4]
* }
*/
public static void ipv6_dst(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, ipv6_dst$OFFSET, ipv6_dst$LAYOUT.byteSize());
}
private static long[] ipv6_dst$DIMS = { 4 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* __u32 ipv6_dst[4]
* }
*/
public static long[] ipv6_dst$dimensions() {
return ipv6_dst$DIMS;
}
private static final VarHandle ipv6_dst$ELEM_HANDLE = ipv6_dst$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* __u32 ipv6_dst[4]
* }
*/
public static int ipv6_dst(MemorySegment struct, long index0) {
return (int)ipv6_dst$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* __u32 ipv6_dst[4]
* }
*/
public static void ipv6_dst(MemorySegment struct, long index0, int fieldValue) {
ipv6_dst$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
}
private static final OfShort h_vlan_proto$LAYOUT = (OfShort)$LAYOUT.select(groupElement("$anon$7200:2"), groupElement("$anon$7201:3"), groupElement("h_vlan_proto"));
/**
* Layout for field:
* {@snippet lang=c :
* __be16 h_vlan_proto
* }
*/
public static final OfShort h_vlan_proto$layout() {
return h_vlan_proto$LAYOUT;
}
private static final long h_vlan_proto$OFFSET = 48;
/**
* Offset for field:
* {@snippet lang=c :
* __be16 h_vlan_proto
* }
*/
public static final long h_vlan_proto$offset() {
return h_vlan_proto$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __be16 h_vlan_proto
* }
*/
public static short h_vlan_proto(MemorySegment struct) {
return struct.get(h_vlan_proto$LAYOUT, h_vlan_proto$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __be16 h_vlan_proto
* }
*/
public static void h_vlan_proto(MemorySegment struct, short fieldValue) {
struct.set(h_vlan_proto$LAYOUT, h_vlan_proto$OFFSET, fieldValue);
}
private static final OfShort h_vlan_TCI$LAYOUT = (OfShort)$LAYOUT.select(groupElement("$anon$7200:2"), groupElement("$anon$7201:3"), groupElement("h_vlan_TCI"));
/**
* Layout for field:
* {@snippet lang=c :
* __be16 h_vlan_TCI
* }
*/
public static final OfShort h_vlan_TCI$layout() {
return h_vlan_TCI$LAYOUT;
}
private static final long h_vlan_TCI$OFFSET = 50;
/**
* Offset for field:
* {@snippet lang=c :
* __be16 h_vlan_TCI
* }
*/
public static final long h_vlan_TCI$offset() {
return h_vlan_TCI$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __be16 h_vlan_TCI
* }
*/
public static short h_vlan_TCI(MemorySegment struct) {
return struct.get(h_vlan_TCI$LAYOUT, h_vlan_TCI$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __be16 h_vlan_TCI
* }
*/
public static void h_vlan_TCI(MemorySegment struct, short fieldValue) {
struct.set(h_vlan_TCI$LAYOUT, h_vlan_TCI$OFFSET, fieldValue);
}
private static final OfInt tbid$LAYOUT = (OfInt)$LAYOUT.select(groupElement("$anon$7200:2"), groupElement("tbid"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 tbid
* }
*/
public static final OfInt tbid$layout() {
return tbid$LAYOUT;
}
private static final long tbid$OFFSET = 48;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 tbid
* }
*/
public static final long tbid$offset() {
return tbid$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 tbid
* }
*/
public static int tbid(MemorySegment struct) {
return struct.get(tbid$LAYOUT, tbid$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 tbid
* }
*/
public static void tbid(MemorySegment struct, int fieldValue) {
struct.set(tbid$LAYOUT, tbid$OFFSET, fieldValue);
}
private static final OfInt mark$LAYOUT = (OfInt)$LAYOUT.select(groupElement("$anon$7213:2"), groupElement("$anon$7215:3"), groupElement("mark"));
/**
* Layout for field:
* {@snippet lang=c :
* __u32 mark
* }
*/
public static final OfInt mark$layout() {
return mark$LAYOUT;
}
private static final long mark$OFFSET = 52;
/**
* Offset for field:
* {@snippet lang=c :
* __u32 mark
* }
*/
public static final long mark$offset() {
return mark$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u32 mark
* }
*/
public static int mark(MemorySegment struct) {
return struct.get(mark$LAYOUT, mark$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u32 mark
* }
*/
public static void mark(MemorySegment struct, int fieldValue) {
struct.set(mark$LAYOUT, mark$OFFSET, fieldValue);
}
private static final SequenceLayout smac$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("$anon$7213:2"), groupElement("$anon$7221:3"), groupElement("smac"));
/**
* Layout for field:
* {@snippet lang=c :
* __u8 smac[6]
* }
*/
public static final SequenceLayout smac$layout() {
return smac$LAYOUT;
}
private static final long smac$OFFSET = 52;
/**
* Offset for field:
* {@snippet lang=c :
* __u8 smac[6]
* }
*/
public static final long smac$offset() {
return smac$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u8 smac[6]
* }
*/
public static MemorySegment smac(MemorySegment struct) {
return struct.asSlice(smac$OFFSET, smac$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* __u8 smac[6]
* }
*/
public static void smac(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, smac$OFFSET, smac$LAYOUT.byteSize());
}
private static long[] smac$DIMS = { 6 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* __u8 smac[6]
* }
*/
public static long[] smac$dimensions() {
return smac$DIMS;
}
private static final VarHandle smac$ELEM_HANDLE = smac$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* __u8 smac[6]
* }
*/
public static byte smac(MemorySegment struct, long index0) {
return (byte)smac$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* __u8 smac[6]
* }
*/
public static void smac(MemorySegment struct, long index0, byte fieldValue) {
smac$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
}
private static final SequenceLayout dmac$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("$anon$7213:2"), groupElement("$anon$7221:3"), groupElement("dmac"));
/**
* Layout for field:
* {@snippet lang=c :
* __u8 dmac[6]
* }
*/
public static final SequenceLayout dmac$layout() {
return dmac$LAYOUT;
}
private static final long dmac$OFFSET = 58;
/**
* Offset for field:
* {@snippet lang=c :
* __u8 dmac[6]
* }
*/
public static final long dmac$offset() {
return dmac$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u8 dmac[6]
* }
*/
public static MemorySegment dmac(MemorySegment struct) {
return struct.asSlice(dmac$OFFSET, dmac$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* __u8 dmac[6]
* }
*/
public static void dmac(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, dmac$OFFSET, dmac$LAYOUT.byteSize());
}
private static long[] dmac$DIMS = { 6 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* __u8 dmac[6]
* }
*/
public static long[] dmac$dimensions() {
return dmac$DIMS;
}
private static final VarHandle dmac$ELEM_HANDLE = dmac$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* __u8 dmac[6]
* }
*/
public static byte dmac(MemorySegment struct, long index0) {
return (byte)dmac$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* __u8 dmac[6]
* }
*/
public static void dmac(MemorySegment struct, long index0, byte fieldValue) {
dmac$ELEM_HANDLE.set(struct, 0L, index0, 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);
}
}