Align XMPP & UDPEchoserver & TWAMP with latest bbf changes

This commit is contained in:
Amin Ben Ramdhane 2020-11-27 10:52:16 +01:00
parent e22a60c637
commit 450b9eaee9
3 changed files with 14 additions and 16 deletions

View file

@ -114,7 +114,6 @@ static int addObjBulkDataProfile(char *refparam, struct dmctx *ctx, void *data,
struct uci_section *profile, *dmmap_bulkdata;
char prof_id[16], *last_inst = NULL;
check_create_dmmap_package("dmmap_bulkdata");
last_inst = get_last_instance_bbfdm("dmmap_bulkdata", "profile", "profile_instance");
snprintf(prof_id, sizeof(prof_id), "%d", last_inst ? atoi(last_inst)+1 : 1);

View file

@ -55,12 +55,12 @@ struct ip_args
static int addObjIPInterfaceTWAMPReflector(char *refparam, struct dmctx *ctx, void *data, char **instance)
{
struct uci_section *connection;
char *value1, *last_inst, *id;
struct uci_section *connection = NULL;
last_inst = get_last_instance_with_option("twamp", "twamp_reflector", "interface", section_name(((struct ip_args *)data)->ip_sec), "twamp_inst");
id = get_last_id("twamp", "twamp_reflector");
dmuci_add_section("twamp", "twamp_reflector", &connection, &value1);
char *last_inst = get_last_instance_with_option("twamp", "twamp_reflector", "interface", section_name(((struct ip_args *)data)->ip_sec), "twamp_inst");
char *id = get_last_id("twamp", "twamp_reflector");
dmuci_add_section("twamp", "twamp_reflector", &connection);
dmasprintf(instance, "%d", last_inst ? atoi(last_inst)+1 : 1);
dmuci_set_value_by_section(connection, "twamp_inst", *instance);
dmuci_set_value_by_section(connection, "id", id);

View file

@ -25,30 +25,29 @@ LIB_MAP_OBJ tRootDynamicObj[] = {
static int add_xmpp_connection(char *refparam, struct dmctx *ctx, void *data, char **instance)
{
struct uci_section *xmpp_con, *xmpp_con_srv, *dmmap_xmpp;
char *con_name, *con_srv_name, *last_inst, *v, *id;
struct uci_section *xmpp_con = NULL, *xmpp_con_srv = NULL, *dmmap_xmpp = NULL;
char id[16];
check_create_dmmap_package("dmmap_xmpp");
last_inst = get_last_instance_bbfdm("dmmap_xmpp", "connection", "con_inst");
dmasprintf(&id, "%d", (last_inst) ? atoi(last_inst) + 1 : 1);
char *last_inst = get_last_instance_bbfdm("dmmap_xmpp", "connection", "con_inst");
snprintf(id, sizeof(id), "%d", (last_inst) ? atoi(last_inst) + 1 : 1);
dmuci_add_section("xmpp", "connection", &xmpp_con, &con_name);
dmuci_add_section("xmpp", "connection", &xmpp_con);
dmuci_set_value_by_section(xmpp_con, "xmpp_id", id);
dmuci_set_value_by_section(xmpp_con, "enable", "0");
dmuci_set_value_by_section(xmpp_con, "interval", "30");
dmuci_set_value_by_section(xmpp_con, "attempt", "16");
dmuci_set_value_by_section(xmpp_con, "serveralgorithm", "DNS-SRV");
dmuci_add_section("xmpp", "connection_server", &xmpp_con_srv, &con_srv_name);
dmuci_add_section("xmpp", "connection_server", &xmpp_con_srv);
dmuci_set_value_by_section(xmpp_con_srv, "con_id", id);
dmuci_set_value_by_section(xmpp_con_srv, "enable", "0");
dmuci_set_value_by_section(xmpp_con_srv, "port", "5222");
dmuci_add_section_bbfdm("dmmap_xmpp", "connection_server", &dmmap_xmpp, &v);
dmuci_add_section_bbfdm("dmmap_xmpp", "connection_server", &dmmap_xmpp);
dmuci_set_value_by_section(dmmap_xmpp, "section_name", section_name(xmpp_con_srv));
dmuci_set_value_by_section(dmmap_xmpp, "con_srv_inst", "1");
dmuci_add_section_bbfdm("dmmap_xmpp", "connection", &dmmap_xmpp, &v);
dmuci_add_section_bbfdm("dmmap_xmpp", "connection", &dmmap_xmpp);
dmuci_set_value_by_section(dmmap_xmpp, "section_name", section_name(xmpp_con));
*instance = update_instance(last_inst, 4, dmmap_xmpp, "con_inst", "dmmap_xmpp", "connection");
return 0;