fr_dict_t *dict;
fr_dict_attr_t *mutable;
bool require_dl = false;
+ bool string_based = false;
if ((argc < 2) || (argc > 3)) {
fr_strerror_const("Missing arguments after PROTOCOL. Expected PROTOCOL <num> <name>");
goto post_option;
}
+ if (strcmp(argv[2], "format=string") == 0) {
+ type_size = 4;
+ string_based = true;
+ goto post_option;
+ }
+
if (strncasecmp(argv[2], "format=", 7) != 0) {
fr_strerror_printf("Invalid format for PROTOCOL. Expected 'format=', got '%s'", argv[2]);
return -1;
if (dict_protocol_add(dict) < 0) goto error;
mutable = UNCONST(fr_dict_attr_t *, dict->root);
+ dict->string_based = string_based;
if (!type_size) {
mutable->flags.type_size = dict->default_type_size;
mutable->flags.length = dict->default_type_length;
vsa_da = da;
- } else if (!ctx->dict->vsa_parent) {
- fr_strerror_printf_push("BEGIN-VENDOR is forbidden for protocol %s - it has no ATTRIBUTE of type 'vsa'",
- ctx->dict->root->name);
- goto error;
-
- } else {
+ } else if (ctx->dict->vsa_parent) {
/*
* Check that the protocol-specific VSA parent exists.
*/
vendor->name);
goto error;
}
+
+ } else if (ctx->dict->string_based) {
+ vsa_da = ctx->dict->root;
+
+ } else {
+ fr_strerror_printf_push("BEGIN-VENDOR is forbidden for protocol %s - it has no ATTRIBUTE of type 'vsa'",
+ ctx->dict->root->name);
+ goto error;
+
}
/*
}
vendor_da = new;
+ } else {
+ fr_assert(vendor_da->type == FR_TYPE_VENDOR);
}
if (dict_gctx_push(ctx, vendor_da) < 0) goto error;
/*
* The parent has children by name only, not by number. Don't even bother trying to track
- * numbers.
+ * numbers, except for VENDOR in root, and MEMBER of a struct.
*/
- if (parent->flags.name_only && (parent->type != FR_TYPE_STRUCT)) return 0;
+ if (!parent->flags.is_root && parent->flags.name_only && (parent->type != FR_TYPE_STRUCT)) return 0;
/*
* We only allocate the pointer array *if* the parent has children.