I was trying to log the contents of an lset_t, but couldn't seem to
find the right method. For instance, given the enum:
enum ikev2_trans_type_esn {
IKEv2_ESN_DISABLED = 0,
IKEv2_ESN_ENABLED = 1,
};
then I can display a truncated value vis:
strip_prefix("ESN_", enum_enum_show(ikev2_trans_type_esn_names,
IKEv2_ESN_DISABLED))
-> "DISABLED"
for lset_t, I'd like something similar:
lset_t s = LELEM(IKEv2_ESN_DISABLED) + LELEM(IKEv2_ESN_ENABLED);
bitenumsof(ikev2_trans_type_esn_names, s)
-> DISABLED+ENABLED
trying to do it with the existing code is, er, annoying:
- the array ikev2_trans_type_esn_name containing the values I need is
out-of-reach - static
- the names have ESN_ hard-wired, and enum_names doesn't know this -
have to keep repeating the magic prefix
and while I'm at it:
- oh for "struct lswlog" so I could just accumulate my message in a
buffer and then send it out (to log or debug or ...)
Andrew
_______________________________________________
Swan-dev mailing list
[email protected]
https://lists.libreswan.org/mailman/listinfo/swan-dev