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 | Enumerations | Functions
sol-flow.h File Reference

These routines are used for Soletta flows manipulation. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <time.h>
#include "sol-flow-packet.h"
#include "sol-flow-buildopts.h"

Go to the source code of this file.

Data Structures

struct  sol_flow_node_container_type
 Structure of Container Node. More...
 
struct  sol_flow_node_named_options
 Named options is an intermediate structure to handle Node Options parsing. More...
 
struct  sol_flow_node_named_options_member
 Structure of a Options Member. More...
 
struct  sol_flow_node_options
 Node options are a set of attributes defined by the Node Type that can change the behavior of a Node. More...
 
struct  sol_flow_node_type
 The node type describes the capabilities and operations of a node. More...
 
struct  sol_flow_port_type_in
 Node's Input port structure. More...
 
struct  sol_flow_port_type_out
 Node's Output port structure. More...
 

Macros

#define sol_flow_get_node_type(_mod, _type, _var)   ({ (*(_var)) = &_type; 0; })
 Gets the specified node type, loading the necessary module if required. More...
 
#define sol_flow_get_packet_type(_mod, _type, _var)   ({ (*(_var)) = _type; 0; })
 Gets the specified packet type, loading the necessary module if required. More...
 
#define SOL_FLOW_NODE_OPTIONS_API_VERSION   (1)
 Compile time API version to be checked during runtime. More...
 
#define SOL_FLOW_NODE_PORT_ERROR   (UINT16_MAX - 1)
 Built-in output port's number, common to every node, meant to output error packets. More...
 
#define SOL_FLOW_NODE_PORT_ERROR_NAME   ("ERROR")
 Error port identifier. More...
 
#define SOL_FLOW_NODE_TYPE_API_VERSION   (1)
 Compile time API version to be checked during runtime. More...
 
#define SOL_FLOW_PORT_TYPE_IN_API_VERSION   (1)
 Compile time API version to be checked during runtime. More...
 
#define SOL_FLOW_PORT_TYPE_OUT_API_VERSION   (1)
 Compile time API version to be checked during runtime. More...
 

Typedefs

typedef struct sol_flow_node sol_flow_node
 A node is an entity that has input/output ports. More...
 
typedef struct
sol_flow_node_container_type 
sol_flow_node_container_type
 Structure of Container Node. More...
 
typedef struct
sol_flow_node_named_options 
sol_flow_node_named_options
 Named options is an intermediate structure to handle Node Options parsing. More...
 
typedef struct
sol_flow_node_named_options_member 
sol_flow_node_named_options_member
 Structure of a Options Member. More...
 
typedef struct
sol_flow_node_options 
sol_flow_node_options
 Node options are a set of attributes defined by the Node Type that can change the behavior of a Node. More...
 
typedef struct sol_flow_node_type sol_flow_node_type
 The node type describes the capabilities and operations of a node. More...
 
typedef struct
sol_flow_port_type_in 
sol_flow_port_type_in
 Node's Input port structure. More...
 
typedef struct
sol_flow_port_type_out 
sol_flow_port_type_out
 Node's Output port structure. More...
 

Enumerations

enum  sol_flow_node_options_member_type {
  SOL_FLOW_NODE_OPTIONS_MEMBER_UNKNOWN, SOL_FLOW_NODE_OPTIONS_MEMBER_BOOL, SOL_FLOW_NODE_OPTIONS_MEMBER_BYTE, SOL_FLOW_NODE_OPTIONS_MEMBER_DIRECTION_VECTOR,
  SOL_FLOW_NODE_OPTIONS_MEMBER_DRANGE_SPEC, SOL_FLOW_NODE_OPTIONS_MEMBER_FLOAT, SOL_FLOW_NODE_OPTIONS_MEMBER_INT, SOL_FLOW_NODE_OPTIONS_MEMBER_IRANGE_SPEC,
  SOL_FLOW_NODE_OPTIONS_MEMBER_RGB, SOL_FLOW_NODE_OPTIONS_MEMBER_STRING
}
 Possible types for option attributes (or members). More...
 
