All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Macros | Typedefs | Functions
Turbulence expr: regular expression support.

Macros

#define __TBC_EXP_STR__(expr)   turbulence_expr_get_expression(expr)
 

Typedefs

typedef struct _TurbulenceExpr TurbulenceExpr
 

Functions

TurbulenceExprturbulence_expr_compile (TurbulenceCtx *ctx, const char *expression, const char *error_msg)
 
void turbulence_expr_free (TurbulenceExpr *expr)
 
const char * turbulence_expr_get_expression (TurbulenceExpr *expr)
 
axl_bool turbulence_expr_match (TurbulenceExpr *expr, const char *subject)
 

Detailed Description

Macro Definition Documentation

#define __TBC_EXP_STR__ (   expr)    turbulence_expr_get_expression(expr)

Alias definition associated to turbulence_expr_get_expression.

Parameters
exprThe TurbulenceExpr where the associated string expression is being queried.
Returns
A reference to the string expression.

Typedef Documentation

typedef struct _TurbulenceExpr TurbulenceExpr

Regular expression type definition provided by the Turbulence expr: regular expression support. module.

This type is used to represent an regular expression that can be used to match strings.

Function Documentation

TurbulenceExpr * turbulence_expr_compile ( TurbulenceCtx ctx,
const char *  expression,
const char *  error_msg 
)

Compiles the expression contained inside (expression) returning a reference to a regular expression that can be used to match strings.

Parameters
ctxThe context where the match operation will take place.
expressionThe regular expression definition.
error_msgThis is an optional error message that can be used by the function to perform a better error reporting. For example, in the case you are compiling an expression for some particular item, you can provide an string such "Failed to compile expression to be used for...". This will help administrators to configure turbulence.
Returns
A newly created reference to the expression compiled or NULL if it fails. The expression returned must be terminated to return resouces used by using turbulence_expr_free.

References error, and msg.

void turbulence_expr_free ( TurbulenceExpr expr)

Terminate the regular expression compiled by turbulence_expr_compile.

const char * turbulence_expr_get_expression ( TurbulenceExpr expr)

Allows to get the string expression this compiled TurbulenceExpr runs.

Parameters
exprThe turbulence expression to get string expression from.
Returns
A reference to the string expression that was used to build this TurbulenceExpr or NULL if it fails.

Referenced by __turbulence_ppath_mask_items().

axl_bool turbulence_expr_match ( TurbulenceExpr expr,
const char *  subject 
)

Function that allows perform matching against the expression, using the subject received.

Parameters
exprThe expression to use to match the string provided (subject). This expression was created with turbulence_expr_compile.
subjectThe string that is going to be matched.
Returns
The function return axl_true in the case the expression (expr) match the string provided (subject).

Referenced by __turbulence_ppath_mask_items().