Transition Guard Condition Examples

Basically, transition guard conditions are boolean C/C++ expressions, which either evaluate to true or false.

Within transition guard conditions the FSM built-in functions can be used to access FSM interface elements and data structure fields. In connection with the C/C++ logical operators ! (NOT), || (OR) and && (AND), complex condition statements can be created.

Guard condition statements must not be terminated by a semicolon (;) character.

The example transition guard conditions are referring to the example FSM interface elements, introduced in Action Examples.

EnumToString(EnumMemory) == "TRUE"

EnumToInt(EnumMemory) == 0

DSToInt(SelectFieldDS(ReadNewInput(PacketInput), "SourcePort")) > 0

QueueLength(ListOfPacketsMemory) != 0 && (int)SelectFieldDS(ReadNewInput(PacketInput), "DestPort") == IntParameter

(int)IntMemory >= 0 && (int)LengthOfVector(IntVectorMemory) > (int)IntMemory

!((int)SelectFieldDS(SelectFieldDS(PacketMemory, "SourceIP"), "Byte1") == 192 &&
  (int)SelectFieldDS(SelectFieldDS(PacketMemory, "SourceIP"),"Byte2") == 162) ||
((int)SelectFieldDS(PacketMemory, "SourcePort") == IntParameter &&
 (int)SelectFieldDS(PacketMemory, "DestPort") != (int)IntMemory && EnumToString(EnumParameter) == "TRUE")