All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
Turbulence Connection Manager: a module that controls all connections created under the turbulence execution


void __turbulence_conn_mgr_proxy_reads (VortexConnection *conn)
axl_bool __turbulence_conn_proxy_reads_loop (TurbulenceLoop *loop, TurbulenceCtx *ctx, int descriptor, axlPointer ptr, axlPointer ptr2)
axl_bool turbulence_conn_mgr_broadcast_msg (TurbulenceCtx *ctx, const void *message, int message_size, const char *profile, TurbulenceConnMgrFilter filter_conn, axlPointer filter_data)
axlList * turbulence_conn_mgr_conn_list (TurbulenceCtx *ctx, VortexPeerRole role, const char *filter)
int turbulence_conn_mgr_count (TurbulenceCtx *ctx)
VortexConnection * turbulence_conn_mgr_find_by_id (TurbulenceCtx *ctx, int conn_id)
axl_bool turbulence_conn_mgr_proxy_on_parent (VortexConnection *conn)
int turbulence_conn_mgr_setup_proxy_on_parent (TurbulenceCtx *ctx, VortexConnection *conn)

Detailed Description

Function Documentation

void __turbulence_conn_mgr_proxy_reads ( VortexConnection *  conn)

Function used to read content from the connection and write that content into the child socket.

Read Write [ Proxied connection ] –> [ Child socket ]

References wrn.

Referenced by turbulence_conn_mgr_setup_proxy_on_parent().

axl_bool __turbulence_conn_proxy_reads_loop ( TurbulenceLoop loop,
TurbulenceCtx ctx,
int  descriptor,
axlPointer  ptr,
axlPointer  ptr2 

Function used to read content from the socket in the loop into the connection proxied.

Read Write [ Loop socket ] –> [ Proxy connection ]

References wrn.

Referenced by turbulence_conn_mgr_setup_proxy_on_parent().

axl_bool turbulence_conn_mgr_broadcast_msg ( TurbulenceCtx ctx,
const void *  message,
int  message_size,
const char *  profile,
TurbulenceConnMgrFilter  filter_conn,
axlPointer  filter_data 

General purpose function that allows to broadcast the provided message (and size), over all channel, running the profile provided, on all connections registered.

The function is really useful if it is required to perform a general broadcast to all BEEP peers connected running a particular profile. The function produces a MSG frame with the content provided.

The function also allows to configure the connections that aren't broadcasted. To do so, pass the function (filter_conn) that configures which connections receives the notification and which not.

ctxTurbulence context where the operation will take place.
messageThe message that is being broadcasted. This parameter is not optional. For empty messages use "" instead of NULL.
message_sizeThe message size to broadcast. This parameter is not optional. For empty messages use 0.
profileThe profile to search for in all connections registered. If a channel is found running this profile, then a message is sent. This attribute is not optional.
filter_connConnection filtering function. If it returns axl_true, the connection is filter. Optional parameter.
filter_dataUser defined data provided to the filter function. Optional parameter.
axl_true if the broadcast message was sent to all connections. The function could return axl_false but it has no support to notify which was the connection(s) or channel(s) that failed.

References error.

axlList * turbulence_conn_mgr_conn_list ( TurbulenceCtx ctx,
VortexPeerRole  role,
const char *  filter 

Allows to get a list of connections registered on the connection manager, matching the providing role and then filtered by the provided filter string.

ctxThe context where the operation will take place.
roleConnection role to select connections. Use -1 to select all connections registered on the manager, no matter its role.
filterOptional filter expresion to resulting connection list. It can be NULL.
A newly allocated connection list having on each position a reference to a VortexConnection object. The caller must finish the list with axl_list_free to free resources. The function returns NULL if it fails.

References msg.

int turbulence_conn_mgr_count ( TurbulenceCtx ctx)

Allows to get number of connections currently handled by this process.

ctxThe context where the query will be served.
The number of connections or -1 if it fails.
VortexConnection* turbulence_conn_mgr_find_by_id ( TurbulenceCtx ctx,
int  conn_id 

Allows to get a reference to the registered connection with the provided id.

The function will return a reference to a VortexConnection owned by the turbulence connection manager.

ctxThe turbulence conext where the connection reference will be looked up.
conn_idThe connection id to lookup.
A VortexConnection reference or NULL value it if fails.
axl_bool turbulence_conn_mgr_proxy_on_parent ( VortexConnection *  conn)

Allows to check if the provided connection has to be proxied on the parent master process in the case it is required to be sent to a child process due to profile path configuration.

To flag a connection in such way will create an especial configuration at the parent process to read content over the provided connection and send it to a "representation" running on the child (as opposed to fully send the entire connection to be handled by the child).

This is done to support some especiall cases (especially those where TLS is around) where it is not possible to store the state of a connection and resume it on a child process.

NOTE: This function only flags! it does not actually send the connection to a particular child (that only will happens when the site administrator configures the profile path to make it).

connThe connection that is flagged to be proxied on parent.
axl_true in the case the connection was flagged to be proxied on on parent otherwise, axl_false is returned.

NOTE TO DEVELOPERS: in the case you are creating a module that needs to activate this feature, just set the value as follows:

1 // set up proxy configuration
2 vortex_connection_set_data (conn, "tbc:proxy:conn", INT_TO_PTR (axl_true));
int turbulence_conn_mgr_setup_proxy_on_parent ( TurbulenceCtx ctx,
VortexConnection *  conn 

Setups the necessary configuration to start proxing content of that connection passing all bytes into the returned socket.

ctxThe turbulence context where the operation will take place.
connThe connection that will be proxied.
The socket where all content will be proxied, remaining on the parent process all code to reading and writing the provided socket.

References __turbulence_conn_mgr_proxy_reads(), __turbulence_conn_proxy_reads_loop(), error, msg, turbulence_loop_create(), and turbulence_loop_watch_descriptor().