WildcardExpr#

class loop_detection.WildcardExpr(string, name=None, max_card=inf, field=None)[source]#

Class for wildcard expression rule representation

Parameters:
  • string (str) – string on the alphabet : {0, 1, * }

  • max_card (int, default = infinity) – maximum cardinality of the rule

  • field (str, default = None) – string for the name of the field the rule acts on (IP source, port range…)

expr#

Wildcard expression of the rule

Type:

str

max_card#
Type:

int

card#

cardinality of the rule

Type:

int

empty_flag#

1 if the rule is empty, 0 otherwise

Type:

int

field#
Type:

str

Examples

>>> r1 = WildcardExpr("*10*")
>>> r2 = WildcardExpr("*1*1")
__and__(other)[source]#

Returns the result of set intersection

Parameters:

other (WildcardExpr) –

Return type:

WildcardExpr

Examples

>>> r1 = WildcardExpr("*10*")
>>> r2 = WildcardExpr("*1*1")
>>> r1 & r2
*101
__lt__(other)[source]#

Check if self is included in other (equality is accepted)

Parameters:

other (WildcardExpr) –

Return type:

bool

Examples

>>> r1 = WildcardExpr("*10*")
>>> r2 = WildcardExpr("*1**")
>>> r1 < r2
True
>>> r3 = WildcardExpr("****")
>>> r3 < r2
False