mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
wiregen: Add enums for TLV types so we can call them by their name
Suggested-by: Lisa Neigut <@niftynei> Signed-off-by: Christian Decker <@cdecker>
This commit is contained in:
parent
cb9debc229
commit
c0b30ac907
@ -119,6 +119,18 @@ bool ${tlv.name}_is_valid(const struct ${tlv.struct_name()} *record,
|
||||
#define TLVS_${tlv.name.upper()}_ARRAY_SIZE ${len(tlv.messages)}
|
||||
extern const struct tlv_record_type tlvs_${tlv.name}[];
|
||||
|
||||
<%!
|
||||
def upper(text):
|
||||
return text.upper()
|
||||
%>
|
||||
|
||||
/* Define an enum with the constants */
|
||||
enum ${tlv.name}_types {
|
||||
% for msg in tlv.ordered_msgs():
|
||||
${msg.struct_name()|upper} = ${msg.number},
|
||||
% endfor
|
||||
};
|
||||
|
||||
% endif
|
||||
% endfor
|
||||
% if options.expose_subtypes and bool(subtypes):
|
||||
|
Loading…
Reference in New Issue
Block a user