mod_netconf: url-capability edit-config

optional json parameter 'source' can be set to 'config' (default value
if missing) or to 'url'

add json parameters:
'uri-source' (needed when source is 'url')

- refs #1362
diff --git a/src/mod_netconf.c b/src/mod_netconf.c
index 8e5b6bc..bd5d8f5 100644
--- a/src/mod_netconf.c
+++ b/src/mod_netconf.c
@@ -763,14 +763,13 @@
 	return res;
 }
 
-static json_object *netconf_editconfig(const char* session_key, NC_DATASTORE target, NC_EDIT_DEFOP_TYPE defop, NC_EDIT_ERROPT_TYPE erropt, NC_EDIT_TESTOPT_TYPE testopt, const char* config)
+static json_object *netconf_editconfig(const char* session_key, NC_DATASTORE source, NC_DATASTORE target, NC_EDIT_DEFOP_TYPE defop, NC_EDIT_ERROPT_TYPE erropt, NC_EDIT_TESTOPT_TYPE testopt, const char* config_or_url)
 {
 	nc_rpc* rpc;
 	json_object *res = NULL;
 
 	/* create requests */
-	/* TODO source NC_DATASTORE_CONFIG / NC_DATASTORE_URL  */
-	rpc = nc_rpc_editconfig(target, NC_DATASTORE_CONFIG, defop, erropt, testopt, config);
+	rpc = nc_rpc_editconfig(target, source, defop, erropt, testopt, config_or_url);
 	if (rpc == NULL) {
 		DEBUG("mod_netconf: creating rpc request failed");
 		return create_error("Internal: Creating rpc request failed");
@@ -984,6 +983,8 @@
 		return NC_DATASTORE_CANDIDATE;
 	} else if (strcmp(ds, "url") == 0) {
 		return NC_DATASTORE_URL;
+	} else if (strcmp(ds, "config") == 0) {
+		return NC_DATASTORE_CONFIG;
 	}
 	return -1;
 }
@@ -1229,17 +1230,26 @@
 	}
 	if ((source = json_object_get_string(json_object_object_get(request, "source"))) != NULL) {
 		ds_type_s = parse_datastore(source);
+	} else {
+		/* source is optional, default value is config */
+		ds_type_s = NC_DATASTORE_CONFIG;
 	}
 	if (ds_type_t == -1) {
 		return create_error("Invalid target repository type requested.");
 	}
-
-	config = json_object_get_string(json_object_object_get(request, "config"));
-	if (config == NULL) {
-		return create_error("Invalid config data parameter.");
+	if (ds_type_s == NC_DATASTORE_CONFIG) {
+		config = json_object_get_string(json_object_object_get(request, "config"));
+		if (config == NULL) {
+			return create_error("Invalid config data parameter.");
+		}
+	} else if (ds_type_s == NC_DATASTORE_URL){
+		config = json_object_get_string(json_object_object_get(request, "uri-source"));
+		if (config == NULL) {
+			config = "";
+		}
 	}
 
-	reply = netconf_editconfig(session_key, ds_type_t, defop_type, erropt_type, NC_EDIT_TESTOPT_TESTSET, config);
+	reply = netconf_editconfig(session_key, ds_type_s, ds_type_t, defop_type, erropt_type, NC_EDIT_TESTOPT_TESTSET, config);
 	if (reply == NULL) {
 		if (err_reply != NULL) {
 			/* use filled err_reply from libnetconf's callback */