mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2026-03-05 08:50:42 +01:00
Ticket refs #15238: Fixing some issues in XMPP object
This commit is contained in:
parent
69777aae9b
commit
c8a9e8fac9
3 changed files with 38 additions and 11 deletions
12
config.c
12
config.c
|
|
@ -871,12 +871,12 @@ int get_global_config(struct config *conf)
|
|||
if((error = uci_get_value(UCI_XMPP_ENABLE,&value)) == CWMP_OK)
|
||||
{
|
||||
if(value != NULL)
|
||||
{
|
||||
{
|
||||
if ((strcasecmp(value,"true")==0) || (strcmp(value,"1")==0))
|
||||
{
|
||||
conf->xmpp_enable = true;
|
||||
CWMP_LOG(INFO,"Xmpp connection id is %d \n", conf->xmpp_enable);
|
||||
}
|
||||
CWMP_LOG(INFO,"Xmpp connection id is %d", conf->xmpp_enable);
|
||||
}
|
||||
value = NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -896,7 +896,7 @@ int get_global_config(struct config *conf)
|
|||
}
|
||||
else
|
||||
{
|
||||
CWMP_LOG(INFO,"Xmpp connection id :%d \n", a);
|
||||
CWMP_LOG(INFO,"Xmpp connection id :%d", a);
|
||||
conf->xmpp_connection_id = a;
|
||||
}
|
||||
}
|
||||
|
|
@ -1283,7 +1283,7 @@ int cwmp_get_xmpp_param(struct cwmp *cwmp) {
|
|||
cwmp->xmpp_param.retry_max_interval = (cwmp->xmpp_param.retry_max_interval) ? cwmp->xmpp_param.retry_max_interval : DEFAULT_RETRY_MAX_INTERVAL;
|
||||
}
|
||||
cwmp_dm_ctx_clean(cwmp, &dmctx);
|
||||
check_xmpp_config(cwmp);
|
||||
//check_xmpp_config(cwmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1334,6 +1334,8 @@ int cwmp_init(int argc, char** argv,struct cwmp *cwmp)
|
|||
#ifdef XMPP_ENABLE
|
||||
if (conf->xmpp_enable && conf->xmpp_connection_id > 0)
|
||||
cwmp_get_xmpp_param(cwmp);
|
||||
else
|
||||
CWMP_LOG(INFO,"XMPP is Disabled");
|
||||
#endif
|
||||
dm_entry_load_enabled_notify(DM_CWMP, cwmp->conf.amd_version, cwmp->conf.instance_mode);
|
||||
return CWMP_OK;
|
||||
|
|
|
|||
|
|
@ -60,4 +60,8 @@ config xmpp_connection
|
|||
option domain ''
|
||||
option resource 'icwmp'
|
||||
option interval '300'
|
||||
option attempt '16'
|
||||
option initial_retry_interval ''
|
||||
option retry_interval_multiplier ''
|
||||
option retry_max_interval ''
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ DMLEAF tXMPPParams[] = {
|
|||
DMLEAF tConnectionParams[] = {
|
||||
/* PARAM, permission, type, getvlue, setvalue, forced_inform, notification*/
|
||||
{"Enable", &DMWRITE, DMT_BOOL, get_connection_enable, set_connection_enable, NULL, NULL},
|
||||
//{"Username", &DMWRITE, DMT_STRING, get_xmpp_connection_username, set_xmpp_connection_username, NULL, NULL},
|
||||
{"Username", &DMWRITE, DMT_STRING, get_xmpp_connection_username, set_xmpp_connection_username, NULL, NULL},
|
||||
{"Password", &DMWRITE, DMT_STRING, get_xmpp_connection_password, set_xmpp_connection_password, NULL, NULL},
|
||||
{"Domain", &DMWRITE, DMT_STRING, get_xmpp_connection_domain, set_xmpp_connection_domain, NULL, NULL},
|
||||
{"Resource", &DMWRITE, DMT_STRING, get_xmpp_connection_resource, set_xmpp_connection_resource, NULL, NULL},
|
||||
|
|
@ -242,15 +242,36 @@ int set_connection_enable(char *refparam, struct dmctx *ctx, void *data, char *i
|
|||
return 0;
|
||||
}
|
||||
|
||||
int get_xmpp_connection_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
int get_xmpp_connection_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
struct uci_section *connsection = (struct uci_section *)data;
|
||||
|
||||
dmuci_get_value_by_section_string(connsection, "password", value);
|
||||
dmuci_get_value_by_section_string(connsection, "username", value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int set_xmpp_connection_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
int set_xmpp_connection_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
struct uci_section *connsection = (struct uci_section *)data;
|
||||
bool b;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
return 0;
|
||||
case VALUESET:
|
||||
dmuci_set_value_by_section(connsection, "username", value);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_xmpp_connection_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = "";
|
||||
return 0;
|
||||
}
|
||||
|
||||
int set_xmpp_connection_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
struct uci_section *connsection = (struct uci_section *)data;
|
||||
bool b;
|
||||
|
|
@ -269,7 +290,7 @@ int get_xmpp_connection_domain(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
{
|
||||
struct uci_section *connsection = (struct uci_section *)data;
|
||||
|
||||
dmuci_get_value_by_section_string(connsection, "password", value);
|
||||
dmuci_get_value_by_section_string(connsection, "domain", value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -282,7 +303,7 @@ int set_xmpp_connection_domain(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
case VALUECHECK:
|
||||
return 0;
|
||||
case VALUESET:
|
||||
dmuci_set_value_by_section(connsection, "password", value);
|
||||
dmuci_set_value_by_section(connsection, "domain", value);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue