prototype implemementation of an sqlite configuration backend
[strongswan.git] / src / charon / control / interfaces / dbus_interface.c
index d93a5d0..10307af 100644 (file)
@@ -119,46 +119,6 @@ static child_cfg_t* get_child_from_peer(peer_cfg_t *peer_cfg, char *name)
 }
 
 /**
- * get a peer configuration by its name, or a name of its children
- */
-static peer_cfg_t *get_peer_cfg_by_name(char *name)
-{
-       iterator_t *i1, *i2;
-       peer_cfg_t *current, *found = NULL;
-       child_cfg_t *child;
-
-       i1 = charon->backends->create_iterator(charon->backends);
-       while (i1->iterate(i1, (void**)&current))
-       {
-               /* compare peer_cfgs name first */
-               if (streq(current->get_name(current), name))
-               {
-                       found = current;
-                       found->get_ref(found);
-                       break;
-               }
-               /* compare all child_cfg names otherwise */
-               i2 = current->create_child_cfg_iterator(current);
-               while (i2->iterate(i2, (void**)&child))
-               {
-                       if (streq(child->get_name(child), name))
-                       {
-                               found = current;
-                               found->get_ref(found);
-                               break;
-                       }
-               }
-               i2->destroy(i2);
-               if (found)
-               {
-                       break;
-               }
-       }
-       i1->destroy(i1);
-       return found;
-}
-
-/**
  * logging dummy
  */
 static bool dbus_log(void *param, signal_t signal, level_t level,
@@ -197,7 +157,7 @@ static bool start_connection(private_dbus_interface_t *this, DBusMessage* msg)
        }
        set_state(this, NM_VPN_STATE_STARTING);
        
-       peer_cfg = get_peer_cfg_by_name(name);
+       peer_cfg = charon->backends->get_peer_cfg_by_name(charon->backends, name);
        if (peer_cfg)
        {
                free(this->name);