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

org.gnome.gio.DBusConnectionFlags Maven / Gradle / Ivy

The newest version!
// This file was automatically generated by Java-GI. Do not edit this file
// directly! Visit  for more information.
//
// The API documentation in this file was derived from GObject-Introspection
// metadata and may include text or comments from the original C sources.
//
// Copyright (c), upstream authors as identified in the GObject-Introspection
// metadata.
//
// This generated file is distributed under the same license as the original
// GObject-Introspection data, unless otherwise specified. Users of this file
// are responsible for complying with any licenses or terms required by the
// original authors.
//
// THIS FILE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
//
package org.gnome.gio;

import io.github.jwharm.javagi.base.Enumeration;
import io.github.jwharm.javagi.interop.Interop;
import java.lang.IllegalStateException;
import java.lang.Override;
import javax.annotation.processing.Generated;
import org.gnome.glib.Type;

/**
 * Flags used when creating a new {@code GDBusConnection}.
 *
 * @version 2.26
 */
@Generated("io.github.jwharm.JavaGI")
public enum DBusConnectionFlags implements Enumeration {
    /**
     * No flags set.
     */
    NONE(0),

    /**
     * Perform authentication against server.
     */
    AUTHENTICATION_CLIENT(1),

    /**
     * Perform authentication against client.
     */
    AUTHENTICATION_SERVER(2),

    /**
     * When
     * authenticating as a server, allow the anonymous authentication
     * method.
     */
    AUTHENTICATION_ALLOW_ANONYMOUS(4),

    /**
     * Pass this flag if connecting to a peer that is a
     * message bus. This means that the Hello() method will be invoked as part of the connection setup.
     */
    MESSAGE_BUS_CONNECTION(8),

    /**
     * If set, processing of D-Bus messages is
     * delayed until g_dbus_connection_start_message_processing() is called.
     */
    DELAY_MESSAGE_PROCESSING(16),

    /**
     * When authenticating
     * as a server, require the UID of the peer to be the same as the UID of the server. (Since: 2.68)
     */
    AUTHENTICATION_REQUIRE_SAME_USER(32),

    /**
     * When authenticating, try to use
     *  protocols that work across a Linux user namespace boundary, even if this
     *  reduces interoperability with older D-Bus implementations. This currently
     *  affects client-side {@code EXTERNAL} authentication, for which this flag makes
     *  connections to a server in another user namespace succeed, but causes
     *  a deadlock when connecting to a GDBus server older than 2.73.3. Since: 2.74
     */
    CROSS_NAMESPACE(64);

    static {
        Gio.javagi$ensureInitialized();
    }

    private final int value;

    /**
     * Create a new DBusConnectionFlags for the provided value
     *
     * @param value the bitfield value
     */
    private DBusConnectionFlags(int value) {
        this.value = value;
    }

    /**
     * Create a new DBusConnectionFlags for the provided value
     *
     * @param value the bitfield value
     * @return the bitfield for the provided value
     */
    public static DBusConnectionFlags of(int value) {
        return switch(value) {
            case 0 -> NONE;
            case 1 -> AUTHENTICATION_CLIENT;
            case 2 -> AUTHENTICATION_SERVER;
            case 4 -> AUTHENTICATION_ALLOW_ANONYMOUS;
            case 8 -> MESSAGE_BUS_CONNECTION;
            case 16 -> DELAY_MESSAGE_PROCESSING;
            case 32 -> AUTHENTICATION_REQUIRE_SAME_USER;
            case 64 -> CROSS_NAMESPACE;
            default -> throw new IllegalStateException("Unexpected value: " + value);
        } ;
    }

    /**
     * Get the numeric value of this enum
     *
     * @return the enum value
     */
    @Override
    public int getValue() {
        return value;
    }

    /**
     * Get the GType of the DBusConnectionFlags class
     *
     * @return the GType
     */
    public static Type getType() {
        return Interop.getType("g_dbus_connection_flags_get_type");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy