@@ -120,6 +120,7 @@ int DeleteChildParams_MultiInstanceObject(char *path, int path_len, dm_node_t *n
120120int strncpy_path_segments (char * dst , char * src , int maxlen );
121121void DumpSchemaFromRoot (dm_node_t * root , char * name );
122122void AddChildNodes (dm_node_t * parent , str_vector_t * sv );
123+ void AddChildArgs (str_vector_t * sv , char * path , str_vector_t * args , char * arg_type );
123124int SortSchemaPath (const void * p1 , const void * p2 );
124125int RegisterDefaultControllerTrust (void );
125126void DestroySchemaRecursive (dm_node_t * parent );
@@ -3065,6 +3066,14 @@ dm_node_t *DM_PRIV_AddSchemaPath(char *path, dm_node_type_t type, unsigned flags
30653066 child = DM_PRIV_FindMatchingChild (parent , seg -> name );
30663067 if (child == NULL )
30673068 {
3069+ // Do not allow tables to be registered implicitly by a parameter. Only allow them to be registered explicitly.
3070+ // Only non-table objects are registered implicitly
3071+ if ((seg -> type == kDMNodeType_Object_MultiInstance ) && (i != num_segments - 1 ))
3072+ {
3073+ USP_ERR_SetMessage ("%s: %s must be registered before %s" , __FUNCTION__ , schema_path , path );
3074+ return NULL ;
3075+ }
3076+
30683077 // Node has not yet been added, so add it
30693078 child = CreateNode (seg -> name , seg -> type , schema_path );
30703079 if (child == NULL )
@@ -3082,7 +3091,9 @@ dm_node_t *DM_PRIV_AddSchemaPath(char *path, dm_node_type_t type, unsigned flags
30823091 inst .order ++ ;
30833092 }
30843093
3085- // Default the group_id, if this is an object which we are adding implicitly to the data model by registering a parameter
3094+ // Default the group_id
3095+ // For grouped table objects, this will be overridden by the caller
3096+ // For non table objects, the group_id is effectively 'don't care' as non-table objects are not accessible via the grouped vendor hook APIs
30863097 if (IsObject (child ))
30873098 {
30883099 dm_object_info_t * info ;
@@ -4187,6 +4198,7 @@ int DeleteChildParams_MultiInstanceObject(char *path, int path_len, dm_node_t *n
41874198 DM_INST_VECTOR_Remove (inst );
41884199
41894200 // Add this object instance to the list of instances which are pending notification to the vendor
4201+ path [path_len + len ] = '\0' ;
41904202 DM_TRANS_Add (kDMOp_Del , path , NULL , NULL , node , inst );
41914203 }
41924204
@@ -4458,8 +4470,25 @@ int SortSchemaPath(const void *p1, const void *p2)
44584470void AddChildNodes (dm_node_t * parent , str_vector_t * sv )
44594471{
44604472 dm_node_t * child ;
4473+ char obj_path [MAX_DM_PATH ];
4474+ char * path ;
4475+
4476+ // Add this node to the string vector
4477+ USP_SNPRINTF (obj_path , sizeof (obj_path ), "%s." , parent -> path );
4478+ path = (IsObject (parent )) ? obj_path : parent -> path ;
4479+ STR_VECTOR_Add (sv , path );
4480+
4481+ // Add arguments (if applicable) to string vector
4482+ if (IsOperation (parent ))
4483+ {
4484+ AddChildArgs (sv , parent -> path , & parent -> registered .oper_info .input_args , "input" );
4485+ AddChildArgs (sv , parent -> path , & parent -> registered .oper_info .output_args , "output" );
4486+ }
44614487
4462- STR_VECTOR_Add (sv , parent -> path );
4488+ if (parent -> type == kDMNodeType_Event )
4489+ {
4490+ AddChildArgs (sv , parent -> path , & parent -> registered .event_info .event_args , "event_arg" );
4491+ }
44634492
44644493 // Iterate over list of children
44654494 child = (dm_node_t * ) parent -> child_nodes .head ;
@@ -4472,6 +4501,32 @@ void AddChildNodes(dm_node_t *parent, str_vector_t *sv)
44724501 }
44734502}
44744503
4504+ /*********************************************************************/ /**
4505+ **
4506+ ** AddChildArgs
4507+ **
4508+ ** Function called to add recursively to add the schema paths of all nodes to a string vector
4509+ **
4510+ ** \param sv - pointer to string vector in which to add the schema paths
4511+ ** \param path - data model path of the USP command or event
4512+ ** \param args - pointer to string vector containing arguments to add to the schema path vector
4513+ ** \param arg_type - pointer to string describing type of argument (input, output, or event_arg)
4514+ **
4515+ ** \return None
4516+ **
4517+ **************************************************************************/
4518+ void AddChildArgs (str_vector_t * sv , char * path , str_vector_t * args , char * arg_type )
4519+ {
4520+ int i ;
4521+ char buf [MAX_DM_PATH ];
4522+
4523+ for (i = 0 ; i < args -> num_entries ; i ++ )
4524+ {
4525+ USP_SNPRINTF (buf , sizeof (buf ), "%s %s:%s" , path , arg_type , args -> vector [i ]);
4526+ STR_VECTOR_Add (sv , buf );
4527+ }
4528+ }
4529+
44754530/*********************************************************************/ /**
44764531**
44774532** FindNodeFromHash
@@ -4525,6 +4580,8 @@ int RegisterDefaultControllerTrust(void)
45254580 err |= USP_DM_RegisterRoleName (kCTrustRole_Untrusted , "Untrusted" );
45264581 err |= USP_DM_AddControllerTrustPermission (kCTrustRole_Untrusted , "Device." , PERMIT_NONE );
45274582 err |= USP_DM_AddControllerTrustPermission (kCTrustRole_Untrusted , "Device.DeviceInfo." , PERMIT_GET | PERMIT_OBJ_INFO );
4583+ err |= USP_DM_AddControllerTrustPermission (kCTrustRole_Untrusted , "Device.LocalAgent.ControllerTrust.RequestChallenge()" , PERMIT_OPER );
4584+ err |= USP_DM_AddControllerTrustPermission (kCTrustRole_Untrusted , "Device.LocalAgent.ControllerTrust.ChallengeResponse()" , PERMIT_OPER );
45284585
45294586 if (err != USP_ERR_OK )
45304587 {
0 commit comments