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

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

// Generated by jextract

package org.purejava.appindicator;

import java.lang.foreign.*;
import java.lang.invoke.MethodHandle;
import java.util.function.Consumer;

import static java.lang.foreign.MemoryLayout.PathElement.groupElement;

/**
 * {@snippet lang=c :
 * struct _GDtlsConnectionInterface {
 *     GTypeInterface g_iface;
 *     gboolean (*accept_certificate)(GDtlsConnection *, GTlsCertificate *, GTlsCertificateFlags);
 *     gboolean (*handshake)(GDtlsConnection *, GCancellable *, GError **);
 *     void (*handshake_async)(GDtlsConnection *, int, GCancellable *, GAsyncReadyCallback, gpointer);
 *     gboolean (*handshake_finish)(GDtlsConnection *, GAsyncResult *, GError **);
 *     gboolean (*shutdown)(GDtlsConnection *, gboolean, gboolean, GCancellable *, GError **);
 *     void (*shutdown_async)(GDtlsConnection *, gboolean, gboolean, int, GCancellable *, GAsyncReadyCallback, gpointer);
 *     gboolean (*shutdown_finish)(GDtlsConnection *, GAsyncResult *, GError **);
 *     void (*set_advertised_protocols)(GDtlsConnection *, const gchar *const *);
 *     const gchar *(*get_negotiated_protocol)(GDtlsConnection *);
 *     gboolean (*get_binding_data)(GDtlsConnection *, GTlsChannelBindingType, GByteArray *, GError **);
 * }
 * }
 */
public class _GDtlsConnectionInterface {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        _GTypeInterface.layout().withName("g_iface"),
        app_indicator_h.C_POINTER.withName("accept_certificate"),
        app_indicator_h.C_POINTER.withName("handshake"),
        app_indicator_h.C_POINTER.withName("handshake_async"),
        app_indicator_h.C_POINTER.withName("handshake_finish"),
        app_indicator_h.C_POINTER.withName("shutdown"),
        app_indicator_h.C_POINTER.withName("shutdown_async"),
        app_indicator_h.C_POINTER.withName("shutdown_finish"),
        app_indicator_h.C_POINTER.withName("set_advertised_protocols"),
        app_indicator_h.C_POINTER.withName("get_negotiated_protocol"),
        app_indicator_h.C_POINTER.withName("get_binding_data")
    ).withName("_GDtlsConnectionInterface");

    /**
     * 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 (*accept_certificate)(GDtlsConnection *, GTlsCertificate *, GTlsCertificateFlags)
     * }
     */
    public class accept_certificate {

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

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

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

        private static final MethodHandle UP$MH = app_indicator_h.upcallHandle(accept_certificate.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(accept_certificate.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, MemorySegment _x1, int _x2) {
            try {
                return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * gboolean (*accept_certificate)(GDtlsConnection *, GTlsCertificate *, GTlsCertificateFlags)
     * }
     */
    public static final AddressLayout accept_certificate$layout() {
        return accept_certificate$LAYOUT;
    }

    private static final long accept_certificate$OFFSET = 16;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * gboolean (*accept_certificate)(GDtlsConnection *, GTlsCertificate *, GTlsCertificateFlags)
     * }
     */
    public static final long accept_certificate$offset() {
        return accept_certificate$OFFSET;
    }

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

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

    /**
     * {@snippet lang=c :
     * gboolean (*handshake)(GDtlsConnection *, GCancellable *, GError **)
     * }
     */
    public class handshake {

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

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER,
            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(handshake.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(handshake.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, MemorySegment _x1, MemorySegment _x2) {
            try {
                return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * gboolean (*handshake)(GDtlsConnection *, GCancellable *, GError **)
     * }
     */
    public static final AddressLayout handshake$layout() {
        return handshake$LAYOUT;
    }

    private static final long handshake$OFFSET = 24;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * gboolean (*handshake)(GDtlsConnection *, GCancellable *, GError **)
     * }
     */
    public static final long handshake$offset() {
        return handshake$OFFSET;
    }

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

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

    /**
     * {@snippet lang=c :
     * void (*handshake_async)(GDtlsConnection *, int, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public class handshake_async {

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

        private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid(
            app_indicator_h.C_POINTER,
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER,
            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(handshake_async.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(handshake_async.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 void invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3, MemorySegment _x4) {
            try {
                 DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * void (*handshake_async)(GDtlsConnection *, int, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static final AddressLayout handshake_async$layout() {
        return handshake_async$LAYOUT;
    }

    private static final long handshake_async$OFFSET = 32;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * void (*handshake_async)(GDtlsConnection *, int, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static final long handshake_async$offset() {
        return handshake_async$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * void (*handshake_async)(GDtlsConnection *, int, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static MemorySegment handshake_async(MemorySegment struct) {
        return struct.get(handshake_async$LAYOUT, handshake_async$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * void (*handshake_async)(GDtlsConnection *, int, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static void handshake_async(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(handshake_async$LAYOUT, handshake_async$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * gboolean (*handshake_finish)(GDtlsConnection *, GAsyncResult *, GError **)
     * }
     */
    public class handshake_finish {

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

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER,
            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(handshake_finish.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(handshake_finish.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, MemorySegment _x1, MemorySegment _x2) {
            try {
                return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * gboolean (*handshake_finish)(GDtlsConnection *, GAsyncResult *, GError **)
     * }
     */
    public static final AddressLayout handshake_finish$layout() {
        return handshake_finish$LAYOUT;
    }

    private static final long handshake_finish$OFFSET = 40;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * gboolean (*handshake_finish)(GDtlsConnection *, GAsyncResult *, GError **)
     * }
     */
    public static final long handshake_finish$offset() {
        return handshake_finish$OFFSET;
    }

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

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

    /**
     * {@snippet lang=c :
     * gboolean (*shutdown)(GDtlsConnection *, gboolean, gboolean, GCancellable *, GError **)
     * }
     */
    public class shutdown {

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

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_INT,
            app_indicator_h.C_INT,
            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(shutdown.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(shutdown.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, int _x1, int _x2, MemorySegment _x3, MemorySegment _x4) {
            try {
                return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * gboolean (*shutdown)(GDtlsConnection *, gboolean, gboolean, GCancellable *, GError **)
     * }
     */
    public static final AddressLayout shutdown$layout() {
        return shutdown$LAYOUT;
    }

    private static final long shutdown$OFFSET = 48;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * gboolean (*shutdown)(GDtlsConnection *, gboolean, gboolean, GCancellable *, GError **)
     * }
     */
    public static final long shutdown$offset() {
        return shutdown$OFFSET;
    }

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

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

    /**
     * {@snippet lang=c :
     * void (*shutdown_async)(GDtlsConnection *, gboolean, gboolean, int, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public class shutdown_async {

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            void apply(MemorySegment _x0, int _x1, int _x2, int _x3, MemorySegment _x4, MemorySegment _x5, MemorySegment _x6);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid(
            app_indicator_h.C_POINTER,
            app_indicator_h.C_INT,
            app_indicator_h.C_INT,
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER,
            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(shutdown_async.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(shutdown_async.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 void invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, int _x2, int _x3, MemorySegment _x4, MemorySegment _x5, MemorySegment _x6) {
            try {
                 DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4, _x5, _x6);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * void (*shutdown_async)(GDtlsConnection *, gboolean, gboolean, int, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static final AddressLayout shutdown_async$layout() {
        return shutdown_async$LAYOUT;
    }

    private static final long shutdown_async$OFFSET = 56;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * void (*shutdown_async)(GDtlsConnection *, gboolean, gboolean, int, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static final long shutdown_async$offset() {
        return shutdown_async$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * void (*shutdown_async)(GDtlsConnection *, gboolean, gboolean, int, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static MemorySegment shutdown_async(MemorySegment struct) {
        return struct.get(shutdown_async$LAYOUT, shutdown_async$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * void (*shutdown_async)(GDtlsConnection *, gboolean, gboolean, int, GCancellable *, GAsyncReadyCallback, gpointer)
     * }
     */
    public static void shutdown_async(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(shutdown_async$LAYOUT, shutdown_async$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * gboolean (*shutdown_finish)(GDtlsConnection *, GAsyncResult *, GError **)
     * }
     */
    public class shutdown_finish {

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

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER,
            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(shutdown_finish.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(shutdown_finish.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, MemorySegment _x1, MemorySegment _x2) {
            try {
                return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * gboolean (*shutdown_finish)(GDtlsConnection *, GAsyncResult *, GError **)
     * }
     */
    public static final AddressLayout shutdown_finish$layout() {
        return shutdown_finish$LAYOUT;
    }

    private static final long shutdown_finish$OFFSET = 64;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * gboolean (*shutdown_finish)(GDtlsConnection *, GAsyncResult *, GError **)
     * }
     */
    public static final long shutdown_finish$offset() {
        return shutdown_finish$OFFSET;
    }

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

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

    /**
     * {@snippet lang=c :
     * void (*set_advertised_protocols)(GDtlsConnection *, const gchar *const *)
     * }
     */
    public class set_advertised_protocols {

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

        private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid(
            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(set_advertised_protocols.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(set_advertised_protocols.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 void invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) {
            try {
                 DOWN$MH.invokeExact(funcPtr, _x0, _x1);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * void (*set_advertised_protocols)(GDtlsConnection *, const gchar *const *)
     * }
     */
    public static final AddressLayout set_advertised_protocols$layout() {
        return set_advertised_protocols$LAYOUT;
    }

    private static final long set_advertised_protocols$OFFSET = 72;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * void (*set_advertised_protocols)(GDtlsConnection *, const gchar *const *)
     * }
     */
    public static final long set_advertised_protocols$offset() {
        return set_advertised_protocols$OFFSET;
    }

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

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

    /**
     * {@snippet lang=c :
     * const gchar *(*get_negotiated_protocol)(GDtlsConnection *)
     * }
     */
    public class get_negotiated_protocol {

        /**
         * 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_negotiated_protocol.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_negotiated_protocol.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_negotiated_protocol$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("get_negotiated_protocol"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * const gchar *(*get_negotiated_protocol)(GDtlsConnection *)
     * }
     */
    public static final AddressLayout get_negotiated_protocol$layout() {
        return get_negotiated_protocol$LAYOUT;
    }

    private static final long get_negotiated_protocol$OFFSET = 80;

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

    /**
     * Getter for field:
     * {@snippet lang=c :
     * const gchar *(*get_negotiated_protocol)(GDtlsConnection *)
     * }
     */
    public static MemorySegment get_negotiated_protocol(MemorySegment struct) {
        return struct.get(get_negotiated_protocol$LAYOUT, get_negotiated_protocol$OFFSET);
    }

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

    /**
     * {@snippet lang=c :
     * gboolean (*get_binding_data)(GDtlsConnection *, GTlsChannelBindingType, GByteArray *, GError **)
     * }
     */
    public class get_binding_data {

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

        private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
            app_indicator_h.C_INT,
            app_indicator_h.C_POINTER,
            app_indicator_h.C_INT,
            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_binding_data.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_binding_data.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, int _x1, MemorySegment _x2, MemorySegment _x3) {
            try {
                return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

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

    /**
     * Layout for field:
     * {@snippet lang=c :
     * gboolean (*get_binding_data)(GDtlsConnection *, GTlsChannelBindingType, GByteArray *, GError **)
     * }
     */
    public static final AddressLayout get_binding_data$layout() {
        return get_binding_data$LAYOUT;
    }

    private static final long get_binding_data$OFFSET = 88;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * gboolean (*get_binding_data)(GDtlsConnection *, GTlsChannelBindingType, GByteArray *, GError **)
     * }
     */
    public static final long get_binding_data$offset() {
        return get_binding_data$OFFSET;
    }

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

    /**
     * Setter for field:
     * {@snippet lang=c :
     * gboolean (*get_binding_data)(GDtlsConnection *, GTlsChannelBindingType, GByteArray *, GError **)
     * }
     */
    public static void get_binding_data(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(get_binding_data$LAYOUT, get_binding_data$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