mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2026-03-01 17:35:33 +01:00
Add CMD_GET_INSTANCES
This new command will return all instances on a given path Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
This commit is contained in:
parent
7b409eba77
commit
164250ca8e
3 changed files with 58 additions and 0 deletions
|
|
@ -296,6 +296,9 @@ int dm_entry_param_method(struct dmctx *ctx, int cmd, char *inparam, char *arg1,
|
|||
case CMD_GET_SCHEMA:
|
||||
fault = dm_entry_get_schema(ctx);
|
||||
break;
|
||||
case CMD_GET_INSTANCES:
|
||||
fault = dm_entry_get_instances(ctx);
|
||||
break;
|
||||
#ifdef BBF_TR064
|
||||
case CMD_UPNP_GET_SUPPORTED_PARAMETERS:
|
||||
ctx->depth = atoi(arg1);
|
||||
|
|
|
|||
|
|
@ -1423,6 +1423,59 @@ static int mparam_get_schema_name(DMPARAM_ARGS)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* **************
|
||||
* get_instances
|
||||
* **************/
|
||||
static int mobj_get_instances_in_obj(DMOBJECT_ARGS)
|
||||
{
|
||||
if (node->matched && node->is_instanceobj) {
|
||||
char *name = dmstrdup(node->current_object);
|
||||
|
||||
if (name) {
|
||||
name[strlen(name) - 1] = 0;
|
||||
add_list_paramameter(dmctx, name, NULL, "xsd:object", NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mparam_get_instances_in_obj(DMPARAM_ARGS)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dm_entry_get_instances(struct dmctx *dmctx)
|
||||
{
|
||||
DMOBJ *root = dmctx->dm_entryobj;
|
||||
DMNODE node = { .current_object = "" };
|
||||
char buf[4] = { dm_delim, 0 };
|
||||
size_t plen;
|
||||
int err;
|
||||
|
||||
if (dmctx->in_param[0] == 0)
|
||||
dmctx->in_param = buf;
|
||||
|
||||
plen = strlen(dmctx->in_param);
|
||||
if (dmctx->in_param[plen - 1] != dm_delim)
|
||||
return FAULT_9005;
|
||||
|
||||
dmctx->inparam_isparam = 0;
|
||||
dmctx->findparam = 0;
|
||||
dmctx->stop = 0;
|
||||
dmctx->checkobj = plugin_obj_match;
|
||||
dmctx->checkleaf = plugin_leaf_match;
|
||||
dmctx->method_obj = mobj_get_instances_in_obj;
|
||||
dmctx->method_param = mparam_get_instances_in_obj;
|
||||
|
||||
err = dm_browse(dmctx, &node, root, NULL, NULL);
|
||||
if (dmctx->findparam == 0)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* ********************
|
||||
* get notification
|
||||
* ********************/
|
||||
|
|
|
|||
|
|
@ -336,6 +336,7 @@ enum {
|
|||
CMD_USP_OPERATE,
|
||||
CMD_USP_LIST_OPERATE,
|
||||
CMD_GET_SCHEMA,
|
||||
CMD_GET_INSTANCES,
|
||||
#ifdef BBF_TR064
|
||||
CMD_UPNP_GET_SUPPORTED_PARAMETERS,
|
||||
CMD_UPNP_GET_INSTANCES,
|
||||
|
|
@ -557,6 +558,7 @@ void dmentry_instance_lookup_inparam(struct dmctx *ctx);
|
|||
int dm_entry_get_value(struct dmctx *ctx);
|
||||
int dm_entry_get_name(struct dmctx *ctx);
|
||||
int dm_entry_get_schema(struct dmctx *ctx);
|
||||
int dm_entry_get_instances(struct dmctx *dmctx);
|
||||
int dm_entry_get_notification(struct dmctx *ctx);
|
||||
int dm_entry_inform(struct dmctx *ctx);
|
||||
int dm_entry_add_object(struct dmctx *ctx);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue