Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmpty = fmt.Errorf("empty filter") ErrExpr = fmt.Errorf("invalid expression") ErrUnmatched = fmt.Errorf("unmatched parentheses") ErrAttr = fmt.Errorf("invalid attribute") ErrIndex = fmt.Errorf("invalid index") ErrOp = fmt.Errorf("invalid operator") ErrValue = fmt.Errorf("invalid value") ErrOpValue = fmt.Errorf("operator needs value") ErrLogic = fmt.Errorf("expecting logical operator") )
Functions ¶
This section is empty.
Types ¶
type Attr ¶
type Attr = int
const ( ATTR_EXPR Attr = iota // sub-expression in value (nested) ATTR_TAG // message tag (from pipe context) ATTR_TYPE // BGP message type ATTR_AF // address family / subsequent address family ATTR_REACH // reachable prefixes ATTR_UNREACH // unreachable prefixes ATTR_PREFIX // prefix, either reachable or unreachable ATTR_ASPATH // AS_PATH attribute ATTR_NEXTHOP // NEXT_HOP attribute ATTR_COMM // COMMUNITY attribute ATTR_COMM_EXT // EXTENDED_COMMUNITY attribute ATTR_COMM_LARGE // LARGE_COMMUNITY attribute )
type Eval ¶
type Eval struct {
Msg *msg.Msg // message being evaluated
PipeKV *xsync.Map[string, any] // pipe key-value store (can be nil)
PipeCaps caps.Caps // pipe capabilities (can be nil)
PipeTags map[string]string // pipe message tags (can be nil)
// contains filtered or unexported fields
}
Eval efficiently evaluates Filters against a given Msg.
func (*Eval) ClearCache ¶
func (ev *Eval) ClearCache()
Clear resets the cache to match the current Msg version.
type Expr ¶
type Expr struct {
Filter *Filter // root filter, must be non-nil
String string // raw expression string
Types bool // allow message types other than UPDATE?
Not bool // negate the final result of this expression?
And bool // apply logical AND with the next expression? (if false, apply OR)
Next *Expr // next expression (nil means last)
Attr Attr // attribute
Idx any // index inside the attribute (eg. int(0) if aspath[0])
Op Op // operator
Val any // value to use (string, int, regexp, etc OR *Expr if nested)
}
Expr represents an expression like <attribute> <operator> <value>, optionally linked with the next expression using a logical AND or OR.
Click to show internal directories.
Click to hide internal directories.