The ENUM keyword
Syntax
ENUM <name> <type>
Description
The ENUM
keyword defines a name for set of VALUEs.
The main purpose of ENUM
is to define commonly used values in one
place, and then refer to those values from multiple places. This
reuse simplifies the dictionaries, and helps to avoid errors.
In the following example, Ethernet-Type
is defined as an ENUM
and
given VALUEs. We then define two
ATTRIBUTEs, and copy those
VALUEs from the ENUM
to the
ATTRIBUTE.
After these definitions, when the server will allow Some-Protocol
to
be assigned the value IPv4
, which will get encoded into a packet as
the 16-bit field `0x0800.
Example
ENUM Ethernet-Type uint16 VALUE Ethernet-Type IPv4 0x0800 VALUE Ethernet-Type IPv6 0x86DD ATTRIBUTE Some-Protocol 2112 uint16 enum=Ethernet-Type ATTRIBUTE Other-Thing 6809 uint16 enum=Ethernet-Type