Blame libnm-core/nm-connection.h

Packit Service a1bd4f
/* SPDX-License-Identifier: LGPL-2.1+ */
Packit 5756e2
/*
Packit 5756e2
 * Copyright (C) 2007 - 2018 Red Hat, Inc.
Packit 5756e2
 * Copyright (C) 2007 - 2008 Novell, Inc.
Packit 5756e2
 */
Packit 5756e2
Packit 5756e2
#ifndef __NM_CONNECTION_H__
Packit 5756e2
#define __NM_CONNECTION_H__
Packit 5756e2
Packit Service a1bd4f
#if !defined(__NETWORKMANAGER_H_INSIDE__) && !defined(NETWORKMANAGER_COMPILATION)
Packit Service a1bd4f
    #error "Only <NetworkManager.h> can be included directly."
Packit 5756e2
#endif
Packit 5756e2
Packit 5756e2
#include "nm-core-types.h"
Packit 5756e2
#include "nm-setting.h"
Packit 5756e2
#include "nm-errors.h"
Packit 5756e2
Packit 5756e2
G_BEGIN_DECLS
Packit 5756e2
Packit Service a1bd4f
#define NM_TYPE_CONNECTION    (nm_connection_get_type())
Packit Service a1bd4f
#define NM_CONNECTION(obj)    (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_CONNECTION, NMConnection))
Packit Service a1bd4f
#define NM_IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_CONNECTION))
Packit Service a1bd4f
#define NM_CONNECTION_GET_INTERFACE(obj) \
Packit Service a1bd4f
    (G_TYPE_INSTANCE_GET_INTERFACE((obj), NM_TYPE_CONNECTION, NMConnectionClass))
Packit 5756e2
Packit 5756e2
/* Signals */
Packit 5756e2
#define NM_CONNECTION_SECRETS_UPDATED "secrets-updated"
Packit 5756e2
#define NM_CONNECTION_SECRETS_CLEARED "secrets-cleared"
Packit 5756e2
#define NM_CONNECTION_CHANGED         "changed"
Packit 5756e2
Packit 5756e2
/*
Packit 5756e2
 * NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD: overwrite the ip6 method
Packit 5756e2
 * when normalizing ip6 configuration. If omitted, this defaults to
Packit 5756e2
 * @NM_SETTING_IP6_CONFIG_METHOD_AUTO.
Packit 5756e2
 */
Packit 5756e2
#define NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD "ip6-config-method"
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * NMConnection:
Packit 5756e2
 *
Packit 5756e2
 * NMConnection is the interface implemented by #NMRemoteConnection on the
Packit 5756e2
 * client side, and #NMSettingsConnection on the daemon side.
Packit 5756e2
 */
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * NMConnectionInterface:
Packit 5756e2
 * @parent: the parent interface struct
Packit 5756e2
 * @secrets_updated: emitted when the connection's secrets are updated
Packit 5756e2
 * @secrets_cleared: emitted when the connection's secrets are cleared
Packit 5756e2
 * @changed: emitted when any change to the connection's settings occurs
Packit 5756e2
 */
Packit 5756e2
typedef struct {
Packit Service a1bd4f
    GTypeInterface parent;
Packit 5756e2
Packit Service a1bd4f
    /* Signals */
Packit Service a1bd4f
    void (*secrets_updated)(NMConnection *connection, const char *setting);
Packit Service a1bd4f
    void (*secrets_cleared)(NMConnection *connection);
Packit Service a1bd4f
    void (*changed)(NMConnection *connection);
Packit 5756e2
Packit 5756e2
} NMConnectionInterface;
Packit 5756e2
Packit Service a1bd4f
GType nm_connection_get_type(void);
Packit 5756e2
Packit Service a1bd4f
void nm_connection_add_setting(NMConnection *connection, NMSetting *setting);
Packit 5756e2
Packit Service a1bd4f
void nm_connection_remove_setting(NMConnection *connection, GType setting_type);
Packit 5756e2
Packit Service a1bd4f
NMSetting *nm_connection_get_setting(NMConnection *connection, GType setting_type);
Packit 5756e2
Packit Service a1bd4f
NMSetting *nm_connection_get_setting_by_name(NMConnection *connection, const char *name);
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * NM_VARIANT_TYPE_CONNECTION:
Packit 5756e2
 *
