Commit 2a4a359e authored by Pavel Šimerda's avatar Pavel Šimerda

libnm-util: add NM_SETTING_COMPARE_FLAG_CANDIDATE flag

Acked-by: Dan Winship's avatarDan Winship <danw@gnome.org>
Acked-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
parent 155ec4c3
......@@ -448,10 +448,13 @@ nm_connection_compare (NMConnection *a,
if (!a && !b)
return TRUE;
if (!a || !b)
return FALSE;
/* CANDIDATE flag also implies FUZZY */
if (flags & NM_SETTING_COMPARE_FLAG_CANDIDATE)
flags |= NM_SETTING_COMPARE_FLAG_FUZZY;
/* A / B: ensure all settings in A match corresponding ones in B */
g_hash_table_iter_init (&iter, NM_CONNECTION_GET_PRIVATE (a)->settings);
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &src)) {
......
......@@ -38,6 +38,14 @@ GType _nm_setting_lookup_setting_type (const char *name);
GType _nm_setting_lookup_setting_type_by_quark (GQuark error_quark);
gint _nm_setting_compare_priority (gconstpointer a, gconstpointer b);
/* NM_SETTING_COMPARE_FLAG_CANDIDATE: check a whether a device-generated connection
* can be meaningfully replaced by a configured connection. With this flag
* the matching function is asymetric and only takes into account properties
* mandated by the candidate configured connection. It is for internal use by
* NetworkManager.
*/
#define NM_SETTING_COMPARE_FLAG_CANDIDATE 0x80000000
/* Ensure the setting's GType is registered at library load time */
#define NM_SETTING_REGISTER_TYPE(x) \
static void __attribute__((constructor)) register_setting (void) \
......
......@@ -134,6 +134,8 @@ typedef enum {
NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS = 0x00000004,
NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS = 0x00000008,
NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS = 0x00000010
/* 0x80000000 is used for a private flag */
} NMSettingCompareFlags;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment