Blame src/core/nm-active-connection.h

Packit Service 5ffa24
/* SPDX-License-Identifier: GPL-2.0-or-later */
Packit Service 5ffa24
/*
Packit Service 5ffa24
 * Copyright (C) 2008 - 2012 Red Hat, Inc.
Packit Service 5ffa24
 */
Packit Service 5ffa24
Packit Service 5ffa24
#ifndef __NETWORKMANAGER_ACTIVE_CONNECTION_H__
Packit Service 5ffa24
#define __NETWORKMANAGER_ACTIVE_CONNECTION_H__
Packit Service 5ffa24
Packit Service 5ffa24
#include "c-list/src/c-list.h"
Packit Service 5ffa24
#include "nm-connection.h"
Packit Service 5ffa24
#include "nm-dbus-object.h"
Packit Service 5ffa24
Packit Service 5ffa24
#define NM_TYPE_ACTIVE_CONNECTION (nm_active_connection_get_type())
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION(obj) \
Packit Service 5ffa24
    (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnection))
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_CLASS(klass) \
Packit Service 5ffa24
    (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionClass))
Packit Service 5ffa24
#define NM_IS_ACTIVE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_ACTIVE_CONNECTION))
Packit Service 5ffa24
#define NM_IS_ACTIVE_CONNECTION_CLASS(klass) \
Packit Service 5ffa24
    (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_ACTIVE_CONNECTION))
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_GET_CLASS(obj) \
Packit Service 5ffa24
    (G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionClass))
