1 // Generatable but for now somewhat handcrafted to encapsulate the layouts
 2 // generated by JStruct, with some additional memory handles and accessors to
 3 // mirror that of the what jextract generates as dynamic constants.
 4 package jdk.internal.sys;
 5 
 6 import jdk.incubator.foreign.MemoryLayout;
 7 import jdk.incubator.foreign.MemoryLayout.PathElement;
 8 import jdk.incubator.foreign.MemoryLayouts;
 9 import java.lang.invoke.VarHandle;
10 
11 final class in6_h$constants {
12 
13     private static final MemoryLayout Cin6_addr$LAYOUT = MemoryLayout.ofStruct(
14             MemoryLayout.ofUnion(
15                     MemoryLayout.ofSequence(16, MemoryLayouts.BITS_8_LE).withName("__u6_addr8"),
16                     MemoryLayout.ofSequence(8, MemoryLayouts.BITS_16_LE).withName("__u6_addr16"),
17                     MemoryLayout.ofSequence(4, MemoryLayouts.BITS_32_LE).withName("__u6_addr32")
18             ).withName("__u6_addr")
19     ).withName("in6_addr");
20     static final MemoryLayout Cin6_addr$LAYOUT() {
21         return  Cin6_addr$LAYOUT;
22     }
23 
24     private static final MemoryLayout Csockaddr_in6$LAYOUT = MemoryLayout.ofStruct(
25             MemoryLayouts.BITS_8_LE.withName("sin6_len"),
26             MemoryLayouts.BITS_8_LE.withName("sin6_family"),
27             MemoryLayouts.BITS_16_BE.withName("sin6_port"),
28             MemoryLayouts.BITS_32_LE.withName("sin6_flowinfo"),
29             Cin6_addr$LAYOUT,
30             MemoryLayouts.BITS_32_LE.withName("sin6_scope_id")
31     ).withName("sockaddr_in6");
32     private static final VarHandle sin6_len$VH = Csockaddr_in6$LAYOUT.varHandle(byte.class, PathElement.groupElement("sin6_len"));
33     private static final VarHandle sin6_family$VH = Csockaddr_in6$LAYOUT.varHandle(byte.class, PathElement.groupElement("sin6_family"));
34     private static final VarHandle sin6_port$VH = Csockaddr_in6$LAYOUT.varHandle(short.class, PathElement.groupElement("sin6_port"));
35     private static final VarHandle sin6_flowinfo$VH = Csockaddr_in6$LAYOUT.varHandle(int.class, PathElement.groupElement("sin6_flowinfo"));
36     private static final VarHandle sin6_scope_id$VH = Csockaddr_in6$LAYOUT.varHandle(int.class, PathElement.groupElement("sin6_scope_id"));
37     static final MemoryLayout Csockaddr_in6$LAYOUT() {
38         return Csockaddr_in6$LAYOUT;
39     }
40     static final VarHandle sin6_len$VH() {
41         return sin6_len$VH;
42     }
43     static final VarHandle sin6_family$VH() {
44         return sin6_family$VH;
45     }
46     static final VarHandle sin6_port$VH() {
47         return sin6_port$VH;
48     }
49     static final VarHandle sin6_flowinfo$VH() {
50         return sin6_flowinfo$VH;
51     }
52     static final VarHandle sin6_scope_id$VH() {
53         return sin6_scope_id$VH;
54     }
55 }