1 // Generated by jextract 2 3 package jdk.internal.ffi.generated.iouring; 4 5 import java.lang.invoke.*; 6 import java.lang.foreign.*; 7 import java.nio.ByteOrder; 8 import java.util.*; 9 import java.util.function.*; 10 import java.util.stream.*; 11 12 import static java.lang.foreign.ValueLayout.*; 13 import static java.lang.foreign.MemoryLayout.PathElement.*; 14 15 /** 16 * {@snippet lang=c : 17 * struct in6_addr { 18 * union { 19 * uint8_t __u6_addr8[16]; 20 * uint16_t __u6_addr16[8]; 21 * uint32_t __u6_addr32[4]; 22 * } __in6_u; 23 * } 24 * } 25 */ 26 @SuppressWarnings("restricted") public class in6_addr { 27 28 in6_addr() { 29 // Suppresses public default constructor, ensuring non-instantiability, 30 // but allows generated subclasses in same package. 31 } 32 33 private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( 34 in6_addr.__in6_u.$LAYOUT().withName("__in6_u") 35 ).withName("in6_addr"); 36 37 public static final GroupLayout $LAYOUT() { 38 return $LAYOUT; 39 } 40 41 /** 42 * {@snippet lang=c : 43 * union { 44 * uint8_t __u6_addr8[16]; 45 * uint16_t __u6_addr16[8]; 46 * uint32_t __u6_addr32[4]; 47 * } 48 * } 49 */ 50 public static class __in6_u { 51 52 __in6_u() { 53 // Suppresses public default constructor, ensuring non-instantiability, 54 // but allows generated subclasses in same package. 55 } 56 57 private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout( 58 MemoryLayout.sequenceLayout(16, iouring_h.C_CHAR).withName("__u6_addr8"), 59 MemoryLayout.sequenceLayout(8, iouring_h.C_SHORT).withName("__u6_addr16"), 60 MemoryLayout.sequenceLayout(4, iouring_h.C_INT).withName("__u6_addr32") 61 ).withName("$anon$223:5"); 62 63 public static final GroupLayout $LAYOUT() { 64 return $LAYOUT; 65 } 66 67 private static final long __u6_addr8$OFFSET = 0; 68 private static final long __u6_addr8$SIZE = 16; 69 70 /** 71 * Getter for field: 72 * {@snippet lang=c : 73 * uint8_t __u6_addr8[16] 74 * } 75 */ 76 public static MemorySegment __u6_addr8(MemorySegment union) { 77 return union.asSlice(__u6_addr8$OFFSET, __u6_addr8$SIZE); 78 } 79 80 /** 81 * Setter for field: 82 * {@snippet lang=c : 83 * uint8_t __u6_addr8[16] 84 * } 85 */ 86 public static void __u6_addr8(MemorySegment union, MemorySegment fieldValue) { 87 MemorySegment.copy(fieldValue, 0L, union, __u6_addr8$OFFSET, __u6_addr8$SIZE); 88 } 89 90 private static final long __u6_addr16$OFFSET = 0; 91 private static final long __u6_addr16$SIZE = 16; 92 93 /** 94 * Getter for field: 95 * {@snippet lang=c : 96 * uint16_t __u6_addr16[8] 97 * } 98 */ 99 public static MemorySegment __u6_addr16(MemorySegment union) { 100 return union.asSlice(__u6_addr16$OFFSET, __u6_addr16$SIZE); 101 } 102 103 /** 104 * Setter for field: 105 * {@snippet lang=c : 106 * uint16_t __u6_addr16[8] 107 * } 108 */ 109 public static void __u6_addr16(MemorySegment union, MemorySegment fieldValue) { 110 MemorySegment.copy(fieldValue, 0L, union, __u6_addr16$OFFSET, __u6_addr16$SIZE); 111 } 112 113 private static final long __u6_addr32$OFFSET = 0; 114 private static final long __u6_addr32$SIZE = 16; 115 116 /** 117 * Getter for field: 118 * {@snippet lang=c : 119 * uint32_t __u6_addr32[4] 120 * } 121 */ 122 public static MemorySegment __u6_addr32(MemorySegment union) { 123 return union.asSlice(__u6_addr32$OFFSET, __u6_addr32$SIZE); 124 } 125 126 /** 127 * Setter for field: 128 * {@snippet lang=c : 129 * uint32_t __u6_addr32[4] 130 * } 131 */ 132 public static void __u6_addr32(MemorySegment union, MemorySegment fieldValue) { 133 MemorySegment.copy(fieldValue, 0L, union, __u6_addr32$OFFSET, __u6_addr32$SIZE); 134 } 135 136 public static MemorySegment asSlice(MemorySegment array, long index) { 137 return array.asSlice($LAYOUT().byteSize() * index); 138 } 139 140 public static long sizeof() { return $LAYOUT().byteSize(); } 141 142 public static MemorySegment allocate(SegmentAllocator allocator) { 143 return allocator.allocate($LAYOUT()); 144 } 145 146 public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 147 return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, $LAYOUT())); 148 } 149 150 public static MemorySegment reinterpret(MemorySegment addr, Arena scope, Consumer<MemorySegment> cleanup) { 151 return reinterpret(addr, 1, scope, cleanup); 152 } 153 154 public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena scope, Consumer<MemorySegment> cleanup) { 155 return addr.reinterpret($LAYOUT().byteSize() * elementCount, scope, cleanup); 156 } 157 } 158 159 private static final long __in6_u$OFFSET = 0; 160 private static final long __in6_u$SIZE = 16; 161 162 /** 163 * Getter for field: 164 * {@snippet lang=c : 165 * union (unnamed union at /usr/include/netinet/in.h:223:5) __in6_u 166 * } 167 */ 168 public static MemorySegment __in6_u(MemorySegment struct) { 169 return struct.asSlice(__in6_u$OFFSET, __in6_u$SIZE); 170 } 171 172 /** 173 * Setter for field: 174 * {@snippet lang=c : 175 * union (unnamed union at /usr/include/netinet/in.h:223:5) __in6_u 176 * } 177 */ 178 public static void __in6_u(MemorySegment struct, MemorySegment fieldValue) { 179 MemorySegment.copy(fieldValue, 0L, struct, __in6_u$OFFSET, __in6_u$SIZE); 180 } 181 182 public static MemorySegment asSlice(MemorySegment array, long index) { 183 return array.asSlice($LAYOUT().byteSize() * index); 184 } 185 186 public static long sizeof() { return $LAYOUT().byteSize(); } 187 188 public static MemorySegment allocate(SegmentAllocator allocator) { 189 return allocator.allocate($LAYOUT()); 190 } 191 192 public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 193 return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, $LAYOUT())); 194 } 195 196 public static MemorySegment reinterpret(MemorySegment addr, Arena scope, Consumer<MemorySegment> cleanup) { 197 return reinterpret(addr, 1, scope, cleanup); 198 } 199 200 public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena scope, Consumer<MemorySegment> cleanup) { 201 return addr.reinterpret($LAYOUT().byteSize() * elementCount, scope, cleanup); 202 } 203 } 204