/* 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)
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());
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;
}
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:
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;\
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).
} 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;
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;
}
*(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);
}
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);
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;
}
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;
}
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);
}
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);
}
}
"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);
}
}
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;
}
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:
if (!RDEBUG_ENABLED4) continue;
- type = dict_attr_types;
+ type = fr_value_box_type_names;
while (type->name) {
int pad;
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 */
*/
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;
}
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;
}
///< 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] = {
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:
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:
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:
// 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;
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;
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;
}
*/
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;
}
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;
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:
*/
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;
}
*/
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;
}
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;
}
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;
}
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;
}
}
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;
}
}
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]) {
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;
}
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;
}
/*
* 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;
/*
* 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;
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;
}
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;
}
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;
/*
* 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;
/*
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;
}
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++) {
*/
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>
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;
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);
}
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);
}
}
"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);
}
}
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) {
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);
}
}
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);
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
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;
}
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;
}
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;
}
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;
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;
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;
}
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;
}
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;
}
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;
}
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;
}
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)],
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
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;
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;
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;
}
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;
}
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;
}
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; \
} \
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; \
} \
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;
}
#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[];
{
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 */
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; \
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;
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;
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;
}
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
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:
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:
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;
}
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;
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);
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;
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) {
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) {
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;
}
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:
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;
}
*/
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;
}
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;
}
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;
* 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];
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;
}
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;
}
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:
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;
}
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:
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;
}
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;
}
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: