]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Move value box field names out of dict.c
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 19 Jul 2018 16:03:52 +0000 (12:03 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 19 Jul 2018 16:03:52 +0000 (12:03 -0400)
29 files changed:
src/bin/radict.c
src/lib/json/json.c
src/lib/server/cf_parse.c
src/lib/server/command.c
src/lib/server/cond_eval.c
src/lib/server/cond_tokenize.c
src/lib/server/snmp.c
src/lib/server/tmpl.c
src/lib/server/xlat_func.c
src/lib/unlang/compile.c
src/lib/util/dict.c
src/lib/util/dict.h
src/lib/util/pair.c
src/lib/util/proto.c
src/lib/util/value.c
src/lib/util/value.h
src/modules/rlm_cipher/rlm_cipher.c
src/modules/rlm_date/rlm_date.c
src/modules/rlm_dhcpv4/rlm_dhcpv4.c
src/modules/rlm_eap/lib/sim/decode.c
src/modules/rlm_eap/lib/sim/encode.c
src/modules/rlm_lua/lua.c
src/modules/rlm_rest/rest.c
src/modules/rlm_unpack/rlm_unpack.c
src/protocols/dhcpv4/decode.c
src/protocols/dhcpv6/encode.c
src/protocols/ethernet/ethernet.c
src/protocols/radius/decode.c
src/protocols/radius/encode.c

index 2620adca3ff53357366b8b48bb04a423ad4e9088..79ef149523494f21267ae0d30ade90f5b8cefc15 100644 (file)
@@ -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)
index e57325f67f22f552387878131f1497d8d0aa28e8..c54e059731d005b2c3384946e1ff2f371896c719 100644 (file)
@@ -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, "<INVALID>")));
+                       MEM(type_name = json_object_new_string(fr_int2str(fr_value_box_type_names, vp->vp_type, "<INVALID>")));
                        json_object_object_add(vp_object, "type", type_name);
 
                        MEM(values = json_object_new_array());
index 0ecf5aa77eb1ab4924e8721b65cfd2c00433f9c9..3378d0254a11cb186581bba27253fdbb65de00ed 100644 (file)
@@ -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;
        }
index 56b5437f4e9938cf04a733eae28df78b63712038..ddb886af5dd15b35277082efb802523bda1f1d08 100644 (file)
@@ -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:
index ede8307cdf3c708f9eb2b3c76b843b9f300057e8..dca203228770fc4b5de90914bafaf0db913bbb2d 100644 (file)
@@ -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, "<INVALID>"),\
-                          fr_int2str(dict_attr_types, cast_type, "<INVALID>"));\
+                          fr_int2str(fr_value_box_type_names, _s->type, "<INVALID>"),\
+                          fr_int2str(fr_value_box_type_names, cast_type, "<INVALID>"));\
                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, "<INVALID>"));
