From: Arran Cudbard-Bell Date: Thu, 6 Jan 2022 15:24:24 +0000 (-0600) Subject: Trim default prefix from generated dlist functions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49695f0782d3d5d6f0b4a1f0ae0090f8cd36f172;p=thirdparty%2Ffreeradius-server.git Trim default prefix from generated dlist functions --- diff --git a/src/bin/unit_test_map.c b/src/bin/unit_test_map.c index 3074e462b0f..92a3f18d9d5 100644 --- a/src/bin/unit_test_map.c +++ b/src/bin/unit_test_map.c @@ -75,7 +75,7 @@ static int process_file(char const *filename) int rcode; char const *name1, *name2; CONF_SECTION *cs; - fr_map_list_t list; + map_list_t list; map_t *map = NULL; char buffer[8192]; @@ -86,7 +86,7 @@ static int process_file(char const *filename) .allow_foreign = false, /* tests are in the RADIUS dictionary */ }; - fr_dlist_map_init(&list); + map_list_init(&list); /* * Must be called first, so the handler is called last */ @@ -122,7 +122,7 @@ static int process_file(char const *filename) cf_log_perr(cs, "map_afrom_cs failed"); return EXIT_FAILURE; /* message already printed */ } - if (fr_dlist_map_empty(&list)) { + if (map_list_empty(&list)) { cf_log_err(cs, "'update' sections cannot be empty"); return EXIT_FAILURE; } @@ -141,7 +141,7 @@ static int process_file(char const *filename) printf("%s %s {\n", name1, name2); } - while ((map = fr_dlist_map_next(&list, map))) { + while ((map = map_list_next(&list, map))) { map_print(&FR_SBUFF_OUT(buffer + 1, sizeof(buffer) - 1), map); puts(buffer); } diff --git a/src/bin/unit_test_module.c b/src/bin/unit_test_module.c index c91e0b65b86..ce78013a5f8 100644 --- a/src/bin/unit_test_module.c +++ b/src/bin/unit_test_module.c @@ -438,7 +438,7 @@ static bool do_xlats(fr_event_list_t *el, char const *filename, FILE *fp) * Verify the result of the map. */ static int map_proc_verify(CONF_SECTION *cs, UNUSED void *mod_inst, UNUSED void *proc_inst, - tmpl_t const *src, UNUSED fr_map_list_t const *maps) + tmpl_t const *src, UNUSED map_list_t const *maps) { if (!src) { cf_log_err(cs, "Missing source"); @@ -450,7 +450,7 @@ static int map_proc_verify(CONF_SECTION *cs, UNUSED void *mod_inst, UNUSED void } static rlm_rcode_t mod_map_proc(UNUSED void *mod_inst, UNUSED void *proc_inst, UNUSED request_t *request, - UNUSED fr_value_box_list_t *src, UNUSED fr_map_list_t const *maps) + UNUSED fr_value_box_list_t *src, UNUSED map_list_t const *maps) { return RLM_MODULE_FAIL; } diff --git a/src/lib/ldap/base.h b/src/lib/ldap/base.h index 34ac0390c05..b8c66308720 100644 --- a/src/lib/ldap/base.h +++ b/src/lib/ldap/base.h @@ -347,7 +347,7 @@ typedef struct { * Used to store the array of attributes we'll be querying for. */ typedef struct { - fr_map_list_t const *maps; //!< Head of list of maps we expanded the RHS of. + map_list_t const *maps; //!< Head of list of maps we expanded the RHS of. char const *attrs[LDAP_MAX_ATTRMAP + LDAP_MAP_RESERVED + 1]; //!< Reserve some space for access attributes //!< and NULL termination. TALLOC_CTX *ctx; //!< Context to allocate new attributes in. @@ -683,7 +683,7 @@ int fr_ldap_map_getvalue(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *reque int fr_ldap_map_verify(map_t *map, void *instance); -int fr_ldap_map_expand(fr_ldap_map_exp_t *expanded, request_t *request, fr_map_list_t const *maps); +int fr_ldap_map_expand(fr_ldap_map_exp_t *expanded, request_t *request, map_list_t const *maps); int fr_ldap_map_do(request_t *request, LDAP *handle, char const *valuepair_attr, fr_ldap_map_exp_t const *expanded, LDAPMessage *entry); diff --git a/src/lib/ldap/map.c b/src/lib/ldap/map.c index bba78ea3ce4..c5a8faee229 100644 --- a/src/lib/ldap/map.c +++ b/src/lib/ldap/map.c @@ -253,7 +253,7 @@ int fr_ldap_map_verify(map_t *map, UNUSED void *instance) * - 0 on success. * - -1 on failure. */ -int fr_ldap_map_expand(fr_ldap_map_exp_t *expanded, request_t *request, fr_map_list_t const *maps) +int fr_ldap_map_expand(fr_ldap_map_exp_t *expanded, request_t *request, map_list_t const *maps) { map_t const *map = NULL; unsigned int total = 0; @@ -262,7 +262,7 @@ int fr_ldap_map_expand(fr_ldap_map_exp_t *expanded, request_t *request, fr_map_l char const *attr; char attr_buff[1024 + 1]; /* X.501 says we need to support at least 1024 chars for attr names */ - while ((map = fr_dlist_map_next(maps, map))) { + while ((map = map_list_next(maps, map))) { if (tmpl_expand(&attr, attr_buff, sizeof(attr_buff), request, map->rhs, NULL, NULL) < 0) { REDEBUG("Expansion of LDAP attribute \"%s\" failed", map->rhs->name); TALLOC_FREE(ctx); @@ -314,7 +314,7 @@ int fr_ldap_map_do(request_t *request, LDAP *handle, fr_ldap_result_t result; char const *name; - while ((map = fr_dlist_map_next(expanded->maps, map))) { + while ((map = map_list_next(expanded->maps, map))) { int ret; name = expanded->attrs[total++]; diff --git a/src/lib/redis/base.h b/src/lib/redis/base.h index b804d07e9a0..301dde91863 100644 --- a/src/lib/redis/base.h +++ b/src/lib/redis/base.h @@ -144,7 +144,7 @@ int fr_redis_reply_to_value_box(TALLOC_CTX *ctx, fr_value_box_t *out, redisRep fr_type_t dst_type, fr_dict_attr_t const *dst_enumv, bool box_error, bool shallow); -int fr_redis_reply_to_map(TALLOC_CTX *ctx, fr_map_list_t *out, +int fr_redis_reply_to_map(TALLOC_CTX *ctx, map_list_t *out, request_t *request, redisReply *key, redisReply *op, redisReply *value); int fr_redis_tuple_from_map(TALLOC_CTX *pool, char const *out[], size_t out_len[], map_t *map); diff --git a/src/lib/redis/redis.c b/src/lib/redis/redis.c index d714a03c710..166b11bfe33 100644 --- a/src/lib/redis/redis.c +++ b/src/lib/redis/redis.c @@ -358,7 +358,7 @@ int fr_redis_reply_to_value_box(TALLOC_CTX *ctx, fr_value_box_t *out, redisReply * - 0 on success. * - -1 on failure. */ -int fr_redis_reply_to_map(TALLOC_CTX *ctx, fr_map_list_t *out, request_t *request, +int fr_redis_reply_to_map(TALLOC_CTX *ctx, map_list_t *out, request_t *request, redisReply *key, redisReply *op, redisReply *value) { map_t *map = NULL; @@ -425,7 +425,7 @@ int fr_redis_reply_to_map(TALLOC_CTX *ctx, fr_map_list_t *out, request_t *reques } MAP_VERIFY(map); - fr_dlist_map_insert_tail(out, map); + map_list_insert_tail(out, map); return 0; } diff --git a/src/lib/server/map.c b/src/lib/server/map.c index bff3c91945e..fe0a9e53636 100644 --- a/src/lib/server/map.c +++ b/src/lib/server/map.c @@ -69,7 +69,7 @@ static inline map_t *map_alloc(TALLOC_CTX *ctx, map_t *parent) } map->parent = parent; - fr_dlist_map_init(&map->child); + map_list_init(&map->child); return map; } @@ -624,7 +624,7 @@ check_for_child: * caller will have to check for this! */ if (is_child && parent) { - fr_dlist_map_insert_tail(&parent->child, map); + map_list_insert_tail(&parent->child, map); } if (parent_p) *parent_p = new_parent; @@ -636,7 +636,7 @@ check_for_child: } -static int _map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, map_t *parent, CONF_SECTION *cs, +static int _map_afrom_cs(TALLOC_CTX *ctx, map_list_t *out, map_t *parent, CONF_SECTION *cs, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules, map_validate_t validate, void *uctx, unsigned int max); @@ -658,7 +658,7 @@ static int _map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, map_t *parent, CON * - 0 on success. * - -1 on failure. */ -int map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, CONF_SECTION *cs, +int map_afrom_cs(TALLOC_CTX *ctx, map_list_t *out, CONF_SECTION *cs, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules, map_validate_t validate, void *uctx, unsigned int max) @@ -666,7 +666,7 @@ int map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, CONF_SECTION *cs, return _map_afrom_cs(ctx, out, NULL, cs, lhs_rules, rhs_rules, validate, uctx, max); } -static int _map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, map_t *parent, CONF_SECTION *cs, +static int _map_afrom_cs(TALLOC_CTX *ctx, map_list_t *out, map_t *parent, CONF_SECTION *cs, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules, map_validate_t validate, void *uctx, unsigned int max) @@ -718,7 +718,7 @@ static int _map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, map_t *parent, CON * Free in reverse as successive entries have their * prececessors as talloc parent contexts */ - fr_dlist_map_talloc_reverse_free(out); + map_list_talloc_reverse_free(out); return -1; } @@ -731,9 +731,9 @@ static int _map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, map_t *parent, CON fr_token_t token; ssize_t slen; bool qualifiers = our_lhs_rules.disallow_qualifiers; - fr_map_list_t child_list; + map_list_t child_list; - fr_dlist_map_init(&child_list); + map_list_init(&child_list); subcs = cf_item_to_section(ci); token = cf_section_name2_quote(subcs); @@ -806,11 +806,11 @@ static int _map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, map_t *parent, CON */ if (_map_afrom_cs(map, &child_list, map, cf_item_to_section(ci), &our_lhs_rules, rhs_rules, validate, uctx, max) < 0) { - fr_dlist_map_talloc_free(&child_list); + map_list_talloc_free(&child_list); talloc_free(map); goto error; } - fr_dlist_map_move(&map->child, &child_list); + map_list_move(&map->child, &child_list); our_lhs_rules.disallow_qualifiers = qualifiers; MAP_VERIFY(map); @@ -840,7 +840,7 @@ static int _map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, map_t *parent, CON next: parent_ctx = map; - fr_dlist_map_insert_tail(out, map); + map_list_insert_tail(out, map); } return 0; @@ -1150,9 +1150,9 @@ int map_to_vp(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, map_t co MEM(n = fr_pair_afrom_da(ctx, tmpl_da(map->lhs))); n->op = map->op; - for (child = fr_dlist_map_next(&map->child, NULL); + for (child = map_list_next(&map->child, NULL); child != NULL; - child = fr_dlist_map_next(&map->child, child)) { + child = map_list_next(&map->child, child)) { fr_pair_list_t list; /* @@ -1947,7 +1947,7 @@ ssize_t map_print(fr_sbuff_t *out, map_t const *map) * If there's no child and no RHS then the * map was invalid. */ - if (fr_dlist_map_empty(&map->child) && !fr_cond_assert(map->rhs != NULL)) { + if (map_list_empty(&map->child) && !fr_cond_assert(map->rhs != NULL)) { fr_sbuff_terminate(out); return 0; } diff --git a/src/lib/server/map.h b/src/lib/server/map.h index de5f5471e8f..8a84815c92e 100644 --- a/src/lib/server/map.h +++ b/src/lib/server/map.h @@ -30,7 +30,7 @@ RCSIDH(map_h, "$Id$") extern "C" { #endif -typedef struct vp_map_s map_t; +typedef struct map_s map_t; typedef struct vp_list_mod_s vp_list_mod_t; #ifdef __cplusplus @@ -57,12 +57,12 @@ extern "C" { ['>'] = true, \ ['~'] = true -FR_DLIST_TYPES(map) +FR_DLIST_TYPES(map_list) /** Given these are used in so many places, it's more friendly to have a proper type * */ -typedef FR_DLIST_HEAD_TYPE(map) fr_map_list_t; +typedef FR_DLIST_HEAD(map_list) map_list_t; /** Value pair map * @@ -74,7 +74,7 @@ typedef FR_DLIST_HEAD_TYPE(map) fr_map_list_t; * * @see tmpl_t */ -struct vp_map_s { +struct map_s { tmpl_t *lhs; //!< Typically describes the attribute to add, modify or compare. tmpl_t *rhs; //!< Typically describes a literal value or a src attribute ///< to copy or compare. @@ -86,11 +86,12 @@ struct vp_map_s { //!< logging validation errors. map_t *parent; //! parent map, for nested ones - fr_map_list_t child; //!< a child map. If it exists, `rhs` MUST be NULL - FR_DLIST_ENTRY_TYPE(map) entry; //!< List entry. + map_list_t child; //!< a child map. If it exists, `rhs` MUST be NULL + + FR_DLIST_ENTRY(map_list) entry; //!< List entry. }; -FR_DLIST_FUNCS(map, map_t, entry) +FR_DLIST_FUNCS(map_list, map_t, entry) /** A list modification * @@ -98,7 +99,7 @@ FR_DLIST_FUNCS(map, map_t, entry) struct vp_list_mod_s { map_t const *map; //!< Original map describing the change to be made. - fr_map_list_t mod; //!< New map containing the destination (LHS) and + map_list_t mod; //!< New map containing the destination (LHS) and ///< values (RHS). fr_dlist_t entry; //!< Entry into dlist }; @@ -119,7 +120,7 @@ typedef int (*radius_map_getvalue_t)(TALLOC_CTX *ctx, fr_pair_list_t *out, reque int map_afrom_cp(TALLOC_CTX *ctx, map_t **out, map_t *parent, CONF_PAIR *cp, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules); -int map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, CONF_SECTION *cs, +int map_afrom_cs(TALLOC_CTX *ctx, map_list_t *out, CONF_SECTION *cs, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules, map_validate_t validate, void *uctx, unsigned int max) CC_HINT(nonnull(2, 3)); diff --git a/src/lib/server/map_async.c b/src/lib/server/map_async.c index af430f81af5..25a66536e94 100644 --- a/src/lib/server/map_async.c +++ b/src/lib/server/map_async.c @@ -46,7 +46,7 @@ static inline vp_list_mod_t *list_mod_alloc(TALLOC_CTX *ctx) { vp_list_mod_t *mod; mod = talloc_zero(ctx, vp_list_mod_t); - fr_dlist_map_init(&mod->mod); + map_list_init(&mod->mod); return mod; } @@ -54,7 +54,7 @@ static inline map_t *map_alloc(TALLOC_CTX *ctx) { map_t *map; map = talloc_zero(ctx, map_t); - fr_dlist_map_init(&map->child); + map_list_init(&map->child); return map; } @@ -92,7 +92,7 @@ static inline vp_list_mod_t *list_mod_generic_afrom_map(TALLOC_CTX *ctx, talloc_free(n); return NULL; } - fr_dlist_map_insert_tail(&n->mod, mod); + map_list_insert_tail(&n->mod, mod); return n; } @@ -134,7 +134,7 @@ static inline vp_list_mod_t *list_mod_delete_afrom_map(TALLOC_CTX *ctx, talloc_free(n); return NULL; } - fr_dlist_map_insert_tail(&n->mod, mod); + map_list_insert_tail(&n->mod, mod); return n; } @@ -194,7 +194,7 @@ static inline vp_list_mod_t *list_mod_empty_string_afrom_map(TALLOC_CTX *ctx, talloc_free(n); return NULL; } - fr_dlist_map_insert_tail(&n->mod, mod); + map_list_insert_tail(&n->mod, mod); return n; } @@ -361,7 +361,7 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out, mod->lhs = mutated->lhs; mod->op = mutated->op; mod->rhs = mutated->rhs; - fr_dlist_map_insert_tail(&n->mod, mod); + map_list_insert_tail(&n->mod, mod); goto finish; } @@ -432,7 +432,7 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out, * before this map is applied. */ if (fr_value_box_copy(n_mod->rhs, tmpl_value(n_mod->rhs), &vp->data) < 0) goto error; - fr_dlist_map_insert_tail(&n->mod, n_mod); + map_list_insert_tail(&n->mod, n_mod); MAP_VERIFY(n_mod); } while ((vp = fr_pair_list_next(list, vp))); @@ -455,8 +455,8 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out, fr_dcursor_init(&values, &head); - if (fr_value_box_from_str(fr_dlist_map_head(&n->mod), - tmpl_value(fr_dlist_map_head(&n->mod)->rhs), type, + if (fr_value_box_from_str(map_list_head(&n->mod), + tmpl_value(map_list_head(&n->mod)->rhs), type, tmpl_da(mutated->lhs), mutated->rhs->name, mutated->rhs->len, fr_value_unescape_by_quote[(uint8_t)mutated->rhs->quote], false)) { @@ -511,7 +511,7 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out, (void)fr_dcursor_init(&from, rhs_result); while ((vb = fr_dcursor_remove(&from))) { if (vb->type != tmpl_da(mutated->lhs)->type) { - n_vb = fr_value_box_alloc_null(fr_dlist_map_head(&n->mod)->rhs); + n_vb = fr_value_box_alloc_null(map_list_head(&n->mod)->rhs); if (!n_vb) { fr_dcursor_head(&from); fr_dcursor_free_list(&from); @@ -589,7 +589,7 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out, vp = fr_dcursor_current(&from); fr_assert(vp); /* Should have errored out */ do { - n_vb = fr_value_box_alloc_null(fr_dlist_map_head(&n->mod)->rhs); + n_vb = fr_value_box_alloc_null(map_list_head(&n->mod)->rhs); if (!n_vb) { attr_error: fr_dcursor_head(&values); @@ -629,7 +629,7 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out, vb = tmpl_value(mutated->rhs); - n_vb = fr_value_box_alloc_null(fr_dlist_map_head(&n->mod)->rhs); + n_vb = fr_value_box_alloc_null(map_list_head(&n->mod)->rhs); if (!n_vb) { data_error: fr_dcursor_head(&values); @@ -756,7 +756,7 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out, } mod->op = vp->op; - fr_dlist_map_insert_tail(&n->mod, mod); + map_list_insert_tail(&n->mod, mod); } } @@ -776,11 +776,11 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out, * If tmpl_value were a pointer we could * assign values directly. */ - fr_value_box_copy(fr_dlist_map_head(&n->mod)->rhs, tmpl_value(fr_dlist_map_head(&n->mod)->rhs), fr_dlist_head(&head)); + fr_value_box_copy(map_list_head(&n->mod)->rhs, tmpl_value(map_list_head(&n->mod)->rhs), fr_dlist_head(&head)); /* * value boxes in tmpls cannot now be the head of a list * - *tmpl_value(fr_dlist_map_head(&n->mod)->rhs)->next = head->next; + *tmpl_value(map_list_head(&n->mod)->rhs)->next = head->next; */ fr_dlist_talloc_free(&head); @@ -826,13 +826,13 @@ static void map_list_mod_to_vps(TALLOC_CTX *ctx, fr_pair_list_t *list, vp_list_m { map_t *mod; - fr_assert(!fr_dlist_map_empty(&vlm->mod)); + fr_assert(!map_list_empty(&vlm->mod)); /* * Fast path... */ - mod = fr_dlist_map_head(&vlm->mod); - if (fr_dlist_map_num_elements(&vlm->mod) == 1) { + mod = map_list_head(&vlm->mod); + if (map_list_num_elements(&vlm->mod) == 1) { fr_pair_t *vp; vp = map_list_mod_to_vp(ctx, mod->lhs, tmpl_value(mod->rhs)); fr_pair_append(list, vp); @@ -844,7 +844,7 @@ static void map_list_mod_to_vps(TALLOC_CTX *ctx, fr_pair_list_t *list, vp_list_m */ for (; mod; - mod = fr_dlist_map_next(&vlm->mod, mod)) { + mod = map_list_next(&vlm->mod, mod)) { fr_pair_t *vp; vp = map_list_mod_to_vp(ctx, mod->lhs, tmpl_value(mod->rhs)); @@ -956,12 +956,12 @@ int map_list_mod_apply(request_t *request, vp_list_mod_t const *vlm) memset(&cc, 0, sizeof(cc)); MAP_VERIFY(map); - fr_assert(!fr_dlist_map_empty(&vlm->mod)); + fr_assert(!map_list_empty(&vlm->mod)); /* * Print debug information for the mods being applied */ - while ((mod = fr_dlist_map_next(&vlm->mod, mod))) { + while ((mod = map_list_next(&vlm->mod, mod))) { fr_value_box_t *vb; MAP_VERIFY(mod); @@ -982,7 +982,7 @@ int map_list_mod_apply(request_t *request, vp_list_mod_t const *vlm) map_list_mod_debug(request, map, mod, vb->type != FR_TYPE_NULL ? vb : NULL); } } - mod = fr_dlist_map_head(&vlm->mod); /* Reset */ + mod = map_list_head(&vlm->mod); /* Reset */ /* * All this has been checked by #map_to_list_mod @@ -1082,7 +1082,7 @@ int map_list_mod_apply(request_t *request, vp_list_mod_t const *vlm) } } - fr_assert(!fr_dlist_map_next(&vlm->mod, mod)); + fr_assert(!map_list_next(&vlm->mod, mod)); /* * Find the destination attribute. We leave with either @@ -1141,7 +1141,7 @@ int map_list_mod_apply(request_t *request, vp_list_mod_t const *vlm) * any of these values. */ if (tmpl_num(map->lhs) != NUM_ALL) { - fr_value_box_t *vb = tmpl_value(fr_dlist_map_head(&vlm->mod)->rhs); + fr_value_box_t *vb = tmpl_value(map_list_head(&vlm->mod)->rhs); if (fr_value_box_cmp(vb, &found->data) == 0) { fr_dcursor_free_item(&list); @@ -1158,7 +1158,7 @@ int map_list_mod_apply(request_t *request, vp_list_mod_t const *vlm) * matches any of these values. */ do { - fr_value_box_t *vb = tmpl_value(fr_dlist_map_head(&vlm->mod)->rhs); + fr_value_box_t *vb = tmpl_value(map_list_head(&vlm->mod)->rhs); if (fr_value_box_cmp(vb, &found->data) == 0) { fr_dcursor_free_item(&list); diff --git a/src/lib/server/map_proc.c b/src/lib/server/map_proc.c index 054b8b9b72e..fed7e7f91db 100644 --- a/src/lib/server/map_proc.c +++ b/src/lib/server/map_proc.c @@ -163,7 +163,7 @@ int map_proc_register(void *mod_inst, char const *name, * - NULL on error. */ map_proc_inst_t *map_proc_instantiate(TALLOC_CTX *ctx, map_proc_t const *proc, - CONF_SECTION *cs, tmpl_t const *src, fr_map_list_t const *maps) + CONF_SECTION *cs, tmpl_t const *src, map_list_t const *maps) { map_proc_inst_t *inst; diff --git a/src/lib/server/map_proc.h b/src/lib/server/map_proc.h index e0b0929c63d..bce2804745e 100644 --- a/src/lib/server/map_proc.h +++ b/src/lib/server/map_proc.h @@ -59,7 +59,7 @@ extern "C" { * - #RLM_MODULE_FAIL - If an error occurred performing the mapping. */ typedef rlm_rcode_t (*map_proc_func_t)(void *mod_inst, void *proc_inst, request_t *request, - fr_value_box_list_t *result, fr_map_list_t const *maps); + fr_value_box_list_t *result, map_list_t const *maps); /** Allocate new instance data for a map processor * @@ -73,7 +73,7 @@ typedef rlm_rcode_t (*map_proc_func_t)(void *mod_inst, void *proc_inst, request_ * - -1 on failure. */ typedef int (*map_proc_instantiate_t)(CONF_SECTION *cs, void *mod_inst, void *proc_inst, - tmpl_t const *src, fr_map_list_t const *maps); + tmpl_t const *src, map_list_t const *maps); map_proc_t *map_proc_find(char const *name); @@ -83,7 +83,7 @@ int map_proc_register(void *mod_inst, char const *name, map_proc_instantiate_t instantiate, size_t inst_size); map_proc_inst_t *map_proc_instantiate(TALLOC_CTX *ctx, map_proc_t const *proc, - CONF_SECTION *cs, tmpl_t const *src, fr_map_list_t const *maps); + CONF_SECTION *cs, tmpl_t const *src, map_list_t const *maps); rlm_rcode_t map_proc(request_t *request, map_proc_inst_t const *inst, fr_value_box_list_t *src); diff --git a/src/lib/server/map_proc_priv.h b/src/lib/server/map_proc_priv.h index 39d1731bf31..a6037237b0f 100644 --- a/src/lib/server/map_proc_priv.h +++ b/src/lib/server/map_proc_priv.h @@ -51,7 +51,7 @@ struct map_proc { struct map_proc_inst { map_proc_t const *proc; //!< Map processor. tmpl_t const *src; //!< Evaluated to provide source value for map processor. - fr_map_list_t const *maps; //!< Head of the map list. + map_list_t const *maps; //!< Head of the map list. void *data; //!< Instance data created by #map_proc_instantiate }; diff --git a/src/lib/server/tmpl.h b/src/lib/server/tmpl.h index 39177a200fe..8559d3ee953 100644 --- a/src/lib/server/tmpl.h +++ b/src/lib/server/tmpl.h @@ -375,13 +375,13 @@ typedef enum { /** Define entry and head types for attribute reference lists * */ -FR_DLIST_TYPES(tmpl_attr) +FR_DLIST_TYPES(tmpl_attr_list) /** An element in a list of nested attribute references * */ typedef struct { - FR_DLIST_ENTRY_TYPE(tmpl_attr) _CONST entry; //!< Entry in the doubly linked list + FR_DLIST_ENTRY(tmpl_attr_list) _CONST entry; //!< Entry in the doubly linked list ///< of attribute references. fr_dict_attr_t const * _CONST da; //!< Resolved dictionary attribute. @@ -415,18 +415,18 @@ typedef struct { /** Define manipulation functions for the attribute reference list * */ -FR_DLIST_FUNCS(tmpl_attr, tmpl_attr_t, entry) +FR_DLIST_FUNCS(tmpl_attr_list, tmpl_attr_t, entry) /** Define entry and head types for tmpl request references * */ -FR_DLIST_TYPES(tmpl_request) +FR_DLIST_TYPES(tmpl_request_list) /** An element in a list of request references * */ typedef struct { - FR_DLIST_ENTRY_TYPE(tmpl_request) _CONST entry; //!< Entry in the doubly linked list + FR_DLIST_ENTRY(tmpl_request_list) _CONST entry; //!< Entry in the doubly linked list ///< of request references. tmpl_request_ref_t _CONST request; @@ -435,7 +435,7 @@ typedef struct { /** Define manipulation functions for the attribute reference list * */ -FR_DLIST_FUNCS(tmpl_request, tmpl_request_t, entry) +FR_DLIST_FUNCS(tmpl_request_list, tmpl_request_t, entry) /** How many additional headers to allocate in a pool for a tmpl_t * @@ -506,8 +506,8 @@ struct tmpl_s { tmpl_pair_list_t list; //!< List to search or insert in. ///< deprecated. - FR_DLIST_HEAD_TYPE(tmpl_request) rr; //!< Request to search or insert in. - FR_DLIST_HEAD_TYPE(tmpl_attr) ar; //!< Head of the attribute reference list. + FR_DLIST_HEAD(tmpl_request_list) rr; //!< Request to search or insert in. + FR_DLIST_HEAD(tmpl_attr_list) ar; //!< Head of the attribute reference list. bool was_oid; //!< Was originally a numeric OID. } attribute; @@ -587,7 +587,7 @@ static inline tmpl_request_ref_t tmpl_request(tmpl_t const *vpt) tmpl_is_attr_unresolved(vpt) || tmpl_is_list(vpt)); - return ((tmpl_request_t *)fr_dlist_tmpl_request_tail(&vpt->data.attribute.rr))->request; + return ((tmpl_request_t *)tmpl_request_list_tail(&vpt->data.attribute.rr))->request; } /** The number of request references contained within a tmpl @@ -599,7 +599,7 @@ static inline size_t tmpl_request_ref_count(tmpl_t const *vpt) tmpl_is_attr_unresolved(vpt) || tmpl_is_list(vpt)); - return fr_dlist_tmpl_request_num_elements(&vpt->data.attribute.rr); + return tmpl_request_list_num_elements(&vpt->data.attribute.rr); } /** @@ -610,21 +610,21 @@ static inline fr_dict_attr_t const *tmpl_da(tmpl_t const *vpt) { tmpl_assert_type(tmpl_is_attr(vpt)); - return ((tmpl_attr_t *)fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar))->ar_da; + return ((tmpl_attr_t *)tmpl_attr_list_tail(&vpt->data.attribute.ar))->ar_da; } static inline fr_dict_attr_t const *tmpl_unknown(tmpl_t const *vpt) { tmpl_assert_type(tmpl_is_attr(vpt)); - return ((tmpl_attr_t *)fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar))->ar_unknown; + return ((tmpl_attr_t *)tmpl_attr_list_tail(&vpt->data.attribute.ar))->ar_unknown; } static inline char const *tmpl_attr_unresolved(tmpl_t const *vpt) { tmpl_assert_type(vpt->type == TMPL_TYPE_ATTR_UNRESOLVED); - return ((tmpl_attr_t *)fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar))->ar_unresolved; + return ((tmpl_attr_t *)tmpl_attr_list_tail(&vpt->data.attribute.ar))->ar_unresolved; } /** The number of attribute references contained within a tmpl @@ -635,7 +635,7 @@ static inline size_t tmpl_attr_count(tmpl_t const *vpt) tmpl_assert_type(tmpl_is_attr(vpt) || tmpl_is_attr_unresolved(vpt)); - return fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar); + return tmpl_attr_list_num_elements(&vpt->data.attribute.ar); } static inline int16_t tmpl_num(tmpl_t const *vpt) @@ -644,9 +644,9 @@ static inline int16_t tmpl_num(tmpl_t const *vpt) tmpl_is_attr_unresolved(vpt) || tmpl_is_list(vpt)); - if (tmpl_is_list(vpt) && (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) == 0)) return NUM_ALL; + if (tmpl_is_list(vpt) && (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) == 0)) return NUM_ALL; - return ((tmpl_attr_t *)fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar))->ar_num; + return ((tmpl_attr_t *)tmpl_attr_list_tail(&vpt->data.attribute.ar))->ar_num; } static inline tmpl_pair_list_t tmpl_list(tmpl_t const *vpt) @@ -877,7 +877,7 @@ int tmpl_afrom_value_box(TALLOC_CTX *ctx, tmpl_t **out, fr_value_box_t *data, void tmpl_attr_ref_debug(const tmpl_attr_t *ar, int idx); -void tmpl_attr_ref_list_debug(FR_DLIST_HEAD_TYPE(tmpl_attr) const *ar_head) CC_HINT(nonnull); +void tmpl_attr_ref_list_debug(FR_DLIST_HEAD(tmpl_attr_list) const *ar_head) CC_HINT(nonnull); void tmpl_attr_debug(tmpl_t const *vpt) CC_HINT(nonnull); diff --git a/src/lib/server/tmpl_dcursor.c b/src/lib/server/tmpl_dcursor.c index 2b1e10f6842..ca816db3e12 100644 --- a/src/lib/server/tmpl_dcursor.c +++ b/src/lib/server/tmpl_dcursor.c @@ -235,7 +235,7 @@ fr_pair_t *_tmpl_cursor_eval(fr_dlist_head_t *list_head, fr_pair_t *curr, tmpl_d static inline CC_HINT(always_inline) void _tmpl_cursor_pair_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_dcursor_ctx_t *cc) { - if (fr_dlist_next(&cc->vpt->data.attribute.ar, ar)) switch (ar->ar_da->type) { + if (tmpl_attr_list_next(&cc->vpt->data.attribute.ar, ar)) switch (ar->ar_da->type) { case FR_TYPE_STRUCTURAL: _tmpl_cursor_child_init(list_ctx, list, ar, cc); break; @@ -275,7 +275,7 @@ static void *_tmpl_cursor_next(fr_dlist_head_t *list, void *curr, void *uctx) vp = _tmpl_cursor_eval(list, curr, cc); if (!vp) continue; - ar = fr_dlist_next(&vpt->data.attribute.ar, ar); + ar = tmpl_attr_list_next(&vpt->data.attribute.ar, ar); if (ar) { list_head = &vp->vp_group; _tmpl_cursor_pair_init(vp, list_head, ar, cc); @@ -351,7 +351,7 @@ fr_pair_t *tmpl_dcursor_init(int *err, TALLOC_CTX *ctx, tmpl_dcursor_ctx_t *cc, /* * Navigate to the correct request context */ - while ((rr = fr_dlist_next(&vpt->data.attribute.rr, rr))) { + while ((rr = tmpl_request_list_next(&vpt->data.attribute.rr, rr))) { if (tmpl_request_ptr(&request, rr->request) < 0) { if (err) { *err = -3; @@ -396,11 +396,11 @@ fr_pair_t *tmpl_dcursor_init(int *err, TALLOC_CTX *ctx, tmpl_dcursor_ctx_t *cc, */ switch (vpt->type) { case TMPL_TYPE_ATTR: - _tmpl_cursor_pair_init(list_ctx, cc->list, fr_dlist_head(&vpt->data.attribute.ar), cc); + _tmpl_cursor_pair_init(list_ctx, cc->list, tmpl_attr_list_head(&vpt->data.attribute.ar), cc); break; case TMPL_TYPE_LIST: - _tmpl_cursor_list_init(list_ctx, cc->list, fr_dlist_head(&vpt->data.attribute.ar), cc); + _tmpl_cursor_list_init(list_ctx, cc->list, tmpl_attr_list_head(&vpt->data.attribute.ar), cc); break; default: @@ -505,7 +505,7 @@ int tmpl_extents_find(TALLOC_CTX *ctx, /* * Navigate to the correct request context */ - while ((rr = fr_dlist_next(&vpt->data.attribute.rr, rr))) { + while ((rr = tmpl_request_list_next(&vpt->data.attribute.rr, rr))) { if (tmpl_request_ptr(&request, rr->request) < 0) { fr_strerror_printf("Request context \"%s\" not available", fr_table_str_by_value(tmpl_request_ref_table, rr->request, "")); @@ -547,7 +547,7 @@ int tmpl_extents_find(TALLOC_CTX *ctx, * treated specially. Once lists are groups * this can be removed. */ - ar = fr_dlist_head(&vpt->data.attribute.ar); + ar = tmpl_attr_list_head(&vpt->data.attribute.ar); switch (ar->ar_da->type) { case FR_TYPE_STRUCTURAL: break; @@ -570,7 +570,7 @@ int tmpl_extents_find(TALLOC_CTX *ctx, /* * Prime the stack! */ - _tmpl_cursor_pair_init(list_ctx, cc.list, fr_dlist_head(&vpt->data.attribute.ar), &cc); + _tmpl_cursor_pair_init(list_ctx, cc.list, tmpl_attr_list_head(&vpt->data.attribute.ar), &cc); /* * - Continue until there are no evaluation contexts @@ -600,7 +600,7 @@ int tmpl_extents_find(TALLOC_CTX *ctx, /* * Evaluate the next reference */ - n_ar = fr_dlist_next(&vpt->data.attribute.ar, ar); + n_ar = tmpl_attr_list_next(&vpt->data.attribute.ar, ar); if (n_ar) { ar = n_ar; list_head = &curr->vp_group; @@ -660,7 +660,7 @@ int tmpl_extents_build_to_leaf_parent(fr_dlist_head_t *existing, fr_dlist_head_t */ for (ar = extent->ar, list = extent->list, list_ctx = extent->list_ctx; ar; - ar = fr_dlist_next(&vpt->data.attribute.ar, ar)) { + ar = tmpl_attr_list_next(&vpt->data.attribute.ar, ar)) { switch (ar->type) { case TMPL_ATTR_TYPE_NORMAL: case TMPL_ATTR_TYPE_UNKNOWN: diff --git a/src/lib/server/tmpl_tokenize.c b/src/lib/server/tmpl_tokenize.c index 933d777a993..7fdc292a2e8 100644 --- a/src/lib/server/tmpl_tokenize.c +++ b/src/lib/server/tmpl_tokenize.c @@ -187,7 +187,7 @@ void tmpl_attr_ref_debug(const tmpl_attr_t *ar, int i) } } -void tmpl_attr_ref_list_debug(FR_DLIST_HEAD_TYPE(tmpl_attr) const *ar_head) +void tmpl_attr_ref_list_debug(FR_DLIST_HEAD(tmpl_attr_list) const *ar_head) { tmpl_attr_t *ar = NULL; unsigned int i = 0; @@ -196,7 +196,7 @@ void tmpl_attr_ref_list_debug(FR_DLIST_HEAD_TYPE(tmpl_attr) const *ar_head) /* * Print all the attribute references */ - while ((ar = fr_dlist_tmpl_attr_next(ar_head, ar))) { + while ((ar = tmpl_attr_list_next(ar_head, ar))) { tmpl_attr_ref_debug(ar, i); i++; } @@ -231,7 +231,7 @@ void tmpl_attr_debug(tmpl_t const *vpt) /* * Print all the request references */ - while ((rr = fr_dlist_tmpl_request_next(&vpt->data.attribute.rr, rr))) { + while ((rr = tmpl_request_list_next(&vpt->data.attribute.rr, rr))) { FR_FAULT_LOG("\t[%u] %s (%u)", i, fr_table_str_by_value(tmpl_request_ref_table, rr->request, ""), rr->request); i++; @@ -479,8 +479,8 @@ static inline CC_HINT(always_inline) void tmpl_type_init(tmpl_t *vpt, tmpl_type_ case TMPL_TYPE_ATTR: case TMPL_TYPE_ATTR_UNRESOLVED: case TMPL_TYPE_LIST: - fr_dlist_tmpl_attr_talloc_init(&vpt->data.attribute.ar); - fr_dlist_tmpl_request_talloc_init(&vpt->data.attribute.rr); + tmpl_attr_list_talloc_init(&vpt->data.attribute.ar); + tmpl_request_list_talloc_init(&vpt->data.attribute.rr); break; default: @@ -684,17 +684,17 @@ static tmpl_request_t *tmpl_req_ref_add(tmpl_t *vpt, tmpl_request_ref_t request) tmpl_request_t *rr; TALLOC_CTX *ctx; - if (fr_dlist_tmpl_request_num_elements(&vpt->data.attribute.rr) == 0) { + if (tmpl_request_list_num_elements(&vpt->data.attribute.rr) == 0) { ctx = vpt; } else { - ctx = fr_dlist_tmpl_request_tail(&vpt->data.attribute.rr); + ctx = tmpl_request_list_tail(&vpt->data.attribute.rr); } MEM(rr = talloc(ctx, tmpl_request_t)); *rr = (tmpl_request_t){ .request = request }; - fr_dlist_tmpl_request_insert_tail(&vpt->data.attribute.rr, rr); + tmpl_request_list_insert_tail(&vpt->data.attribute.rr, rr); return rr; } @@ -707,10 +707,10 @@ static tmpl_attr_t *tmpl_attr_add(tmpl_t *vpt, tmpl_attr_type_t type) tmpl_attr_t *ar; TALLOC_CTX *ctx; - if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) == 0) { + if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) == 0) { ctx = vpt; } else { - ctx = fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar); + ctx = tmpl_attr_list_tail(&vpt->data.attribute.ar); } MEM(ar = talloc(ctx, tmpl_attr_t)); @@ -718,7 +718,7 @@ static tmpl_attr_t *tmpl_attr_add(tmpl_t *vpt, tmpl_attr_type_t type) .type = type, .num = NUM_ANY }; - fr_dlist_tmpl_attr_insert_tail(&vpt->data.attribute.ar, ar); + tmpl_attr_list_insert_tail(&vpt->data.attribute.ar, ar); return ar; } @@ -772,9 +772,9 @@ int tmpl_attr_copy(tmpl_t *dst, tmpl_t const *src) /* * Clear any existing attribute references */ - if (fr_dlist_tmpl_attr_num_elements(&dst->data.attribute.ar) > 0) fr_dlist_tmpl_attr_talloc_reverse_free(&dst->data.attribute.ar); + if (tmpl_attr_list_num_elements(&dst->data.attribute.ar) > 0) tmpl_attr_list_talloc_reverse_free(&dst->data.attribute.ar); - while ((src_ar = fr_dlist_tmpl_attr_next(&src->data.attribute.ar, src_ar))) { + while ((src_ar = tmpl_attr_list_next(&src->data.attribute.ar, src_ar))) { dst_ar = tmpl_attr_add(dst, src_ar->type); switch (src_ar->type) { @@ -799,11 +799,11 @@ int tmpl_attr_copy(tmpl_t *dst, tmpl_t const *src) /* * Clear any existing request references */ - if (fr_dlist_tmpl_request_num_elements(&dst->data.attribute.rr) > 0) { - fr_dlist_tmpl_request_talloc_reverse_free(&dst->data.attribute.rr); + if (tmpl_request_list_num_elements(&dst->data.attribute.rr) > 0) { + tmpl_request_list_talloc_reverse_free(&dst->data.attribute.rr); } - while ((src_rr = fr_dlist_tmpl_request_next(&src->data.attribute.rr, src_rr))) { + while ((src_rr = tmpl_request_list_next(&src->data.attribute.rr, src_rr))) { MEM(dst_rr = tmpl_req_ref_add(dst, src_rr->request)); } @@ -829,8 +829,8 @@ int tmpl_attr_set_da(tmpl_t *vpt, fr_dict_attr_t const *da) /* * Clear any existing references */ - if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) > 0) { - fr_dlist_tmpl_attr_talloc_reverse_free(&vpt->data.attribute.ar); + if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) > 0) { + tmpl_attr_list_talloc_reverse_free(&vpt->data.attribute.ar); } /* @@ -863,17 +863,17 @@ int tmpl_attr_set_leaf_da(tmpl_t *vpt, fr_dict_attr_t const *da) /* * Clear any existing references */ - if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) > 0) { - if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) > 1) { - ref = fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar); - parent = fr_dlist_tmpl_attr_prev(&vpt->data.attribute.ar, ref); + if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) > 0) { + if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) > 1) { + ref = tmpl_attr_list_tail(&vpt->data.attribute.ar); + parent = tmpl_attr_list_prev(&vpt->data.attribute.ar, ref); if (!fr_dict_attr_common_parent(parent->ar_da, da, true)) { fr_strerror_const("New leaf da and old leaf da do not share the same ancestor"); return -1; } } else { - ref = fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar); + ref = tmpl_attr_list_tail(&vpt->data.attribute.ar); } /* @@ -911,10 +911,10 @@ void tmpl_attr_set_leaf_num(tmpl_t *vpt, int16_t num) tmpl_assert_type(tmpl_is_attr(vpt) || tmpl_is_list(vpt) || tmpl_is_attr_unresolved(vpt)); - if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) == 0) { + if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) == 0) { ref = tmpl_attr_add(vpt, TMPL_ATTR_TYPE_UNKNOWN); } else { - ref = fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar); + ref = tmpl_attr_list_tail(&vpt->data.attribute.ar); } ref->num = num; @@ -931,9 +931,9 @@ void tmpl_attr_rewrite_leaf_num(tmpl_t *vpt, int16_t from, int16_t to) tmpl_assert_type(tmpl_is_attr(vpt) || tmpl_is_list(vpt) || tmpl_is_attr_unresolved(vpt)); - if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) == 0) return; + if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) == 0) return; - ref = fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar); + ref = tmpl_attr_list_tail(&vpt->data.attribute.ar); if (ref->ar_num == from) ref->ar_num = to; TMPL_ATTR_VERIFY(vpt); @@ -948,7 +948,7 @@ void tmpl_attr_rewrite_num(tmpl_t *vpt, int16_t from, int16_t to) tmpl_assert_type(tmpl_is_attr(vpt) || tmpl_is_list(vpt) || tmpl_is_attr_unresolved(vpt)); - while ((ref = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ref))) if (ref->ar_num == from) ref->ar_num = to; + while ((ref = tmpl_attr_list_next(&vpt->data.attribute.ar, ref))) if (ref->ar_num == from) ref->ar_num = to; TMPL_ATTR_VERIFY(vpt); } @@ -961,7 +961,7 @@ void tmpl_attr_set_request(tmpl_t *vpt, tmpl_request_ref_t request) fr_assert_msg(tmpl_is_attr(vpt), "Expected tmpl type 'attr', got '%s'", fr_table_str_by_value(tmpl_type_table, vpt->type, "")); - if (fr_dlist_tmpl_request_num_elements(&vpt->data.attribute.rr) > 0) fr_dlist_tmpl_request_talloc_reverse_free(&vpt->data.attribute.rr); + if (tmpl_request_list_num_elements(&vpt->data.attribute.rr) > 0) tmpl_request_list_talloc_reverse_free(&vpt->data.attribute.rr); tmpl_req_ref_add(vpt, request); @@ -1071,7 +1071,7 @@ static inline CC_HINT(always_inline) void tmpl_attr_insert(tmpl_t *vpt, tmpl_att /* * Insert the reference into the list. */ - fr_dlist_tmpl_attr_insert_tail(&vpt->data.attribute.ar, ar); + tmpl_attr_list_insert_tail(&vpt->data.attribute.ar, ar); switch (ar->num) { case 0: @@ -1080,7 +1080,7 @@ static inline CC_HINT(always_inline) void tmpl_attr_insert(tmpl_t *vpt, tmpl_att default: ar->resolve_only = true; - while ((ar = fr_dlist_tmpl_attr_prev(&vpt->data.attribute.ar, ar))) ar->resolve_only = true; + while ((ar = tmpl_attr_list_prev(&vpt->data.attribute.ar, ar))) ar->resolve_only = true; break; } } @@ -1265,7 +1265,7 @@ int tmpl_attr_afrom_attr_unresolved_substr(TALLOC_CTX *ctx, tmpl_attr_error_t *e if (fr_sbuff_next_if_char(name, '.')) { ret = tmpl_attr_afrom_attr_unresolved_substr(ctx, err, vpt, NULL, NULL, name, t_rules, depth + 1); if (ret < 0) { - fr_dlist_tmpl_attr_talloc_free_tail(&vpt->data.attribute.ar); /* Remove and free ar */ + tmpl_attr_list_talloc_free_tail(&vpt->data.attribute.ar); /* Remove and free ar */ return -1; } } @@ -1372,7 +1372,7 @@ static inline int tmpl_attr_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t * useful to have the original. */ if (!da && !vpt->rules.disallow_internal && - (ar = fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar)) && + (ar = tmpl_attr_list_tail(&vpt->data.attribute.ar)) && (ar->type == TMPL_ATTR_TYPE_NORMAL) && (ar->ar_da->type == FR_TYPE_GROUP)) { (void)fr_dict_attr_by_name_substr(NULL, &da, fr_dict_root(fr_dict_internal()), @@ -1665,7 +1665,7 @@ do_suffix: if (ar) tmpl_attr_insert(vpt, ar); if (tmpl_attr_afrom_attr_substr(ctx, err, vpt, our_parent, namespace, name, p_rules, t_rules, depth + 1) < 0) { - if (ar) fr_dlist_tmpl_attr_talloc_free_tail(&vpt->data.attribute.ar); /* Remove and free ar */ + if (ar) tmpl_attr_list_talloc_free_tail(&vpt->data.attribute.ar); /* Remove and free ar */ goto error; } /* @@ -1696,7 +1696,7 @@ static inline int tmpl_request_ref_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_ tmpl_request_ref_t ref; size_t ref_len; tmpl_request_t *rr; - FR_DLIST_HEAD_TYPE(tmpl_request) *list = &vpt->data.attribute.rr; + FR_DLIST_HEAD(tmpl_request_list) *list = &vpt->data.attribute.rr; fr_sbuff_marker_t s_m; tmpl_rules_t const *t_rules = *pt_rules; @@ -1717,7 +1717,7 @@ static inline int tmpl_request_ref_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_ *rr = (tmpl_request_t){ .request = ref }; - fr_dlist_tmpl_request_insert_tail(list, rr); + tmpl_request_list_insert_tail(list, rr); } return 0; @@ -1758,7 +1758,7 @@ static inline int tmpl_request_ref_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_ *rr = (tmpl_request_t){ .request = ref }; - fr_dlist_tmpl_request_insert_tail(list, rr); + tmpl_request_list_insert_tail(list, rr); /* * Update the parsing rules if we go to the parent. @@ -1773,7 +1773,7 @@ static inline int tmpl_request_ref_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_ */ if (fr_sbuff_next_if_char(name, '.')) { if (tmpl_request_ref_afrom_attr_substr(ctx, err, vpt, name, p_rules, pt_rules, depth + 1) < 0) { - fr_dlist_tmpl_request_talloc_free_tail(list); /* Remove and free rr */ + tmpl_request_list_talloc_free_tail(list); /* Remove and free rr */ return -1; } } @@ -1968,7 +1968,7 @@ ssize_t tmpl_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t *err, if (t_rules->list_as_attr) { tmpl_attr_t *ar; - ar = fr_dlist_tmpl_attr_head(&vpt->data.attribute.ar); + ar = tmpl_attr_list_head(&vpt->data.attribute.ar); fr_assert(ar != NULL); if ((ar->ar_type != TMPL_ATTR_TYPE_NORMAL) || @@ -2005,7 +2005,7 @@ ssize_t tmpl_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t *err, * Prepend the list ref so it gets evaluated * first. */ - fr_dlist_tmpl_attr_insert_head(&vpt->data.attribute.ar, ar); + tmpl_attr_list_insert_head(&vpt->data.attribute.ar, ar); } } } @@ -2016,7 +2016,7 @@ ssize_t tmpl_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t *err, * * Eventually we'll remove TMPL_TYPE_LIST */ - if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) == 0) { + if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) == 0) { tmpl_attr_t *ar; MEM(ar = talloc_zero(vpt, tmpl_attr_t)); @@ -2026,7 +2026,7 @@ ssize_t tmpl_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t *err, break; case 1: /* Found a filter */ - fr_dlist_tmpl_attr_insert_tail(&vpt->data.attribute.ar, ar); + tmpl_attr_list_insert_tail(&vpt->data.attribute.ar, ar); break; default: /* Parse error */ @@ -3232,7 +3232,7 @@ static inline CC_HINT(always_inline) int tmpl_attr_resolve(tmpl_t *vpt, tmpl_res * This emulates what's done in the initial * tokenizer function. */ - ar = fr_dlist_tmpl_attr_head(&vpt->data.attribute.ar); + ar = tmpl_attr_list_head(&vpt->data.attribute.ar); if (ar->type == TMPL_ATTR_TYPE_UNRESOLVED) { (void)fr_dict_attr_search_by_name_substr(NULL, &da, @@ -3259,7 +3259,7 @@ static inline CC_HINT(always_inline) int tmpl_attr_resolve(tmpl_t *vpt, tmpl_res * and correct its parent and * namespace. */ - next = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar); + next = tmpl_attr_list_next(&vpt->data.attribute.ar, ar); if (next) { next->ar_parent = da; next->ar_unresolved_namespace = da; @@ -3269,7 +3269,7 @@ static inline CC_HINT(always_inline) int tmpl_attr_resolve(tmpl_t *vpt, tmpl_res /* * Loop, resolving each unresolved attribute in turn */ - while ((ar = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar))) { + while ((ar = tmpl_attr_list_next(&vpt->data.attribute.ar, ar))) { switch (ar->type) { case TMPL_ATTR_TYPE_NORMAL: continue; /* Don't need to resolve */ @@ -3297,7 +3297,7 @@ static inline CC_HINT(always_inline) int tmpl_attr_resolve(tmpl_t *vpt, tmpl_res * in the internal dictionary. */ if (!da) { - prev = fr_dlist_tmpl_attr_prev(&vpt->data.attribute.ar, ar); + prev = tmpl_attr_list_prev(&vpt->data.attribute.ar, ar); if (!vpt->rules.disallow_internal && prev && (prev->ar_da->type == FR_TYPE_GROUP)) { (void)fr_dict_attr_by_name_substr(NULL, &da, @@ -3325,7 +3325,7 @@ static inline CC_HINT(always_inline) int tmpl_attr_resolve(tmpl_t *vpt, tmpl_res * Reach into the next reference * and correct its parent. */ - next = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar); + next = tmpl_attr_list_next(&vpt->data.attribute.ar, ar); if (next) { next->ar_parent = da; next->ar_unresolved_namespace = da; @@ -3345,9 +3345,9 @@ static inline CC_HINT(always_inline) int tmpl_attr_resolve(tmpl_t *vpt, tmpl_res * an index, the ar is redundant and should * be removed. */ - prev = fr_dlist_tmpl_attr_prev(&vpt->data.attribute.ar, ar); + prev = tmpl_attr_list_prev(&vpt->data.attribute.ar, ar); if (prev && (prev->ar_da->type != FR_TYPE_GROUP) && (prev->ar_num == NUM_ANY)) { - fr_dlist_tmpl_attr_remove(&vpt->data.attribute.ar, prev); + tmpl_attr_list_remove(&vpt->data.attribute.ar, prev); ar->ar_parent = prev->ar_parent; talloc_free(prev); } @@ -3479,8 +3479,8 @@ void tmpl_unresolve(tmpl_t *vpt) case TMPL_TYPE_LIST: case TMPL_TYPE_ATTR: case TMPL_TYPE_ATTR_UNRESOLVED: - fr_dlist_tmpl_attr_talloc_free(&vpt->data.attribute.ar); - fr_dlist_tmpl_request_talloc_free(&vpt->data.attribute.rr); + tmpl_attr_list_talloc_free(&vpt->data.attribute.ar); + tmpl_request_list_talloc_free(&vpt->data.attribute.rr); break; /* @@ -3574,7 +3574,7 @@ static void attr_to_raw(tmpl_t *vpt, tmpl_attr_t *ref) */ void tmpl_attr_to_raw(tmpl_t *vpt) { - attr_to_raw(vpt, fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar)); + attr_to_raw(vpt, tmpl_attr_list_tail(&vpt->data.attribute.ar)); } /** Add an unknown #fr_dict_attr_t specified by a #tmpl_t to the main dictionary @@ -3598,7 +3598,7 @@ int tmpl_attr_unknown_add(tmpl_t *vpt) if (!tmpl_da(vpt)->flags.is_unknown) return 1; /* Ensure at least the leaf is unknown */ - while ((ar = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar))) { + while ((ar = tmpl_attr_list_next(&vpt->data.attribute.ar, ar))) { fr_dict_attr_t const *unknown, *known; switch (ar->type) { @@ -3621,7 +3621,7 @@ int tmpl_attr_unknown_add(tmpl_t *vpt) * Fixup the parent of the next unknown * now it's known. */ - next = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar); + next = tmpl_attr_list_next(&vpt->data.attribute.ar, ar); if (next && (next->type == TMPL_ATTR_TYPE_UNKNOWN) && (next->ar_da->parent == unknown)) { if (fr_dict_attr_unknown_parent_to_known(fr_dict_attr_unconst(next->ar_da), @@ -3806,7 +3806,7 @@ ssize_t tmpl_attr_print(fr_sbuff_t *out, tmpl_t const *vpt, tmpl_attr_prefix_t a /* * Print request references */ - while ((rr = fr_dlist_tmpl_request_next(&vpt->data.attribute.rr, rr))) { + while ((rr = tmpl_request_list_next(&vpt->data.attribute.rr, rr))) { if (rr->request == REQUEST_CURRENT) continue; /* Don't print the default request */ FR_SBUFF_IN_TABLE_STR_RETURN(&our_out, tmpl_request_ref_table, rr->request, ""); @@ -3820,13 +3820,13 @@ ssize_t tmpl_attr_print(fr_sbuff_t *out, tmpl_t const *vpt, tmpl_attr_prefix_t a if (printed_rr) FR_SBUFF_IN_CHAR_RETURN(&our_out, '.'); FR_SBUFF_IN_TABLE_STR_RETURN(&our_out, pair_list_table, tmpl_list(vpt), ""); - if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar)) FR_SBUFF_IN_CHAR_RETURN(&our_out, '.'); + if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar)) FR_SBUFF_IN_CHAR_RETURN(&our_out, '.'); /* * Request qualifier with no list qualifier */ } else if (printed_rr) { - if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar)) FR_SBUFF_IN_CHAR_RETURN(&our_out, '.'); + if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar)) FR_SBUFF_IN_CHAR_RETURN(&our_out, '.'); } /* @@ -3838,7 +3838,7 @@ ssize_t tmpl_attr_print(fr_sbuff_t *out, tmpl_t const *vpt, tmpl_attr_prefix_t a * we add the .unknown prefix. * */ - if (!tmpl_is_list(vpt) && (ar = fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar))) { + if (!tmpl_is_list(vpt) && (ar = tmpl_attr_list_tail(&vpt->data.attribute.ar))) { switch (ar->type) { case TMPL_ATTR_TYPE_NORMAL: case TMPL_ATTR_TYPE_UNKNOWN: @@ -3855,7 +3855,7 @@ ssize_t tmpl_attr_print(fr_sbuff_t *out, tmpl_t const *vpt, tmpl_attr_prefix_t a * Print attribute identifiers */ ar = NULL; - while ((ar = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar))) { + while ((ar = tmpl_attr_list_next(&vpt->data.attribute.ar, ar))) { if (!tmpl_is_list(vpt)) switch(ar->type) { case TMPL_ATTR_TYPE_NORMAL: case TMPL_ATTR_TYPE_UNKNOWN: @@ -3869,7 +3869,7 @@ ssize_t tmpl_attr_print(fr_sbuff_t *out, tmpl_t const *vpt, tmpl_attr_prefix_t a /* * First component in the list has everything built */ - if (ar == fr_dlist_tmpl_attr_head(&vpt->data.attribute.ar)) { + if (ar == tmpl_attr_list_head(&vpt->data.attribute.ar)) { depth = ar->ar_parent->depth - 1; /* Adjust for array index */ /* * Everything else skips the first component @@ -3963,7 +3963,7 @@ ssize_t tmpl_attr_print(fr_sbuff_t *out, tmpl_t const *vpt, tmpl_attr_prefix_t a break; } - if (fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar)) FR_SBUFF_IN_CHAR_RETURN(&our_out, '.'); + if (tmpl_attr_list_next(&vpt->data.attribute.ar, ar)) FR_SBUFF_IN_CHAR_RETURN(&our_out, '.'); } return fr_sbuff_set(out, &our_out); } @@ -4158,13 +4158,13 @@ void tmpl_attr_verify(char const *file, int line, tmpl_t const *vpt) /* * Loop detection */ - while ((slow = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, slow)) && - (fast = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, fast))) { + while ((slow = tmpl_attr_list_next(&vpt->data.attribute.ar, slow)) && + (fast = tmpl_attr_list_next(&vpt->data.attribute.ar, fast))) { /* * Advances twice as fast as slow... */ - fast = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, fast); + fast = tmpl_attr_list_next(&vpt->data.attribute.ar, fast); fr_fatal_assert_msg(fast != slow, "CONSISTENCY CHECK FAILED %s[%u]: Looping reference list found. " "Fast pointer hit slow pointer at \"%s\"", @@ -4179,7 +4179,7 @@ void tmpl_attr_verify(char const *file, int line, tmpl_t const *vpt) * Known attribute cannot come after unresolved or unknown attributes * Unknown attributes cannot come after unresolved attributes */ - if (!tmpl_is_list(vpt)) while ((ar = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar))) { + if (!tmpl_is_list(vpt)) while ((ar = tmpl_attr_list_next(&vpt->data.attribute.ar, ar))) { switch (ar->type) { case TMPL_ATTR_TYPE_NORMAL: if (seen_unknown) { @@ -4333,13 +4333,13 @@ void tmpl_verify(char const *file, int line, tmpl_t const *vpt) break; case TMPL_TYPE_ATTR_UNRESOLVED: - if ((fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) > 0) && - ((tmpl_attr_t *)fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar))->da) { + if ((tmpl_attr_list_num_elements(&vpt->data.attribute.ar) > 0) && + ((tmpl_attr_t *)tmpl_attr_list_tail(&vpt->data.attribute.ar))->da) { #ifndef NDEBUG tmpl_attr_debug(vpt); #endif fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: TMPL_TYPE_ATTR_UNRESOLVED contains %u " - "references", file, line, fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar)); + "references", file, line, tmpl_attr_list_num_elements(&vpt->data.attribute.ar)); } break; @@ -4405,13 +4405,13 @@ void tmpl_verify(char const *file, int line, tmpl_t const *vpt) file, line); } - if ((fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) > 0) && - ((tmpl_attr_t *)fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar))->da) { + if ((tmpl_attr_list_num_elements(&vpt->data.attribute.ar) > 0) && + ((tmpl_attr_t *)tmpl_attr_list_tail(&vpt->data.attribute.ar))->da) { #ifndef NDEBUG tmpl_attr_debug(vpt); #endif fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: TMPL_TYPE_LIST contains %u " - "references", file, line, fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar)); + "references", file, line, tmpl_attr_list_num_elements(&vpt->data.attribute.ar)); } break; diff --git a/src/lib/server/users_file.c b/src/lib/server/users_file.c index 24ba80c20d8..a0e2a7b0018 100644 --- a/src/lib/server/users_file.c +++ b/src/lib/server/users_file.c @@ -365,8 +365,8 @@ int pairlist_read(TALLOC_CTX *ctx, fr_dict_t const *dict, char const *file, PAIR * We MUST be either at a valid entry, OR at EOF. */ MEM(t = talloc_zero(ctx, PAIR_LIST)); - fr_dlist_map_init(&t->check); - fr_dlist_map_init(&t->reply); + map_list_init(&t->check); + map_list_init(&t->reply); t->filename = filename; t->lineno = lineno; t->order = order++; @@ -470,7 +470,7 @@ check_item: do_insert: fr_assert(!new_map->parent); - fr_dlist_map_insert_tail(&t->check, new_map); + map_list_insert_tail(&t->check, new_map); /* * There can be spaces before any comma. @@ -646,7 +646,7 @@ next_reply_item: fr_assert(tmpl_list(new_map->lhs) == PAIR_LIST_REPLY); - if (!new_map->parent) fr_dlist_map_insert_tail(&t->reply, new_map); + if (!new_map->parent) map_list_insert_tail(&t->reply, new_map); (void) fr_sbuff_adv_past_blank(&sbuff, SIZE_MAX, NULL); diff --git a/src/lib/server/users_file.h b/src/lib/server/users_file.h index 0b69c6b8106..112c1ebc67d 100644 --- a/src/lib/server/users_file.h +++ b/src/lib/server/users_file.h @@ -37,8 +37,8 @@ extern "C" { typedef struct pair_list { char const *name; //!< Key for matching entry. - fr_map_list_t check; //!< List of maps for comparison / modifying control list - fr_map_list_t reply; //!< List of maps for modifying reply list + map_list_t check; //!< List of maps for comparison / modifying control list + map_list_t reply; //!< List of maps for modifying reply list int order; //!< Sequence of entry in source file char const *filename; //!< Filename entry read from int lineno; //!< Line number entry read from diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index 1b15519902e..58b269b658e 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -591,7 +591,7 @@ static bool pass2_fixup_map(map_t *map, tmpl_rules_t const *rules, fr_dict_attr_ /* * Sanity check sublists. */ - if (!fr_dlist_map_empty(&map->child)) { + if (!map_list_empty(&map->child)) { fr_dict_attr_t const *da; if (!tmpl_is_attr(map->lhs)) { @@ -611,7 +611,7 @@ static bool pass2_fixup_map(map_t *map, tmpl_rules_t const *rules, fr_dict_attr_ return false; } - return pass2_fixup_map(fr_dlist_map_head(&map->child), rules, da); + return pass2_fixup_map(map_list_head(&map->child), rules, da); } return true; @@ -627,7 +627,7 @@ static bool pass2_fixup_update(unlang_group_t *g, tmpl_rules_t const *rules) RULES_VERIFY(rules); - while ((map = fr_dlist_map_next(&gext->map, map))) { + while ((map = map_list_next(&gext->map, map))) { /* * Mostly fixup the map, but maybe leave the RHS * unresolved. @@ -660,7 +660,7 @@ static bool pass2_fixup_map_rhs(unlang_group_t *g, tmpl_rules_t const *rules) * the RHS as a reference to a json string, SQL column * name, etc. */ - while ((map = fr_dlist_map_next(&gext->map, map))) { + while ((map = map_list_next(&gext->map, map))) { if (!pass2_fixup_map(map, rules, NULL)) return false; } @@ -669,7 +669,7 @@ static bool pass2_fixup_map_rhs(unlang_group_t *g, tmpl_rules_t const *rules) */ if (!gext->vpt) return true; - return pass2_fixup_tmpl(fr_dlist_map_head(&gext->map)->ci, &gext->vpt, + return pass2_fixup_tmpl(map_list_head(&gext->map)->ci, &gext->vpt, cf_section_to_item(g->cs), rules->dict_def); } @@ -709,7 +709,7 @@ static void unlang_dump(unlang_t *instruction, int depth) g = unlang_generic_to_group(c); gext = unlang_group_to_map(g); map = NULL; - while ((map = fr_dlist_map_next(&gext->map, map))) { + while ((map = map_list_next(&gext->map, map))) { map_print(&FR_SBUFF_OUT(buffer, sizeof(buffer)), map); DEBUG("%.*s%s", depth + 1, unlang_spaces, buffer); } @@ -724,7 +724,7 @@ static void unlang_dump(unlang_t *instruction, int depth) edit = unlang_generic_to_edit(c); map = NULL; - while ((map = fr_dlist_map_next(&edit->maps, map))) { + while ((map = map_list_next(&edit->maps, map))) { map_print(&FR_SBUFF_OUT(buffer, sizeof(buffer)), map); DEBUG("%.*s%s", depth + 1, unlang_spaces, buffer); } @@ -1384,10 +1384,10 @@ static unlang_t *compile_map(unlang_t *parent, unlang_compile_t *unlang_ctx, CON /* * This looks at cs->name2 to determine which list to update */ - fr_dlist_map_init(&gext->map); + map_list_init(&gext->map); rcode = map_afrom_cs(gext, &gext->map, cs, &t_rules, &t_rules, unlang_fixup_map, NULL, 256); if (rcode < 0) return NULL; /* message already printed */ - if (fr_dlist_map_empty(&gext->map)) { + if (map_list_empty(&gext->map)) { cf_log_err(cs, "'map' sections cannot be empty"); goto error; } @@ -1456,10 +1456,10 @@ static unlang_t *compile_update(unlang_t *parent, unlang_compile_t *unlang_ctx, /* * This looks at cs->name2 to determine which list to update */ - fr_dlist_map_init(&gext->map); + map_list_init(&gext->map); rcode = map_afrom_cs(gext, &gext->map, cs, &t_rules, &t_rules, unlang_fixup_update, NULL, 128); if (rcode < 0) return NULL; /* message already printed */ - if (fr_dlist_map_empty(&gext->map)) { + if (map_list_empty(&gext->map)) { cf_log_err(cs, "'update' sections cannot be empty"); error: talloc_free(g); @@ -1515,10 +1515,10 @@ static unlang_t *compile_filter(unlang_t *parent, unlang_compile_t *unlang_ctx, /* * This looks at cs->name2 to determine which list to update */ - fr_dlist_map_init(&gext->map); + map_list_init(&gext->map); rcode = map_afrom_cs(gext, &gext->map, cs, &t_rules, &t_rules, unlang_fixup_filter, NULL, 128); if (rcode < 0) return NULL; /* message already printed */ - if (fr_dlist_map_empty(&gext->map)) { + if (map_list_empty(&gext->map)) { cf_log_err(cs, "'filter' sections cannot be empty"); return NULL; } @@ -1684,7 +1684,7 @@ static unlang_t *compile_edit_section(unlang_t *parent, unlang_compile_t *unlang c->debug_name = c->name; c->type = UNLANG_TYPE_EDIT; - fr_dlist_map_init(&edit->maps); + map_list_init(&edit->maps); edit_free = edit; compile_action_defaults(c, unlang_ctx); @@ -1696,7 +1696,7 @@ static unlang_t *compile_edit_section(unlang_t *parent, unlang_compile_t *unlang MEM(map = talloc_zero(parent, map_t)); map->op = op; map->ci = cf_section_to_item(cs); - fr_dlist_map_init(&map->child); + map_list_init(&map->child); name = cf_section_name1(cs); @@ -1732,7 +1732,7 @@ static unlang_t *compile_edit_section(unlang_t *parent, unlang_compile_t *unlang */ // if (unlang_fixup_update(map, NULL) < 0) goto fail; - fr_dlist_map_insert_tail(&edit->maps, map); + map_list_insert_tail(&edit->maps, map); *prev = c; return out; @@ -1776,7 +1776,7 @@ static unlang_t *compile_edit_pair(unlang_t *parent, unlang_compile_t *unlang_ct c->debug_name = c->name; c->type = UNLANG_TYPE_EDIT; - fr_dlist_map_init(&edit->maps); + map_list_init(&edit->maps); edit_free = edit; compile_action_defaults(c, unlang_ctx); @@ -1785,7 +1785,7 @@ static unlang_t *compile_edit_pair(unlang_t *parent, unlang_compile_t *unlang_ct /* * Convert this particular map. */ - if (map_afrom_cp(edit, &map, fr_dlist_map_tail(&edit->maps), cp, &t_rules, &t_rules) < 0) { + if (map_afrom_cp(edit, &map, map_list_tail(&edit->maps), cp, &t_rules, &t_rules) < 0) { fail: talloc_free(edit_free); return NULL; @@ -1802,7 +1802,7 @@ static unlang_t *compile_edit_pair(unlang_t *parent, unlang_compile_t *unlang_ct */ if (unlang_fixup_update(map, NULL) < 0) goto fail; - fr_dlist_map_insert_tail(&edit->maps, map); + map_list_insert_tail(&edit->maps, map); *prev = c; return out; diff --git a/src/lib/unlang/edit.c b/src/lib/unlang/edit.c index 5549a155f3e..fe1b549322f 100644 --- a/src/lib/unlang/edit.c +++ b/src/lib/unlang/edit.c @@ -56,7 +56,7 @@ typedef struct { fr_edit_list_t *el; //!< edit list unlang_edit_state_t state; //!< What we're currently doing. - fr_map_list_t const *map_head; + map_list_t const *map_head; map_t const *map; //!< the map to evaluate edit_result_t lhs; //!< LHS child entries @@ -509,7 +509,7 @@ static int expand_rhs_list(NDEBUG_UNUSED unlang_frame_state_edit_t *state, reque return -1; } - if (!fr_dlist_map_empty(&map->child)) { + if (!map_list_empty(&map->child)) { REDEBUG("In-place lists not yet implemented"); return -1; } @@ -540,7 +540,7 @@ static unlang_action_t process_edit(rlm_rcode_t *p_result, request_t *request, u */ for (map = state->map; map != NULL; - map = state->map = fr_dlist_map_next(state->map_head, map)) { + map = state->map = map_list_next(state->map_head, map)) { repeatable_set(frame); /* Call us again when done */ switch (state->state) { @@ -711,10 +711,10 @@ static unlang_action_t unlang_edit_state_init(rlm_rcode_t *p_result, request_t * * The edit list creates a local pool which should * generally be large enough for most edits. */ - MEM(state->el = fr_edit_list_alloc(state, fr_dlist_map_num_elements(&edit->maps))); + MEM(state->el = fr_edit_list_alloc(state, map_list_num_elements(&edit->maps))); state->map_head = &edit->maps; - state->map = fr_dlist_map_head(state->map_head); + state->map = map_list_head(state->map_head); fr_pair_list_init(&state->rhs.pair_list); /* diff --git a/src/lib/unlang/edit_priv.h b/src/lib/unlang/edit_priv.h index 74430b28770..bdf704668bb 100644 --- a/src/lib/unlang/edit_priv.h +++ b/src/lib/unlang/edit_priv.h @@ -30,7 +30,7 @@ extern "C" { typedef struct { unlang_t self; - fr_map_list_t maps; //!< Head of the map list + map_list_t maps; //!< Head of the map list } unlang_edit_t; /** Cast a generic structure to the edit extension diff --git a/src/lib/unlang/map_priv.h b/src/lib/unlang/map_priv.h index a915b7e9f55..e98cd1b1a95 100644 --- a/src/lib/unlang/map_priv.h +++ b/src/lib/unlang/map_priv.h @@ -31,7 +31,7 @@ extern "C" { typedef struct { unlang_group_t group; tmpl_t *vpt; - fr_map_list_t map; //!< Head of the map list + map_list_t map; //!< Head of the map list map_proc_inst_t *proc_inst; } unlang_map_t; diff --git a/src/lib/util/dlist.h b/src/lib/util/dlist.h index b7cd7bd3996..c2bf5215f71 100644 --- a/src/lib/util/dlist.h +++ b/src/lib/util/dlist.h @@ -1057,14 +1057,14 @@ static inline void fr_dlist_noop(void) * @param[in] _name Prefix we add to type-specific structures. * @return fr_dlist__entry_t */ -#define FR_DLIST_ENTRY_TYPE(_name) fr_dlist_ ## _name ## _entry_t +#define FR_DLIST_ENTRY(_name) _name ## _entry_t /** Expands to the type name used for the head wrapper structure * * @param[in] _name Prefix we add to type-specific structures. * @return fr_dlist__head_t */ -#define FR_DLIST_HEAD_TYPE(_name) fr_dlist_ ## _name ## _head_t +#define FR_DLIST_HEAD(_name) _name ## _head_t /** Define type specific wrapper structs for dlists * @@ -1072,8 +1072,8 @@ static inline void fr_dlist_noop(void) * which will use type specific functions. */ #define FR_DLIST_TYPES(_name) \ - typedef struct { fr_dlist_t entry; } FR_DLIST_ENTRY_TYPE(_name); \ - typedef struct { fr_dlist_head_t head; } FR_DLIST_HEAD_TYPE(_name); \ + typedef struct { fr_dlist_t entry; } FR_DLIST_ENTRY(_name); \ + typedef struct { fr_dlist_head_t head; } FR_DLIST_HEAD(_name); \ /** Define type specific wrapper functions for dlists * @@ -1086,96 +1086,97 @@ static inline void fr_dlist_noop(void) */ #define FR_DLIST_FUNCS(_name, _element_type, _element_entry) \ DIAG_OFF(unused-function) \ - _Static_assert(IS_FIELD_COMPATIBLE(_element_type, _element_entry, FR_DLIST_ENTRY_TYPE(_name)) == 1, "Bad dlist entry field type");\ - static inline fr_dlist_head_t *fr_dlist_ ## _name ## _list_head(FR_DLIST_HEAD_TYPE(_name) const *list) \ + _Static_assert(IS_FIELD_COMPATIBLE(_element_type, _element_entry, FR_DLIST_ENTRY(_name)) == 1, "Bad dlist entry field type");\ + static inline fr_dlist_head_t *_name ## _list_head(FR_DLIST_HEAD(_name) const *list) \ { return UNCONST(fr_dlist_head_t *, &list->head); } \ - static inline void fr_dlist_ ## _name ## _entry_init(_element_type *entry) \ +\ + static inline void _name ## _entry_init(_element_type *entry) \ { \ _Generic((&entry->_element_entry), \ - FR_DLIST_ENTRY_TYPE(_name) *: fr_dlist_entry_init(UNCONST(fr_dlist_t *, &entry->_element_entry.entry)), \ - FR_DLIST_ENTRY_TYPE(_name) const *: fr_dlist_noop()\ + FR_DLIST_ENTRY(_name) *: fr_dlist_entry_init(UNCONST(fr_dlist_t *, &entry->_element_entry.entry)), \ + FR_DLIST_ENTRY(_name) const *: fr_dlist_noop()\ ); \ } \ \ - static inline void fr_dlist_ ## _name ## _init(FR_DLIST_HEAD_TYPE(_name) *list) \ + static inline void _name ## _init(FR_DLIST_HEAD(_name) *list) \ { _fr_dlist_init(&list->head, offsetof(_element_type, _element_entry), NULL); } \ \ - static inline void fr_dlist_ ## _name ## _talloc_init(FR_DLIST_HEAD_TYPE(_name) *list) \ + static inline void _name ## _talloc_init(FR_DLIST_HEAD(_name) *list) \ { _fr_dlist_init(&list->head, offsetof(_element_type, _element_entry), #_element_type); } \ \ - static inline void fr_dlist_ ## _name ## _clear(FR_DLIST_HEAD_TYPE(_name) *list) \ + static inline void _name ## _clear(FR_DLIST_HEAD(_name) *list) \ { fr_dlist_clear(&list->head); } \ \ - static inline bool fr_dlist_ ## _name ## _in_list(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *ptr) \ + static inline bool _name ## _in_list(FR_DLIST_HEAD(_name) *list, _element_type *ptr) \ { return fr_dlist_in_list(&list->head, ptr); } \ \ - static inline int fr_dlist_ ## _name ## _insert_head(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *ptr) \ + static inline int _name ## _insert_head(FR_DLIST_HEAD(_name) *list, _element_type *ptr) \ { return fr_dlist_insert_head(&list->head, ptr); } \ \ - static inline int fr_dlist_ ## _name ## _insert_tail(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *ptr) \ + static inline int _name ## _insert_tail(FR_DLIST_HEAD(_name) *list, _element_type *ptr) \ { return fr_dlist_insert_tail(&list->head, ptr); } \ \ - static inline int fr_dlist_ ## _name ## _insert_after(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *pos, _element_type *ptr) \ + static inline int _name ## _insert_after(FR_DLIST_HEAD(_name) *list, _element_type *pos, _element_type *ptr) \ { return fr_dlist_insert_after(&list->head, pos, ptr); } \ \ - static inline int fr_dlist_ ## _name ## _insert_before(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *pos, _element_type *ptr) \ + static inline int _name ## _insert_before(FR_DLIST_HEAD(_name) *list, _element_type *pos, _element_type *ptr) \ { return fr_dlist_insert_before(&list->head, pos, ptr); } \ \ - static inline _element_type *fr_dlist_ ## _name ## _head(FR_DLIST_HEAD_TYPE(_name) const *list) \ + static inline _element_type *_name ## _head(FR_DLIST_HEAD(_name) const *list) \ { return fr_dlist_head(&list->head); } \ \ - static inline bool fr_dlist_ ## _name ## _empty(FR_DLIST_HEAD_TYPE(_name) const *list) \ + static inline bool _name ## _empty(FR_DLIST_HEAD(_name) const *list) \ { return fr_dlist_empty(&list->head); } \ \ - static inline bool fr_dlist_ ## _name ## _initialised(FR_DLIST_HEAD_TYPE(_name) const *list) \ + static inline bool _name ## _initialised(FR_DLIST_HEAD(_name) const *list) \ { return fr_dlist_initialised(&list->head); } \ \ - static inline _element_type *fr_dlist_ ## _name ## _tail(FR_DLIST_HEAD_TYPE(_name) const *list) \ + static inline _element_type *_name ## _tail(FR_DLIST_HEAD(_name) const *list) \ { return fr_dlist_tail(&list->head); } \ \ - static inline _element_type *fr_dlist_ ## _name ## _next(FR_DLIST_HEAD_TYPE(_name) const *list, _element_type const *ptr) \ + static inline _element_type *_name ## _next(FR_DLIST_HEAD(_name) const *list, _element_type const *ptr) \ { return fr_dlist_next(&list->head, ptr); } \ \ - static inline _element_type *fr_dlist_ ## _name ## _prev(FR_DLIST_HEAD_TYPE(_name) const *list, _element_type const *ptr) \ + static inline _element_type *_name ## _prev(FR_DLIST_HEAD(_name) const *list, _element_type const *ptr) \ { return fr_dlist_prev(&list->head, ptr); } \ \ - static inline _element_type *fr_dlist_ ## _name ## _remove(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *ptr) \ + static inline _element_type *_name ## _remove(FR_DLIST_HEAD(_name) *list, _element_type *ptr) \ { return fr_dlist_remove(&list->head, ptr); } \ \ - static inline _element_type *fr_dlist_ ## _name ## _pop_head(FR_DLIST_HEAD_TYPE(_name) *list) \ + static inline _element_type *_name ## _pop_head(FR_DLIST_HEAD(_name) *list) \ { return fr_dlist_pop_head(&list->head); } \ \ - static inline _element_type *fr_dlist_ ## _name ## _pop_tail(FR_DLIST_HEAD_TYPE(_name) *list) \ + static inline _element_type *_name ## _pop_tail(FR_DLIST_HEAD(_name) *list) \ { return fr_dlist_pop_tail(&list->head); } \ \ - static inline _element_type *fr_dlist_ ## _name ## _replace(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *item, _element_type *ptr) \ + static inline _element_type *_name ## _replace(FR_DLIST_HEAD(_name) *list, _element_type *item, _element_type *ptr) \ { return fr_dlist_replace(&list->head, item, ptr); } \ \ - static inline int fr_dlist_ ## _name ## _move(FR_DLIST_HEAD_TYPE(_name) *dst, FR_DLIST_HEAD_TYPE(_name) *src) \ + static inline int _name ## _move(FR_DLIST_HEAD(_name) *dst, FR_DLIST_HEAD(_name) *src) \ { return fr_dlist_move(&dst->head, &src->head); } \ \ - static inline int fr_dlist_ ## _name ## _move_head(FR_DLIST_HEAD_TYPE(_name) *dst, FR_DLIST_HEAD_TYPE(_name) *src) \ + static inline int _name ## _move_head(FR_DLIST_HEAD(_name) *dst, FR_DLIST_HEAD(_name) *src) \ { return fr_dlist_move_head(&dst->head, &src->head); } \ \ - static inline void fr_dlist_ ## _name ## _talloc_free_head(FR_DLIST_HEAD_TYPE(_name) *list) \ + static inline void _name ## _talloc_free_head(FR_DLIST_HEAD(_name) *list) \ { fr_dlist_talloc_free_head(&list->head); } \ \ - static inline void fr_dlist_ ## _name ## _talloc_free_tail(FR_DLIST_HEAD_TYPE(_name) *list) \ + static inline void _name ## _talloc_free_tail(FR_DLIST_HEAD(_name) *list) \ { fr_dlist_talloc_free_tail(&list->head); } \ \ - static inline void fr_dlist_ ## _name ## _talloc_free_item(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *ptr) \ + static inline void _name ## _talloc_free_item(FR_DLIST_HEAD(_name) *list, _element_type *ptr) \ { fr_dlist_talloc_free_item(&list->head, ptr); } \ \ - static inline void fr_dlist_ ## _name ## _talloc_free(FR_DLIST_HEAD_TYPE(_name) *list) \ + static inline void _name ## _talloc_free(FR_DLIST_HEAD(_name) *list) \ { fr_dlist_talloc_free(&list->head); } \ \ - static inline void fr_dlist_ ## _name ## _talloc_reverse_free(FR_DLIST_HEAD_TYPE(_name) *list) \ + static inline void _name ## _talloc_reverse_free(FR_DLIST_HEAD(_name) *list) \ { fr_dlist_talloc_reverse_free(&list->head); } \ \ - static inline unsigned int fr_dlist_ ## _name ## _num_elements(FR_DLIST_HEAD_TYPE(_name) const *list) \ + static inline unsigned int _name ## _num_elements(FR_DLIST_HEAD(_name) const *list) \ { return fr_dlist_num_elements(&list->head); } \ \ - static inline void fr_dlist_ ## _name ## _sort(FR_DLIST_HEAD_TYPE(_name) *list, fr_cmp_t cmp) \ + static inline void _name ## _sort(FR_DLIST_HEAD(_name) *list, fr_cmp_t cmp) \ { fr_dlist_sort(&list->head, cmp); } \ DIAG_ON(unused-function) diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index b298775cac2..e8b3b4737d9 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -32,7 +32,7 @@ RCSID("$Id$") #include #include -FR_DLIST_FUNCS(pair, fr_pair_t, order_entry) +FR_DLIST_FUNCS(fr_pair_order_list, fr_pair_t, order_entry) /** Initialise a pair list header * @@ -46,7 +46,7 @@ void fr_pair_list_init(fr_pair_list_t *list) * in the list and allows us to iterate over * all of them. */ - fr_dlist_pair_talloc_init(&list->order); + fr_pair_order_list_talloc_init(&list->order); } /** Free a fr_pair_t @@ -107,7 +107,7 @@ fr_pair_list_t *fr_pair_list_alloc(TALLOC_CTX *ctx) */ static inline CC_HINT(always_inline) void pair_init_null(fr_pair_t *vp) { - fr_dlist_pair_entry_init(vp); + fr_pair_order_list_entry_init(vp); /* * Legacy cruft @@ -465,7 +465,7 @@ int fr_pair_steal(TALLOC_CTX *ctx, fr_pair_t *vp) */ int fr_pair_steal_append(TALLOC_CTX *list_ctx, fr_pair_list_t *list, fr_pair_t *vp) { - if (fr_dlist_pair_in_list(&list->order, vp)) { + if (fr_pair_order_list_in_list(&list->order, vp)) { fr_strerror_printf("Pair %pV is a list member, cannot be moved", vp); return -1; } @@ -488,7 +488,7 @@ int fr_pair_steal_append(TALLOC_CTX *list_ctx, fr_pair_list_t *list, fr_pair_t * */ int fr_pair_steal_prepend(TALLOC_CTX *list_ctx, fr_pair_list_t *list, fr_pair_t *vp) { - if (fr_dlist_pair_in_list(&list->order, vp)) { + if (fr_pair_order_list_in_list(&list->order, vp)) { fr_strerror_printf("Pair %pV is a list member, cannot be moved", vp); return -1; } @@ -508,7 +508,7 @@ int fr_pair_steal_prepend(TALLOC_CTX *list_ctx, fr_pair_list_t *list, fr_pair_t */ void fr_pair_list_free(fr_pair_list_t *list) { - fr_dlist_pair_talloc_free(&list->order); + fr_pair_order_list_talloc_free(&list->order); } /** Is a valuepair list empty @@ -520,7 +520,7 @@ void fr_pair_list_free(fr_pair_list_t *list) */ bool fr_pair_list_empty(fr_pair_list_t const *list) { - return fr_dlist_pair_empty(&list->order); + return fr_pair_order_list_empty(&list->order); } /** Mark malformed or unrecognised attributed as unknown @@ -609,9 +609,9 @@ unsigned int fr_pair_count_by_da(fr_pair_list_t const *list, fr_dict_attr_t cons fr_pair_t *vp = NULL; unsigned int count = 0; - if (fr_dlist_pair_empty(&list->order)) return 0; + if (fr_pair_order_list_empty(&list->order)) return 0; - while ((vp = fr_dlist_pair_next(&list->order, vp))) if (da == vp->da) count++; + while ((vp = fr_pair_order_list_next(&list->order, vp))) if (da == vp->da) count++; return count; } @@ -631,11 +631,11 @@ fr_pair_t *fr_pair_find_by_da(fr_pair_list_t const *list, fr_pair_t const *prev, { fr_pair_t *vp = UNCONST(fr_pair_t *, prev); - if (fr_dlist_pair_empty(&list->order)) return NULL; + if (fr_pair_order_list_empty(&list->order)) return NULL; PAIR_LIST_VERIFY(list); - while ((vp = fr_dlist_pair_next(&list->order, vp))) if (da == vp->da) return vp; + while ((vp = fr_pair_order_list_next(&list->order, vp))) if (da == vp->da) return vp; return NULL; } @@ -655,7 +655,7 @@ fr_pair_t *fr_pair_find_by_da_idx(fr_pair_list_t const *list, fr_dict_attr_t con { fr_pair_t *vp = NULL; - if (fr_dlist_pair_empty(&list->order)) return NULL; + if (fr_pair_order_list_empty(&list->order)) return NULL; PAIR_LIST_VERIFY(list); @@ -736,7 +736,7 @@ fr_pair_t *fr_pair_find_by_child_num(fr_pair_list_t const *list, fr_pair_t const fr_dict_attr_t const *da; /* List head may be NULL if it contains no VPs */ - if (fr_dlist_pair_empty(&list->order)) return NULL; + if (fr_pair_order_list_empty(&list->order)) return NULL; PAIR_LIST_VERIFY(list); @@ -762,7 +762,7 @@ fr_pair_t *fr_pair_find_by_child_num_idx(fr_pair_list_t const *list, fr_dict_attr_t const *da; /* List head may be NULL if it contains no VPs */ - if (fr_dlist_pair_empty(&list->order)) return NULL; + if (fr_pair_order_list_empty(&list->order)) return NULL; PAIR_LIST_VERIFY(list); @@ -840,7 +840,7 @@ fr_pair_t *_fr_pair_dcursor_iter_init(fr_dcursor_t *cursor, fr_pair_list_t const fr_dcursor_iter_t iter, void const *uctx, bool is_const) { - return _fr_dcursor_init(cursor, fr_dlist_pair_list_head(&list->order), + return _fr_dcursor_init(cursor, fr_pair_order_list_list_head(&list->order), iter, uctx, _pair_list_dcursor_insert, _pair_list_dcursor_remove, list, is_const); } @@ -861,7 +861,7 @@ fr_pair_t *_fr_pair_dcursor_iter_init(fr_dcursor_t *cursor, fr_pair_list_t const fr_pair_t *_fr_pair_dcursor_init(fr_dcursor_t *cursor, fr_pair_list_t const *list, bool is_const) { - return _fr_dcursor_init(cursor, fr_dlist_pair_list_head(&list->order), + return _fr_dcursor_init(cursor, fr_pair_order_list_list_head(&list->order), NULL, NULL, _pair_list_dcursor_insert, _pair_list_dcursor_remove, list, is_const); } @@ -881,7 +881,7 @@ fr_pair_t *_fr_pair_dcursor_by_da_init(fr_dcursor_t *cursor, fr_pair_list_t const *list, fr_dict_attr_t const *da, bool is_const) { - return _fr_dcursor_init(cursor, fr_dlist_pair_list_head(&list->order), + return _fr_dcursor_init(cursor, fr_pair_order_list_list_head(&list->order), fr_pair_iter_next_by_da, da, _pair_list_dcursor_insert, _pair_list_dcursor_remove, list, is_const); } @@ -900,7 +900,7 @@ fr_pair_t *_fr_pair_dcursor_by_ancestor_init(fr_dcursor_t *cursor, fr_pair_list_t const *list, fr_dict_attr_t const *da, bool is_const) { - return _fr_dcursor_init(cursor, fr_dlist_pair_list_head(&list->order), + return _fr_dcursor_init(cursor, fr_pair_order_list_list_head(&list->order), fr_pair_iter_next_by_ancestor, da, _pair_list_dcursor_insert, _pair_list_dcursor_remove, list, is_const); } @@ -916,7 +916,7 @@ fr_pair_t *_fr_pair_dcursor_by_ancestor_init(fr_dcursor_t *cursor, */ fr_pair_t *fr_pair_list_head(fr_pair_list_t const *list) { - return fr_dlist_pair_head(&list->order); + return fr_pair_order_list_head(&list->order); } /** Get the next item in a valuepair list after a specific entry @@ -930,7 +930,7 @@ fr_pair_t *fr_pair_list_head(fr_pair_list_t const *list) */ fr_pair_t *fr_pair_list_next(fr_pair_list_t const *list, fr_pair_t const *item) { - return fr_dlist_pair_next(&list->order, item); + return fr_pair_order_list_next(&list->order, item); } /** Get the previous item in a valuepair list before a specific entry @@ -943,7 +943,7 @@ fr_pair_t *fr_pair_list_next(fr_pair_list_t const *list, fr_pair_t const *item) */ fr_pair_t *fr_pair_list_prev(fr_pair_list_t const *list, fr_pair_t const *item) { - return fr_dlist_pair_prev(&list->order, item); + return fr_pair_order_list_prev(&list->order, item); } /** Get the tail of a valuepair list @@ -956,7 +956,7 @@ fr_pair_t *fr_pair_list_prev(fr_pair_list_t const *list, fr_pair_t const *item) */ fr_pair_t *fr_pair_list_tail(fr_pair_list_t const *list) { - return fr_dlist_pair_tail(&list->order); + return fr_pair_order_list_tail(&list->order); } /** Add a VP to the start of the list. @@ -973,12 +973,12 @@ int fr_pair_prepend(fr_pair_list_t *list, fr_pair_t *to_add) { PAIR_VERIFY(to_add); - if (fr_dlist_pair_in_list(&list->order, to_add)) { + if (fr_pair_order_list_in_list(&list->order, to_add)) { fr_strerror_printf("Pair %pV already inserted into list", to_add); return -1; } - fr_dlist_pair_insert_head(&list->order, to_add); + fr_pair_order_list_insert_head(&list->order, to_add); return 0; } @@ -997,12 +997,12 @@ int fr_pair_append(fr_pair_list_t *list, fr_pair_t *to_add) { PAIR_VERIFY(to_add); - if (fr_dlist_pair_in_list(&list->order, to_add)) { + if (fr_pair_order_list_in_list(&list->order, to_add)) { fr_strerror_printf("Pair %pV already inserted into list", to_add); return -1; } - fr_dlist_pair_insert_tail(&list->order, to_add); + fr_pair_order_list_insert_tail(&list->order, to_add); return 0; } @@ -1020,17 +1020,17 @@ int fr_pair_insert_after(fr_pair_list_t *list, fr_pair_t *pos, fr_pair_t *to_add { PAIR_VERIFY(to_add); - if (fr_dlist_pair_in_list(&list->order, to_add)) { + if (fr_pair_order_list_in_list(&list->order, to_add)) { fr_strerror_printf("Pair %pV already inserted into list", to_add); return -1; } - if (pos && !fr_dlist_pair_in_list(&list->order, pos)) { + if (pos && !fr_pair_order_list_in_list(&list->order, pos)) { fr_strerror_printf("Pair %pV not in list", pos); return -1; } - fr_dlist_pair_insert_after(&list->order, pos, to_add); + fr_pair_order_list_insert_after(&list->order, pos, to_add); return 0; } @@ -1048,17 +1048,17 @@ int fr_pair_insert_before(fr_pair_list_t *list, fr_pair_t *pos, fr_pair_t *to_ad { PAIR_VERIFY(to_add); - if (fr_dlist_pair_in_list(&list->order, to_add)) { + if (fr_pair_order_list_in_list(&list->order, to_add)) { fr_strerror_printf("Pair %pV already inserted into list", to_add); return -1; } - if (pos && !fr_dlist_pair_in_list(&list->order, pos)) { + if (pos && !fr_pair_order_list_in_list(&list->order, pos)) { fr_strerror_printf("Pair %pV not in list", pos); return -1; } - fr_dlist_pair_insert_before(&list->order, pos, to_add); + fr_pair_order_list_insert_before(&list->order, pos, to_add); return 0; } @@ -1232,8 +1232,8 @@ fr_pair_t *fr_pair_remove(fr_pair_list_t *list, fr_pair_t *vp) { fr_pair_t *prev; - prev = fr_dlist_pair_prev(&list->order, vp); - fr_dlist_pair_remove(&list->order, vp); + prev = fr_pair_order_list_prev(&list->order, vp); + fr_pair_order_list_remove(&list->order, vp); return prev; } @@ -1248,8 +1248,8 @@ fr_pair_t *fr_pair_delete(fr_pair_list_t *list, fr_pair_t *vp) { fr_pair_t *prev; - prev = fr_dlist_pair_prev(&list->order, vp); - fr_dlist_pair_remove(&list->order, vp); + prev = fr_pair_order_list_prev(&list->order, vp); + fr_pair_order_list_remove(&list->order, vp); talloc_free(vp); return prev; @@ -1486,7 +1486,7 @@ int fr_pair_list_cmp(fr_pair_list_t const *a, fr_pair_list_t const *b) */ void fr_pair_list_sort(fr_pair_list_t *list, fr_cmp_t cmp) { - fr_dlist_pair_sort(&list->order, cmp); + fr_pair_order_list_sort(&list->order, cmp); } /** Write an error to the library errorbuff detailing the mismatch @@ -1545,7 +1545,7 @@ bool fr_pair_validate(fr_pair_t const *failed[2], fr_pair_list_t *filter, fr_pai { fr_pair_t *check, *match; - if (fr_dlist_pair_empty(&filter->order) && fr_dlist_pair_empty(&list->order)) return true; + if (fr_pair_order_list_empty(&filter->order) && fr_pair_order_list_empty(&list->order)) return true; /* * This allows us to verify the sets of validate and reply are equal @@ -1618,7 +1618,7 @@ bool fr_pair_validate_relaxed(fr_pair_t const *failed[2], fr_pair_list_t *filter { fr_pair_t *check, *last_check = NULL, *match = NULL; - if (fr_dlist_pair_empty(&filter->order) && fr_dlist_pair_empty(&list->order)) return true; + if (fr_pair_order_list_empty(&filter->order) && fr_pair_order_list_empty(&list->order)) return true; /* * This allows us to verify the sets of validate and reply are equal @@ -1861,9 +1861,9 @@ void fr_pair_value_clear(fr_pair_t *vp) break; case FR_TYPE_STRUCTURAL: - if (!fr_dlist_pair_empty(&vp->vp_group.order)) return; + if (!fr_pair_order_list_empty(&vp->vp_group.order)) return; - while ((child = fr_dlist_pair_pop_tail(&vp->vp_group.order))) { + while ((child = fr_pair_order_list_pop_tail(&vp->vp_group.order))) { fr_pair_value_clear(child); talloc_free(child); } @@ -2744,7 +2744,7 @@ void fr_pair_list_tainted(fr_pair_list_t *list) */ void fr_pair_list_append(fr_pair_list_t *dst, fr_pair_list_t *src) { - fr_dlist_pair_move(&dst->order, &src->order); + fr_pair_order_list_move(&dst->order, &src->order); } /** Move a list of fr_pair_t from a temporary list to the head of a destination list @@ -2754,7 +2754,7 @@ void fr_pair_list_append(fr_pair_list_t *dst, fr_pair_list_t *src) */ void fr_pair_list_prepend(fr_pair_list_t *dst, fr_pair_list_t *src) { - fr_dlist_pair_move_head(&dst->order, &src->order); + fr_pair_order_list_move_head(&dst->order, &src->order); } /** Evaluation function for matching if vp matches a given da @@ -2781,7 +2781,7 @@ bool fr_pair_matches_da(void const *item, void const *uctx) */ size_t fr_pair_list_len(fr_pair_list_t const *list) { - return fr_dlist_pair_num_elements(&list->order); + return fr_pair_order_list_num_elements(&list->order); } /** Parse a list of VPs from a value box. diff --git a/src/lib/util/pair.h b/src/lib/util/pair.h index 226e865311a..d1e56231f73 100644 --- a/src/lib/util/pair.h +++ b/src/lib/util/pair.h @@ -46,10 +46,10 @@ extern "C" { typedef struct value_pair_s fr_pair_t; -FR_DLIST_TYPES(pair) +FR_DLIST_TYPES(fr_pair_order_list) typedef struct { - FR_DLIST_HEAD_TYPE(pair) order; //!< Maintains the relative order of pairs in a list. + FR_DLIST_HEAD(fr_pair_order_list) order; //!< Maintains the relative order of pairs in a list. } fr_pair_list_t; /** Stores an attribute, a value and various bits of other data @@ -64,7 +64,7 @@ struct value_pair_s { ///< Note: This should not be modified outside ///< of pair.c except via #fr_pair_reinit_from_da. - FR_DLIST_ENTRY_TYPE(pair) _CONST order_entry; //!< Entry to maintain relative order within a list + FR_DLIST_ENTRY(fr_pair_order_list) _CONST order_entry; //!< Entry to maintain relative order within a list ///< of pairs. This ensures pairs within the list ///< are encoded in the same order as they were ///< received or inserted. diff --git a/src/modules/proto_ldap_sync/sync.h b/src/modules/proto_ldap_sync/sync.h index 0cc512cebe7..8d15dfc510a 100644 --- a/src/modules/proto_ldap_sync/sync.h +++ b/src/modules/proto_ldap_sync/sync.h @@ -149,7 +149,7 @@ struct sync_config_s { /* * LDAP attribute to RADIUS map */ - fr_map_list_t entry_map; //!< How to convert attributes in entries + map_list_t entry_map; //!< How to convert attributes in entries //!< to FreeRADIUS attributes. /* diff --git a/src/modules/rlm_attr_filter/rlm_attr_filter.c b/src/modules/rlm_attr_filter/rlm_attr_filter.c index ae83b13533f..fd5f4c65295 100644 --- a/src/modules/rlm_attr_filter/rlm_attr_filter.c +++ b/src/modules/rlm_attr_filter/rlm_attr_filter.c @@ -118,13 +118,13 @@ static int attr_filter_getfile(TALLOC_CTX *ctx, module_inst_ctx_t const *mctx, c /* * We apply the rules in the reply items. */ - if (!fr_dlist_map_empty(&entry->check)) { + if (!map_list_empty(&entry->check)) { WARN("%s[%d] Check list is not empty for entry \"%s\".\n", filename, entry->lineno, entry->name); } map = NULL; - while ((map = fr_dlist_map_next(&entry->reply, map))) { + while ((map = map_list_next(&entry->reply, map))) { fr_dict_attr_t const *da; if (!tmpl_is_attr(map->lhs)) { @@ -240,7 +240,7 @@ static unlang_action_t CC_HINT(nonnull(1,2)) attr_filter_common(rlm_rcode_t *p_r fr_pair_list_init(&check_list); - while ((map = fr_dlist_map_next(&pl->reply, map))) { + while ((map = map_list_next(&pl->reply, map))) { if (map_to_vp(packet, &tmp_list, request, map, NULL) < 0) { RPWARN("Failed parsing map %s for check item, skipping it", map->lhs->name); continue; diff --git a/src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c b/src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c index 278a78ab900..23e59952bf2 100644 --- a/src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c +++ b/src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c @@ -132,13 +132,13 @@ static cache_status_t cache_entry_find(rlm_cache_entry_t **out, redisReply *reply = NULL; int s_ret; - fr_map_list_t head; + map_list_t head; #ifdef HAVE_TALLOC_ZERO_POOLED_OBJECT size_t pool_size = 0; #endif rlm_cache_entry_t *c; - fr_dlist_map_init(&head); + map_list_init(&head); for (s_ret = fr_redis_cluster_state_init(&state, &conn, driver->cluster, request, key, key_len, false); s_ret == REDIS_RCODE_TRY_AGAIN; /* Continue */ s_ret = fr_redis_cluster_state_next(&state, &conn, driver->cluster, request, status, &reply)) { @@ -198,7 +198,7 @@ static cache_status_t cache_entry_find(rlm_cache_entry_t **out, #else c = talloc_zero(NULL, rlm_cache_entry_t); #endif - fr_dlist_map_init(&c->maps); + map_list_init(&c->maps); /* * Convert the key/value pairs back into maps */ @@ -215,30 +215,30 @@ static cache_status_t cache_entry_find(rlm_cache_entry_t **out, /* * Pull out the cache created date */ - if (tmpl_da(fr_dlist_map_head(&head)->lhs) == attr_cache_created) { + if (tmpl_da(map_list_head(&head)->lhs) == attr_cache_created) { map_t *map; - c->created = tmpl_value(fr_dlist_map_head(&head)->rhs)->vb_date; + c->created = tmpl_value(map_list_head(&head)->rhs)->vb_date; - map = fr_dlist_map_pop_head(&head); + map = map_list_pop_head(&head); talloc_free(map); } /* * Pull out the cache expires date */ - if (tmpl_da(fr_dlist_map_head(&head)->lhs) == attr_cache_expires) { + if (tmpl_da(map_list_head(&head)->lhs) == attr_cache_expires) { map_t *map; - c->expires = tmpl_value(fr_dlist_map_head(&head)->rhs)->vb_date; + c->expires = tmpl_value(map_list_head(&head)->rhs)->vb_date; - map = fr_dlist_map_pop_head(&head); + map = map_list_pop_head(&head); talloc_free(map); } c->key = talloc_memdup(c, key, key_len); c->key_len = key_len; - fr_dlist_map_move(&c->maps, &head); + map_list_move(&c->maps, &head); *out = c; return CACHE_OK; @@ -306,7 +306,7 @@ static cache_status_t cache_entry_insert(UNUSED rlm_cache_config_t const *config fr_value_box_init(&expires_value.data.literal, FR_TYPE_DATE, NULL, true); tmpl_value(&expires_value)->vb_date = c->expires; - cnt = fr_dlist_map_num_elements(&c->maps) + 2; + cnt = map_list_num_elements(&c->maps) + 2; /* * The majority of serialized entries should be under 1k. @@ -342,7 +342,7 @@ static cache_status_t cache_entry_insert(UNUSED rlm_cache_config_t const *config } argv_p += 3; argv_len_p += 3; - while ((map = fr_dlist_map_next(&c->maps, map))) { + while ((map = map_list_next(&c->maps, map))) { if (fr_redis_tuple_from_map(pool, argv_p, argv_len_p, map) < 0) { REDEBUG("Failed encoding map as Redis K/V pair"); talloc_free(pool); diff --git a/src/modules/rlm_cache/rlm_cache.c b/src/modules/rlm_cache/rlm_cache.c index a4098046b26..accc1edc1a5 100644 --- a/src/modules/rlm_cache/rlm_cache.c +++ b/src/modules/rlm_cache/rlm_cache.c @@ -160,7 +160,7 @@ static rlm_rcode_t cache_merge(rlm_cache_t const *inst, request_t *request, rlm_ RDEBUG2("Merging cache entry into request"); RINDENT(); - while ((map = fr_dlist_map_next(&c->maps, map))) { + while ((map = map_list_next(&c->maps, map))) { /* * The only reason that the application of a map entry * can fail, is if the destination list or request @@ -320,7 +320,7 @@ static unlang_action_t cache_insert(rlm_rcode_t *p_result, if (!c) { RETURN_MODULE_FAIL; } - fr_dlist_map_init(&c->maps); + map_list_init(&c->maps); c->key = talloc_memdup(c, key, key_len); c->key_len = key_len; @@ -337,7 +337,7 @@ static unlang_action_t cache_insert(rlm_rcode_t *p_result, * gathering fr_pair_ts to cache. */ pool = talloc_pool(NULL, 2048); - while ((map = fr_dlist_map_next(&inst->maps, map))) { + while ((map = map_list_next(&inst->maps, map))) { fr_pair_list_t to_cache; fr_pair_list_init(&to_cache); @@ -376,7 +376,7 @@ static unlang_action_t cache_insert(rlm_rcode_t *p_result, MEM(c_map = talloc_zero(c, map_t)); c_map->op = map->op; - fr_dlist_map_init(&c_map->child); + map_list_init(&c_map->child); /* * Now we turn the fr_pair_ts into maps. @@ -425,7 +425,7 @@ static unlang_action_t cache_insert(rlm_rcode_t *p_result, fr_assert(0); } MAP_VERIFY(c_map); - fr_dlist_map_insert_tail(&c->maps, c_map); + map_list_insert_tail(&c->maps, c_map); } talloc_free_children(pool); /* reset pool state */ } @@ -868,7 +868,7 @@ xlat_action_t cache_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out, return XLAT_ACTION_FAIL; } - while ((map = fr_dlist_map_next(&c->maps, map))) { + while ((map = map_list_next(&c->maps, map))) { if ((tmpl_da(map->lhs) != tmpl_da(target)) || (tmpl_list(map->lhs) != tmpl_list(target))) continue; @@ -1044,14 +1044,14 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) .allow_foreign = true /* Because we don't know where we'll be called */ }; - fr_dlist_map_init(&inst->maps); + map_list_init(&inst->maps); if (map_afrom_cs(inst, &inst->maps, update, &parse_rules, &parse_rules, cache_verify, NULL, MAX_ATTRMAP) < 0) { return -1; } } - if (fr_dlist_map_empty(&inst->maps)) { + if (map_list_empty(&inst->maps)) { cf_log_err(conf, "Cache config must contain an update section, and " "that section must not be empty"); return -1; diff --git a/src/modules/rlm_cache/rlm_cache.h b/src/modules/rlm_cache/rlm_cache.h index 35eb2674b8d..90f067a71db 100644 --- a/src/modules/rlm_cache/rlm_cache.h +++ b/src/modules/rlm_cache/rlm_cache.h @@ -70,7 +70,7 @@ typedef struct { module_instance_t *driver_inst; //!< Driver's instance data. rlm_cache_driver_t const *driver; //!< Driver's exported interface. - fr_map_list_t maps; //!< Attribute map applied to users. + map_list_t maps; //!< Attribute map applied to users. //!< and profiles. } rlm_cache_t; @@ -81,7 +81,7 @@ typedef struct { fr_unix_time_t created; //!< When the entry was created. fr_unix_time_t expires; //!< When the entry expires. - fr_map_list_t maps; //!< Head of the maps list. + map_list_t maps; //!< Head of the maps list. } rlm_cache_entry_t; /** Allocate a new cache entry diff --git a/src/modules/rlm_cache/serialize.c b/src/modules/rlm_cache/serialize.c index 96ce1ecf7f3..45640b4086a 100644 --- a/src/modules/rlm_cache/serialize.c +++ b/src/modules/rlm_cache/serialize.c @@ -53,7 +53,7 @@ int cache_serialize(TALLOC_CTX *ctx, char **out, rlm_cache_entry_t const *c) /* * It's valid to have an empty cache entry (save allocing the pairs pool) */ - if (fr_dlist_map_empty(&c->maps)) goto finish; + if (map_list_empty(&c->maps)) goto finish; value_pool = talloc_pool(ctx, 512); if (!value_pool) { @@ -63,7 +63,7 @@ int cache_serialize(TALLOC_CTX *ctx, char **out, rlm_cache_entry_t const *c) return -1; } - while ((map = fr_dlist_map_next(&c->maps, map))) { + while ((map = map_list_next(&c->maps, map))) { char *value; ssize_t slen; @@ -167,7 +167,7 @@ int cache_deserialize(rlm_cache_entry_t *c, fr_dict_t const *dict, char *in, ssi MAP_VERIFY(map); /* It's not a special attribute, add it to the map list */ - fr_dlist_map_insert_tail(&c->maps, map); + map_list_insert_tail(&c->maps, map); next: p = q + 1; diff --git a/src/modules/rlm_client/rlm_client.c b/src/modules/rlm_client/rlm_client.c index 17fd9258fd9..9b736c08943 100644 --- a/src/modules/rlm_client/rlm_client.c +++ b/src/modules/rlm_client/rlm_client.c @@ -115,7 +115,7 @@ static int _map_proc_client_get_vp(TALLOC_CTX *ctx, fr_pair_list_t *out, request * - #RLM_MODULE_FAIL if an error occurred. */ static rlm_rcode_t map_proc_client(UNUSED void *mod_inst, UNUSED void *proc_inst, request_t *request, - fr_value_box_list_t *client_override, fr_map_list_t const *maps) + fr_value_box_list_t *client_override, map_list_t const *maps) { rlm_rcode_t rcode = RLM_MODULE_OK; map_t const *map = NULL; @@ -177,7 +177,7 @@ static rlm_rcode_t map_proc_client(UNUSED void *mod_inst, UNUSED void *proc_inst uctx.cs = client->cs; RINDENT(); - while ((map = fr_dlist_map_next(maps, map))) { + while ((map = map_list_next(maps, map))) { char *field = NULL; if (tmpl_aexpand(request, &field, request, map->rhs, NULL, NULL) < 0) { diff --git a/src/modules/rlm_couchbase/rlm_couchbase.c b/src/modules/rlm_couchbase/rlm_couchbase.c index e3458e0da5d..9d7e19507da 100644 --- a/src/modules/rlm_couchbase/rlm_couchbase.c +++ b/src/modules/rlm_couchbase/rlm_couchbase.c @@ -149,11 +149,11 @@ static unlang_action_t mod_authorize(rlm_rcode_t *p_result, module_ctx_t const * TALLOC_CTX *pool = talloc_pool(request, 1024); /* We need to do lots of allocs */ fr_dcursor_t maps; map_t *map = NULL; - fr_map_list_t map_head; + map_list_t map_head; vp_list_mod_t *vlm; fr_dlist_head_t vlm_head; - fr_dlist_map_init(&map_head); + map_list_init(&map_head); fr_dcursor_init(&maps, &map_head); /* diff --git a/src/modules/rlm_csv/rlm_csv.c b/src/modules/rlm_csv/rlm_csv.c index e9b2de1fef1..a0330543895 100644 --- a/src/modules/rlm_csv/rlm_csv.c +++ b/src/modules/rlm_csv/rlm_csv.c @@ -32,7 +32,7 @@ RCSID("$Id$") #include static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_t *request, - fr_value_box_list_t *key, fr_map_list_t const *maps); + fr_value_box_list_t *key, map_list_t const *maps); /* * Define a structure for our module configuration. @@ -64,7 +64,7 @@ typedef struct { tmpl_t *key; fr_type_t key_data_type; - fr_map_list_t map; //!< if there is an "update" section in the configuration. + map_list_t map; //!< if there is an "update" section in the configuration. } rlm_csv_t; typedef struct rlm_csv_entry_s rlm_csv_entry_t; @@ -480,7 +480,7 @@ static int csv_map_verify(map_t *map, void *instance) * Verify the result of the map. */ static int csv_maps_verify(CONF_SECTION *cs, void *mod_inst, UNUSED void *proc_inst, - tmpl_t const *src, fr_map_list_t const *maps) + tmpl_t const *src, map_list_t const *maps) { map_t const *map = NULL; @@ -490,7 +490,7 @@ static int csv_maps_verify(CONF_SECTION *cs, void *mod_inst, UNUSED void *proc_i return -1; } - while ((map = fr_dlist_map_next(maps, map))) { + while ((map = map_list_next(maps, map))) { /* * This function doesn't change the map, so it's OK. */ @@ -762,7 +762,7 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) }; char buffer[8192]; - fr_dlist_map_init(&inst->map); + map_list_init(&inst->map); /* * "update" without "key" is invalid, as we can't run the * module. @@ -893,7 +893,7 @@ static int csv_map_getvalue(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *req * - #RLM_MODULE_FAIL if an error occurred. */ static rlm_rcode_t mod_map_apply(rlm_csv_t const *inst, request_t *request, - fr_value_box_t const *key, fr_map_list_t const *maps) + fr_value_box_t const *key, map_list_t const *maps) { rlm_rcode_t rcode = RLM_MODULE_UPDATED; rlm_csv_entry_t *e; @@ -907,7 +907,7 @@ static rlm_rcode_t mod_map_apply(rlm_csv_t const *inst, request_t *request, redo: RINDENT(); - while ((map = fr_dlist_map_next(maps, map))) { + while ((map = map_list_next(maps, map))) { int field; char *field_name; @@ -972,7 +972,7 @@ finish: * - #RLM_MODULE_FAIL if an error occurred. */ static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_t *request, - fr_value_box_list_t *key, fr_map_list_t const *maps) + fr_value_box_list_t *key, map_list_t const *maps) { rlm_csv_t *inst = talloc_get_type_abort(mod_inst, rlm_csv_t); fr_value_box_t *key_head = fr_dlist_head(key); @@ -1003,7 +1003,7 @@ static unlang_action_t CC_HINT(nonnull) mod_process(rlm_rcode_t *p_result, modul ssize_t slen; fr_value_box_t *key; - if (fr_dlist_map_empty(&inst->map) || !inst->key) RETURN_MODULE_NOOP; + if (map_list_empty(&inst->map) || !inst->key) RETURN_MODULE_NOOP; /* * Expand the key to whatever it is. For attributes, diff --git a/src/modules/rlm_files/rlm_files.c b/src/modules/rlm_files/rlm_files.c index 50dd685e4fd..d7fc6039ebd 100644 --- a/src/modules/rlm_files/rlm_files.c +++ b/src/modules/rlm_files/rlm_files.c @@ -152,7 +152,7 @@ static int getusersfile(TALLOC_CTX *ctx, char const *filename, fr_htrie_t **ptre * and probably ':=' for server * configuration items. */ - while ((map = fr_dlist_map_next(&entry->check, map))) { + while ((map = map_list_next(&entry->check, map))) { if (!tmpl_is_attr(map->lhs)) { ERROR("%s[%d] Left side of check item %s is not an attribute", entry->filename, entry->lineno, map->lhs->name); @@ -193,7 +193,7 @@ static int getusersfile(TALLOC_CTX *ctx, char const *filename, fr_htrie_t **ptre * worth doing. */ map = NULL; - while ((map = fr_dlist_map_next(&entry->reply, map))) { + while ((map = map_list_next(&entry->reply, map))) { if (!tmpl_is_attr(map->lhs)) { ERROR("%s[%d] Left side of reply item %s is not an attribute", entry->filename, entry->lineno, map->lhs->name); @@ -477,7 +477,7 @@ redo: /* * Realize the map to a list of VPs */ - while ((map = fr_dlist_map_next(&pl->check, map))) { + while ((map = map_list_next(&pl->check, map))) { fr_pair_list_t tmp_list; /* @@ -529,9 +529,9 @@ redo: fr_pair_list_free(&list); /* ctx may be reply */ - if (!fr_dlist_map_empty(&pl->reply)) { + if (!map_list_empty(&pl->reply)) { map = NULL; - while ((map = fr_dlist_map_next(&pl->reply, map))) { + while ((map = map_list_next(&pl->reply, map))) { fr_pair_list_t tmp_list; fr_pair_list_init(&tmp_list); if (map->op == T_OP_CMP_FALSE) continue; diff --git a/src/modules/rlm_json/rlm_json.c b/src/modules/rlm_json/rlm_json.c index a941a8401b7..079f6cf71ae 100644 --- a/src/modules/rlm_json/rlm_json.c +++ b/src/modules/rlm_json/rlm_json.c @@ -279,7 +279,7 @@ static xlat_action_t json_encode_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out, * - -1 on failure. */ static int mod_map_proc_instantiate(CONF_SECTION *cs, UNUSED void *mod_inst, void *proc_inst, - tmpl_t const *src, fr_map_list_t const *maps) + tmpl_t const *src, map_list_t const *maps) { rlm_json_jpath_cache_t *cache_inst = proc_inst; map_t const *map = NULL; @@ -292,7 +292,7 @@ static int mod_map_proc_instantiate(CONF_SECTION *cs, UNUSED void *mod_inst, voi return -1; } - while ((map = fr_dlist_map_next(maps, map))) { + while ((map = map_list_next(maps, map))) { CONF_PAIR *cp = cf_item_to_pair(map->ci); char const *p; @@ -343,7 +343,7 @@ static int mod_map_proc_instantiate(CONF_SECTION *cs, UNUSED void *mod_inst, voi * list member was pre-allocated and passed to the * instantiation callback. */ - if (fr_dlist_map_next(maps, map)) { + if (map_list_next(maps, map)) { *tail = cache = talloc_zero(cache, rlm_json_jpath_cache_t); tail = &cache->next; } @@ -414,7 +414,7 @@ static int _json_map_proc_get_value(TALLOC_CTX *ctx, fr_pair_list_t *out, reques * - #RLM_MODULE_FAIL if a fault occurred. */ static rlm_rcode_t mod_map_proc(UNUSED void *mod_inst, void *proc_inst, request_t *request, - fr_value_box_list_t *json, fr_map_list_t const *maps) + fr_value_box_list_t *json, map_list_t const *maps) { rlm_rcode_t rcode = RLM_MODULE_UPDATED; struct json_tokener *tok; @@ -454,7 +454,7 @@ static rlm_rcode_t mod_map_proc(UNUSED void *mod_inst, void *proc_inst, request_ goto finish; } - while ((map = fr_dlist_map_next(maps, map))) { + while ((map = map_list_next(maps, map))) { switch (map->rhs->type) { /* * Cached types diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index 381a6d8c015..4a722cb125c 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -585,7 +585,7 @@ static xlat_action_t ldap_xlat(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, * Verify the result of the map. */ static int ldap_map_verify(CONF_SECTION *cs, UNUSED void *mod_inst, UNUSED void *proc_inst, - tmpl_t const *src, UNUSED fr_map_list_t const *maps) + tmpl_t const *src, UNUSED map_list_t const *maps) { if (!src) { cf_log_err(cs, "Missing LDAP URI"); @@ -734,7 +734,7 @@ static void _ldap_async_bind_auth_watch(fr_connection_t *conn, UNUSED fr_connect * - #RLM_MODULE_FAIL if an error occurred. */ static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_t *request, - fr_value_box_list_t *url, fr_map_list_t const *maps) + fr_value_box_list_t *url, map_list_t const *maps) { rlm_rcode_t rcode = RLM_MODULE_UPDATED; rlm_ldap_t *inst = talloc_get_type_abort(mod_inst, rlm_ldap_t); @@ -833,9 +833,9 @@ static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_ } RINDENT(); - for (map = fr_dlist_map_head(maps), i = 0; + for (map = map_list_head(maps), i = 0; map != NULL; - map = fr_dlist_map_next(maps, map), i++) { + map = map_list_next(maps, map), i++) { int ret; fr_ldap_result_t attr; @@ -1418,7 +1418,7 @@ skip_edir: } } - if (!fr_dlist_map_empty(&inst->user_map) || inst->valuepair_attr) { + if (!map_list_empty(&inst->user_map) || inst->valuepair_attr) { RDEBUG2("Processing user attributes"); RINDENT(); if (fr_ldap_map_do(request, handle, inst->valuepair_attr, @@ -1888,7 +1888,7 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) rlm_ldap_t *inst = talloc_get_type_abort(mctx->inst->data, rlm_ldap_t); CONF_SECTION *conf = mctx->inst->conf; - fr_dlist_map_init(&inst->user_map); + map_list_init(&inst->user_map); options = cf_section_find(conf, "options", NULL); if (!options || !cf_pair_find(options, "chase_referrals")) { diff --git a/src/modules/rlm_ldap/rlm_ldap.h b/src/modules/rlm_ldap/rlm_ldap.h index 73958ca0b4a..61c7cbcf4e4 100644 --- a/src/modules/rlm_ldap/rlm_ldap.h +++ b/src/modules/rlm_ldap/rlm_ldap.h @@ -36,7 +36,7 @@ typedef struct { /* * RADIUS attribute to LDAP attribute maps */ - fr_map_list_t user_map; //!< Attribute map applied to users and profiles. + map_list_t user_map; //!< Attribute map applied to users and profiles. /* * Options diff --git a/src/modules/rlm_radius/rlm_radius.c b/src/modules/rlm_radius/rlm_radius.c index 45112c76d1d..05306d36155 100644 --- a/src/modules/rlm_radius/rlm_radius.c +++ b/src/modules/rlm_radius/rlm_radius.c @@ -327,10 +327,10 @@ static int status_check_update_parse(TALLOC_CTX *ctx, void *out, UNUSED void *pa int rcode; CONF_SECTION *cs; char const *name2; - fr_map_list_t *head = (fr_map_list_t *)out; + map_list_t *head = (map_list_t *)out; fr_assert(cf_item_is_section(ci)); - fr_dlist_map_init(head); + map_list_init(head); cs = cf_item_to_section(ci); name2 = cf_section_name2(cs); @@ -349,7 +349,7 @@ static int status_check_update_parse(TALLOC_CTX *ctx, void *out, UNUSED void *pa rcode = map_afrom_cs(ctx, head, cs, &parse_rules, &parse_rules, unlang_fixup_update, NULL, 128); if (rcode < 0) return -1; /* message already printed */ - if (fr_dlist_map_empty(head)) { + if (map_list_empty(head)) { cf_log_err(cs, "'update' sections cannot be empty"); return -1; } diff --git a/src/modules/rlm_radius/rlm_radius.h b/src/modules/rlm_radius/rlm_radius.h index 0f5a401cc16..caf0a3500ae 100644 --- a/src/modules/rlm_radius/rlm_radius.h +++ b/src/modules/rlm_radius/rlm_radius.h @@ -69,7 +69,7 @@ struct rlm_radius_s { uint32_t proxy_state; //!< Unique ID (mostly) of this module. uint32_t *types; //!< array of allowed packet types uint32_t status_check; //!< code of status-check type - fr_map_list_t status_check_map; //!< attributes for the status-server checks + map_list_t status_check_map; //!< attributes for the status-server checks uint32_t num_answers_to_alive; //!< How many status check responses we need to ///< mark the connection as alive. diff --git a/src/modules/rlm_radius/rlm_radius_udp.c b/src/modules/rlm_radius/rlm_radius_udp.c index c890b111882..d1e141edc9f 100644 --- a/src/modules/rlm_radius/rlm_radius_udp.c +++ b/src/modules/rlm_radius/rlm_radius_udp.c @@ -370,7 +370,7 @@ static void CC_HINT(nonnull) status_check_alloc(udp_handle_t *h) * Create the VPs, and ignore any errors * creating them. */ - while ((map = fr_dlist_map_next(&inst->parent->status_check_map, map))) { + while ((map = map_list_next(&inst->parent->status_check_map, map))) { /* * Skip things which aren't attributes. */ diff --git a/src/modules/rlm_smtp/rlm_smtp.c b/src/modules/rlm_smtp/rlm_smtp.c index 36095527313..513fe0b57bc 100644 --- a/src/modules/rlm_smtp/rlm_smtp.c +++ b/src/modules/rlm_smtp/rlm_smtp.c @@ -76,7 +76,7 @@ typedef struct { char const *name; //!< Auth-Type value for this module instance. fr_dict_enum_value_t *auth_type; - fr_map_list_t header_maps; //!< Attribute map used to process header elements + map_list_t header_maps; //!< Attribute map used to process header elements bool set_date; } rlm_smtp_t; @@ -547,7 +547,7 @@ static int header_source(rlm_smtp_thread_t *t, fr_mail_ctx_t *uctx, rlm_smtp_t c * Initialize the sbuff for writing the config elements as header attributes */ fr_sbuff_init_talloc(uctx, &conf_buffer, &conf_ctx, 256, SIZE_MAX); - conf_map = fr_dlist_map_head(&inst->header_maps); + conf_map = map_list_head(&inst->header_maps); /* * Load in all of the header elements supplied in the config @@ -571,10 +571,10 @@ static int header_source(rlm_smtp_thread_t *t, fr_mail_ctx_t *uctx, rlm_smtp_t c next: /* Check if there are more values to parse */ - if (!fr_dlist_map_next(&inst->header_maps, conf_map)) break; + if (!map_list_next(&inst->header_maps, conf_map)) break; /* reinitialize the buffer and move to the next value */ fr_sbuff_init_talloc(uctx, &conf_buffer, &conf_ctx, 256, SIZE_MAX); - conf_map = fr_dlist_map_next(&inst->header_maps, conf_map); + conf_map = map_list_next(&inst->header_maps, conf_map); } /* Add the FROM: line */ @@ -1045,7 +1045,7 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) CONF_SECTION *conf = mctx->inst->conf; CONF_SECTION *header; - fr_dlist_map_init(&inst->header_maps); + map_list_init(&inst->header_maps); header = cf_section_find(conf, "header", NULL); if (!header) return 0; diff --git a/src/modules/rlm_sql/rlm_sql.c b/src/modules/rlm_sql/rlm_sql.c index b19fd0f428f..a8e29a1b5d4 100644 --- a/src/modules/rlm_sql/rlm_sql.c +++ b/src/modules/rlm_sql/rlm_sql.c @@ -356,7 +356,7 @@ static int _sql_map_proc_get_value(TALLOC_CTX *ctx, fr_pair_list_t *out, * Verify the result of the map. */ static int sql_map_verify(CONF_SECTION *cs, UNUSED void *mod_inst, UNUSED void *proc_inst, - tmpl_t const *src, UNUSED fr_map_list_t const *maps) + tmpl_t const *src, UNUSED map_list_t const *maps) { if (!src) { cf_log_err(cs, "Missing SQL query"); @@ -380,7 +380,7 @@ static int sql_map_verify(CONF_SECTION *cs, UNUSED void *mod_inst, UNUSED void * * - #RLM_MODULE_FAIL if a fault occurred. */ static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_t *request, - fr_value_box_list_t *query, fr_map_list_t const *maps) + fr_value_box_list_t *query, map_list_t const *maps) { rlm_sql_t *inst = talloc_get_type_abort(mod_inst, rlm_sql_t); rlm_sql_handle_t *handle = NULL; @@ -486,9 +486,9 @@ static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_ * faster than building a radix tree each time the * map set is evaluated (map->rhs can be dynamic). */ - for (map = fr_dlist_map_head(maps), i = 0; + for (map = map_list_head(maps), i = 0; map && (i < MAX_SQL_FIELD_INDEX); - map = fr_dlist_map_next(maps, map), i++) { + map = map_list_next(maps, map), i++) { /* * Expand the RHS to get the name of the SQL field */ @@ -525,9 +525,9 @@ static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_ */ while (((ret = rlm_sql_fetch_row(&row, inst, request, &handle)) == RLM_SQL_OK)) { rows++; - for (map = fr_dlist_map_head(maps), j = 0; + for (map = map_list_head(maps), j = 0; map && (j < MAX_SQL_FIELD_INDEX); - map = fr_dlist_map_next(maps, map), j++) { + map = map_list_next(maps, map), j++) { if (field_index[j] < 0) continue; /* We didn't find the map RHS in the field set */ if (map_to_request(request, map, _sql_map_proc_get_value, row[field_index[j]]) < 0) goto error; }