What should be the type in CONFD_SET_TAG_PTR for a union?


I want to use cdb_get_values to fetch values from db. But when one of the leaf is a union, what should I specify as the type in CONFD_SET_TAG_PTR? How will I know the type in advance?

Thanks, Prasanth

You can’t use C_PTR / CONFD_SET_TAG_PTR for such leafs, but have to use C_NOEXISTS / CONFD_SET_TAG_NOEXISTS and get both type and value from the ‘values’ array after the call. This is analogous to the case of reading a single leaf of a union type: you can’t use the type safe cdb_get_xxx() (e.g. cdb_get_int32()) functions, but have to use cdb_get() and get both type and value from the confd_value_t struct after the call.

Thanks Per. It was really helpful.