enum  sol_flow_node_type_flags { SOL_FLOW_NODE_TYPE_FLAGS_CONTAINER = (1 << 0) }
 Flags used to set some sol_flow_node_type characteristics. More...
 

Functions

void sol_flow_node_del (struct sol_flow_node *node)
 Deletes a node. More...
 
const char * sol_flow_node_get_id (const struct sol_flow_node *node)
 Retrieves the node ID string. More...
 
const struct sol_flow_nodesol_flow_node_get_parent (const struct sol_flow_node *node)
 Gets the node's parent. More...
 
void * sol_flow_node_get_private_data (const struct sol_flow_node *node)
 Retrieves a node private data. More...
 
const struct sol_flow_node_typesol_flow_node_get_type (const struct sol_flow_node *node)
 Get a node's type. More...
 
void sol_flow_node_named_options_fini (struct sol_flow_node_named_options *named_opts)
 Finalize named options. More...
 
int sol_flow_node_named_options_init_from_strv (struct sol_flow_node_named_options *named_opts, const struct sol_flow_node_type *type, const char *const *strv)
 Initializes a Named options structure from a options string. More...
 
struct sol_flow_nodesol_flow_node_new (struct sol_flow_node *parent, const char *id, const struct sol_flow_node_type *type, const struct sol_flow_node_options *options)
 Creates a new node. More...
 
void sol_flow_node_options_del (const struct sol_flow_node_type *type, struct sol_flow_node_options *options)
 Delete an options handle. More...
 
enum
sol_flow_node_options_member_type 
sol_flow_node_options_member_type_from_string (const char *data_type)
 Returns the option member type which name is data_type. More...
 
const char * sol_flow_node_options_member_type_to_str (enum sol_flow_node_options_member_type type)
 Returns a string for the name of a given option member type. More...
 
int sol_flow_node_options_new (const struct sol_flow_node_type *type, const struct sol_flow_node_named_options *named_opts, struct sol_flow_node_options **out_opts)
 Creates a new Node Options. More...
 
void sol_flow_node_options_strv_del (char **opts_strv)
 Delete a key-value options array. More...
 
void sol_flow_node_type_del (struct sol_flow_node_type *type)
 Delete a node type. More...
 
const struct
sol_flow_port_type_in
sol_flow_node_type_get_port_in (const struct sol_flow_node_type *type, uint16_t port)
 Get a node type's input port definition struct, given a port index. More...
 
const struct
sol_flow_port_type_out
sol_flow_node_type_get_port_out (const struct sol_flow_node_type *type, uint16_t port)
 Get a node type's output port definition struct, given a port index. More...
 
int sol_flow_send_blob_packet (struct sol_flow_node *src, uint16_t src_port, const struct sol_blob *value)
 Convenience function to create and send a Blob packet. More...
 
int sol_flow_send_bool_packet (struct sol_flow_node *src, uint16_t src_port, unsigned char value)
 Convenience function to create and send a Boolean packet. More...
 
int sol_flow_send_byte_packet (struct sol_flow_node *src, uint16_t src_port, unsigned char value)
 Convenience function to create and send a Byte packet. More...
 
int sol_flow_send_composed_packet (struct sol_flow_node *src, uint16_t src_port, const struct sol_flow_packet_type *composed_type, struct sol_flow_packet **children)
 Convenience function to create and send a Composed packet. More...
 
int sol_flow_send_direction_vector_components_packet (struct sol_flow_node *src, uint16_t src_port, double x, double y, double z)
 Similar to sol_flow_send_direction_vector_packet(), but takes the vector components as arguments. More...
 
int sol_flow_send_direction_vector_packet (struct sol_flow_node *src, uint16_t src_port, const struct sol_direction_vector *value)
 Convenience function to create and send a Direction Vector packet. More...
 
int sol_flow_send_drange_packet (struct sol_flow_node *src, uint16_t src_port, const struct sol_drange *value)
 Convenience function to create and send a Drange packet. More...
 
int sol_flow_send_drange_value_packet (struct sol_flow_node *src, uint16_t src_port, double value)
 Convenience function to create and send a Drange packet of value value and default spec. More...
 
int sol_flow_send_empty_packet (struct sol_flow_node *src, uint16_t src_port)
 Convenience function to create and send an Empty packet. More...
 
int sol_flow_send_error_packet (struct sol_flow_node *src, int code, const char *msg_fmt,...) SOL_ATTR_PRINTF(3
 Convenience function to create and send an Error packet. More...
 
int int sol_flow_send_error_packet_errno (struct sol_flow_node *src, int code)
 Similar to sol_flow_send_error_packet, but uses a default error message based on code. More...
 
int sol_flow_send_error_packet_str (struct sol_flow_node *src, int code, const char *str)
 Similar to sol_flow_send_error_packet, but the error message is ready to be used. More...
 
int sol_flow_send_http_response_packet (struct sol_flow_node *src, uint16_t src_port, int response_code, const char *url, const char *content_type, const struct sol_blob *content, const struct sol_vector *cookies, const struct sol_vector *headers)
 Convenience function to create and send a HTTP Response packet. More...
 
int sol_flow_send_irange_packet (struct sol_flow_node *src, uint16_t src_port, const struct sol_irange *value)
 Convenience function to create and send an Irange packet. More...
 
int sol_flow_send_irange_value_packet (struct sol_flow_node *src, uint16_t src_port, int32_t value)
 Convenience function to create and send a Irange packet of value value and default spec. More...
 
int sol_flow_send_json_array_packet (struct sol_flow_node *src, uint16_t src_port, const struct sol_blob *value)
 Convenience function to create and send a JSON Array packet. More...
 
int sol_flow_send_json_object_packet (struct sol_flow_node *src, uint16_t src_port, const struct sol_blob *value)
 Convenience function to create and send a JSON Object packet. More...
 
int sol_flow_send_location_components_packet (struct sol_flow_node *src, uint16_t src_port, double lat, double lon, double alt)
 Similar to sol_flow_send_location_packet(), but takes the location components as arguments. More...
 
int sol_flow_send_location_packet (struct sol_flow_node *src, uint16_t src_port, const struct sol_location *value)
 Convenience function to create and send a Location packet. More...
 
int sol_flow_send_packet (struct sol_flow_node *src, uint16_t src_port, struct sol_flow_packet *packet)
 Send a packet from a given node to one of its output ports. More...
 
int sol_flow_send_rgb_components_packet (struct sol_flow_node *src, uint16_t src_port, uint32_t red, uint32_t green, uint32_t blue)
 Similar to sol_flow_send_rgb_packet(), but takes the RGB components as arguments. More...
 
int sol_flow_send_rgb_packet (struct sol_flow_node *src, uint16_t src_port, const struct sol_rgb *value)
 Convenience function to create and send a RGB packet. More...
 
int sol_flow_send_string_packet (struct sol_flow_node *src, uint16_t src_port, const char *value)
 Convenience function to create and send a String packet. More...
 
int sol_flow_send_string_slice_packet (struct sol_flow_node *src, uint16_t src_port, const struct sol_str_slice value)
 Convenience function to create and send a String packet from a string slice. More...
 
int sol_flow_send_string_take_packet (struct sol_flow_node *src, uint16_t src_port, char *value)
 Convenience function to create and send a String packet but takes ownership of value to use as the packet content. More...
 
int sol_flow_send_timestamp_packet (struct sol_flow_node *src, uint16_t src_port, const struct timespec *value)
 Convenience function to create and send a Timestamp packet. More...
 

Detailed Description

These routines are used for Soletta flows manipulation.

Macro Definition Documentation

#define SOL_FLOW_NODE_OPTIONS_API_VERSION   (1)

Compile time API version to be checked during runtime.

Examples:
/src/samples/flow/c-api/simple-c-type.c.

Referenced by startup().

#define SOL_FLOW_NODE_PORT_ERROR   (UINT16_MAX - 1)

Built-in output port's number, common to every node, meant to output error packets.

#define SOL_FLOW_NODE_TYPE_API_VERSION   (1)

Compile time API version to be checked during runtime.

#define SOL_FLOW_PORT_TYPE_IN_API_VERSION   (1)

Compile time API version to be checked during runtime.

#define SOL_FLOW_PORT_TYPE_OUT_API_VERSION   (1)

Compile time API version to be checked during runtime.