From: Arran Cudbard-Bell Date: Thu, 19 Jul 2018 16:03:52 +0000 (-0400) Subject: Move value box field names out of dict.c X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ab2730f4cfdaedaaca0a337db0df1531fa117dc;p=thirdparty%2Ffreeradius-server.git Move value box field names out of dict.c --- diff --git a/src/bin/radict.c b/src/bin/radict.c index 2620adca3ff..79ef1495234 100644 --- a/src/bin/radict.c +++ b/src/bin/radict.c @@ -133,7 +133,7 @@ static void da_print_info_td(fr_dict_t const *dict, fr_dict_attr_t const *da) /* Protocol Name Type */ printf("%s\t%s\t%s\t%s\t%s\n", fr_dict_root(dict)->name, oid_str, da->name, - fr_int2str(dict_attr_types, da->type, "?Unknown?"), flags); + fr_int2str(fr_value_box_type_names, da->type, "?Unknown?"), flags); } static void _fr_dict_export(uint64_t *count, uintptr_t *low, uintptr_t *high, fr_dict_attr_t const *da, unsigned int lvl) diff --git a/src/lib/json/json.c b/src/lib/json/json.c index e57325f67f2..c54e059731d 100644 --- a/src/lib/json/json.c +++ b/src/lib/json/json.c @@ -397,7 +397,7 @@ const char *fr_json_afrom_pair_list(TALLOC_CTX *ctx, VALUE_PAIR **vps, const cha MEM(vp_object = json_object_new_object()); json_object_object_add(obj, name_with_prefix, vp_object); - MEM(type_name = json_object_new_string(fr_int2str(dict_attr_types, vp->vp_type, ""))); + MEM(type_name = json_object_new_string(fr_int2str(fr_value_box_type_names, vp->vp_type, ""))); json_object_object_add(vp_object, "type", type_name); MEM(values = json_object_new_array()); diff --git a/src/lib/server/cf_parse.c b/src/lib/server/cf_parse.c index 0ecf5aa77eb..3378d0254a1 100644 --- a/src/lib/server/cf_parse.c +++ b/src/lib/server/cf_parse.c @@ -423,7 +423,7 @@ int cf_pair_parse_value(TALLOC_CTX *ctx, void *out, UNUSED void *base, CONF_ITEM rad_assert(type < FR_TYPE_MAX); cf_log_err(cp, "type '%s' (%i) is not supported in the configuration files", - fr_int2str(dict_attr_types, type, "?Unknown?"), type); + fr_int2str(fr_value_box_type_names, type, "?Unknown?"), type); rcode = -1; goto error; } diff --git a/src/lib/server/command.c b/src/lib/server/command.c index 56b5437f4e9..ddb886af5dd 100644 --- a/src/lib/server/command.c +++ b/src/lib/server/command.c @@ -230,7 +230,7 @@ static bool fr_command_valid_syntax(fr_cmd_argv_t *argv) if (uppercase) { fr_type_t type; - type = fr_str2int(dict_attr_types, argv->name, FR_TYPE_INVALID); + type = fr_str2int(fr_value_box_type_names, argv->name, FR_TYPE_INVALID); switch (type) { case FR_TYPE_ABINARY: case FR_TYPE_VALUE_BOX: diff --git a/src/lib/server/cond_eval.c b/src/lib/server/cond_eval.c index ede8307cdf3..dca20322877 100644 --- a/src/lib/server/cond_eval.c +++ b/src/lib/server/cond_eval.c @@ -393,8 +393,8 @@ static int cond_normalise_and_cmp(REQUEST *request, fr_cond_t const *c, fr_value do {\ if ((cast_type != FR_TYPE_INVALID) && _s && (_s ->type != FR_TYPE_INVALID) && (cast_type != _s->type)) {\ EVAL_DEBUG("CASTING " #_s " FROM %s TO %s",\ - fr_int2str(dict_attr_types, _s->type, ""),\ - fr_int2str(dict_attr_types, cast_type, ""));\ + fr_int2str(fr_value_box_type_names, _s->type, ""),\ + fr_int2str(fr_value_box_type_names, cast_type, ""));\ if (fr_value_box_cast(request, &_s ## _cast, cast_type, cast, _s) < 0) {\ RPEDEBUG("Failed casting " #_s " operand");\ rcode = -1;\ @@ -440,7 +440,7 @@ do {\ cast = map->lhs->tmpl_da; EVAL_DEBUG("NORMALISATION TYPE %s (PAIRCMP TYPE)", - fr_int2str(dict_attr_types, cast->type, "")); + fr_int2str(fr_value_box_type_names, cast->type, "")); /* * Otherwise we use the explicit cast, or implicit * cast (from an attribute reference). @@ -450,23 +450,23 @@ do {\ } else if (c->cast) { cast = c->cast; EVAL_DEBUG("NORMALISATION TYPE %s (EXPLICIT CAST)", - fr_int2str(dict_attr_types, cast->type, "")); + fr_int2str(fr_value_box_type_names, cast->type, "")); } else if (map->lhs->type == TMPL_TYPE_ATTR) { cast = map->lhs->tmpl_da; EVAL_DEBUG("NORMALISATION TYPE %s (IMPLICIT FROM LHS REF)", - fr_int2str(dict_attr_types, cast->type, "")); + fr_int2str(fr_value_box_type_names, cast->type, "")); } else if (map->rhs->type == TMPL_TYPE_ATTR) { cast = map->rhs->tmpl_da; EVAL_DEBUG("NORMALISATION TYPE %s (IMPLICIT FROM RHS REF)", - fr_int2str(dict_attr_types, cast->type, "")); + fr_int2str(fr_value_box_type_names, cast->type, "")); } else if (map->lhs->type == TMPL_TYPE_DATA) { cast_type = map->lhs->tmpl_value_type; EVAL_DEBUG("NORMALISATION TYPE %s (IMPLICIT FROM LHS DATA)", - fr_int2str(dict_attr_types, cast_type, "")); + fr_int2str(fr_value_box_type_names, cast_type, "")); } else if (map->rhs->type == TMPL_TYPE_DATA) { cast_type = map->rhs->tmpl_value_type; EVAL_DEBUG("NORMALISATION TYPE %s (IMPLICIT FROM RHS DATA)", - fr_int2str(dict_attr_types, cast_type, "")); + fr_int2str(fr_value_box_type_names, cast_type, "")); } if (cast) cast_type = cast->type; diff --git a/src/lib/server/cond_tokenize.c b/src/lib/server/cond_tokenize.c index 544eddc4b45..7a64c4a57f1 100644 --- a/src/lib/server/cond_tokenize.c +++ b/src/lib/server/cond_tokenize.c @@ -71,7 +71,7 @@ next: case COND_TYPE_EXISTS: rad_assert(c->data.vpt != NULL); if (c->cast) { - len = snprintf(p, end - p, "<%s>", fr_int2str(dict_attr_types, + len = snprintf(p, end - p, "<%s>", fr_int2str(fr_value_box_type_names, c->cast->type, "??")); p += len; } @@ -86,7 +86,7 @@ next: *(p++) = '['; /* for extra-clear debugging */ #endif if (c->cast) { - len = snprintf(p, end - p, "<%s>", fr_int2str(dict_attr_types, c->cast->type, "??")); + len = snprintf(p, end - p, "<%s>", fr_int2str(fr_value_box_type_names, c->cast->type, "??")); RETURN_IF_TRUNCATED(p, len, end - p); } @@ -302,7 +302,7 @@ static ssize_t cond_tokenize_cast(char const *start, fr_dict_attr_t const **pda, q = p; while (*q && *q != '>') q++; - cast = fr_substr2int(dict_attr_types, p, FR_TYPE_INVALID, q - p); + cast = fr_substr2int(fr_value_box_type_names, p, FR_TYPE_INVALID, q - p); if (cast == FR_TYPE_INVALID) { *error = "Invalid data type in cast"; return -(p - start); diff --git a/src/lib/server/snmp.c b/src/lib/server/snmp.c index 17e9dd05e5b..cd8ec86156f 100644 --- a/src/lib/server/snmp.c +++ b/src/lib/server/snmp.c @@ -620,7 +620,7 @@ static ssize_t snmp_process_index_attr(fr_cursor_t *out, REQUEST *request, if (tlv_stack[depth]->type != FR_TYPE_UINT32) { fr_strerror_printf("Bad index attribute: Index attribute \"%s\" should be a integer, " "but is a %s", tlv_stack[depth]->name, - fr_int2str(dict_attr_types, tlv_stack[depth]->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, tlv_stack[depth]->type, "?Unknown?")); goto error; } diff --git a/src/lib/server/tmpl.c b/src/lib/server/tmpl.c index 7c507bbf763..a508e80cda1 100644 --- a/src/lib/server/tmpl.c +++ b/src/lib/server/tmpl.c @@ -1370,8 +1370,8 @@ int tmpl_define_undefined_attr(fr_dict_t *dict_def, vp_tmpl_t *vpt, if (type != da->type) { fr_strerror_printf("Attribute %s of type %s already defined with type %s", - da->name, fr_int2str(dict_attr_types, type, ""), - fr_int2str(dict_attr_types, da->type, "")); + da->name, fr_int2str(fr_value_box_type_names, type, ""), + fr_int2str(fr_value_box_type_names, da->type, "")); return -1; } @@ -2570,7 +2570,7 @@ void tmpl_verify(char const *file, int line, vp_tmpl_t const *vpt) FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: TMPL_TYPE_ATTR " "attribute \"%s\" (%s) not found in global dictionary", file, line, vpt->tmpl_da->name, - fr_int2str(dict_attr_types, vpt->tmpl_da->type, "")); + fr_int2str(fr_value_box_type_names, vpt->tmpl_da->type, "")); if (!fr_cond_assert(0)) fr_exit_now(1); } @@ -2580,7 +2580,7 @@ void tmpl_verify(char const *file, int line, vp_tmpl_t const *vpt) FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: TMPL_TYPE_ATTR " "attribute \"%s\" variant (%s) not found in global dictionary", file, line, vpt->tmpl_da->name, - fr_int2str(dict_attr_types, vpt->tmpl_da->type, "")); + fr_int2str(fr_value_box_type_names, vpt->tmpl_da->type, "")); if (!fr_cond_assert(0)) fr_exit_now(1); } } @@ -2591,9 +2591,9 @@ void tmpl_verify(char const *file, int line, vp_tmpl_t const *vpt) "and global dictionary pointer %p \"%s\" (%s) differ", file, line, vpt->tmpl_da, vpt->tmpl_da->name, - fr_int2str(dict_attr_types, vpt->tmpl_da->type, ""), + fr_int2str(fr_value_box_type_names, vpt->tmpl_da->type, ""), da, da->name, - fr_int2str(dict_attr_types, da->type, "")); + fr_int2str(fr_value_box_type_names, da->type, "")); if (!fr_cond_assert(0)) fr_exit_now(1); } } diff --git a/src/lib/server/xlat_func.c b/src/lib/server/xlat_func.c index 162feaed7fb..2e39cdb9d9a 100644 --- a/src/lib/server/xlat_func.c +++ b/src/lib/server/xlat_func.c @@ -224,7 +224,7 @@ static ssize_t xlat_integer(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen, break; } - REDEBUG("Type '%s' cannot be converted to integer", fr_int2str(dict_attr_types, vp->vp_type, "???")); + REDEBUG("Type '%s' cannot be converted to integer", fr_int2str(fr_value_box_type_names, vp->vp_type, "???")); return -1; } @@ -360,7 +360,7 @@ static ssize_t xlat_debug_attr(UNUSED TALLOC_CTX *ctx, UNUSED char **out, UNUSED vendor = fr_dict_vendor_by_da(vp->da); if (vendor) RIDEBUG2("Vendor : %i (%s)", vendor->pen, vendor->name); - RIDEBUG2("Type : %s", fr_int2str(dict_attr_types, vp->vp_type, "")); + RIDEBUG2("Type : %s", fr_int2str(fr_value_box_type_names, vp->vp_type, "")); switch (vp->vp_type) { case FR_TYPE_VARIABLE_SIZE: @@ -373,7 +373,7 @@ static ssize_t xlat_debug_attr(UNUSED TALLOC_CTX *ctx, UNUSED char **out, UNUSED if (!RDEBUG_ENABLED4) continue; - type = dict_attr_types; + type = fr_value_box_type_names; while (type->name) { int pad; diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index 79e6446dd0c..055769bc733 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -675,7 +675,7 @@ static bool pass2_cond_callback(void *ctx, fr_cond_t *c) if (tmpl_cast_in_place(map->rhs, map->lhs->tmpl_da->type, map->lhs->tmpl_da) < 0) { cf_log_err(map->ci, "Failed to parse data type %s from string: %s", - fr_int2str(dict_attr_types, map->lhs->tmpl_da->type, ""), + fr_int2str(fr_value_box_type_names, map->lhs->tmpl_da->type, ""), map->rhs->name); return false; } /* else the cast was successful */ @@ -1239,8 +1239,8 @@ int unlang_fixup_update(vp_map_t *map, UNUSED void *ctx) */ if (tmpl_cast_in_place(map->rhs, map->lhs->tmpl_da->type, map->lhs->tmpl_da) < 0) { cf_log_perr(map->ci, "Cannot convert RHS value (%s) to LHS attribute type (%s)", - fr_int2str(dict_attr_types, FR_TYPE_STRING, ""), - fr_int2str(dict_attr_types, map->lhs->tmpl_da->type, "")); + fr_int2str(fr_value_box_type_names, FR_TYPE_STRING, ""), + fr_int2str(fr_value_box_type_names, map->lhs->tmpl_da->type, "")); return -1; } @@ -1254,7 +1254,7 @@ int unlang_fixup_update(vp_map_t *map, UNUSED void *ctx) da = fr_dict_attr_by_type(map->lhs->tmpl_da, map->rhs->tmpl_value_type); if (!da) { fr_strerror_printf("Cannot find %s variant of attribute \"%s\"", - fr_int2str(dict_attr_types, map->rhs->tmpl_value_type, + fr_int2str(fr_value_box_type_names, map->rhs->tmpl_value_type, ""), map->lhs->tmpl_da->name); return -1; } diff --git a/src/lib/util/dict.c b/src/lib/util/dict.c index de14691f202..38f59b44688 100644 --- a/src/lib/util/dict.c +++ b/src/lib/util/dict.c @@ -112,71 +112,6 @@ struct fr_dict { ///< in the dictionary. }; -/** Map data types to names representing those types - */ -FR_NAME_NUMBER const dict_attr_types[] = { - { "string", FR_TYPE_STRING }, - { "octets", FR_TYPE_OCTETS }, - - { "ipaddr", FR_TYPE_IPV4_ADDR }, - { "ipv4prefix", FR_TYPE_IPV4_PREFIX }, - { "ipv6addr", FR_TYPE_IPV6_ADDR }, - { "ipv6prefix", FR_TYPE_IPV6_PREFIX }, - { "ifid", FR_TYPE_IFID }, - { "combo-ip", FR_TYPE_COMBO_IP_ADDR }, - { "combo-prefix", FR_TYPE_COMBO_IP_PREFIX }, - { "ether", FR_TYPE_ETHERNET }, - - { "bool", FR_TYPE_BOOL }, - - { "uint8", FR_TYPE_UINT8 }, - { "uint16", FR_TYPE_UINT16 }, - { "uint32", FR_TYPE_UINT32 }, - { "uint64", FR_TYPE_UINT64 }, - - { "int8", FR_TYPE_INT8 }, - { "int16", FR_TYPE_INT16 }, - { "int32", FR_TYPE_INT32 }, - { "int64", FR_TYPE_INT64 }, - - { "float32", FR_TYPE_FLOAT32 }, - { "float64", FR_TYPE_FLOAT64 }, - - { "timeval", FR_TYPE_TIMEVAL }, - { "date", FR_TYPE_DATE }, - { "date_milliseconds", FR_TYPE_DATE_MILLISECONDS }, - { "date_microseconds", FR_TYPE_DATE_MICROSECONDS }, - { "date_nanoseconds", FR_TYPE_DATE_NANOSECONDS }, - - { "abinary", FR_TYPE_ABINARY }, - - { "size", FR_TYPE_SIZE }, - - { "tlv", FR_TYPE_TLV }, - { "struct", FR_TYPE_STRUCT }, - - { "extended", FR_TYPE_EXTENDED }, - { "long-extended", FR_TYPE_LONG_EXTENDED }, - - { "vsa", FR_TYPE_VSA }, - { "evs", FR_TYPE_EVS }, - { "vendor", FR_TYPE_VENDOR }, - { "group", FR_TYPE_GROUP }, - - /* - * Alternative names - */ - { "cidr", FR_TYPE_IPV4_PREFIX }, - { "byte", FR_TYPE_UINT8 }, - { "short", FR_TYPE_UINT16 }, - { "integer", FR_TYPE_UINT32 }, - { "integer64", FR_TYPE_UINT64 }, - { "decimal", FR_TYPE_FLOAT64 }, - { "signed", FR_TYPE_INT32 }, - - { NULL, 0 } -}; - /** Map data types to min / max data sizes */ size_t const dict_attr_sizes[FR_TYPE_MAX + 1][2] = { @@ -803,7 +738,7 @@ static bool dict_attr_fields_valid(fr_dict_t *dict, fr_dict_attr_t const *parent switch (type) { default: fr_strerror_printf("The 'array' flag cannot be used with attributes of type '%s'", - fr_int2str(dict_attr_types, type, "")); + fr_int2str(fr_value_box_type_names, type, "")); goto error; case FR_TYPE_IPV4_ADDR: @@ -882,7 +817,7 @@ static bool dict_attr_fields_valid(fr_dict_t *dict, fr_dict_attr_t const *parent case FR_TYPE_EVS: fr_strerror_printf("The 'encrypt=%d' flag cannot be used with attributes " "of type '%s'", flags->encrypt, - fr_int2str(dict_attr_types, type, "")); + fr_int2str(fr_value_box_type_names, type, "")); goto error; default: @@ -900,7 +835,7 @@ static bool dict_attr_fields_valid(fr_dict_t *dict, fr_dict_attr_t const *parent default: encrypt_fail: fr_strerror_printf("The 'encrypt' flag cannot be used with attributes of type '%s'", - fr_int2str(dict_attr_types, type, "")); + fr_int2str(fr_value_box_type_names, type, "")); goto error; case FR_TYPE_IPV4_ADDR: @@ -927,7 +862,7 @@ static bool dict_attr_fields_valid(fr_dict_t *dict, fr_dict_attr_t const *parent // case FR_TYPE_VSA: if (!parent->flags.is_root) { fr_strerror_printf("Attributes of type '%s' can only be used in the RFC space", - fr_int2str(dict_attr_types, type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, type, "?Unknown?")); goto error; } break; @@ -938,7 +873,7 @@ static bool dict_attr_fields_valid(fr_dict_t *dict, fr_dict_attr_t const *parent case FR_TYPE_EVS: if ((parent->type != FR_TYPE_EXTENDED) && (parent->type != FR_TYPE_LONG_EXTENDED)) { fr_strerror_printf("Attributes of type 'evs' MUST have a parent of type 'extended', " - "instead of '%s'", fr_int2str(dict_attr_types, parent->type, "?Unknown?")); + "instead of '%s'", fr_int2str(fr_value_box_type_names, parent->type, "?Unknown?")); goto error; } break; @@ -947,7 +882,7 @@ static bool dict_attr_fields_valid(fr_dict_t *dict, fr_dict_attr_t const *parent if ((parent->type != FR_TYPE_VSA) && (parent->type != FR_TYPE_EVS)) { fr_strerror_printf("Attributes of type 'vendor' MUST have a parent of type 'vsa' or " "'evs', instead of '%s'", - fr_int2str(dict_attr_types, parent->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, parent->type, "?Unknown?")); goto error; } @@ -983,7 +918,7 @@ static bool dict_attr_fields_valid(fr_dict_t *dict, fr_dict_attr_t const *parent */ if (!v) { fr_strerror_printf("Attributes of type '%s' require a parent attribute", - fr_int2str(dict_attr_types, type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, type, "?Unknown?")); goto error; } @@ -1007,7 +942,7 @@ static bool dict_attr_fields_valid(fr_dict_t *dict, fr_dict_attr_t const *parent if (!v) { fr_strerror_printf("Attributes of type '%s' can only be used in VSA dictionaries", - fr_int2str(dict_attr_types, type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, type, "?Unknown?")); goto error; } break; @@ -1017,7 +952,7 @@ static bool dict_attr_fields_valid(fr_dict_t *dict, fr_dict_attr_t const *parent case FR_TYPE_FLOAT64: case FR_TYPE_COMBO_IP_PREFIX: fr_strerror_printf("Attributes of type '%s' cannot be used in dictionaries", - fr_int2str(dict_attr_types, type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, type, "?Unknown?")); goto error; default: @@ -1668,7 +1603,7 @@ static int dict_attr_ref_add(fr_dict_t *dict, fr_dict_attr_t const *parent, */ if (!ref->flags.is_root && (ref->type != FR_TYPE_TLV)) { fr_strerror_printf("Referenced attribute \"%s\" must be of type '%s' not a 'tlv'", ref->name, - fr_int2str(dict_attr_types, ref->type, "")); + fr_int2str(fr_value_box_type_names, ref->type, "")); return -1; } @@ -1677,7 +1612,7 @@ static int dict_attr_ref_add(fr_dict_t *dict, fr_dict_attr_t const *parent, */ if (type != FR_TYPE_TLV) { fr_strerror_printf("Reference attribute must be of type 'tlv', not type '%s'", - fr_int2str(dict_attr_types, type, "")); + fr_int2str(fr_value_box_type_names, type, "")); return -1; } @@ -1815,16 +1750,16 @@ int fr_dict_enum_add_alias(fr_dict_attr_t const *da, char const *alias, if (!coerce) { fr_strerror_printf("%s: Type mismatch between attribute (%s) and enum (%s)", __FUNCTION__, - fr_int2str(dict_attr_types, da->type, ""), - fr_int2str(dict_attr_types, value->type, "")); + fr_int2str(fr_value_box_type_names, da->type, ""), + fr_int2str(fr_value_box_type_names, value->type, "")); return -1; } if (fr_value_box_cast(enumv, enum_value, da->type, NULL, value) < 0) { fr_strerror_printf_push("%s: Failed coercing enum type (%s) to attribute type (%s)", __FUNCTION__, - fr_int2str(dict_attr_types, value->type, ""), - fr_int2str(dict_attr_types, da->type, "")); + fr_int2str(fr_value_box_type_names, value->type, ""), + fr_int2str(fr_value_box_type_names, da->type, "")); return -1; } @@ -1945,7 +1880,7 @@ int fr_dict_enum_add_alias_next(fr_dict_attr_t const *da, char const *alias) default: fr_strerror_printf("Attribute is wrong type for auto-numbering, expected numeric type, got %s", - fr_int2str(dict_attr_types, da->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, da->type, "?Unknown?")); return -1; } @@ -2177,7 +2112,7 @@ int fr_dict_unknown_vendor_afrom_num(TALLOC_CTX *ctx, fr_dict_attr_t **out, default: fr_strerror_printf("Unknown vendors can only be parented by 'vsa' or 'evs' " - "attributes, not '%s'", fr_int2str(dict_attr_types, parent->type, "?Unknown?")); + "attributes, not '%s'", fr_int2str(fr_value_box_type_names, parent->type, "?Unknown?")); return -1; } } @@ -2409,7 +2344,7 @@ ssize_t fr_dict_unknown_afrom_oid_str(TALLOC_CTX *ctx, fr_dict_attr_t **out, fr_strerror_printf("Parent OID component (%s) in \"%.*s\" specified a " "non-structural type (%s)", our_parent->name, (int)(p - oid_str), oid_str, - fr_int2str(dict_attr_types, our_parent->type, "")); + fr_int2str(fr_value_box_type_names, our_parent->type, "")); goto error; } } @@ -2630,7 +2565,7 @@ void fr_dict_print(fr_dict_attr_t const *da, int depth) printf("%u%.*s%s \"%s\" vendor: %x (%u), num: %x (%u), type: %s, flags: %s\n", da->depth, depth, "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t", name, da->name, fr_dict_vendor_num_by_da(da), fr_dict_vendor_num_by_da(da), da->attr, da->attr, - fr_int2str(dict_attr_types, da->type, "?Unknown?"), buff); + fr_int2str(fr_value_box_type_names, da->type, "?Unknown?"), buff); if (da->children) for (i = 0; i < talloc_array_length(da->children); i++) { if (da->children[i]) { @@ -3196,9 +3131,9 @@ fr_dict_attr_t const *fr_dict_vendor_attr_by_num(fr_dict_attr_t const *vendor_ro default: fr_strerror_printf("Wrong type for vendor root, expected '%s' or '%s' got '%s'", - fr_int2str(dict_attr_types, FR_TYPE_VSA, ""), - fr_int2str(dict_attr_types, FR_TYPE_EVS, ""), - fr_int2str(dict_attr_types, vendor_root->type, "")); + fr_int2str(fr_value_box_type_names, FR_TYPE_VSA, ""), + fr_int2str(fr_value_box_type_names, FR_TYPE_EVS, ""), + fr_int2str(fr_value_box_type_names, vendor_root->type, "")); return NULL; } @@ -3210,8 +3145,8 @@ fr_dict_attr_t const *fr_dict_vendor_attr_by_num(fr_dict_attr_t const *vendor_ro if (vendor->type != FR_TYPE_VENDOR) { fr_strerror_printf("Wrong type for vendor, expected '%s' got '%s'", - fr_int2str(dict_attr_types, vendor->type, ""), - fr_int2str(dict_attr_types, FR_TYPE_VENDOR, "")); + fr_int2str(fr_value_box_type_names, vendor->type, ""), + fr_int2str(fr_value_box_type_names, FR_TYPE_VENDOR, "")); return NULL; } @@ -3934,7 +3869,7 @@ static int dict_read_process_attribute(fr_dict_t *dict, fr_dict_attr_t const *pa /* * find the type of the attribute. */ - type = fr_str2int(dict_attr_types, argv[2], -1); + type = fr_str2int(fr_value_box_type_names, argv[2], -1); if (type < 0) { fr_strerror_printf("Unknown data type '%s'", argv[2]); return -1; @@ -4115,7 +4050,7 @@ static int dict_read_process_named_attribute(fr_dict_t *dict, fr_dict_attr_t con /* * find the type of the attribute. */ - type = fr_str2int(dict_attr_types, argv[1], -1); + type = fr_str2int(fr_value_box_type_names, argv[1], -1); if (type < 0) { fr_strerror_printf("Unknown data type '%s'", argv[1]); return -1; @@ -4774,7 +4709,7 @@ static int _dict_from_file(dict_from_file_ctx_t *ctx, if (da->type != FR_TYPE_TLV) { fr_strerror_printf_push("Attribute '%s' should be a 'tlv', but is a '%s'", argv[1], - fr_int2str(dict_attr_types, da->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, da->type, "?Unknown?")); goto error; } @@ -4864,7 +4799,7 @@ static int _dict_from_file(dict_from_file_ctx_t *ctx, if (da->type != FR_TYPE_EVS) { fr_strerror_printf_push("Invalid format for BEGIN-VENDOR. " "Attribute '%s' should be 'evs' but is '%s'", p, - fr_int2str(dict_attr_types, da->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, da->type, "?Unknown?")); goto error; } @@ -5037,7 +4972,7 @@ int fr_dict_from_file(fr_dict_t **out, char const *fn) flags.internal = 1; - for (p = dict_attr_types; p->name; p++) { + for (p = fr_value_box_type_names; p->name; p++) { fr_dict_attr_t *n; /* @@ -5174,7 +5109,7 @@ int fr_dict_internal_afrom_file(fr_dict_t **out, char const *dict_subdir) * fr_dict_attr_add(), because we know what we're doing, and * that function does too many checks. */ - for (p = dict_attr_types; p->name; p++) { + for (p = fr_value_box_type_names; p->name; p++) { fr_dict_attr_t *n; /* @@ -5384,8 +5319,8 @@ int fr_dict_attr_autoload(fr_dict_attr_autoload_t const *to_load) if (da->type != p->type) { fr_strerror_printf("Attribute \"%s\" should be type %s, but defined as type %s", da->name, - fr_int2str(dict_attr_types, p->type, "?Unknown?"), - fr_int2str(dict_attr_types, da->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, p->type, "?Unknown?"), + fr_int2str(fr_value_box_type_names, da->type, "?Unknown?")); return -1; } @@ -5468,7 +5403,7 @@ static void _fr_dict_dump(fr_dict_attr_t const *da, unsigned int lvl) fr_dict_snprint_flags(flags, sizeof(flags), &da->flags); printf("[%02i] 0x%016" PRIxPTR "%*s %s(%u) %s %s\n", lvl, (unsigned long)da, lvl * 2, " ", - da->name, da->attr, fr_int2str(dict_attr_types, da->type, ""), flags); + da->name, da->attr, fr_int2str(fr_value_box_type_names, da->type, ""), flags); len = talloc_array_length(da->children); for (i = 0; i < len; i++) { diff --git a/src/lib/util/dict.h b/src/lib/util/dict.h index 8fc48455999..36ebb2d8985 100644 --- a/src/lib/util/dict.h +++ b/src/lib/util/dict.h @@ -38,7 +38,6 @@ extern "C" { */ typedef struct dict_attr fr_dict_attr_t; typedef struct fr_dict fr_dict_t; -extern const FR_NAME_NUMBER dict_attr_types[]; /* Fixme - Should probably move to value.c */ #include diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index 6d529877844..daf6bd8fffd 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -2138,7 +2138,7 @@ int fr_pair_value_from_str(VALUE_PAIR *vp, char const *value, ssize_t inlen, cha da = fr_dict_attr_by_type(vp->da, type); if (!da) { fr_strerror_printf("Cannot find %s variant of attribute \"%s\"", - fr_int2str(dict_attr_types, type, ""), vp->da->name); + fr_int2str(fr_value_box_type_names, type, ""), vp->da->name); return -1; } vp->da = da; @@ -2933,7 +2933,7 @@ inline void fr_pair_verify(char const *file, int line, VALUE_PAIR const *vp) FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: VALUE_PAIR attribute %p \"%s\" (%s) " "not found in global dictionary", file, line, vp->da, vp->da->name, - fr_int2str(dict_attr_types, vp->vp_type, "")); + fr_int2str(fr_value_box_type_names, vp->vp_type, "")); if (!fr_cond_assert(0)) fr_exit_now(1); } @@ -2943,7 +2943,7 @@ inline void fr_pair_verify(char const *file, int line, VALUE_PAIR const *vp) FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: VALUE_PAIR attribute %p \"%s\" " "variant (%s) not found in global dictionary", file, line, vp->da, vp->da->name, - fr_int2str(dict_attr_types, vp->da->type, "")); + fr_int2str(fr_value_box_type_names, vp->da->type, "")); if (!fr_cond_assert(0)) fr_exit_now(1); } } @@ -2954,8 +2954,8 @@ inline void fr_pair_verify(char const *file, int line, VALUE_PAIR const *vp) "dictionary pointer %p \"%s\" (%s) " "and global dictionary pointer %p \"%s\" (%s) differ", file, line, vp->da, vp->da->name, - fr_int2str(dict_attr_types, vp->da->type, ""), - da, da->name, fr_int2str(dict_attr_types, da->type, "")); + fr_int2str(fr_value_box_type_names, vp->da->type, ""), + da, da->name, fr_int2str(fr_value_box_type_names, da->type, "")); if (!fr_cond_assert(0)) fr_exit_now(1); } } @@ -2965,8 +2965,8 @@ inline void fr_pair_verify(char const *file, int line, VALUE_PAIR const *vp) FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: VALUE_PAIR (raw/unknown) attribute %p \"%s\" " "data type incorrect. Expected %s, got %s", file, line, vp->da, vp->da->name, - fr_int2str(dict_attr_types, FR_TYPE_OCTETS, ""), - fr_int2str(dict_attr_types, vp->data.type, "")); + fr_int2str(fr_value_box_type_names, FR_TYPE_OCTETS, ""), + fr_int2str(fr_value_box_type_names, vp->data.type, "")); if (!fr_cond_assert(0)) fr_exit_now(1); } } else if (vp->da->type != vp->data.type) { @@ -2978,8 +2978,8 @@ inline void fr_pair_verify(char const *file, int line, VALUE_PAIR const *vp) FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: VALUE_PAIR attribute %p \"%s\" " "data type (%s) does not match da type (%s)", file, line, vp->da, vp->da->name, - fr_int2str(dict_attr_types, vp->data.type, data_type_int), - fr_int2str(dict_attr_types, vp->da->type, da_type_int)); + fr_int2str(fr_value_box_type_names, vp->data.type, data_type_int), + fr_int2str(fr_value_box_type_names, vp->da->type, da_type_int)); if (!fr_cond_assert(0)) fr_exit_now(1); } } diff --git a/src/lib/util/proto.c b/src/lib/util/proto.c index 345207c24bd..9a05aabc417 100644 --- a/src/lib/util/proto.c +++ b/src/lib/util/proto.c @@ -81,7 +81,7 @@ void fr_proto_tlv_stack_print(char const *file, int line, char const *func, fr_d for (i--; i >= 0; i--) { fprintf(fr_log_fp, "stk: %s%.*s: %s [%i] %s: %s, vendor: 0x%x (%u), attr: 0x%x (%u)\n", prefix, (int)(proto_log_indent - len), spaces, (i == (int)depth) ? ">" : " ", i, - fr_int2str(dict_attr_types, tlv_stack[i]->type, "?Unknown?"), + fr_int2str(fr_value_box_type_names, tlv_stack[i]->type, "?Unknown?"), tlv_stack[i]->name, fr_dict_vendor_num_by_da(tlv_stack[i]), fr_dict_vendor_num_by_da(tlv_stack[i]), tlv_stack[i]->attr, tlv_stack[i]->attr); diff --git a/src/lib/util/value.c b/src/lib/util/value.c index d744e791181..919c42d0a78 100644 --- a/src/lib/util/value.c +++ b/src/lib/util/value.c @@ -93,6 +93,71 @@ static_assert(SIZEOF_MEMBER(fr_value_box_t, vb_float32) == 4, static_assert(SIZEOF_MEMBER(fr_value_box_t, vb_float64) == 8, "vb_float64 has unexpected length"); +/** Map data types to names representing those types + */ +FR_NAME_NUMBER const fr_value_box_type_names[] = { + { "string", FR_TYPE_STRING }, + { "octets", FR_TYPE_OCTETS }, + + { "ipaddr", FR_TYPE_IPV4_ADDR }, + { "ipv4prefix", FR_TYPE_IPV4_PREFIX }, + { "ipv6addr", FR_TYPE_IPV6_ADDR }, + { "ipv6prefix", FR_TYPE_IPV6_PREFIX }, + { "ifid", FR_TYPE_IFID }, + { "combo-ip", FR_TYPE_COMBO_IP_ADDR }, + { "combo-prefix", FR_TYPE_COMBO_IP_PREFIX }, + { "ether", FR_TYPE_ETHERNET }, + + { "bool", FR_TYPE_BOOL }, + + { "uint8", FR_TYPE_UINT8 }, + { "uint16", FR_TYPE_UINT16 }, + { "uint32", FR_TYPE_UINT32 }, + { "uint64", FR_TYPE_UINT64 }, + + { "int8", FR_TYPE_INT8 }, + { "int16", FR_TYPE_INT16 }, + { "int32", FR_TYPE_INT32 }, + { "int64", FR_TYPE_INT64 }, + + { "float32", FR_TYPE_FLOAT32 }, + { "float64", FR_TYPE_FLOAT64 }, + + { "timeval", FR_TYPE_TIMEVAL }, + { "date", FR_TYPE_DATE }, + { "date_milliseconds", FR_TYPE_DATE_MILLISECONDS }, + { "date_microseconds", FR_TYPE_DATE_MICROSECONDS }, + { "date_nanoseconds", FR_TYPE_DATE_NANOSECONDS }, + + { "abinary", FR_TYPE_ABINARY }, + + { "size", FR_TYPE_SIZE }, + + { "tlv", FR_TYPE_TLV }, + { "struct", FR_TYPE_STRUCT }, + + { "extended", FR_TYPE_EXTENDED }, + { "long-extended", FR_TYPE_LONG_EXTENDED }, + + { "vsa", FR_TYPE_VSA }, + { "evs", FR_TYPE_EVS }, + { "vendor", FR_TYPE_VENDOR }, + { "group", FR_TYPE_GROUP }, + + /* + * Alternative names + */ + { "cidr", FR_TYPE_IPV4_PREFIX }, + { "byte", FR_TYPE_UINT8 }, + { "short", FR_TYPE_UINT16 }, + { "integer", FR_TYPE_UINT32 }, + { "integer64", FR_TYPE_UINT64 }, + { "decimal", FR_TYPE_FLOAT64 }, + { "signed", FR_TYPE_INT32 }, + + { NULL, 0 } +}; + /** How many bytes on-the-wire would a #fr_value_box_t value consume * * This is for the generic NETWORK format. For field sizes in the in-memory @@ -1041,7 +1106,7 @@ ssize_t fr_value_box_to_network(size_t *need, uint8_t *dst, size_t dst_len, fr_v if ((min == 0) && (max == 0)) { unsupported: fr_strerror_printf("Cannot encode type \"%s\"", - fr_int2str(dict_attr_types, value->type, "")); + fr_int2str(fr_value_box_type_names, value->type, "")); return -1; } @@ -1177,14 +1242,14 @@ ssize_t fr_value_box_from_network(TALLOC_CTX *ctx, if (len < min) { fr_strerror_printf("Got truncated value parsing type \"%s\". " "Expected length >= %zu bytes, got %zu bytes", - fr_int2str(dict_attr_types, type, ""), + fr_int2str(fr_value_box_type_names, type, ""), min, len); return -1; } if (len > max) { fr_strerror_printf("Found trailing garbage parsing type \"%s\". " "Expected length <= %zu bytes, got %zu bytes", - fr_int2str(dict_attr_types, type, ""), + fr_int2str(fr_value_box_type_names, type, ""), max, len); return -1; } @@ -1265,7 +1330,7 @@ ssize_t fr_value_box_from_network(TALLOC_CTX *ctx, case FR_TYPE_ABINARY: case FR_TYPE_NON_VALUES: fr_strerror_printf("Cannot decode type \"%s\" - Is not a value", - fr_int2str(dict_attr_types, type, "")); + fr_int2str(fr_value_box_type_names, type, "")); break; } @@ -1301,8 +1366,8 @@ static int fr_value_box_fixed_size_from_ocets(fr_value_box_t *dst, if (src->datum.length < fr_value_box_network_sizes[dst_type][0]) { fr_strerror_printf("Invalid cast from %s to %s. Source is length %zd is smaller than " "destination type size %zd", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, ""), + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, ""), src->datum.length, fr_value_box_network_sizes[dst_type][0]); return -1; @@ -1311,8 +1376,8 @@ static int fr_value_box_fixed_size_from_ocets(fr_value_box_t *dst, if (src->datum.length > fr_value_box_network_sizes[dst_type][1]) { fr_strerror_printf("Invalid cast from %s to %s. Source length %zd is greater than " "destination type size %zd", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, ""), + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, ""), src->datum.length, fr_value_box_network_sizes[dst_type][1]); return -1; @@ -1487,8 +1552,8 @@ static inline int fr_value_box_cast_to_ipv4addr(TALLOC_CTX *ctx, fr_value_box_t if (memcmp(src->vb_ip.addr.v6.s6_addr, v4_v6_map, sizeof(v4_v6_map)) != 0) { bad_v6_prefix_map: fr_strerror_printf("Invalid cast from %s to %s. No IPv4-IPv6 mapping prefix", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, "")); + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, "")); return -1; } @@ -1501,8 +1566,8 @@ static inline int fr_value_box_cast_to_ipv4addr(TALLOC_CTX *ctx, fr_value_box_t if (src->vb_ip.prefix != 32) { fr_strerror_printf("Invalid cast from %s to %s. Only /32 (not %i/) prefixes may be " "cast to IP address types", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, ""), + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, ""), src->vb_ip.prefix); return -1; } @@ -1513,8 +1578,8 @@ static inline int fr_value_box_cast_to_ipv4addr(TALLOC_CTX *ctx, fr_value_box_t if (src->vb_ip.prefix != 128) { fr_strerror_printf("Invalid cast from %s to %s. Only /128 (not /%i) prefixes may be " "cast to IP address types", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, ""), + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, ""), src->vb_ip.prefix); return -1; } @@ -1532,8 +1597,8 @@ static inline int fr_value_box_cast_to_ipv4addr(TALLOC_CTX *ctx, fr_value_box_t if (src->datum.length != sizeof(dst->vb_ip.addr.v4.s_addr)) { fr_strerror_printf("Invalid cast from %s to %s. Only %zu uint8 octet strings " "may be cast to IP address types", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, ""), + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, ""), sizeof(dst->vb_ip.addr.v4.s_addr)); return -1; } @@ -1551,8 +1616,8 @@ static inline int fr_value_box_cast_to_ipv4addr(TALLOC_CTX *ctx, fr_value_box_t default: fr_strerror_printf("Invalid cast from %s to %s. Unsupported", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, "")); + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, "")); return -1; } @@ -1597,8 +1662,8 @@ static inline int fr_value_box_cast_to_ipv4prefix(TALLOC_CTX *ctx, fr_value_box_ if (memcmp(src->vb_ip.addr.v6.s6_addr, v4_v6_map, sizeof(v4_v6_map)) != 0) { bad_v6_prefix_map: fr_strerror_printf("Invalid cast from %s to %s. No IPv4-IPv6 mapping prefix", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, "")); + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, "")); return -1; } memcpy(&dst->vb_ip.addr.v4.s_addr, &src->vb_ip.addr.v6.s6_addr[sizeof(v4_v6_map)], @@ -1611,8 +1676,8 @@ static inline int fr_value_box_cast_to_ipv4prefix(TALLOC_CTX *ctx, fr_value_box_ if (src->vb_ip.prefix < (sizeof(v4_v6_map) << 3)) { fr_strerror_printf("Invalid cast from %s to %s. Expected prefix >= %u bits got %u bits", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, ""), + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, ""), (unsigned int)(sizeof(v4_v6_map) << 3), src->vb_ip.prefix); return -1; } @@ -1635,8 +1700,8 @@ static inline int fr_value_box_cast_to_ipv4prefix(TALLOC_CTX *ctx, fr_value_box_ if (src->datum.length != sizeof(dst->vb_ip.addr.v4.s_addr) + 1) { fr_strerror_printf("Invalid cast from %s to %s. Only %zu uint8 octet strings " "may be cast to IP address types", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, ""), + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, ""), sizeof(dst->vb_ip.addr.v4.s_addr) + 1); return -1; } @@ -1656,8 +1721,8 @@ static inline int fr_value_box_cast_to_ipv4prefix(TALLOC_CTX *ctx, fr_value_box_ default: fr_strerror_printf("Invalid cast from %s to %s. Unsupported", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, "")); + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, "")); return -1; } @@ -1712,8 +1777,8 @@ static inline int fr_value_box_cast_to_ipv6addr(TALLOC_CTX *ctx, fr_value_box_t if (src->vb_ip.prefix != 32) { fr_strerror_printf("Invalid cast from %s to %s. Only /32 (not /%i) prefixes may be " "cast to IP address types", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, ""), + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, ""), src->vb_ip.prefix); return -1; } @@ -1730,8 +1795,8 @@ static inline int fr_value_box_cast_to_ipv6addr(TALLOC_CTX *ctx, fr_value_box_t if (src->vb_ip.prefix != 128) { fr_strerror_printf("Invalid cast from %s to %s. Only /128 (not /%i) prefixes may be " "cast to IP address types", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, ""), + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, ""), src->vb_ip.prefix); return -1; } @@ -1749,8 +1814,8 @@ static inline int fr_value_box_cast_to_ipv6addr(TALLOC_CTX *ctx, fr_value_box_t if (src->datum.length != sizeof(dst->vb_ip.addr.v6.s6_addr)) { fr_strerror_printf("Invalid cast from %s to %s. Only %zu uint8 octet strings " "may be cast to IP address types", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, ""), + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, ""), sizeof(dst->vb_ip.addr.v6.s6_addr)); return -1; } @@ -1759,8 +1824,8 @@ static inline int fr_value_box_cast_to_ipv6addr(TALLOC_CTX *ctx, fr_value_box_t default: fr_strerror_printf("Invalid cast from %s to %s. Unsupported", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, "")); + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, "")); break; } @@ -1833,8 +1898,8 @@ static inline int fr_value_box_cast_to_ipv6prefix(TALLOC_CTX *ctx, fr_value_box_ if (src->datum.length != (sizeof(dst->vb_ip.addr.v6.s6_addr) + 2)) { fr_strerror_printf("Invalid cast from %s to %s. Only %zu uint8 octet strings " "may be cast to IP address types", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, ""), + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, ""), sizeof(dst->vb_ip.addr.v6.s6_addr) + 2); return -1; } @@ -1845,8 +1910,8 @@ static inline int fr_value_box_cast_to_ipv6prefix(TALLOC_CTX *ctx, fr_value_box_ default: fr_strerror_printf("Invalid cast from %s to %s. Unsupported", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, "")); + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, "")); return -1; } @@ -1902,8 +1967,8 @@ static inline int fr_value_box_cast_to_ethernet(TALLOC_CTX *ctx, fr_value_box_t default: fr_strerror_printf("Invalid cast from %s to %s. Unsupported", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, "")); + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, "")); return -1; } @@ -1936,8 +2001,8 @@ static inline int fr_value_box_cast_to_bool(TALLOC_CTX *ctx, fr_value_box_t *dst default: fr_strerror_printf("Invalid cast from %s to %s. Unsupported", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, "")); + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, "")); return -1; } @@ -1981,8 +2046,8 @@ static inline int fr_value_box_cast_to_uint8(TALLOC_CTX *ctx, fr_value_box_t *ds default: fr_strerror_printf("Invalid cast from %s to %s. Unsupported", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, "")); + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, "")); return -1; } @@ -2039,8 +2104,8 @@ static inline int fr_value_box_cast_to_uint16(TALLOC_CTX *ctx, fr_value_box_t *d default: fr_strerror_printf("Invalid cast from %s to %s. Unsupported", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, "")); + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, "")); return -1; } @@ -2115,8 +2180,8 @@ static inline int fr_value_box_cast_to_uint32(TALLOC_CTX *ctx, fr_value_box_t *d default: fr_strerror_printf("Invalid cast from %s to %s. Unsupported", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, "")); + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, "")); return -1; } @@ -2205,8 +2270,8 @@ static inline int fr_value_box_cast_to_uint64(TALLOC_CTX *ctx, fr_value_box_t *d default: fr_strerror_printf("Invalid cast from %s to %s. Unsupported", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, "")); + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, "")); return -1; } @@ -2245,8 +2310,8 @@ int fr_value_box_cast(TALLOC_CTX *ctx, fr_value_box_t *dst, if (fr_dict_non_data_types[dst_type]) { fr_strerror_printf("Invalid cast from %s to %s. Can only cast simple data types.", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, "")); + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, "")); return -1; } @@ -2412,8 +2477,8 @@ int fr_value_box_cast(TALLOC_CTX *ctx, fr_value_box_t *dst, default: invalid_cast: fr_strerror_printf("Invalid cast from %s to %s", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, "")); + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, "")); return -1; } goto fixed_length; @@ -2461,8 +2526,8 @@ int fr_value_box_cast(TALLOC_CTX *ctx, fr_value_box_t *dst, if (src->datum.length < fr_value_box_network_sizes[dst_type][0]) { fr_strerror_printf("Invalid cast from %s to %s. Source is length %zd is smaller than " "destination type size %zd", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, ""), + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, ""), src->datum.length, fr_value_box_network_sizes[dst_type][0]); return -1; @@ -2471,8 +2536,8 @@ int fr_value_box_cast(TALLOC_CTX *ctx, fr_value_box_t *dst, if (src->datum.length > fr_value_box_network_sizes[dst_type][1]) { fr_strerror_printf("Invalid cast from %s to %s. Source length %zd is greater than " "destination type size %zd", - fr_int2str(dict_attr_types, src->type, ""), - fr_int2str(dict_attr_types, dst_type, ""), + fr_int2str(fr_value_box_type_names, src->type, ""), + fr_int2str(fr_value_box_type_names, dst_type, ""), src->datum.length, fr_value_box_network_sizes[dst_type][1]); return -1; @@ -2627,7 +2692,7 @@ int fr_value_unbox_ipaddr(fr_ipaddr_t *dst, fr_value_box_t *src) default: fr_strerror_printf("Unboxing failed. Needed IPv4/6 addr/prefix, had type %s", - fr_int2str(dict_attr_types, src->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, src->type, "?Unknown?")); return -1; } @@ -2850,8 +2915,8 @@ int fr_value_box_append_bstr(fr_value_box_t *dst, char const *src, size_t len, b if (dst->type != FR_TYPE_STRING) { fr_strerror_printf("%s: Expected boxed value of type %s, got type %s", __FUNCTION__, - fr_int2str(dict_attr_types, FR_TYPE_STRING, ""), - fr_int2str(dict_attr_types, dst->type, "")); + fr_int2str(fr_value_box_type_names, FR_TYPE_STRING, ""), + fr_int2str(fr_value_box_type_names, dst->type, "")); return -1; } @@ -3131,8 +3196,8 @@ int fr_value_box_append_mem(fr_value_box_t *dst, uint8_t const *src, size_t len, if (dst->type != FR_TYPE_OCTETS) { fr_strerror_printf("%s: Expected boxed value of type %s, got type %s", __FUNCTION__, - fr_int2str(dict_attr_types, FR_TYPE_OCTETS, ""), - fr_int2str(dict_attr_types, dst->type, "")); + fr_int2str(fr_value_box_type_names, FR_TYPE_OCTETS, ""), + fr_int2str(fr_value_box_type_names, dst->type, "")); return -1; } @@ -3365,7 +3430,7 @@ static int fr_value_box_integer_str(fr_value_box_t *dst, fr_type_t dst_type, cha if (uinteger > _type ## _MAX) { \ fr_strerror_printf("Value %" PRIu64 " is invalid for type %s (must be in range " \ "0-%" PRIu64 ")", \ - uinteger, fr_int2str(dict_attr_types, dst_type, ""), \ + uinteger, fr_int2str(fr_value_box_type_names, dst_type, ""), \ (uint64_t) _type ## _MAX); \ return -1; \ } \ @@ -3376,7 +3441,7 @@ static int fr_value_box_integer_str(fr_value_box_t *dst, fr_type_t dst_type, cha if ((sinteger > _type ## _MAX) || (sinteger < _type ## _MIN)) { \ fr_strerror_printf("Value %" PRIu64 " is invalid for type %s (must be in range " \ "%" PRIu64 "-%" PRIu64 ")", \ - sinteger, fr_int2str(dict_attr_types, dst_type, ""), \ + sinteger, fr_int2str(fr_value_box_type_names, dst_type, ""), \ (int64_t) _type ## _MIN, (int64_t) _type ## _MAX); \ return -1; \ } \ @@ -4147,7 +4212,7 @@ int fr_value_box_list_concat(TALLOC_CTX *ctx, default: fr_strerror_printf("Invalid argument. Can't concatenate boxes to type %s", - fr_int2str(dict_attr_types, type, "")); + fr_int2str(fr_value_box_type_names, type, "")); return -1; } diff --git a/src/lib/util/value.h b/src/lib/util/value.h index 311e72b6133..7318e5622cb 100644 --- a/src/lib/util/value.h +++ b/src/lib/util/value.h @@ -41,6 +41,7 @@ typedef struct value_box fr_value_box_t; #include +extern const FR_NAME_NUMBER fr_value_box_type_names[]; extern size_t const fr_value_box_field_sizes[]; extern size_t const fr_value_box_offsets[]; @@ -383,8 +384,8 @@ static inline int fr_value_unbox_ethernet_addr(uint8_t dst[6], fr_value_box_t *s { if (unlikely(src->type != FR_TYPE_ETHERNET)) { \ fr_strerror_printf("Unboxing failed. Needed type %s, had type %s", - fr_int2str(dict_attr_types, FR_TYPE_ETHERNET, "?Unknown?"), - fr_int2str(dict_attr_types, src->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, FR_TYPE_ETHERNET, "?Unknown?"), + fr_int2str(fr_value_box_type_names, src->type, "?Unknown?")); return -1; \ } memcpy(dst, src->vb_ether, sizeof(src->vb_ether)); /* Must be src, dst is a pointer */ @@ -395,8 +396,8 @@ static inline int fr_value_unbox_ethernet_addr(uint8_t dst[6], fr_value_box_t *s static inline int fr_value_unbox_##_field(_ctype *var, fr_value_box_t const *src) { \ if (unlikely(src->type != _type)) { \ fr_strerror_printf("Unboxing failed. Needed type %s, had type %s", \ - fr_int2str(dict_attr_types, _type, "?Unknown?"), \ - fr_int2str(dict_attr_types, src->type, "?Unknown?")); \ + fr_int2str(fr_value_box_type_names, _type, "?Unknown?"), \ + fr_int2str(fr_value_box_type_names, src->type, "?Unknown?")); \ return -1; \ } \ *var = src->vb_##_field; \ diff --git a/src/modules/rlm_cipher/rlm_cipher.c b/src/modules/rlm_cipher/rlm_cipher.c index 60ba4bb5543..f2421ac5e14 100644 --- a/src/modules/rlm_cipher/rlm_cipher.c +++ b/src/modules/rlm_cipher/rlm_cipher.c @@ -745,8 +745,8 @@ static xlat_action_t cipher_rsa_verify_xlat(TALLOC_CTX *ctx, fr_cursor_t *out, if ((*in)->type != FR_TYPE_OCTETS) { REDEBUG("Signature argument wrong type, expected %s, got %s. " "Use %%{base64_decode:} or %%{hex_decode:} if signature is armoured", - fr_int2str(dict_attr_types, FR_TYPE_OCTETS, "?Unknown?"), - fr_int2str(dict_attr_types, (*in)->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, FR_TYPE_OCTETS, "?Unknown?"), + fr_int2str(fr_value_box_type_names, (*in)->type, "?Unknown?")); return XLAT_ACTION_FAIL; } sig = (*in)->vb_octets; diff --git a/src/modules/rlm_date/rlm_date.c b/src/modules/rlm_date/rlm_date.c index 874aa482773..f36e744e5c5 100644 --- a/src/modules/rlm_date/rlm_date.c +++ b/src/modules/rlm_date/rlm_date.c @@ -128,7 +128,7 @@ static ssize_t xlat_date_convert(UNUSED TALLOC_CTX *ctx, char **out, size_t outl return date_convert_string(request, out, outlen, vp->vp_strvalue, inst->fmt); default: - REDEBUG("Can't convert type %s into date", fr_int2str(dict_attr_types, vp->da->type, "")); + REDEBUG("Can't convert type %s into date", fr_int2str(fr_value_box_type_names, vp->da->type, "")); } return -1; diff --git a/src/modules/rlm_dhcpv4/rlm_dhcpv4.c b/src/modules/rlm_dhcpv4/rlm_dhcpv4.c index 4d33f14267e..44b9df05930 100644 --- a/src/modules/rlm_dhcpv4/rlm_dhcpv4.c +++ b/src/modules/rlm_dhcpv4/rlm_dhcpv4.c @@ -77,7 +77,7 @@ static ssize_t dhcp_options_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outl if (src->tmpl_da->type != FR_TYPE_OCTETS) { REDEBUG("dhcp_options got a %s attribute needed octets", - fr_int2str(dict_attr_types, src->tmpl_da->type, "")); + fr_int2str(fr_value_box_type_names, src->tmpl_da->type, "")); goto error; } diff --git a/src/modules/rlm_eap/lib/sim/decode.c b/src/modules/rlm_eap/lib/sim/decode.c index 1aee6acb739..76f29fd111d 100644 --- a/src/modules/rlm_eap/lib/sim/decode.c +++ b/src/modules/rlm_eap/lib/sim/decode.c @@ -542,7 +542,7 @@ static ssize_t sim_decode_pair_value(TALLOC_CTX *ctx, fr_cursor_t *cursor, fr_di FR_PROTO_TRACE("Parent %s len %zu", parent->name, attr_len); FR_PROTO_HEX_DUMP(__FUNCTION__ , data, attr_len); - FR_PROTO_TRACE("Type \"%s\" (%u)", fr_int2str(dict_attr_types, parent->type, "?Unknown?"), parent->type); + FR_PROTO_TRACE("Type \"%s\" (%u)", fr_int2str(fr_value_box_type_names, parent->type, "?Unknown?"), parent->type); /* * Special cases, attributes that either have odd formats, or need diff --git a/src/modules/rlm_eap/lib/sim/encode.c b/src/modules/rlm_eap/lib/sim/encode.c index 7be12c927c4..c79f8c8d781 100644 --- a/src/modules/rlm_eap/lib/sim/encode.c +++ b/src/modules/rlm_eap/lib/sim/encode.c @@ -320,7 +320,7 @@ static ssize_t encode_value(uint8_t *out, size_t outlen, switch (da->type) { case FR_TYPE_STRUCTURAL: fr_strerror_printf("%s: Called with structural type %s", __FUNCTION__, - fr_int2str(dict_attr_types, tlv_stack[depth]->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, tlv_stack[depth]->type, "?Unknown?")); return PAIR_ENCODE_ERROR; default: @@ -698,7 +698,7 @@ static ssize_t encode_rfc_hdr(uint8_t *out, size_t outlen, fr_dict_attr_t const switch (tlv_stack[depth]->type) { case FR_TYPE_STRUCTURAL: fr_strerror_printf("%s: Called with structural type %s", __FUNCTION__, - fr_int2str(dict_attr_types, tlv_stack[depth]->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, tlv_stack[depth]->type, "?Unknown?")); return PAIR_ENCODE_ERROR; default: @@ -833,7 +833,7 @@ static ssize_t encode_tlv_hdr(uint8_t *out, size_t outlen, if (tlv_stack[depth]->type != FR_TYPE_TLV) { fr_strerror_printf("%s: Expected type \"tlv\" got \"%s\"", __FUNCTION__, - fr_int2str(dict_attr_types, tlv_stack[depth]->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, tlv_stack[depth]->type, "?Unknown?")); return PAIR_ENCODE_ERROR; } diff --git a/src/modules/rlm_lua/lua.c b/src/modules/rlm_lua/lua.c index 5b212240d47..341acc440df 100644 --- a/src/modules/rlm_lua/lua.c +++ b/src/modules/rlm_lua/lua.c @@ -139,7 +139,7 @@ static int rlm_lua_marshall(lua_State *L, VALUE_PAIR const *vp) break; case FR_TYPE_NON_VALUES: - ERROR("Cannot convert %s to Lua type", fr_int2str(dict_attr_types, vp->vp_type, "")); + ERROR("Cannot convert %s to Lua type", fr_int2str(fr_value_box_type_names, vp->vp_type, "")); return -1; } return 0; diff --git a/src/modules/rlm_rest/rest.c b/src/modules/rlm_rest/rest.c index 0bc6355cec9..2c8a0c7743a 100644 --- a/src/modules/rlm_rest/rest.c +++ b/src/modules/rlm_rest/rest.c @@ -804,7 +804,7 @@ static int rest_decode_post(UNUSED rlm_rest_t const *instance, UNUSED rlm_rest_s rad_assert(vps); RINDENT(); - RDEBUG3("Type : %s", fr_int2str(dict_attr_types, da->type, "")); + RDEBUG3("Type : %s", fr_int2str(fr_value_box_type_names, da->type, "")); ctx = radius_list_ctx(reference, list_name); diff --git a/src/modules/rlm_unpack/rlm_unpack.c b/src/modules/rlm_unpack/rlm_unpack.c index 770cede55e5..1220f2e6c5c 100644 --- a/src/modules/rlm_unpack/rlm_unpack.c +++ b/src/modules/rlm_unpack/rlm_unpack.c @@ -138,7 +138,7 @@ static ssize_t unpack_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen, goto nothing; } - type = fr_str2int(dict_attr_types, data_type, FR_TYPE_INVALID); + type = fr_str2int(fr_value_box_type_names, data_type, FR_TYPE_INVALID); if (type == FR_TYPE_INVALID) { REDEBUG("Invalid data type '%s'", data_type); goto nothing; diff --git a/src/protocols/dhcpv4/decode.c b/src/protocols/dhcpv4/decode.c index 04c5a7bf9dd..ba24169e1af 100644 --- a/src/protocols/dhcpv4/decode.c +++ b/src/protocols/dhcpv4/decode.c @@ -285,8 +285,8 @@ static ssize_t decode_tlv(TALLOC_CTX *ctx, fr_cursor_t *cursor, fr_dict_attr_t c child = unknown_child; } FR_PROTO_TRACE("decode context changed %s:%s -> %s:%s", - fr_int2str(dict_attr_types, parent->type, ""), parent->name, - fr_int2str(dict_attr_types, child->type, ""), child->name); + fr_int2str(fr_value_box_type_names, parent->type, ""), parent->name, + fr_int2str(fr_value_box_type_names, child->type, ""), child->name); tlv_len = decode_value(ctx, cursor, child, p + 2, p[1]); if (tlv_len <= 0) { @@ -421,8 +421,8 @@ ssize_t fr_dhcpv4_decode_option(TALLOC_CTX *ctx, fr_cursor_t *cursor, if (!child) return -1; } FR_PROTO_TRACE("decode context changed %s:%s -> %s:%s", - fr_int2str(dict_attr_types, parent->type, ""), parent->name, - fr_int2str(dict_attr_types, child->type, ""), child->name); + fr_int2str(fr_value_box_type_names, parent->type, ""), parent->name, + fr_int2str(fr_value_box_type_names, child->type, ""), child->name); ret = decode_value(ctx, cursor, child, data + 2, data[1]); if (ret < 0) { diff --git a/src/protocols/dhcpv6/encode.c b/src/protocols/dhcpv6/encode.c index 5feb55bb3e7..a86a840a302 100644 --- a/src/protocols/dhcpv6/encode.c +++ b/src/protocols/dhcpv6/encode.c @@ -142,7 +142,7 @@ static ssize_t encode_struct(uint8_t *out, size_t outlen, if (tlv_stack[depth]->type != FR_TYPE_STRUCT) { fr_strerror_printf("%s: Expected type \"struct\" got \"%s\"", __FUNCTION__, - fr_int2str(dict_attr_types, tlv_stack[depth]->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, tlv_stack[depth]->type, "?Unknown?")); return PAIR_ENCODE_ERROR; } @@ -240,7 +240,7 @@ static ssize_t encode_value(uint8_t *out, size_t outlen, switch (da->type) { case FR_TYPE_STRUCTURAL: fr_strerror_printf("%s: Called with structural type %s", __FUNCTION__, - fr_int2str(dict_attr_types, da->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, da->type, "?Unknown?")); return PAIR_ENCODE_ERROR; default: @@ -630,7 +630,7 @@ static ssize_t encode_tlv_hdr(uint8_t *out, size_t outlen, if (tlv_stack[depth]->type != FR_TYPE_TLV) { fr_strerror_printf("%s: Expected type \"tlv\" got \"%s\"", __FUNCTION__, - fr_int2str(dict_attr_types, tlv_stack[depth]->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, tlv_stack[depth]->type, "?Unknown?")); return PAIR_ENCODE_ERROR; } @@ -835,7 +835,7 @@ static ssize_t encode_vsio_hdr(uint8_t *out, size_t outlen, */ if (da->type != FR_TYPE_VSA) { fr_strerror_printf("%s: Expected type \"vsa\" got \"%s\"", __FUNCTION__, - fr_int2str(dict_attr_types, da->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, da->type, "?Unknown?")); return PAIR_ENCODE_ERROR; } @@ -853,7 +853,7 @@ static ssize_t encode_vsio_hdr(uint8_t *out, size_t outlen, if (da->type != FR_TYPE_VENDOR) { fr_strerror_printf("%s: Expected type \"vsa\" got \"%s\"", __FUNCTION__, - fr_int2str(dict_attr_types, da->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, da->type, "?Unknown?")); return PAIR_ENCODE_ERROR; } diff --git a/src/protocols/ethernet/ethernet.c b/src/protocols/ethernet/ethernet.c index 43075499688..12867f26505 100644 --- a/src/protocols/ethernet/ethernet.c +++ b/src/protocols/ethernet/ethernet.c @@ -371,8 +371,8 @@ static int fr_ethernet_set_option(void *proto_ctx, fr_proto_opt_group_t group, i case PROTO_OPT_L2_PAYLOAD_LEN: if (in->type != FR_TYPE_SIZE) { fr_strerror_printf("Unboxing failed. Needed type %s, had type %s", - fr_int2str(dict_attr_types, FR_TYPE_SIZE, "?Unknown?"), - fr_int2str(dict_attr_types, in->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, FR_TYPE_SIZE, "?Unknown?"), + fr_int2str(fr_value_box_type_names, in->type, "?Unknown?")); return -1; } ether_ctx->payload_len = in->vb_size; diff --git a/src/protocols/radius/decode.c b/src/protocols/radius/decode.c index f17dd982564..06b7fda7757 100644 --- a/src/protocols/radius/decode.c +++ b/src/protocols/radius/decode.c @@ -1167,7 +1167,7 @@ ssize_t fr_radius_decode_pair_value(TALLOC_CTX *ctx, fr_cursor_t *cursor, fr_dic * Double-check the length after decrypting the * attribute. */ - FR_PROTO_TRACE("Type \"%s\" (%u)", fr_int2str(dict_attr_types, parent->type, "?Unknown?"), parent->type); + FR_PROTO_TRACE("Type \"%s\" (%u)", fr_int2str(fr_value_box_type_names, parent->type, "?Unknown?"), parent->type); min = fr_radius_attr_sizes[parent->type][0]; max = fr_radius_attr_sizes[parent->type][1]; diff --git a/src/protocols/radius/encode.c b/src/protocols/radius/encode.c index 844de892450..772078ae71b 100644 --- a/src/protocols/radius/encode.c +++ b/src/protocols/radius/encode.c @@ -426,7 +426,7 @@ static ssize_t encode_struct(uint8_t *out, size_t outlen, if (tlv_stack[depth]->type != FR_TYPE_STRUCT) { fr_strerror_printf("%s: Expected type \"struct\" got \"%s\"", __FUNCTION__, - fr_int2str(dict_attr_types, tlv_stack[depth]->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, tlv_stack[depth]->type, "?Unknown?")); return -1; } @@ -556,7 +556,7 @@ static ssize_t encode_tlv_hdr(uint8_t *out, size_t outlen, if (tlv_stack[depth]->type != FR_TYPE_TLV) { fr_strerror_printf("%s: Expected type \"tlv\" got \"%s\"", __FUNCTION__, - fr_int2str(dict_attr_types, tlv_stack[depth]->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, tlv_stack[depth]->type, "?Unknown?")); return -1; } @@ -643,7 +643,7 @@ static ssize_t encode_value(uint8_t *out, size_t outlen, switch (da->type) { case FR_TYPE_STRUCTURAL: fr_strerror_printf("%s: Called with structural type %s", __FUNCTION__, - fr_int2str(dict_attr_types, tlv_stack[depth]->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, tlv_stack[depth]->type, "?Unknown?")); return -1; default: @@ -904,7 +904,7 @@ static int encode_extended_hdr(uint8_t *out, size_t outlen, if ((tlv_stack[depth]->type != FR_TYPE_EXTENDED) && (tlv_stack[depth]->type != FR_TYPE_LONG_EXTENDED)) { fr_strerror_printf("%s : Called for non-extended attribute type %s", - __FUNCTION__, fr_int2str(dict_attr_types, tlv_stack[depth]->type, "?Unknown?")); + __FUNCTION__, fr_int2str(fr_value_box_type_names, tlv_stack[depth]->type, "?Unknown?")); return -1; } @@ -1096,7 +1096,7 @@ static ssize_t encode_rfc_hdr_internal(uint8_t *out, size_t outlen, switch (tlv_stack[depth]->type) { case FR_TYPE_STRUCTURAL: fr_strerror_printf("%s: Called with structural type %s", __FUNCTION__, - fr_int2str(dict_attr_types, tlv_stack[depth]->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, tlv_stack[depth]->type, "?Unknown?")); return -1; default: @@ -1371,7 +1371,7 @@ static int encode_vsa_hdr(uint8_t *out, size_t outlen, if (da->type != FR_TYPE_VSA) { fr_strerror_printf("%s: Expected type \"vsa\" got \"%s\"", __FUNCTION__, - fr_int2str(dict_attr_types, da->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, da->type, "?Unknown?")); return -1; } @@ -1401,7 +1401,7 @@ static int encode_vsa_hdr(uint8_t *out, size_t outlen, if (da->type != FR_TYPE_VENDOR) { fr_strerror_printf("%s: Expected type \"vsa\" got \"%s\"", __FUNCTION__, - fr_int2str(dict_attr_types, da->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, da->type, "?Unknown?")); return -1; } @@ -1444,7 +1444,7 @@ static int encode_rfc_hdr(uint8_t *out, size_t outlen, fr_dict_attr_t const **tl switch (tlv_stack[depth]->type) { case FR_TYPE_STRUCTURAL: fr_strerror_printf("%s: Expected leaf type got \"%s\"", __FUNCTION__, - fr_int2str(dict_attr_types, tlv_stack[depth]->type, "?Unknown?")); + fr_int2str(fr_value_box_type_names, tlv_stack[depth]->type, "?Unknown?")); return -1; default: