1 // Generated by jextract
  2 package jdk.internal.sys;
  3 
  4 import jdk.incubator.foreign.MemoryAddress;
  5 import jdk.incubator.foreign.MemoryLayout;
  6 import jdk.incubator.foreign.MemorySegment;
  7 import jdk.incubator.foreign.NativeAllocationScope;
  8 import java.lang.invoke.VarHandle;
  9 
 10 public final class in_h {
 11 
 12     private in_h() {}
 13 
 14     public static class Cin_addr {
 15 
 16         private Cin_addr() {}
 17         public static MemoryLayout $LAYOUT() {
 18             return in_h$constants.Cin_addr$LAYOUT();
 19         }
 20         public static VarHandle s_addr$VH() {
 21             return in_h$constants.s_addr$VH();
 22         }
 23         public static int s_addr$get(MemoryAddress addr) {
 24             return (int)in_h$constants.s_addr$VH().get(addr);
 25         }
 26         public static int s_addr$get(jdk.incubator.foreign.MemoryAddress addr, long index) {
 27             return (int)in_h$constants.s_addr$VH().get(addr.addOffset(index*sizeof()));
 28         }
 29         public static void s_addr$set(jdk.incubator.foreign.MemoryAddress addr, int x) {
 30             in_h$constants.s_addr$VH().set(addr, x);
 31         }
 32         public static void s_addr$set(jdk.incubator.foreign.MemoryAddress addr, long index, int x) {
 33             in_h$constants.s_addr$VH().set(addr.addOffset(index*sizeof()), x);
 34         }
 35         public static long sizeof() { return $LAYOUT().byteSize(); }
 36         public static MemorySegment allocate() { return MemorySegment.allocateNative($LAYOUT()); }
 37         public static MemoryAddress allocate(NativeAllocationScope scope) { return scope.allocate($LAYOUT()); }
 38         public static MemorySegment allocateArray(int len) {
 39             return MemorySegment.allocateNative(MemoryLayout.ofSequence(len, $LAYOUT()));}
 40         public static MemoryAddress allocateArray(int len, NativeAllocationScope scope) {
 41             return scope.allocate(MemoryLayout.ofSequence(len, $LAYOUT()));}
 42     }
 43 
 44     public static class Csockaddr_in {
 45 
 46         private Csockaddr_in() {}
 47         public static MemoryLayout $LAYOUT() {
 48             return in_h$constants.Csockaddr_in$LAYOUT();
 49         }
 50         public static VarHandle sin_len$VH() {
 51             return in_h$constants.sin_len$VH();
 52         }
 53         public static byte sin_len$get(MemoryAddress addr) {
 54             return (byte)in_h$constants.sin_len$VH().get(addr);
 55         }
 56         public static byte sin_len$get(jdk.incubator.foreign.MemoryAddress addr, long index) {
 57             return (byte)in_h$constants.sin_len$VH().get(addr.addOffset(index*sizeof()));
 58         }
 59         public static void sin_len$set(jdk.incubator.foreign.MemoryAddress addr, byte x) {
 60             in_h$constants.sin_len$VH().set(addr, x);
 61         }
 62         public static void sin_len$set(jdk.incubator.foreign.MemoryAddress addr, long index, byte x) {
 63             in_h$constants.sin_len$VH().set(addr.addOffset(index*sizeof()), x);
 64         }
 65         public static VarHandle sin_family$VH() {
 66             return in_h$constants.sin_family$VH();
 67         }
 68         public static byte sin_family$get(MemoryAddress addr) {
 69             return (byte)in_h$constants.sin_family$VH().get(addr);
 70         }
 71         public static byte sin_family$get(jdk.incubator.foreign.MemoryAddress addr, long index) {
 72             return (byte)in_h$constants.sin_family$VH().get(addr.addOffset(index*sizeof()));
 73         }
 74         public static void sin_family$set(jdk.incubator.foreign.MemoryAddress addr, byte x) {
 75             in_h$constants.sin_family$VH().set(addr, x);
 76         }
 77         public static void sin_family$set(jdk.incubator.foreign.MemoryAddress addr, long index, byte x) {
 78             in_h$constants.sin_family$VH().set(addr.addOffset(index*sizeof()), x);
 79         }
 80         public static VarHandle sin_port$VH() {
 81             return in_h$constants.sin_port$VH();
 82         }
 83         public static short sin_port$get(MemoryAddress addr) {
 84             return (short)in_h$constants.sin_port$VH().get(addr);
 85         }
 86         public static short sin_port$get(jdk.incubator.foreign.MemoryAddress addr, long index) {
 87             return (short)in_h$constants.sin_port$VH().get(addr.addOffset(index*sizeof()));
 88         }
 89         public static void sin_port$set(jdk.incubator.foreign.MemoryAddress addr, short x) {
 90             in_h$constants.sin_port$VH().set(addr, x);
 91         }
 92         public static void sin_port$set(jdk.incubator.foreign.MemoryAddress addr, long index, short x) {
 93             in_h$constants.sin_port$VH().set(addr.addOffset(index*sizeof()), x);
 94         }
 95         public static MemoryAddress sin_addr$addr(MemoryAddress addr) {
 96             return addr.segment().asSlice(4, 4).baseAddress();
 97         }
 98         public static MemoryAddress sin_zero$addr(MemoryAddress addr) {
 99             return addr.segment().asSlice(8, 8).baseAddress();
100         }
101         public static long sizeof() { return $LAYOUT().byteSize(); }
102         public static MemorySegment allocate() { return MemorySegment.allocateNative($LAYOUT()); }
103         public static MemoryAddress allocate(NativeAllocationScope scope) { return scope.allocate($LAYOUT()); }
104         public static MemorySegment allocateArray(int len) {
105             return MemorySegment.allocateNative(MemoryLayout.ofSequence(len, $LAYOUT()));}
106         public static MemoryAddress allocateArray(int len, NativeAllocationScope scope) {
107             return scope.allocate(MemoryLayout.ofSequence(len, $LAYOUT()));}
108     }
109 
110 }