summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2019-01-21 11:53:48 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2019-03-27 10:17:39 +0100
commit937796f6ea78c320e90e909330799a56df56b911 (patch)
treef97afe8fdff533a0762c938ad1c8a37d0c51d3be
parent8cdc011cd1425333f1817de6821da2b1ebdef40e (diff)
downloadNetworkManager-937796f6ea78c320e90e909330799a56df56b911.tar.gz
libnm: add nm_lldp_neighbor_get_attr_value()
The function provides access to the GVariant representing a LLDP attribute.
-rw-r--r--libnm/libnm.ver1
-rw-r--r--libnm/nm-device.c21
-rw-r--r--libnm/nm-device.h2
3 files changed, 24 insertions, 0 deletions
diff --git a/libnm/libnm.ver b/libnm/libnm.ver
index b705ca4589..c2780cca81 100644
--- a/libnm/libnm.ver
+++ b/libnm/libnm.ver
@@ -1536,6 +1536,7 @@ global:
nm_bridge_vlan_set_untagged;
nm_bridge_vlan_to_str;
nm_bridge_vlan_unref;
+ nm_lldp_neighbor_get_attr_value;
nm_setting_bridge_add_vlan;
nm_setting_bridge_clear_vlans;
nm_setting_bridge_get_num_vlans;
diff --git a/libnm/nm-device.c b/libnm/nm-device.c
index 6586140f96..a09ecb5cbb 100644
--- a/libnm/nm-device.c
+++ b/libnm/nm-device.c
@@ -2813,6 +2813,27 @@ nm_lldp_neighbor_get_attr_uint_value (NMLldpNeighbor *neighbor, const char *name
}
/**
+ * nm_lldp_neighbor_get_attr_value:
+ * @neighbor: the #NMLldpNeighbor
+ * @name: the attribute name
+ *
+ * Gets the value (as a GVariant) of attribute with name @name on @neighbor
+ *
+ * Returns: (transfer none): the value or %NULL if the attribute with @name was
+ * not found.
+ *
+ * Since: 1.18
+ **/
+GVariant *
+nm_lldp_neighbor_get_attr_value (NMLldpNeighbor *neighbor, const char *name)
+{
+ g_return_val_if_fail (neighbor, FALSE);
+ g_return_val_if_fail (name && name[0], FALSE);
+
+ return g_hash_table_lookup (neighbor->attrs, name);
+}
+
+/**
* nm_lldp_neighbor_get_attr_type:
* @neighbor: the #NMLldpNeighbor
* @name: the attribute name
diff --git a/libnm/nm-device.h b/libnm/nm-device.h
index 9d31d38a44..6227229782 100644
--- a/libnm/nm-device.h
+++ b/libnm/nm-device.h
@@ -234,6 +234,8 @@ gboolean nm_lldp_neighbor_get_attr_uint_value (NMLldpNeighbor *neighbor, const c
guint *out_value);
NM_AVAILABLE_IN_1_2
const GVariantType *nm_lldp_neighbor_get_attr_type (NMLldpNeighbor *neighbor, const char *name);
+NM_AVAILABLE_IN_1_18
+GVariant *nm_lldp_neighbor_get_attr_value (NMLldpNeighbor *neighbor, const char *name);
G_END_DECLS