Packit 5756e2
 * #GVariantType for a dictionary mapping from setting names to
Packit 5756e2
 * %NM_VARIANT_TYPE_SETTING variants. This is used to represent an
Packit 5756e2
 * #NMConnection, and is the type taken by nm_simple_connection_new_from_dbus()
Packit 5756e2
 * and returned from nm_connection_to_dbus().
Packit 5756e2
 */
Packit Service a1bd4f
#define NM_VARIANT_TYPE_CONNECTION (G_VARIANT_TYPE("a{sa{sv}}"))
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * NM_VARIANT_TYPE_SETTING:
Packit 5756e2
 *
Packit 5756e2
 * #GVariantType for a dictionary mapping from property names to values. This is
Packit 5756e2
 * an alias for %G_VARIANT_TYPE_VARDICT, and is the type of each element of
Packit 5756e2
 * an %NM_VARIANT_TYPE_CONNECTION dictionary.
Packit 5756e2
 */
Packit 5756e2
#define NM_VARIANT_TYPE_SETTING G_VARIANT_TYPE_VARDICT
Packit 5756e2
Packit 5756e2
/**
Packit 5756e2
 * NMConnectionSerializationFlags:
Packit 5756e2
 * @NM_CONNECTION_SERIALIZE_ALL: serialize all properties (including secrets)
Packit 5756e2
 * @NM_CONNECTION_SERIALIZE_NO_SECRETS: do not include secrets
Packit 5756e2
 * @NM_CONNECTION_SERIALIZE_ONLY_SECRETS: only serialize secrets
Packit 5756e2
 * @NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED: if set, only secrets that
Packit 5756e2
 *   are agent owned will be serialized. Since: 1.20
Packit 5756e2
 *
Packit 5756e2
 * These flags determine which properties are serialized when calling when
Packit 5756e2
 * calling nm_connection_to_dbus().
Packit 5756e2
 **/
Packit 5756e2
typedef enum { /*< flags >*/
Packit Service a1bd4f
               NM_CONNECTION_SERIALIZE_ALL                      = 0x00000000,
Packit Service a1bd4f
               NM_CONNECTION_SERIALIZE_NO_SECRETS               = 0x00000001,
Packit Service a1bd4f
               NM_CONNECTION_SERIALIZE_ONLY_SECRETS             = 0x00000002,
Packit Service a1bd4f
               NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED = 0x00000004,
Packit 5756e2
} NMConnectionSerializationFlags;
Packit 5756e2
Packit Service a1bd4f
GVariant *nm_connection_to_dbus(NMConnection *connection, NMConnectionSerializationFlags flags);
Packit 5756e2
Packit Service a1bd4f
gboolean
Packit Service a1bd4f
nm_connection_replace_settings(NMConnection *connection, GVariant *new_settings, GError **error);
Packit 5756e2
Packit Service a1bd4f
void nm_connection_replace_settings_from_connection(NMConnection *connection,
Packit Service a1bd4f
                                                    NMConnection *new_connection);
Packit 5756e2
Packit Service a1bd4f
void nm_connection_clear_settings(NMConnection *connection);
Packit 5756e2
Packit Service a1bd4f
gboolean nm_connection_compare(NMConnection *a, NMConnection *b, NMSettingCompareFlags flags);
Packit 5756e2
Packit Service a1bd4f
gboolean nm_connection_diff(NMConnection *        a,
Packit Service a1bd4f
                            NMConnection *        b,
Packit Service a1bd4f
                            NMSettingCompareFlags flags,
Packit Service a1bd4f
                            GHashTable **         out_settings);
Packit 5756e2
Packit Service a1bd4f
gboolean nm_connection_verify(NMConnection *connection, GError **error);
Packit 5756e2
NM_AVAILABLE_IN_1_2
Packit Service a1bd4f
gboolean nm_connection_verify_secrets(NMConnection *connection, GError **error);
Packit Service a1bd4f
gboolean nm_connection_normalize(NMConnection *connection,
Packit Service a1bd4f
                                 GHashTable *  parameters,
Packit Service a1bd4f
                                 gboolean *    modified,
Packit Service a1bd4f
                                 GError **     error);
Packit 5756e2
Packit Service a1bd4f
const char *nm_connection_need_secrets(NMConnection *connection, GPtrArray **hints);
Packit 5756e2
Packit Service a1bd4f
void nm_connection_clear_secrets(NMConnection *connection);
Packit 5756e2
Packit Service a1bd4f
void nm_connection_clear_secrets_with_flags(NMConnection *                   connection,
Packit Service a1bd4f
                                            NMSettingClearSecretsWithFlagsFn func,
Packit Service a1bd4f
                                            gpointer                         user_data);
Packit 5756e2
Packit Service a1bd4f
gboolean nm_connection_update_secrets(NMConnection *connection,
Packit Service a1bd4f
                                      const char *  setting_name,
Packit Service a1bd4f
                                      GVariant *    secrets,
Packit Service a1bd4f
                                      GError **     error);
Packit 5756e2
Packit Service a1bd4f
void nm_connection_set_path(NMConnection *connection, const char *path);
Packit 5756e2
Packit Service a1bd4f
const char *nm_connection_get_path(NMConnection *connection);
Packit 5756e2
Packit Service a1bd4f
const char *nm_connection_get_interface_name(NMConnection *connection);
Packit 5756e2
Packit Service a1bd4f
gboolean nm_connection_is_type(NMConnection *connection, const char *type);
Packit 5756e2
Packit Service a1bd4f
void nm_connection_for_each_setting_value(NMConnection *       connection,
Packit Service a1bd4f
                                          NMSettingValueIterFn func,
Packit Service a1bd4f
                                          gpointer             user_data);
Packit 5756e2
Packit 5756e2
NM_AVAILABLE_IN_1_10
Packit Service a1bd4f
NMSetting **nm_connection_get_settings(NMConnection *connection, guint *out_length);
Packit 5756e2
Packit Service a1bd4f
void nm_connection_dump(NMConnection *connection);
Packit 5756e2
Packit 5756e2
/* Helpers */
Packit Service a1bd4f
const char *nm_connection_get_uuid(NMConnection *connection);
Packit Service a1bd4f
const char *nm_connection_get_id(NMConnection *connection);
Packit Service a1bd4f
const char *nm_connection_get_connection_type(NMConnection *connection);
Packit Service a1bd4f
Packit Service a1bd4f
gboolean nm_connection_is_virtual(NMConnection *connection);
Packit Service a1bd4f
char *   nm_connection_get_virtual_device_description(NMConnection *connection);
Packit Service a1bd4f
Packit Service a1bd4f
NMSetting8021x *     nm_connection_get_setting_802_1x(NMConnection *connection);
Packit Service a1bd4f
NMSettingBluetooth * nm_connection_get_setting_bluetooth(NMConnection *connection);
Packit Service a1bd4f
NMSettingBond *      nm_connection_get_setting_bond(NMConnection *connection);
Packit Service a1bd4f
NMSettingTeam *      nm_connection_get_setting_team(NMConnection *connection);
Packit Service a1bd4f
NMSettingTeamPort *  nm_connection_get_setting_team_port(NMConnection *connection);
Packit Service a1bd4f
NMSettingBridge *    nm_connection_get_setting_bridge(NMConnection *connection);
Packit Service a1bd4f
NMSettingBridgePort *nm_connection_get_setting_bridge_port(NMConnection *connection);
Packit Service a1bd4f
NMSettingCdma *      nm_connection_get_setting_cdma(NMConnection *connection);
Packit Service a1bd4f
NMSettingConnection *nm_connection_get_setting_connection(NMConnection *connection);
Packit Service a1bd4f
NMSettingDcb *       nm_connection_get_setting_dcb(NMConnection *connection);
Packit 5756e2
NM_AVAILABLE_IN_1_8
Packit Service a1bd4f
NMSettingDummy *     nm_connection_get_setting_dummy(NMConnection *connection);
Packit Service a1bd4f
NMSettingGeneric *   nm_connection_get_setting_generic(NMConnection *connection);
Packit Service a1bd4f
NMSettingGsm *       nm_connection_get_setting_gsm(NMConnection *connection);
Packit Service a1bd4f
NMSettingInfiniband *nm_connection_get_setting_infiniband(NMConnection *connection);
Packit 5756e2
NM_AVAILABLE_IN_1_2
Packit Service a1bd4f
NMSettingIPTunnel *nm_connection_get_setting_ip_tunnel(NMConnection *connection);
Packit Service a1bd4f
NMSettingIPConfig *nm_connection_get_setting_ip4_config(NMConnection *connection);
Packit Service a1bd4f
NMSettingIPConfig *nm_connection_get_setting_ip6_config(NMConnection *connection);
Packit 5756e2
NM_AVAILABLE_IN_1_6
Packit Service a1bd4f
NMSettingMacsec *nm_connection_get_setting_macsec(NMConnection *connection);
Packit 5756e2
NM_AVAILABLE_IN_1_2
Packit Service a1bd4f
NMSettingMacvlan * nm_connection_get_setting_macvlan(NMConnection *connection);
Packit Service a1bd4f
NMSettingOlpcMesh *nm_connection_get_setting_olpc_mesh(NMConnection *connection);
Packit 5756e2
NM_AVAILABLE_IN_1_10
Packit Service a1bd4f
NMSettingOvsBridge *nm_connection_get_setting_ovs_bridge(NMConnection *connection);
Packit 5756e2
NM_AVAILABLE_IN_1_10
Packit Service a1bd4f
NMSettingOvsInterface *nm_connection_get_setting_ovs_interface(NMConnection *connection);
Packit Service a1bd4f
NMSettingOvsPatch *    nm_connection_get_setting_ovs_patch(NMConnection *connection);
Packit 5756e2
NM_AVAILABLE_IN_1_10
Packit Service a1bd4f
NMSettingOvsPort *nm_connection_get_setting_ovs_port(NMConnection *connection);
Packit Service a1bd4f
NMSettingPpp *    nm_connection_get_setting_ppp(NMConnection *connection);
Packit Service a1bd4f
NMSettingPppoe *  nm_connection_get_setting_pppoe(NMConnection *connection);
Packit 5756e2
NM_AVAILABLE_IN_1_6
Packit Service a1bd4f
NMSettingProxy * nm_connection_get_setting_proxy(NMConnection *connection);
Packit Service a1bd4f
NMSettingSerial *nm_connection_get_setting_serial(NMConnection *connection);
Packit 5756e2
NM_AVAILABLE_IN_1_12
Packit Service a1bd4f
NMSettingTCConfig *nm_connection_get_setting_tc_config(NMConnection *connection);
Packit 5756e2
NM_AVAILABLE_IN_1_2
Packit Service a1bd4f
NMSettingTun *             nm_connection_get_setting_tun(NMConnection *connection);
Packit Service a1bd4f
NMSettingVpn *             nm_connection_get_setting_vpn(NMConnection *connection);
Packit Service a1bd4f
NMSettingWimax *           nm_connection_get_setting_wimax(NMConnection *connection);
Packit Service a1bd4f
NMSettingAdsl *            nm_connection_get_setting_adsl(NMConnection *connection);
Packit Service a1bd4f
NMSettingWired *           nm_connection_get_setting_wired(NMConnection *connection);
Packit Service a1bd4f
NMSettingWireless *        nm_connection_get_setting_wireless(NMConnection *connection);
Packit Service a1bd4f
NMSettingWirelessSecurity *nm_connection_get_setting_wireless_security(NMConnection *connection);
Packit Service a1bd4f
NMSettingVlan *            nm_connection_get_setting_vlan(NMConnection *connection);
Packit 5756e2
NM_AVAILABLE_IN_1_2
Packit Service a1bd4f
NMSettingVxlan *nm_connection_get_setting_vxlan(NMConnection *connection);
Packit 5756e2
Packit 5756e2
G_END_DECLS
Packit 5756e2
Packit 5756e2
#endif /* __NM_CONNECTION_H__ */