libnm-util: add function nm_connection_get_interface_name()

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-01-10 18:08:03 +01:00
parent d44d526c00
commit 28169725d7
4 changed files with 34 additions and 1 deletions

View file

@ -13,6 +13,7 @@ global:
nm_connection_for_each_setting_value;
nm_connection_get_connection_type;
nm_connection_get_id;
nm_connection_get_interface_name;
nm_connection_get_path;
nm_connection_get_setting;
nm_connection_get_setting_802_1x;

View file

@ -1105,6 +1105,33 @@ nm_connection_get_path (NMConnection *connection)
return NM_CONNECTION_GET_PRIVATE (connection)->path;
}
/**
* nm_connection_get_interface_name:
* @connection: The #NMConnection
*
* Returns the interface name as stored in NMSettingConnection:interface_name.
* If the connection contains no NMSettingConnection, it will return %NULL.
*
* For hardware devices and software devices created outside of NetworkManager,
* this name is used to match the device. for software devices created by
* NetworkManager, this is the name of the created interface.
*
* Returns: Name of the kernel interface or %NULL
*
* Since: 1.0
*/
const char *
nm_connection_get_interface_name (NMConnection *connection)
{
NMSettingConnection *s_con;
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
s_con = nm_connection_get_setting_connection (connection);
return s_con ? nm_setting_connection_get_interface_name (s_con) : NULL;
}
/**
* nm_connection_get_virtual_iface_name:
* @connection: The #NMConnection

View file

@ -181,6 +181,9 @@ const char * nm_connection_get_path (NMConnection *connection);
const char * nm_connection_get_virtual_iface_name (NMConnection *connection);
NM_AVAILABLE_IN_1_0
const char * nm_connection_get_interface_name (NMConnection *connection);
gboolean nm_connection_is_type (NMConnection *connection, const char *type);
void nm_connection_for_each_setting_value (NMConnection *connection,

View file

@ -1138,6 +1138,8 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
* set, then the connection can be attached to any interface of the
* appropriate type (subject to restrictions imposed by other settings).
*
* For software devices this specifies the name of the created device.
*
* For connection types where interface names cannot easily be made
* persistent (e.g. mobile broadband or USB Ethernet), this property should
* not be used. Setting this property restricts the interfaces a connection
@ -1171,7 +1173,7 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
/**
* NMSettingConnection:permissions:
*
*
* An array of strings defining what access a given user has to this
* connection. If this is %NULL or empty, all users are allowed to access
* this connection. Otherwise a user is allowed to access this connection