* - 0 on success.
* - <0 on error.
*/
-int mod_json_object_to_map(TALLOC_CTX *ctx, fr_cursor_t *out, request_t *request, json_object *json, pair_list_t list)
+int mod_json_object_to_map(TALLOC_CTX *ctx, fr_dcursor_t *out, request_t *request, json_object *json, tmpl_pair_list_t list)
{
json_object *list_obj;
char const *list_name = fr_table_str_by_value(pair_list_table, list, "<INVALID>");
return -1;
}
- fr_cursor_tail(out); /* Wind to the end */
+ fr_dcursor_tail(out); /* Wind to the end */
/*
* Loop through the keys in this object.
REDEBUG("Invalid json type for \"%s\" key - Attributes must be json objects", attr_name);
error:
- fr_cursor_free_list(out); /* Free any maps we added */
+ fr_dcursor_free_list(out); /* Free any maps we added */
return -1;
}
goto bad_value;
}
- fr_cursor_insert(out, map);
+ fr_dcursor_insert(out, map);
}
}
int mod_attribute_to_element(const char *name, json_object *map, void *buf);
-int mod_json_object_to_map(TALLOC_CTX *ctx, fr_cursor_t *out, request_t *request, json_object *json, fr_pair_list_t list);
+int mod_json_object_to_map(TALLOC_CTX *ctx, fr_dcursor_t *out, request_t *request, json_object *json, tmpl_pair_list_t list);
json_object *mod_value_pair_to_json_object(request_t *request, fr_pair_t *vp);
#include <freeradius-devel/server/module.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/base.h>
+#include <freeradius-devel/radius/defs.h>
#include <freeradius-devel/json/base.h>
{
TALLOC_CTX *pool = talloc_pool(request, 1024); /* We need to do lots of allocs */
- fr_cursor_t maps, vlms;
- map_t *map_head = NULL, *map;
+ fr_cursor_t vlms;
+ fr_dcursor_t maps;
+ map_t *map = NULL;
+ fr_map_list_t map_head;
vp_list_mod_t *vlm_head = NULL, *vlm;
- fr_cursor_init(&maps, &map_head);
+ fr_map_list_init(&map_head);
+ fr_dcursor_init(&maps, &map_head);
/*
* Convert JSON data into maps
* Convert all the maps into list modifications,
* which are guaranteed to succeed.
*/
- for (map = fr_cursor_head(&maps);
- map;
- map = fr_cursor_next(&maps)) {
+ while ((map = fr_dlist_next(&map_head, map))) {
if (map_to_list_mod(pool, &vlm, request, map, NULL, NULL) < 0) goto invalid;
fr_cursor_insert(&vlms, vlm);
}