From 17cef81a8d1d119f457a01214a86e2c0e883ce8f Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Fri, 22 Dec 2023 17:00:44 +0100 Subject: datatype: Describe rt symbol tables Implement a symbol_table_print() wrapper for the run-time populated rt_symbol_tables which formats output similar to expr_describe() and includes the data source. Since these tables reside in struct output_ctx there is no implicit connection between data type and therefore providing callbacks for relevant datat types which feed the data into said wrapper is a simpler solution than extending expr_describe() itself. Signed-off-by: Phil Sutter --- src/rt.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/rt.c') diff --git a/src/rt.c b/src/rt.c index 3ee710dd..d8f3352f 100644 --- a/src/rt.c +++ b/src/rt.c @@ -45,10 +45,17 @@ static struct error_record *realm_type_parse(struct parse_ctx *ctx, return symbolic_constant_parse(ctx, sym, ctx->tbl->realm, res); } +static void realm_type_describe(struct output_ctx *octx) +{ + rt_symbol_table_describe(octx, "rt_realms", + octx->tbl.realm, &realm_type); +} + const struct datatype realm_type = { .type = TYPE_REALM, .name = "realm", .desc = "routing realm", + .describe = realm_type_describe, .byteorder = BYTEORDER_HOST_ENDIAN, .size = 4 * BITS_PER_BYTE, .basetype = &integer_type, -- cgit v1.2.3