Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions

Static flow is a parent node that creates its children nodes and routes packets between them. More...

Data Structures

struct  sol_flow_static_conn_spec
 Structure for the specification of a connection. More...
 
struct  sol_flow_static_node_spec
 Structure for the specification of a node. More...
 
struct  sol_flow_static_port_spec
 Structure for the specification of node ports. More...
 
struct  sol_flow_static_spec
 Specification of how a static flow should work. More...
 

Macros

#define SOL_FLOW_STATIC_CONN_SPEC_GUARD   { .src = UINT16_MAX }
 Guard element of the connections spec array. More...
 
#define SOL_FLOW_STATIC_NODE_SPEC_GUARD   { }
 Guard element of the nodes spec array. More...
 
#define SOL_FLOW_STATIC_PORT_SPEC_GUARD   { .node = UINT16_MAX }
 Guard element of the ports spec array. More...
 

Typedefs

typedef struct
sol_flow_static_conn_spec 
sol_flow_static_conn_spec
 Structure for the specification of a connection. More...
 
typedef struct
sol_flow_static_node_spec 
sol_flow_static_node_spec
 Structure for the specification of a node. More...
 
typedef struct
sol_flow_static_port_spec 
sol_flow_static_port_spec
 Structure for the specification of node ports. More...
 
typedef struct sol_flow_static_spec sol_flow_static_spec
 Specification of how a static flow should work. More...
 

Functions

struct sol_flow_nodesol_flow_static_get_node (struct sol_flow_node *node, uint16_t index)
 Get a container node's children node by index. More...
 
struct sol_flow_nodesol_flow_static_new (struct sol_flow_node *parent, const struct sol_flow_static_node_spec nodes[], const struct sol_flow_static_conn_spec conns[])
 Creates a new "static flow" node. More...
 
struct sol_flow_node_typesol_flow_static_new_type (const struct sol_flow_static_spec *spec)
 Creates a new "static flow" (container) type. More...
 

Detailed Description

Static flow is a parent node that creates its children nodes and routes packets between them.

It follows an specification received upon creation. The configuration of the flow (connections made) will not change at runtime – thus the name static.

The specification consists in two arrays: one indicating each node type, and the other indicating each connection as a sequence of (source node, source port, destination node, destination port) tuples.

The connection specification is used to dispatch connections when messages are sent. This approach provides a very low memory overhead but still perfomant way to route the packets.

Macro Definition Documentation

#define SOL_FLOW_STATIC_CONN_SPEC_GUARD   { .src = UINT16_MAX }

Guard element of the connections spec array.

Examples:
/src/samples/flow/c-api/lowlevel.c.
#define SOL_FLOW_STATIC_NODE_SPEC_GUARD   { }

Guard element of the nodes spec array.

Examples:
/src/samples/flow/c-api/lowlevel.c.
#define SOL_FLOW_STATIC_PORT_SPEC_GUARD   { .node = UINT16_MAX }

Guard element of the ports spec array.

Typedef Documentation

Structure for the specification of a connection.

Structure for the specification of a node.

Structure for the specification of node ports.

Specification of how a static flow should work.

Note
Note that the arrays and functions provided are assumed to be available and valid while the static flow type created from it is being used.

Function Documentation

struct sol_flow_node* sol_flow_static_get_node ( struct sol_flow_node node,
uint16_t  index 
)

Get a container node's children node by index.

Parameters
nodeThe node to get the child node from
indexThe index of the child node in node (position in the sol_flow_static_node_spec array)
Returns
The child node of node with the given index or NULL, on errors.
struct sol_flow_node* sol_flow_static_new ( struct sol_flow_node parent,
const struct sol_flow_static_node_spec  nodes[],
const struct sol_flow_static_conn_spec  conns[] 
)

Creates a new "static flow" node.

Nodes should be created in the sol_main_callbacks::startup function, and at least the root one must be a "static flow" node. This function will create one of those "by hand", if all the child nodes and connections are provided.

Parameters
parentThe parent node. Pass NULL if you're creating the root node of the flow.
nodesA SOL_FLOW_STATIC_PORT_SPEC_GUARD terminated array of node specification structs
connsA SOL_FLOW_STATIC_CONN_SPEC_GUARD terminated array of port connections of the nodes declared in nodes. This array must be sorted by node index and port indexes.

For a higher level construct to get your root static flow node, consider using sol_flow_builder_new() family of functions.

See Also
sol_flow_new(), sol_flow_builder_get_node_type() and sol_flow_static_new_type().
Returns
A new node instance on success, otherwise NULL.
Examples:
/src/samples/flow/c-api/lowlevel.c.

Referenced by startup().

struct sol_flow_node_type* sol_flow_static_new_type ( const struct sol_flow_static_spec spec)

Creates a new "static flow" (container) type.

This allows one to create a static flow type "by hand" and fine- tune it. Exported input/output ports may be declared, as well as options forwarding.

Parameters
specA specification of the type to be created. The data inside the spec is assumed to still be valid until the type is deleted.
Returns
A new container node type on success, otherwise NULL.