Enumerations

Enumerations are sets of named values that behave as constants. These logical names are used in methods of different objects and associated to values that are used to improve the consistency and readability of the code. Enumerations make source code easier to read because a name is shown instead of a number.

In ANDi's case, the way to interact with Enumerations is through the predefined set used globally and out of the box in any script or module. The list below defines all available Enumerations. No Enumeration can be added by the user.

In order to use Enumeration members, it suffices to reference the Enumeration by name and access the member directly.
# Usage: enumeration_set.value
# e.g.
EtherType.IpV4
Each Enumeration member corresponds to an int value, to access this int value you can access the field value__ found in the member. This field is read-only and attempting to write to it will result in Runtime Warning in the script and may lead to errors.
# Usage: enumeration_set.member.value__
# e.g.
EtherType.IpV4.value__
# returns 2048 (int32 type)
Enumeration members are comparable. It is possible to use logic operators on Enumeration members. keep in mind these operations are performed on the int value of the member.
# Usage: enumeration_set.member logical_operator enumeration_set.member ( <, >, ==, etc)
# e.g.
EtherType.Arp < EtherType.PrecisionTimeProtocol
# returns True
Enumeration members are also accessible through their value accessed using Enumeration name.
# Usage: enumeration_set(intvalue or hexvalue)
# e.g.
EtherType(2048)
EtherType(0x0800)
# returns EtherType.IpV4
Enumerations are also bitwise operation friendly, it is possible to run bitwise operations on Enumeration members.
# Usage: enumeration_set.member bitwise_operator (|, &, ^, ~) enumeration_set.member (or int)
# e.g.
AutoCalculate.CRC | AutoCalculate.AliveCounter
# returns AutoCalculate.All

Global Predefined Enumerations Set