+                          fr_int2str(fr_value_box_type_names, cast->type, "<INVALID>"));
        /*
         *      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, "<INVALID>"));
+                          fr_int2str(fr_value_box_type_names, cast->type, "<INVALID>"));
        } 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, "<INVALID>"));
+                          fr_int2str(fr_value_box_type_names, cast->type, "<INVALID>"));
        } 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, "<INVALID>"));
+                          fr_int2str(fr_value_box_type_names, cast->type, "<INVALID>"));
        } 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, "<INVALID>"));
+                          fr_int2str(fr_value_box_type_names, cast_type, "<INVALID>"));
        } 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, "<INVALID>"));
+                          fr_int2str(fr_value_box_type_names, cast_type, "<INVALID>"));
        }
 
        if (cast) cast_type = cast->type;
index 544eddc4b4541a16574ca920393a4be60362d657..7a64c4a57f1e79f3406e9838462d3696e897371d 100644 (file)
@@ -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);
index 17e9dd05e5b983d1a7185e4bd24859bd5c6fc671..cd8ec86156f7b68bf4e8ec497da4e53d70d5aa4e 100644 (file)
@@ -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;
        }
 
index 7c507bbf763bf289d1758a3ded534bb4178f4da2..a508e80cda1a2a97a689ae7e9ed2973df411639d 100644 (file)
@@ -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, "<UNKNOWN>"),
-                                  fr_int2str(dict_attr_types, da->type, "<UNKNOWN>"));
+                                  da->name, fr_int2str(fr_value_box_type_names, type, "<UNKNOWN>"),
+                                  fr_int2str(fr_value_box_type_names, da->type, "<UNKNOWN>"));
                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, "<INVALID>"));
+                                            fr_int2str(fr_value_box_type_names, vpt->tmpl_da->type, "<INVALID>"));
                                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, "<INVALID>"));
+                                                    fr_int2str(fr_value_box_type_names, vpt->tmpl_da->type, "<INVALID>"));
                                        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, "<INVALID>"),
+                                            fr_int2str(fr_value_box_type_names, vpt->tmpl_da->type, "<INVALID>"),
                                             da, da->name,
-                                            fr_int2str(dict_attr_types, da->type, "<INVALID>"));
+                                            fr_int2str(fr_value_box_type_names, da->type, "<INVALID>"));
                                if (!fr_cond_assert(0)) fr_exit_now(1);
                        }
                }
index 162feaed7fb67558bbae8a755abfbeef5c8b26c5..2e39cdb9d9a5d35b280be748a5a4763c14705e1d 100644 (file)
@@ -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, "<INVALID>"));
+               RIDEBUG2("Type   : %s", fr_int2str(fr_value_box_type_names, vp->vp_type, "<INVALID>"));
 
                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;
 
index 79e6446dd0c6cde734ded6b199563790d56c0522..055769bc7335573ad2855ea372699fa1aaf2a5f1 100644 (file)
@@ -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, "<UNKNOWN>"),
+                                                          fr_int2str(fr_value_box_type_names, map->lhs->tmpl_da->type, "<UNKNOWN>"),
                                                           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, "<INVALID>"),
-                                   fr_int2str(dict_attr_types, map->lhs->tmpl_da->type, "<INVALID>"));
+                                   fr_int2str(fr_value_box_type_names, FR_TYPE_STRING, "<INVALID>"),
+                                   fr_int2str(fr_value_box_type_names, map->lhs->tmpl_da->type, "<INVALID>"));
                        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,
                                                   "<INVALID>"), map->lhs->tmpl_da->name);
                                return -1;
                        }
index de14691f20233026aafc44d46db9801d4916569e..38f59b44688bed419f35db15cd065ecee89562b3 100644 (file)
@@ -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, "<UNKNOWN>"));
+                                          fr_int2str(fr_value_box_type_names, type, "<UNKNOWN>"));
                        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, "<UNKNOWN>"));
+                                                          fr_int2str(fr_value_box_type_names, type, "<UNKNOWN>"));
                                        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, "<UNKNOWN>"));
+                                          fr_int2str(fr_value_box_type_names, type, "<UNKNOWN>"));
                        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, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, ref->type, "<INVALID>"));
                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, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, type, "<INVALID>"));
                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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, value->type, "<INVALID>"));
+                                          fr_int2str(fr_value_box_type_names, da->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, value->type, "<INVALID>"));
                        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, "<INVALID>"),
-                                               fr_int2str(dict_attr_types, da->type, "<INVALID>"));
+                                               fr_int2str(fr_value_box_type_names, value->type, "<INVALID>"),
+                                               fr_int2str(fr_value_box_type_names, da->type, "<INVALID>"));
 
                        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, "<INVALID>"));
+                                                          fr_int2str(fr_value_box_type_names, our_parent->type, "<INVALID>"));
                                        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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, FR_TYPE_EVS, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, vendor_root->type, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, FR_TYPE_VSA, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, FR_TYPE_EVS, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, vendor_root->type, "<INVALID>"));
                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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, FR_TYPE_VENDOR, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, vendor->type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, FR_TYPE_VENDOR, "<INVALID>"));
                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, "<INVALID>"), flags);
+              da->name, da->attr, fr_int2str(fr_value_box_type_names, da->type, "<INVALID>"), flags);
 
        len = talloc_array_length(da->children);
        for (i = 0; i < len; i++) {
index 8fc4845599924c22ced5ea48b7bf5e5c8f098255..36ebb2d898502fbadfcc350a2efcd835dd1363d2 100644 (file)
@@ -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 <freeradius-devel/util/value.h>
 
index 6d529877844245026f4d321a541b720c835f7c6b..daf6bd8fffd7e910075da8322b015a3267e48f6a 100644 (file)
@@ -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, "<INVALID>"), vp->da->name);
+                                          fr_int2str(fr_value_box_type_names, type, "<INVALID>"), 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, "<INVALID>"));
+                                    fr_int2str(fr_value_box_type_names, vp->vp_type, "<INVALID>"));
                        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, "<INVALID>"));
+                                            fr_int2str(fr_value_box_type_names, vp->da->type, "<INVALID>"));
                                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, "<INVALID>"),
-                                    da, da->name, fr_int2str(dict_attr_types, da->type, "<INVALID>"));
+                                    fr_int2str(fr_value_box_type_names, vp->da->type, "<INVALID>"),
+                                    da, da->name, fr_int2str(fr_value_box_type_names, da->type, "<INVALID>"));
                        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, "<INVALID>"),
-                                    fr_int2str(dict_attr_types, vp->data.type, "<INVALID>"));
+                                    fr_int2str(fr_value_box_type_names, FR_TYPE_OCTETS, "<INVALID>"),
+                                    fr_int2str(fr_value_box_type_names, vp->data.type, "<INVALID>"));
                        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);
        }
 }
index 345207c24bd931a23b6962399717e623f76c1aa2..9a05aabc4170c086443e418548a44785aebe4528 100644 (file)
@@ -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);
index d744e791181c27fb92ff9054f046cbec04827883..919c42d0a78fc4dc3b1e454ffe3323d78d27eb10 100644 (file)
@@ -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, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, value->type, "<INVALID>"));
                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, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, type, "<INVALID>"),
                                   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, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, type, "<INVALID>"),
                                   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, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, type, "<INVALID>"));
                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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"),
                                   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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"),
                                   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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+                                          fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"));
                        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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"),
                                           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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"),
                                           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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"),
                                           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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"));
                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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+                                          fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"));
                        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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"),
                                           (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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"),
                                           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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"));
                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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"),
                                           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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"),
                                           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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"),
                                           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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"));
                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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"),
                                           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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"));
                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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"));
                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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"));
                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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"));
                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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"));
                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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"));
                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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"));
                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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"));
                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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, dst_type, "<INVALID>"));
+                                          fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"));
                        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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"),
                                           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, "<INVALID>"),
-                                          fr_int2str(dict_attr_types, dst_type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, src->type, "<INVALID>"),
+                                          fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"),
                                           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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst->type, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, FR_TYPE_STRING, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst->type, "<INVALID>"));
                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, "<INVALID>"),
-                                  fr_int2str(dict_attr_types, dst->type, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, FR_TYPE_OCTETS, "<INVALID>"),
+                                  fr_int2str(fr_value_box_type_names, dst->type, "<INVALID>"));
                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, "<INVALID>"), \
+                                          uinteger, fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"), \
                                           (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, "<INVALID>"), \
+                                          sinteger, fr_int2str(fr_value_box_type_names, dst_type, "<INVALID>"), \
                                           (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, "<INVALID>"));
+                                  fr_int2str(fr_value_box_type_names, type, "<INVALID>"));
                return -1;
        }
 
index 311e72b6133c5ab22d4cd613c82a5ffd59412749..7318e5622cba5646dedbf1a34d65bf3d5b8efd13 100644 (file)
@@ -41,6 +41,7 @@ typedef struct value_box fr_value_box_t;
 
 #include <freeradius-devel/util/dict.h>
 
+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; \
index 60ba4bb55439583431a9e93d4f31cbef307aa335..f2421ac5e14418722bd8e830b4d6040d26c2fa95 100644 (file)
@@ -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:<text>} or %%{hex_decode:<text>} 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;
index 874aa482773210d1ddce6ddbae9a845fca32c35f..f36e744e5c5bd682ca9cc5ed2845622d983a68e4 100644 (file)
@@ -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, "<INVALID>"));
+               REDEBUG("Can't convert type %s into date", fr_int2str(fr_value_box_type_names, vp->da->type, "<INVALID>"));
        }
 
        return -1;
index 4d33f14267e7c9264d603eca9abddfbe97b5dd8f..44b9df05930f805f93cf1971e1b039ec7d83f345 100644 (file)
@@ -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, "<INVALID>"));
+                       fr_int2str(fr_value_box_type_names, src->tmpl_da->type, "<INVALID>"));
                goto error;
        }
 
index 1aee6acb739f7e3945149f4f72c3a78384ec1e3d..76f29fd111de7151741323d382c43da43f5c4d50 100644 (file)
@@ -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
index 7be12c927c4adc0fd8a28102bd20f9e32f704019..c79f8c8d781c8bf82fe5e43a4a22a829a793deed 100644 (file)
@@ -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;
        }
 
index 5b212240d47f428b8dcd844ef80a61ddb4cf291b..341acc440df73883a9069ef54a6446fd50d7c629 100644 (file)
@@ -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, "<INVALID>"));
+               ERROR("Cannot convert %s to Lua type", fr_int2str(fr_value_box_type_names, vp->vp_type, "<INVALID>"));
                return -1;
        }
        return 0;
index 0bc6355cec9f1cae6bdcbb862156a8dfd1fd44e0..2c8a0c7743a44d3538910ad0bb01ced027704b0e 100644 (file)
@@ -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, "<INVALID>"));
+               RDEBUG3("Type  : %s", fr_int2str(fr_value_box_type_names, da->type, "<INVALID>"));
 
                ctx = radius_list_ctx(reference, list_name);
 
index 770cede55e5097e237a20f49eaff67b3beccfd7f..1220f2e6c5cdad977a21d33897899545e387a6a3 100644 (file)
@@ -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;
index 04c5a7bf9dd13ca732a5560ae5385881c3f99d24..ba24169e1afe22ccc23d660408fc5203b205bdd8 100644 (file)
@@ -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, "<invalid>"), parent->name,
-                              fr_int2str(dict_attr_types, child->type, "<invalid>"), child->name);
+                              fr_int2str(fr_value_box_type_names, parent->type, "<invalid>"), parent->name,
+                              fr_int2str(fr_value_box_type_names, child->type, "<invalid>"), 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, "<invalid>"), parent->name,
-                      fr_int2str(dict_attr_types, child->type, "<invalid>"), child->name);
+                      fr_int2str(fr_value_box_type_names, parent->type, "<invalid>"), parent->name,
+                      fr_int2str(fr_value_box_type_names, child->type, "<invalid>"), child->name);
 
        ret = decode_value(ctx, cursor, child, data + 2, data[1]);
        if (ret < 0) {
index 5feb55bb3e702c42e90779504d610ffacb187f61..a86a840a302250dd851e5db9e9621a71e18fa029 100644 (file)
@@ -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;
        }
 
index 43075499688097883d068e82a9a6a43651b0bc10..12867f265055089ea8f2feda3118700567d11895 100644 (file)
@@ -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;
index f17dd9825640c7e30d3fdee2c1e254907626ecd4..06b7fda775723638191c2c2c78bf02ea16ddbc1e 100644 (file)
@@ -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];
index 844de892450ebe31c3b84106b82c173d77cc04c4..772078ae71b580b90ba4f4fc17f2aa2f2016c496 100644 (file)
@@ -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: