101 amxc_var_t* sub_obj = NULL;
111 sub_obj = amxc_var_add_key(amxc_htable_t, data->
response, path, NULL);
114 amxc_var_delete(&sub_obj);
121 amxc_var_delete(&sub_obj);
141 int32_t depth = amxc_var_dyncast(int32_t, GET_ARG(args,
"depth"));
142 amxc_var_t* params = GET_ARG(args,
"parameters");
143 bool has_params = !amxc_llist_is_empty(amxc_var_constcast(amxc_llist_t, params));
149 .key_path = key_path,
150 .template_only = template_only,
151 .include_templates = GET_BOOL(args,
"templates"),
153 .has_params = has_params
160 amxc_llist_for_each(it, paths) {
162 amxc_string_t* real_path = amxc_string_from_llist_it(it);
163 const char* str_rp = NULL;
165 str_rp = amxc_string_get(real_path, 0);
178 while(parent != NULL) {
219 amxc_var_t* var_rel_path = GET_ARG(args,
"rel_path");
220 const char* rel_path = GET_CHAR(var_rel_path, NULL);
221 amxc_var_t* params = GET_ARG(args,
"parameters");
223 const char* object_path = NULL;
224 const char* parameter = NULL;
227 amxc_llist_init(&paths);
231 when_failed(retval, exit);
235 if((parameter != NULL) && (parameter[0] != 0)) {
237 params = amxc_var_add_key(amxc_llist_t, args,
"parameters", NULL);
239 amxc_var_add(cstring_t, params, parameter);
242 amxc_var_set_type(ret, AMXC_VAR_ID_HTABLE);
244 when_failed(retval, exit);
245 amxc_var_take_it(var_rel_path);
249 const amxc_htable_t* hresult = amxc_var_constcast(amxc_htable_t, ret);
250 if(amxc_htable_is_empty(hresult)) {
264 const amxc_htable_t* hresult = amxc_var_constcast(amxc_htable_t, ret);
265 if((hresult != NULL) && !amxc_htable_is_empty(hresult)) {
275 amxc_var_delete(&var_rel_path);
277 amxc_llist_clean(&paths, amxc_string_list_it_free);
287 amxc_var_t* var_rel_path = GET_ARG(args,
"rel_path");
288 const char* rel_path = GET_CHAR(var_rel_path, NULL);
290 const char* object_path = NULL;
292 amxc_var_t* attrs = NULL;
294 amxc_llist_init(&paths);
298 when_failed(retval, exit);
311 amxc_var_set_type(ret, AMXC_VAR_ID_HTABLE);
313 when_failed(retval, exit);
315 amxc_var_take_it(var_rel_path);
322 amxc_var_delete(&attrs);
323 amxc_var_delete(&var_rel_path);
325 amxc_llist_clean(&paths, amxc_string_list_it_free);
Ambiorix Data Model API header file.
amxd_object_t * amxd_dm_findf(amxd_dm_t *const dm, const char *abs_path,...) __attribute__((format(printf
amxd_status_t amxd_dm_invoke_action(amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, amxc_var_t *const retval)
struct _amxd_get amxd_get_t
static void amxd_get_subobject(amxd_object_t *const object, UNUSED int32_t depth, void *priv)
amxd_status_t amxd_object_func_get_instances(amxd_object_t *object, UNUSED amxd_function_t *func, amxc_var_t *args, amxc_var_t *ret)
amxd_status_t amxd_object_func_get(amxd_object_t *object, UNUSED amxd_function_t *func, amxc_var_t *args, amxc_var_t *ret)
static amxd_status_t amxd_get_fill_response(amxd_dm_t *dm, bool key_path, bool template_only, amxc_llist_t *paths, amxc_var_t *args, amxc_var_t *ret)
static bool amxd_get_filter(amxd_object_t *const object, UNUSED int32_t depth, void *priv)
void PRIVATE amxd_def_funcs_remove_args(amxc_var_t *args)
Ambiorix Data Model API header file.
bool amxd_action_can_access_object(uint32_t object_attrs, amxd_dm_access_t access)
bool amxd_action_verify_access(amxd_object_t *object, amxd_dm_access_t access)
Ambiorix path API header file.
Ambiorix Data Model API header file.
enum _amxd_status amxd_status_t
@ amxd_status_parameter_not_found
@ amxd_status_invalid_path
@ amxd_status_object_not_found
@ amxd_status_unknown_error
#define AMXD_OBJECT_INDEXED
Name and path format flag - use index for instance objects.
#define AMXD_OBJECT_NAMED
Name and path format flag - default behavior, use name for instance objects.
enum _amxd_dm_access amxd_dm_access_t
Access level.
#define AMXD_OBJECT_TERMINATE
Path format flag - when set the object path is terminated with a dot.
amxd_object_t amxd_status_t amxd_status_t char * amxd_object_get_path(const amxd_object_t *object, const uint32_t flags)
Get the full path of the object.
amxd_object_t * amxd_object_get_parent(const amxd_object_t *const object)
Get the parent object.
void amxd_object_hierarchy_walk(amxd_object_t *const object, const amxd_direction_t direction, amxd_object_filter_fn_t filter, amxd_object_cb_fn_t cb, int32_t depth, void *priv)
Iterates over all objects in the data model tree.
amxd_object_t * amxd_object_findf(amxd_object_t *object, const char *rel_path,...) __attribute__((format(printf
Find an object in the data model tree, starting from an object.
amxd_dm_t * amxd_object_get_dm(const amxd_object_t *const object)
Get the data model.
amxd_object_t amxd_status_t amxd_object_resolve_pathf(amxd_object_t *object, amxc_llist_t *paths, const char *rel_path,...) __attribute__((format(printf
Resolves a search path into a list of matching object paths.
bool amxd_object_is_supported(amxd_object_t *object, const char *rel_path)
Checks if a path is in the supported data model.
static amxd_object_type_t amxd_object_get_type(const amxd_object_t *const object)
Returns the object type.
uint32_t amxd_object_get_attrs(const amxd_object_t *const object)
Gets the set attributes of an object.
amxd_status_t amxd_path_init(amxd_path_t *path, const char *object_path)
Initializes an amxd_path_t structure.
const char * amxd_path_get_param(amxd_path_t *path)
Gets the parameter name.
static bool amxd_path_is_search_path(amxd_path_t *path)
Checks if the path is a search path.
const char * amxd_path_get(amxd_path_t *path, int flags)
Returns the path stored in the amxd_path_t structure.
void amxd_path_clean(amxd_path_t *path)
Cleans an amxd_path_t structure.