Skip to content

Enum description

Mikhail Yakshin edited this page Mar 5, 2016 · 3 revisions

Enum description allows to set up a enum (or closest equivalent) construct in target language source file, which can then be referenced in attribute descriptions using enum specification.

A given class can have multiple named enums, each of which is essentially a map from integers to strings. For example:

enums:
  ip_protocol:
    1: icmp
    6: tcp
    0x11: udp
  port:
    22: ssh
    25: smtp
    80: http

This one defines 2 named enums (named ip_protocol and port respectively), which can be referenced in attributes like that:

seq:
  - id: src_port
    type: u2
    enum: port
Clone this wiki locally