Packit Service 5ffa24
Packit Service 5ffa24
/* D-Bus Exported Properties */
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_CONNECTION      "connection"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_ID              "id"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_UUID            "uuid"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_TYPE            "type"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT "specific-object"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_DEVICES         "devices"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_STATE           "state"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_STATE_FLAGS     "state-flags"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_DEFAULT         "default"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_IP4_CONFIG      "ip4-config"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_DHCP4_CONFIG    "dhcp4-config"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_DEFAULT6        "default6"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_IP6_CONFIG      "ip6-config"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG    "dhcp6-config"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_VPN             "vpn"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_MASTER          "master"
Packit Service 5ffa24
Packit Service 5ffa24
/* Internal non-exported properties */
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_INT_SETTINGS_CONNECTION "int-settings-connection"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_INT_APPLIED_CONNECTION  "int-applied-connection"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_INT_DEVICE              "int-device"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_INT_SUBJECT             "int-subject"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_INT_MASTER              "int-master"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_INT_MASTER_READY        "int-master-ready"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_INT_ACTIVATION_TYPE     "int-activation-type"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_INT_ACTIVATION_REASON   "int-activation-reason"
Packit Service 5ffa24
Packit Service 5ffa24
/* Signals */
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_STATE_CHANGED "state-changed"
Packit Service 5ffa24
Packit Service 5ffa24
/* Internal signals*/
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_DEVICE_CHANGED         "device-changed"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_DEVICE_METERED_CHANGED "device-metered-changed"
Packit Service 5ffa24
#define NM_ACTIVE_CONNECTION_PARENT_ACTIVE          "parent-active"
Packit Service 5ffa24
Packit Service 5ffa24
struct _NMActiveConnectionPrivate;
Packit Service 5ffa24
Packit Service 5ffa24
struct _NMActiveConnection {
Packit Service 5ffa24
    NMDBusObject                       parent;
Packit Service 5ffa24
    struct _NMActiveConnectionPrivate *_priv;
Packit Service 5ffa24
Packit Service 5ffa24
    /* active connection can be tracked in a list by NMManager. This is
Packit Service 5ffa24
     * the list node. */
Packit Service 5ffa24
    CList active_connections_lst;
Packit Service 5ffa24
};
Packit Service 5ffa24
Packit Service 5ffa24
typedef struct {
Packit Service 5ffa24
    NMDBusObjectClass parent;
Packit Service 5ffa24
Packit Service 5ffa24
    /* re-emits device state changes as a convenience for subclasses for
Packit Service 5ffa24
     * device states >= DISCONNECTED.
Packit Service 5ffa24
     */
Packit Service 5ffa24
    void (*device_state_changed)(NMActiveConnection *connection,
Packit Service 5ffa24
                                 NMDevice *          device,
Packit Service 5ffa24
                                 NMDeviceState       new_state,
Packit Service 5ffa24
                                 NMDeviceState       old_state);
Packit Service 5ffa24
    void (*master_failed)(NMActiveConnection *connection);
Packit Service 5ffa24
Packit Service 5ffa24
    void (*device_changed)(NMActiveConnection *connection,
Packit Service 5ffa24
                           NMDevice *          new_device,
Packit Service 5ffa24
                           NMDevice *          old_device);
Packit Service 5ffa24
Packit Service 5ffa24
    void (*device_metered_changed)(NMActiveConnection *connection, NMMetered new_value);
Packit Service 5ffa24
Packit Service 5ffa24
    void (*parent_active)(NMActiveConnection *connection);
Packit Service 5ffa24
} NMActiveConnectionClass;
Packit Service 5ffa24
Packit Service 5ffa24
guint64 nm_active_connection_version_id_get(NMActiveConnection *self);
Packit Service 5ffa24
guint64 nm_active_connection_version_id_bump(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
GType nm_active_connection_get_type(void);
Packit Service 5ffa24
Packit Service 5ffa24
typedef void (*NMActiveConnectionAuthResultFunc)(NMActiveConnection *self,
Packit Service 5ffa24
                                                 gboolean            success,
Packit Service 5ffa24
                                                 const char *        error_desc,
Packit Service 5ffa24
                                                 gpointer            user_data);
Packit Service 5ffa24
Packit Service 5ffa24
void nm_active_connection_authorize(NMActiveConnection *             self,
Packit Service 5ffa24
                                    NMConnection *                   initial_connection,
Packit Service 5ffa24
                                    NMActiveConnectionAuthResultFunc result_func,
Packit Service 5ffa24
                                    gpointer                         user_data);
Packit Service 5ffa24
Packit Service 5ffa24
NMSettingsConnection *nm_active_connection_get_settings_connection(NMActiveConnection *self);
Packit Service 5ffa24
NMConnection *        nm_active_connection_get_applied_connection(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
NMSettingsConnection *_nm_active_connection_get_settings_connection(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
void nm_active_connection_set_settings_connection(NMActiveConnection *  self,
Packit Service 5ffa24
                                                  NMSettingsConnection *connection);
Packit Service 5ffa24
Packit Service 5ffa24
gboolean
Packit Service 5ffa24
nm_active_connection_has_unmodified_applied_connection(NMActiveConnection *  self,
Packit Service 5ffa24
                                                       NMSettingCompareFlags compare_flags);
Packit Service 5ffa24
Packit Service 5ffa24
const char *nm_active_connection_get_settings_connection_id(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
const char *nm_active_connection_get_specific_object(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
void nm_active_connection_set_specific_object(NMActiveConnection *self,
Packit Service 5ffa24
                                              const char *        specific_object);
Packit Service 5ffa24
Packit Service 5ffa24
void
Packit Service 5ffa24
nm_active_connection_set_default(NMActiveConnection *self, int addr_family, gboolean is_default);
Packit Service 5ffa24
Packit Service 5ffa24
gboolean nm_active_connection_get_default(NMActiveConnection *self, int addr_family);
Packit Service 5ffa24
Packit Service 5ffa24
NMActiveConnectionState nm_active_connection_get_state(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
void nm_active_connection_set_state(NMActiveConnection *          self,
Packit Service 5ffa24
                                    NMActiveConnectionState       state,
Packit Service 5ffa24
                                    NMActiveConnectionStateReason reason);
Packit Service 5ffa24
Packit Service 5ffa24
void nm_active_connection_set_state_fail(NMActiveConnection *          active,
Packit Service 5ffa24
                                         NMActiveConnectionStateReason reason,
Packit Service 5ffa24
                                         const char *                  error_desc);
Packit Service 5ffa24
Packit Service 5ffa24
NMActivationStateFlags nm_active_connection_get_state_flags(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
void nm_active_connection_set_state_flags_full(NMActiveConnection *   self,
Packit Service 5ffa24
                                               NMActivationStateFlags state_flags,
Packit Service 5ffa24
                                               NMActivationStateFlags mask);
Packit Service 5ffa24
Packit Service 5ffa24
static inline void
Packit Service 5ffa24
nm_active_connection_set_state_flags(NMActiveConnection *self, NMActivationStateFlags state_flags)
Packit Service 5ffa24
{
Packit Service 5ffa24
    nm_active_connection_set_state_flags_full(self, state_flags, state_flags);
Packit Service 5ffa24
}
Packit Service 5ffa24
Packit Service 5ffa24
static inline void
Packit Service 5ffa24
nm_active_connection_set_state_flags_clear(NMActiveConnection *   self,
Packit Service 5ffa24
                                           NMActivationStateFlags state_flags)
Packit Service 5ffa24
{
Packit Service 5ffa24
    nm_active_connection_set_state_flags_full(self, NM_ACTIVATION_STATE_FLAG_NONE, state_flags);
Packit Service 5ffa24
}
Packit Service 5ffa24
Packit Service 5ffa24
NMDevice *nm_active_connection_get_device(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
gboolean nm_active_connection_set_device(NMActiveConnection *self, NMDevice *device);
Packit Service 5ffa24
Packit Service 5ffa24
NMAuthSubject *nm_active_connection_get_subject(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
gboolean nm_active_connection_get_user_requested(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
NMActiveConnection *nm_active_connection_get_master(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
gboolean nm_active_connection_get_master_ready(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
void nm_active_connection_set_master(NMActiveConnection *self, NMActiveConnection *master);
Packit Service 5ffa24
Packit Service 5ffa24
void nm_active_connection_set_parent(NMActiveConnection *self, NMActiveConnection *parent);
Packit Service 5ffa24
Packit Service 5ffa24
NMActivationType nm_active_connection_get_activation_type(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
NMActivationReason nm_active_connection_get_activation_reason(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
NMKeepAlive *nm_active_connection_get_keep_alive(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
void nm_active_connection_clear_secrets(NMActiveConnection *self);
Packit Service 5ffa24
Packit Service 5ffa24
#endif /* __NETWORKMANAGER_ACTIVE_CONNECTION_H__ */