mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Moving stun params to stunc
This commit is contained in:
parent
0650586286
commit
6471616110
2 changed files with 6 additions and 184 deletions
|
|
@ -447,181 +447,6 @@ static int set_instance_mode(char *refparam, struct dmctx *ctx, void *data, char
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* STUN parameters
|
||||
*/
|
||||
/*#Device.ManagementServer.UDPConnectionRequestAddress!UCI:stun/stun,stun/crudp_address*/
|
||||
static int get_upd_cr_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
varstate_get_value_string("stun", "stun", "crudp_address", value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.ManagementServer.STUNEnable!UCI:stun/stun,stun/enable*/
|
||||
static int get_stun_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = dmuci_get_option_value_fallback_def("stun", "stun", "enable", "1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_stun_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
bool b;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
string_to_bool(value, &b);
|
||||
dmuci_set_value("stun", "stun", "enable", b ? "1" : "0");
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.ManagementServer.STUNServerAddress!UCI:stun/stun,stun/server_address*/
|
||||
static int get_stun_server_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
dmuci_get_option_value_string("stun", "stun", "server_address", value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_stun_server_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
dmuci_set_value("stun", "stun", "server_address", value);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.ManagementServer.STUNServerPort!UCI:stun/stun,stun/server_port*/
|
||||
static int get_stun_server_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = dmuci_get_option_value_fallback_def("stun", "stun", "server_port", "3478");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_stun_server_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
dmuci_set_value("stun", "stun", "server_port", value);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.ManagementServer.STUNUsername!UCI:stun/stun,stun/username*/
|
||||
static int get_stun_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
dmuci_get_option_value_string("stun", "stun", "username", value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_stun_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
dmuci_set_value("stun", "stun", "username", value);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.ManagementServer.STUNPassword!UCI:stun/stun,stun/password*/
|
||||
static int get_stun_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = "";
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_stun_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
dmuci_set_value("stun", "stun", "password", value);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.ManagementServer.STUNMaximumKeepAlivePeriod!UCI:stun/stun,stun/max_keepalive*/
|
||||
static int get_stun_maximum_keepalive_period(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = dmuci_get_option_value_fallback_def("stun", "stun", "max_keepalive", "-1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_stun_maximum_keepalive_period(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
dmuci_set_value("stun", "stun", "max_keepalive", value);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.ManagementServer.STUNMinimumKeepAlivePeriod!UCI:stun/stun,stun/min_keepalive*/
|
||||
static int get_stun_minimum_keepalive_period(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = dmuci_get_option_value_fallback_def("stun", "stun", "min_keepalive", "30");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_stun_minimum_keepalive_period(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
dmuci_set_value("stun", "stun", "min_keepalive", value);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.ManagementServer.NATDetected!UCI:stun/stun,stun/nat_detected*/
|
||||
static int get_nat_detected(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
char *v;
|
||||
|
||||
dmuci_get_option_value_string("stun", "stun", "enable", &v);
|
||||
|
||||
if (*v == '1') { //stun is enabled
|
||||
varstate_get_value_string("stun", "stun", "nat_detected", &v);
|
||||
*value = (*v == '1') ? "true" : "false";
|
||||
} else
|
||||
*value = "false";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* XMPP parameters
|
||||
*/
|
||||
|
|
@ -725,15 +550,6 @@ DMLEAF tManagementServerParams[] = {
|
|||
{"ConnectionRequestUsername", &DMWRITE, DMT_STRING, get_management_server_connection_request_username, set_management_server_connection_request_username, BBFDM_CWMP},
|
||||
{"ConnectionRequestPassword", &DMWRITE, DMT_STRING, get_empty, set_management_server_connection_request_passwd, BBFDM_CWMP},
|
||||
{"UpgradesManaged", &DMWRITE, DMT_BOOL, get_upgrades_managed, set_upgrades_managed, BBFDM_CWMP},
|
||||
{"UDPConnectionRequestAddress", &DMREAD, DMT_STRING, get_upd_cr_address, NULL, BBFDM_CWMP},
|
||||
{"STUNEnable", &DMWRITE, DMT_BOOL, get_stun_enable, set_stun_enable, BBFDM_CWMP},
|
||||
{"STUNServerAddress", &DMWRITE, DMT_STRING, get_stun_server_address, set_stun_server_address, BBFDM_CWMP},
|
||||
{"STUNServerPort", &DMWRITE, DMT_UNINT, get_stun_server_port, set_stun_server_port, BBFDM_CWMP},
|
||||
{"STUNUsername", &DMWRITE, DMT_STRING, get_stun_username, set_stun_username, BBFDM_CWMP},
|
||||
{"STUNPassword", &DMWRITE, DMT_STRING, get_stun_password, set_stun_password, BBFDM_CWMP},
|
||||
{"STUNMaximumKeepAlivePeriod", &DMWRITE, DMT_INT, get_stun_maximum_keepalive_period, set_stun_maximum_keepalive_period, BBFDM_CWMP},
|
||||
{"STUNMinimumKeepAlivePeriod", &DMWRITE, DMT_UNINT, get_stun_minimum_keepalive_period, set_stun_minimum_keepalive_period, BBFDM_CWMP},
|
||||
{"NATDetected", &DMREAD, DMT_BOOL, get_nat_detected, NULL, BBFDM_CWMP},
|
||||
{"HTTPCompressionSupported", &DMREAD, DMT_STRING, get_management_server_http_compression_supportted, NULL, BBFDM_CWMP},
|
||||
{"HTTPCompression", &DMWRITE, DMT_STRING, get_management_server_http_compression, set_management_server_http_compression, BBFDM_CWMP},
|
||||
{"LightweightNotificationProtocolsSupported", &DMREAD, DMT_STRING, get_lwn_protocol_supported, NULL, BBFDM_CWMP},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
[program:ubusd]
|
||||
autorestart=false
|
||||
startretries=0
|
||||
priority=1
|
||||
command=/bin/bash -c "/usr/sbin/ubusd"
|
||||
|
||||
[program:rpcd]
|
||||
autorestart=false
|
||||
startretries=0
|
||||
priority=2
|
||||
command=/bin/bash -c "/usr/sbin/rpcd"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue