All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Typedefs | Functions
Turbulence Profile Path: API for handling and retrieving information associated to a profile path policy


typedef struct


int __turbulence_ppath_mask_items (TurbulenceCtx *ctx, TurbulencePPathItem **ppath_items, TurbulencePPathState *state, const char *uri, const char *serverName, int channel_num, VortexConnection *connection, const char *profile_content, int level)
void turbulence_ppath_add_profile_attr_alias (TurbulenceCtx *ctx, const char *profile, const char *conn_attr)
TurbulencePPathDefturbulence_ppath_find_by_id (TurbulenceCtx *ctx, int ppath_id)
int turbulence_ppath_get_id (TurbulencePPathDef *ppath_def)
const char * turbulence_ppath_get_name (TurbulencePPathDef *ppath_def)
const char * turbulence_ppath_get_server_name (VortexConnection *conn)
const char * turbulence_ppath_get_work_dir (TurbulenceCtx *ctx, TurbulencePPathDef *ppath_def)
TurbulencePPathDefturbulence_ppath_selected (VortexConnection *conn)

Detailed Description

Typedef Documentation

typedef struct _TurbulencePPathState TurbulencePPathState

about how profile path is applied

In general terms, profile path is the mechanism used by Turbulence to know which profiles and settings are to be enforced on a particular connection.

To do so, the following chain is followed:

1) A connection is received or created due to a tuning profile (like TLS) and it has no profile path selected.

2) Then, a call to __turbulence_ppath_select is done to find a profile path to associate. This function is in charge of setting the mask handler that implements the profile path once selected.

3) If a profile path can't be selected yet because all of them are declared using a serverName and the client still didn't opened a channel requesting a particular serverName, then a temporal profile path mask is used: __turbulence_ppath_mask_temporal.

4) Once the right profile path is selected for a connection, is then configured the profile path mask __turbulence_ppath_mask.

In all steps above, if the connection requests some value that do not match administrative configuration, the connection is either dropped or channel is denied (according its status: if it has a temporal profile path mask or the definitive one).

path state

Every connection has a profile path state object which stores currently the profile path definition selected. This value is accessed via:

state = vortex_connection_get_data (connection, TURBULENCE_PPATH_STATE);

In the case it is required to apply a profile path to a connection because it is in the context of a child with a profile path selected or some similar reason, use the following code:

__turbulence_ppath_set_state (ctx, connection, turbulence_ppath_get_id (ctx->child->ppath), NULL);

For example, this code is used to handle connections at __turbulence_ppath_handle_connection_on_connect when it is detected the connection notified at that function due to a tuning profile process in process (currently only TLS).

Function Documentation

int __turbulence_ppath_mask_items ( TurbulenceCtx ctx,
TurbulencePPathItem **  ppath_items,
TurbulencePPathState state,
const char *  uri,
const char *  serverName,
int  channel_num,
VortexConnection *  connection,
const char *  profile_content,
int  level 

NOTE: about profile filtering

In order to apply profile path filtering, first, a profile path is selected and once done, this function is called to apply policy defined in such profile path.

This function does two checks: the first part tries to check if an <allow> or <if-success> directive allows to create the profile requested at the 0 level. The 0 level is just the set of profiles that are listed as direct childs of the profile path, that is, the profiles that are available directly to peers once the profile path is selected.

In the case no <allow> or <if-sucess> directive allows the profile requested (uri parameter), then the second part is called, which tries to find <if-sucesss> declaration that may contain another <allow> or <if-success> directives that might allow the requested profile. To perform that task, the function calls recursively to itself.

References error, msg2, turbulence_expr_get_expression(), turbulence_expr_match(), and turbulence_ppath_get_name().

void turbulence_ppath_add_profile_attr_alias ( TurbulenceCtx ctx,
const char *  profile,
const char *  conn_attr 

Allows to add a profile path attribute alias on the provided turbulence ctx.

ctxThe turbulence context where the profile path alias will be added.
profileThe profile string to be aliased.
conn_attrThe connection attribute that must be checked instead of the profile string.
TurbulencePPathDef* turbulence_ppath_find_by_id ( TurbulenceCtx ctx,
int  ppath_id 

Function used to find a profile path definition given its unique identifier.

int turbulence_ppath_get_id ( TurbulencePPathDef ppath_def)

Allows to get the unique profile path identifier.

ppath_defThe profile path where the unique identifier will be retrieved.
The unique identifier or -1 ir it fails.
const char* turbulence_ppath_get_name ( TurbulencePPathDef ppath_def)

Allows to get profile path name from the provided profile path.

ppath_defThe profile path definition where the name is retrieved.
A reference to the profile path name or NULL it if fails.

Referenced by __turbulence_ppath_mask_items().

const char* turbulence_ppath_get_server_name ( VortexConnection *  conn)

Allows to get the serverName requested for the profile path selected.

This value represents the serverName sent on first channel start request and was used, along with other data, to select current profile path. This value may be NULL since serverName is optional.

connThe connection with a profile path already configured.
A reference to the serverName value or NULL if it fails.

NOTE: this is NOT the serverName but the value requested by remote BEEP peer. It must be considered as a requested value, until the first channel with serverName is accepted. Then a call to vortex_connection_get_server_name can be done. This API is specially useful when a module wants to load serverName specific environment in case the channel is accepted.

References msg.

const char* turbulence_ppath_get_work_dir ( TurbulenceCtx ctx,
TurbulencePPathDef ppath_def 

Allows to get the profile path working directory.

ctxThe Turbulence context.
ppath_defThe profile path definition where the work directory is retrieved.
A reference to the work directory defined on the profile path or NULL it is not defined.

References wrn.

TurbulencePPathDef* turbulence_ppath_selected ( VortexConnection *  conn)

Allows to get the current selected profile path on the provided connection.

connThe connection where the Profile path configured is requested.
The profile path name or NULL if it has no profile path defined.