mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
hosts: add ActiveLastChange parameter support
This commit is contained in:
parent
41fdc02419
commit
a193d35b84
5 changed files with 38 additions and 1 deletions
|
|
@ -233,6 +233,25 @@ int os__get_HostsHost_Active(char *refparam, struct dmctx *ctx, void *data, char
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.Hosts.Host.{i}.ActiveLastChange!UBUS:router.network/hosts//hosts[@i-1].activelstch*/
|
||||
int os__get_HostsHost_ActiveLastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
char local_time[32] = {0};
|
||||
time_t t_time;
|
||||
|
||||
*value = "0001-01-01T00:00:00Z";
|
||||
char *lastchange = dmjson_get_value((json_object *)data, 1, "activelstch");
|
||||
t_time = atoi(lastchange);
|
||||
if (localtime(&t_time) == NULL)
|
||||
return -1;
|
||||
|
||||
if (strftime(local_time, sizeof(local_time), "%Y-%m-%dT%H:%M:%SZ", localtime(&t_time)) == 0)
|
||||
return -1;
|
||||
|
||||
*value = dmstrdup(local_time);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.Hosts.Host.{i}.IPv4AddressNumberOfEntries!UBUS:router.network/hosts//hosts[@i-1].ipv4addr*/
|
||||
int os__get_HostsHost_IPv4AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -120,6 +120,11 @@ int os__get_HostsHost_Active(char *refparam, struct dmctx *ctx, void *data, char
|
|||
return not_implemented(value);
|
||||
}
|
||||
|
||||
int os__get_HostsHost_ActiveLastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
return not_implemented(value);
|
||||
}
|
||||
|
||||
int os__get_HostsHost_IPv4AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
return not_implemented(value);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ DMLEAF tHostsHostParams[] = {
|
|||
{"UserClassID", &DMREAD, DMT_HEXBIN, os__get_HostsHost_UserClassID, NULL, NULL, NULL, BBFDM_BOTH},
|
||||
{"HostName", &DMREAD, DMT_STRING, os__get_HostsHost_HostName, NULL, NULL, NULL, BBFDM_BOTH},
|
||||
{"Active", &DMREAD, DMT_BOOL, os__get_HostsHost_Active, NULL, NULL, NULL, BBFDM_BOTH},
|
||||
{"ActiveLastChange", &DMREAD, DMT_TIME, os__get_HostsHost_ActiveLastChange, NULL, NULL, NULL, BBFDM_BOTH},
|
||||
{"IPv4AddressNumberOfEntries", &DMREAD, DMT_UNINT, os__get_HostsHost_IPv4AddressNumberOfEntries, NULL, NULL, NULL, BBFDM_BOTH},
|
||||
{"IPv6AddressNumberOfEntries", &DMREAD, DMT_UNINT, os__get_HostsHost_IPv6AddressNumberOfEntries, NULL, NULL, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ int os__get_HostsHost_ClientID(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
int os__get_HostsHost_UserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int os__get_HostsHost_HostName(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int os__get_HostsHost_Active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int os__get_HostsHost_ActiveLastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int os__get_HostsHost_IPv4AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int os__get_HostsHost_IPv6AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int os__get_HostsHostIPv4Address_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
|
|
|
|||
|
|
@ -52859,7 +52859,18 @@
|
|||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "dateTime"
|
||||
"datatype": "dateTime",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "router.network",
|
||||
"method": "hosts",
|
||||
"args": {},
|
||||
"key": "hosts[@i-1].activelstch"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"IPv4AddressNumberOfEntries": {
|
||||
"type": "unsignedInt",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue