}
}
-static void _fr_dict_export(fr_dict_t const *dict, uint64_t *count, uintptr_t *low, uintptr_t *high, fr_dict_attr_t const *da, unsigned int lvl)
+static void _raddict_export(fr_dict_t const *dict, uint64_t *count, uintptr_t *low, uintptr_t *high, fr_dict_attr_t const *da, unsigned int lvl)
{
unsigned int i;
size_t len;
len = talloc_array_length(children);
for (i = 0; i < len; i++) {
for (p = children[i]; p; p = p->next) {
- _fr_dict_export(dict, count, low, high, p, lvl + 1);
+ _raddict_export(dict, count, low, high, p, lvl + 1);
}
}
}
-static void fr_dict_export(uint64_t *count, uintptr_t *low, uintptr_t *high, fr_dict_t *dict)
+static void raddict_export(uint64_t *count, uintptr_t *low, uintptr_t *high, fr_dict_t *dict)
{
if (count) *count = 0;
if (low) *low = UINTPTR_MAX;
if (high) *high = 0;
- _fr_dict_export(dict, count, low, high, fr_dict_root(dict), 0);
+ _raddict_export(dict, count, low, high, fr_dict_root(dict), 0);
}
/**
int ret = 0;
bool found = false;
bool export = false;
+ bool file_export = false;
+ char const *protocol;
TALLOC_CTX *autofree;
fr_dict_gctx_t const *our_dict_gctx = NULL;
fr_debug_lvl = 1;
- while ((c = getopt(argc, argv, "ED:Vxh")) != -1) switch (c) {
+ while ((c = getopt(argc, argv, "fED:p:Vxh")) != -1) switch (c) {
+ case 'f':
+ file_export = true;
+ break;
+
case 'E':
export = true;
break;
dict_dir = optarg;
break;
+ case 'p':
+ protocol = optarg;
+ break;
+
case 'V':
print_values = true;
break;
goto finish;
}
+ if (file_export) {
+ fr_dict_t **dict_p = dicts;
+
+ do {
+ if (protocol && (strcasecmp(fr_dict_root(*dict_p)->name, protocol) == 0)) {
+ fr_dict_export(*dict_p);
+ }
+ } while (++dict_p < dict_end);
+ }
+
if (export) {
fr_dict_t **dict_p = dicts;
uintptr_t high;
uintptr_t low;
- fr_dict_export(&count, &low, &high, *dict_p);
+ raddict_export(&count, &low, &high, *dict_p);
DEBUG2("Attribute count %" PRIu64, count);
DEBUG2("Memory allocd %zu (bytes)", talloc_total_size(*dict_p));
DEBUG2("Memory spread %zu (bytes)", (size_t) (high - low));