All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.purejava.appindicator._GTlsBackendInterface Maven / Gradle / Ivy

The newest version!
// Generated by jextract

package org.purejava.appindicator;

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 _GTlsBackendInterface {
 *     GTypeInterface g_iface;
 *     gboolean (*supports_tls)(GTlsBackend *);
 *     GType (*get_certificate_type)(void);
 *     GType (*get_client_connection_type)(void);
 *     GType (*get_server_connection_type)(void);
 *     GType (*get_file_database_type)(void);
 *     GTlsDatabase *(*get_default_database)(GTlsBackend *);
 *     gboolean (*supports_dtls)(GTlsBackend *);
 *     GType (*get_dtls_client_connection_type)(void);
 *     GType (*get_dtls_server_connection_type)(void);
 * }
 * }
 */
public class _GTlsBackendInterface {

    _GTlsBackendInterface() {
        // Should not be called directly
    }

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        _GTypeInterface.layout().withName("g_iface"),
        app_indicator_h.C_POINTER.withName("supports_tls"),
        app_indicator_h.C_POINTER.withName("get_certificate_type"),
        app_indicator_h.C_POINTER.withName("get_client_connection_type"),
        app_indicator_h.C_POINTER.withName("get_server_connection_type"),
        app_indicator_h.C_POINTER.withName("get_file_database_type"),
        app_indicator_h.C_POINTER.withName("get_default_database"),
        app_indicator_h.C_POINTER.withName("supports_dtls"),
        app_indicator_h.C_POINTER.withName("get_dtls_client_connection_type"),
        app_indicator_h.C_POINTER.withName("get_dtls_server_connection_type")
    ).withName("_GTlsBackendInterface");

    /**
     * The layout of this struct
     */
    public static final GroupLayout layout() {
        return $LAYOUT;
    }

    private static final GroupLayout g_iface$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("g_iface"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GTypeInterface g_iface
     * }
     */
    public static final GroupLayout g_iface$layout() {
        return g_iface$LAYOUT;
    }

    private static final long g_iface$OFFSET = 0;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * GTypeInterface g_iface
     * }
     */
    public static final long g_iface$offset() {
        return g_iface$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * GTypeInterface g_iface
     * }
     */
    public static MemorySegment g_iface(MemorySegment struct) {
        return struct.asSlice(g_iface$OFFSET, g_iface$LAYOUT.byteSize());
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * GTypeInterface g_iface
     * }
     */
    public static void g_iface(MemorySegment struct, MemorySegment fieldValue) {
        MemorySegment.copy(fieldValue, 0L, struct, g_iface$OFFSET, g_iface$LAYOUT.byteSize());
    }

    /**
     * {@snippet lang=c :
     * gboolean (*supports_tls)(GTlsBackend *)
     * }
     */
    public class supports_tls {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            int apply(MemorySegment _x0);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(supports_tls.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(supports_tls.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static int invoke(MemorySegment funcPtr,MemorySegment _x0) {
            try {
                return (int) DOWN$MH.invokeExact(funcPtr, _x0);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout supports_tls$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("supports_tls"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * gboolean (*supports_tls)(GTlsBackend *)
     * }
     */
    public static final AddressLayout supports_tls$layout() {
        return supports_tls$LAYOUT;
    }

    private static final long supports_tls$OFFSET = 16;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * gboolean (*supports_tls)(GTlsBackend *)
     * }
     */
    public static final long supports_tls$offset() {
        return supports_tls$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * gboolean (*supports_tls)(GTlsBackend *)
     * }
     */
    public static MemorySegment supports_tls(MemorySegment struct) {
        return struct.get(supports_tls$LAYOUT, supports_tls$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * gboolean (*supports_tls)(GTlsBackend *)
     * }
     */
    public static void supports_tls(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(supports_tls$LAYOUT, supports_tls$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * GType (*get_certificate_type)(void)
     * }
     */
    public class get_certificate_type {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            long apply();
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_LONG);

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(get_certificate_type.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(get_certificate_type.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static long invoke(MemorySegment funcPtr) {
            try {
                return (long) DOWN$MH.invokeExact(funcPtr);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout get_certificate_type$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_certificate_type"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GType (*get_certificate_type)(void)
     * }
     */
    public static final AddressLayout get_certificate_type$layout() {
        return get_certificate_type$LAYOUT;
    }

    private static final long get_certificate_type$OFFSET = 24;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * GType (*get_certificate_type)(void)
     * }
     */
    public static final long get_certificate_type$offset() {
        return get_certificate_type$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * GType (*get_certificate_type)(void)
     * }
     */
    public static MemorySegment get_certificate_type(MemorySegment struct) {
        return struct.get(get_certificate_type$LAYOUT, get_certificate_type$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * GType (*get_certificate_type)(void)
     * }
     */
    public static void get_certificate_type(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(get_certificate_type$LAYOUT, get_certificate_type$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * GType (*get_client_connection_type)(void)
     * }
     */
    public class get_client_connection_type {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            long apply();
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_LONG);

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(get_client_connection_type.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(get_client_connection_type.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static long invoke(MemorySegment funcPtr) {
            try {
                return (long) DOWN$MH.invokeExact(funcPtr);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout get_client_connection_type$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_client_connection_type"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GType (*get_client_connection_type)(void)
     * }
     */
    public static final AddressLayout get_client_connection_type$layout() {
        return get_client_connection_type$LAYOUT;
    }

    private static final long get_client_connection_type$OFFSET = 32;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * GType (*get_client_connection_type)(void)
     * }
     */
    public static final long get_client_connection_type$offset() {
        return get_client_connection_type$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * GType (*get_client_connection_type)(void)
     * }
     */
    public static MemorySegment get_client_connection_type(MemorySegment struct) {
        return struct.get(get_client_connection_type$LAYOUT, get_client_connection_type$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * GType (*get_client_connection_type)(void)
     * }
     */
    public static void get_client_connection_type(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(get_client_connection_type$LAYOUT, get_client_connection_type$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * GType (*get_server_connection_type)(void)
     * }
     */
    public class get_server_connection_type {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            long apply();
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_LONG);

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(get_server_connection_type.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(get_server_connection_type.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static long invoke(MemorySegment funcPtr) {
            try {
                return (long) DOWN$MH.invokeExact(funcPtr);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout get_server_connection_type$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_server_connection_type"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GType (*get_server_connection_type)(void)
     * }
     */
    public static final AddressLayout get_server_connection_type$layout() {
        return get_server_connection_type$LAYOUT;
    }

    private static final long get_server_connection_type$OFFSET = 40;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * GType (*get_server_connection_type)(void)
     * }
     */
    public static final long get_server_connection_type$offset() {
        return get_server_connection_type$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * GType (*get_server_connection_type)(void)
     * }
     */
    public static MemorySegment get_server_connection_type(MemorySegment struct) {
        return struct.get(get_server_connection_type$LAYOUT, get_server_connection_type$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * GType (*get_server_connection_type)(void)
     * }
     */
    public static void get_server_connection_type(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(get_server_connection_type$LAYOUT, get_server_connection_type$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * GType (*get_file_database_type)(void)
     * }
     */
    public class get_file_database_type {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            long apply();
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_LONG);

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(get_file_database_type.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(get_file_database_type.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static long invoke(MemorySegment funcPtr) {
            try {
                return (long) DOWN$MH.invokeExact(funcPtr);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout get_file_database_type$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_file_database_type"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GType (*get_file_database_type)(void)
     * }
     */
    public static final AddressLayout get_file_database_type$layout() {
        return get_file_database_type$LAYOUT;
    }

    private static final long get_file_database_type$OFFSET = 48;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * GType (*get_file_database_type)(void)
     * }
     */
    public static final long get_file_database_type$offset() {
        return get_file_database_type$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * GType (*get_file_database_type)(void)
     * }
     */
    public static MemorySegment get_file_database_type(MemorySegment struct) {
        return struct.get(get_file_database_type$LAYOUT, get_file_database_type$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * GType (*get_file_database_type)(void)
     * }
     */
    public static void get_file_database_type(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(get_file_database_type$LAYOUT, get_file_database_type$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * GTlsDatabase *(*get_default_database)(GTlsBackend *)
     * }
     */
    public class get_default_database {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            MemorySegment apply(MemorySegment _x0);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_POINTER,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(get_default_database.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(get_default_database.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0) {
            try {
                return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout get_default_database$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_default_database"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GTlsDatabase *(*get_default_database)(GTlsBackend *)
     * }
     */
    public static final AddressLayout get_default_database$layout() {
        return get_default_database$LAYOUT;
    }

    private static final long get_default_database$OFFSET = 56;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * GTlsDatabase *(*get_default_database)(GTlsBackend *)
     * }
     */
    public static final long get_default_database$offset() {
        return get_default_database$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * GTlsDatabase *(*get_default_database)(GTlsBackend *)
     * }
     */
    public static MemorySegment get_default_database(MemorySegment struct) {
        return struct.get(get_default_database$LAYOUT, get_default_database$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * GTlsDatabase *(*get_default_database)(GTlsBackend *)
     * }
     */
    public static void get_default_database(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(get_default_database$LAYOUT, get_default_database$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * gboolean (*supports_dtls)(GTlsBackend *)
     * }
     */
    public class supports_dtls {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            int apply(MemorySegment _x0);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(supports_dtls.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(supports_dtls.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static int invoke(MemorySegment funcPtr,MemorySegment _x0) {
            try {
                return (int) DOWN$MH.invokeExact(funcPtr, _x0);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout supports_dtls$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("supports_dtls"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * gboolean (*supports_dtls)(GTlsBackend *)
     * }
     */
    public static final AddressLayout supports_dtls$layout() {
        return supports_dtls$LAYOUT;
    }

    private static final long supports_dtls$OFFSET = 64;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * gboolean (*supports_dtls)(GTlsBackend *)
     * }
     */
    public static final long supports_dtls$offset() {
        return supports_dtls$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * gboolean (*supports_dtls)(GTlsBackend *)
     * }
     */
    public static MemorySegment supports_dtls(MemorySegment struct) {
        return struct.get(supports_dtls$LAYOUT, supports_dtls$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * gboolean (*supports_dtls)(GTlsBackend *)
     * }
     */
    public static void supports_dtls(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(supports_dtls$LAYOUT, supports_dtls$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * GType (*get_dtls_client_connection_type)(void)
     * }
     */
    public class get_dtls_client_connection_type {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            long apply();
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_LONG);

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(get_dtls_client_connection_type.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(get_dtls_client_connection_type.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static long invoke(MemorySegment funcPtr) {
            try {
                return (long) DOWN$MH.invokeExact(funcPtr);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout get_dtls_client_connection_type$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_dtls_client_connection_type"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GType (*get_dtls_client_connection_type)(void)
     * }
     */
    public static final AddressLayout get_dtls_client_connection_type$layout() {
        return get_dtls_client_connection_type$LAYOUT;
    }

    private static final long get_dtls_client_connection_type$OFFSET = 72;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * GType (*get_dtls_client_connection_type)(void)
     * }
     */
    public static final long get_dtls_client_connection_type$offset() {
        return get_dtls_client_connection_type$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * GType (*get_dtls_client_connection_type)(void)
     * }
     */
    public static MemorySegment get_dtls_client_connection_type(MemorySegment struct) {
        return struct.get(get_dtls_client_connection_type$LAYOUT, get_dtls_client_connection_type$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * GType (*get_dtls_client_connection_type)(void)
     * }
     */
    public static void get_dtls_client_connection_type(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(get_dtls_client_connection_type$LAYOUT, get_dtls_client_connection_type$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * GType (*get_dtls_server_connection_type)(void)
     * }
     */
    public class get_dtls_server_connection_type {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            long apply();
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_LONG);

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(get_dtls_server_connection_type.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(get_dtls_server_connection_type.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static long invoke(MemorySegment funcPtr) {
            try {
                return (long) DOWN$MH.invokeExact(funcPtr);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout get_dtls_server_connection_type$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_dtls_server_connection_type"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * GType (*get_dtls_server_connection_type)(void)
     * }
     */
    public static final AddressLayout get_dtls_server_connection_type$layout() {
        return get_dtls_server_connection_type$LAYOUT;
    }

    private static final long get_dtls_server_connection_type$OFFSET = 80;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * GType (*get_dtls_server_connection_type)(void)
     * }
     */
    public static final long get_dtls_server_connection_type$offset() {
        return get_dtls_server_connection_type$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * GType (*get_dtls_server_connection_type)(void)
     * }
     */
    public static MemorySegment get_dtls_server_connection_type(MemorySegment struct) {
        return struct.get(get_dtls_server_connection_type$LAYOUT, get_dtls_server_connection_type$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * GType (*get_dtls_server_connection_type)(void)
     * }
     */
    public static void get_dtls_server_connection_type(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(get_dtls_server_connection_type$LAYOUT, get_dtls_server_connection_type$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);
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy