libnm-util: add NM_SETTING_COMPARE_FLAG_CANDIDATE flag

Acked-by: Dan Winship <danw@gnome.org>
Acked-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Pavel Šimerda 2013-07-31 16:58:41 +02:00
parent 155ec4c382
commit 2a4a359eb1
3 changed files with 14 additions and 1 deletions

View file

@ -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)) {

View file

@ -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) \

View file

@ -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;