+ * initiate an IKE or CHILD SA
+ */
+static void initiate(private_control_controller_t *this, request_t *r,
+ bool ike, char *config)
+{
+ gateway_t *gateway;
+ enumerator_t *e;
+
+ r->setf(r, "title=Establishing %s SA %s", ike ? "IKE" : "CHILD", config);
+ gateway = this->manager->select_gateway(this->manager, 0);
+ e = gateway->initiate(gateway, ike, config);
+ handle_result(this, r, e);
+}
+
+/**
+ * terminate an IKE or CHILD SA
+ */
+static void terminate(private_control_controller_t *this, request_t *r,
+ bool ike, u_int32_t id)
+{
+ gateway_t *gateway;
+ enumerator_t *e;
+
+ r->setf(r, "title=Terminate %s SA %d", ike ? "IKE" : "CHILD", id);
+ gateway = this->manager->select_gateway(this->manager, 0);
+ e = gateway->terminate(gateway, ike, id);
+ handle_result(this, r, e);
+}
+
+/**