manager: export nm_manager_get_connection_iface()
authorLubomir Rintel <lkundrak@v3.sk>
Tue, 16 Feb 2016 14:07:49 +0000 (15:07 +0100)
committerThomas Haller <thaller@redhat.com>
Wed, 17 Feb 2016 17:43:44 +0000 (18:43 +0100)
We'll need the actual device name that should be used for a connection
activated on a given device when checking the connection availability.

src/nm-manager.c
src/nm-manager.h

index 9738d49..eb9576e 100644 (file)
@@ -948,24 +948,24 @@ find_parent_device_for_connection (NMManager *self, NMConnection *connection)
 }
 
 /**
- * get_virtual_iface_name:
+ * nm_manager_get_connection_iface:
  * @self: the #NMManager
- * @connection: the #NMConnection representing a virtual interface
+ * @connection: the #NMConnection to get the interface for
  * @out_parent: on success, the parent device if any
  * @error: an error if determining the virtual interface name failed
  *
  * Given @connection, returns the interface name that the connection
- * would represent if it is a virtual connection.  %NULL is returned and
- * @error is set if the connection is not virtual, or if the name could
- * not be determined.
+ * would need to use when activated. %NULL is returned if the name
+ * is not specified in connection or a the name for a virtual device
+ * could not be generated.
  *
  * Returns: the expected interface name (caller takes ownership), or %NULL
  */
-static char *
-get_virtual_iface_name (NMManager *self,
-                        NMConnection *connection,
-                        NMDevice **out_parent,
-                        GError **error)
+char *
+nm_manager_get_connection_iface (NMManager *self,
+                                 NMConnection *connection,
+                                 NMDevice **out_parent,
+                                 GError **error)
 {
        NMDeviceFactory *factory;
        char *iface = NULL;
@@ -1021,7 +1021,7 @@ system_create_virtual_device (NMManager *self, NMConnection *connection)
        g_return_val_if_fail (NM_IS_MANAGER (self), NULL);
        g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
 
-       iface = get_virtual_iface_name (self, connection, &parent, &error);
+       iface = nm_manager_get_connection_iface (self, connection, &parent, &error);
        if (!iface) {
                nm_log_warn (LOGD_DEVICE, "(%s) can't get a name of a virtual device: %s",
                             nm_connection_get_id (connection), error->message);
@@ -3219,7 +3219,7 @@ validate_activation_request (NMManager *self,
                        char *iface;
 
                        /* Look for an existing device with the connection's interface name */
-                       iface = get_virtual_iface_name (self, connection, NULL, error);
+                       iface = nm_manager_get_connection_iface (self, connection, NULL, error);
                        if (!iface)
                                goto error;
 
index 2935d2a..9783020 100644 (file)
@@ -101,6 +101,11 @@ const GSList *      nm_manager_get_devices             (NMManager *manager);
 NMDevice *          nm_manager_get_device_by_ifindex   (NMManager *manager,
                                                         int ifindex);
 
+char *              nm_manager_get_connection_iface (NMManager *self,
+                                                     NMConnection *connection,
+                                                     NMDevice **out_parent,
+                                                     GError **error);
+
 NMActiveConnection *nm_manager_activate_connection     (NMManager *manager,
                                                         NMSettingsConnection *connection,
                                                         const char *specific_object,
@@ -113,4 +118,5 @@ gboolean            nm_manager_deactivate_connection   (NMManager *manager,
                                                         NMDeviceStateReason reason,
                                                         GError **error);
 
+
 #endif /* __NETWORKMANAGER_MANAGER_H__ */