553 #ifndef SOL_NO_API_VERSION
554 #define SOL_FLOW_NODE_OPTIONS_API_VERSION (1)
555 uint16_t api_version;
650 const char *
const *strv);
676 #include "sol-flow-buildopts.h"
681 #define SOL_FLOW_NODE_PORT_ERROR_NAME ("ERROR")
683 #ifdef SOL_FLOW_NODE_TYPE_DESCRIPTION_ENABLED
687 typedef struct sol_flow_port_description {
689 const char *description;
690 const char *data_type;
692 uint16_t base_port_idx;
700 } sol_flow_port_description;
705 typedef struct sol_flow_node_options_member_description {
707 const char *description;
708 const char *data_type;
724 } sol_flow_node_options_member_description;
729 typedef struct sol_flow_node_options_description {
730 const struct sol_flow_node_options_member_description *members;
732 #ifndef SOL_NO_API_VERSION
736 } sol_flow_node_options_description;
745 typedef struct sol_flow_node_type_description {
746 #ifndef SOL_NO_API_VERSION
756 #define SOL_FLOW_NODE_TYPE_DESCRIPTION_API_VERSION (1)
757 uint16_t api_version;
767 const char *category;
769 const char *options_symbol;
770 const char *description;
775 const struct sol_flow_port_description *
const *ports_in;
776 const struct sol_flow_port_description *
const *ports_out;
777 const struct sol_flow_node_options_description *options;
778 } sol_flow_node_type_description;
797 #define SOL_FLOW_NODE_PORT_ERROR (UINT16_MAX - 1)
798 #ifndef SOL_NO_API_VERSION
799 #define SOL_FLOW_NODE_TYPE_API_VERSION (1)
800 uint16_t api_version;
847 #ifdef SOL_FLOW_NODE_TYPE_DESCRIPTION_ENABLED
848 const struct sol_flow_node_type_description *description;
852 #ifdef SOL_FLOW_NODE_TYPE_DESCRIPTION_ENABLED
862 int sol_flow_node_named_options_parse_member(
865 const struct sol_flow_node_options_member_description *mdesc);
898 #ifdef SOL_FLOW_NODE_TYPE_DESCRIPTION_ENABLED
906 void sol_flow_foreach_builtin_node_type(
bool (*cb)(
void *data,
const struct sol_flow_node_type *type),
const void *data);
916 const struct sol_flow_port_description *sol_flow_node_get_description_port_in(
const struct sol_flow_node_type *type, uint16_t
port);
926 const struct sol_flow_port_description *sol_flow_node_get_description_port_out(
const struct sol_flow_node_type *type, uint16_t
port);
938 uint16_t sol_flow_node_find_port_in(
const struct sol_flow_node_type *type,
const char *name);
950 uint16_t sol_flow_node_find_port_out(
const struct sol_flow_node_type *type,
const char *name);
994 #ifndef SOL_NO_API_VERSION
995 #define SOL_FLOW_PORT_TYPE_OUT_API_VERSION (1)
996 uint16_t api_version;
1015 #ifndef SOL_NO_API_VERSION
1016 #define SOL_FLOW_PORT_TYPE_IN_API_VERSION (1)
1017 uint16_t api_version;
1058 #ifdef SOL_DYNAMIC_MODULES
1060 #define sol_flow_get_node_type(_mod, _type, _var) sol_flow_internal_get_node_type(_mod, #_type, _var)
1062 int sol_flow_internal_get_node_type(
const char *modname,
const char *symbol,
const struct sol_flow_node_type ***type);
1064 #define sol_flow_get_packet_type(_mod, _type, _var) sol_flow_internal_get_packet_type(_mod, #_type, _var)
1066 int sol_flow_internal_get_packet_type(
const char *module,
const char *symbol,
const struct sol_flow_packet_type **type);
1069 #define sol_flow_get_node_type(_mod, _type, _var) ({ (*(_var)) = &_type; 0; })
1070 #define sol_flow_get_packet_type(_mod, _type, _var) ({ (*(_var)) = _type; 0; })
const struct sol_flow_packet_type * packet_type
The packet type that the port will receive.
Definition: sol-flow.h:1019
struct sol_flow_node_named_options sol_flow_node_named_options
Named options is an intermediate structure to handle Node Options parsing.
struct sol_flow_port_type_in sol_flow_port_type_in
Node's Input port structure.
void sol_flow_node_named_options_fini(struct sol_flow_node_named_options *named_opts)
Finalize named options.
int(* connect)(struct sol_flow_node *node, void *data, uint16_t port, uint16_t conn_id)
Member function issued every time a new connection is made to the port.
Definition: sol-flow.h:1003
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.
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.
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.
#define SOL_ATTR_PRINTF(fmt, arg)
Specifies that a function takes printf style arguments which should be type-checked against a format ...
Definition: sol-macros.h:189
int(* process)(struct sol_flow_node *container, uint16_t source_in_port_idx, struct sol_flow_packet *packet)
Member function issued when there is no parent and a sol_flow_send() was called in this container...
Definition: sol-flow.h:977
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.
These routines are used for Soletta flow packets manipulation.
struct sol_flow_node_container_type sol_flow_node_container_type
Structure of Container Node.
Structure of a Options Member.
Definition: sol-flow.h:598
void sol_flow_node_options_strv_del(char **opts_strv)
Delete a key-value options array.
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.
const void * type_data
Pointer to per-type user data.
Definition: sol-flow.h:806
struct sol_flow_node * sol_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.
uint16_t ports_out_count
Number of Output ports.
Definition: sol-flow.h:810
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.
void sol_flow_node_options_del(const struct sol_flow_node_type *type, struct sol_flow_node_options *options)
Delete an options handle.
Node options are a set of attributes defined by the Node Type that can change the behavior of a Node...
Definition: sol-flow.h:552
sol_flow_node_type_flags
Flags used to set some sol_flow_node_type characteristics.
Definition: sol-flow.h:784
int sol_flow_send_empty_packet(struct sol_flow_node *src, uint16_t src_port)
Convenience function to create and send an Empty packet.
void sol_flow_node_type_del(struct sol_flow_node_type *type)
Delete a node type.
Data type describing a Double range.
Definition: sol-types.h:187
Definition: sol-flow.h:569
Definition: sol-flow.h:570
struct sol_flow_node_named_options_member * members
List of option members.
Definition: sol-flow.h:620
struct sol_flow_node sol_flow_node
A node is an entity that has input/output ports.
Definition: sol-flow.h:71
Definition: sol-flow.h:567
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.
unsigned char byte
Value of a byte member.
Definition: sol-flow.h:603
struct sol_rgb rgb
Value of a rgb member.
Definition: sol-flow.h:607
Structure of Container Node.
Definition: sol-flow.h:959
int(* disconnect)(struct sol_flow_node *node, void *data, uint16_t port, uint16_t conn_id)
Member function issued every time a connection is unmade on the port.
Definition: sol-flow.h:1008
struct sol_drange_spec drange_spec
Value of a drange spec member.
Definition: sol-flow.h:606
Definition: sol-flow.h:573
Definition: sol-flow.h:565
double f
Value of a float member.
Definition: sol-flow.h:610
struct sol_direction_vector direction_vector
Value of a direction vector member.
Definition: sol-flow.h:608
uint16_t options_size
Options size in bytes.
Definition: sol-flow.h:803
void(* add)(struct sol_flow_node *container, struct sol_flow_node *node)
Member function that, if not NULL, is issued when child nodes of of an instance of this type are crea...
Definition: sol-flow.h:982
static struct sol_buffer value
Definition: server.c:42
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...
struct sol_flow_packet sol_flow_packet
A packet is a generic container for different kinds (types) of contents.
Definition: sol-flow-packet.h:54
uint16_t ports_in_count
Number of Input ports.
Definition: sol-flow.h:809
static struct sol_blob lat
Definition: lwm2m-server.c:61
String slice type.
Definition: sol-str-slice.h:84
Data type to describe a direction vector.
Definition: sol-types.h:125
Definition: sol-flow.h:571
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.
int32_t i
Value of a integer member.
Definition: sol-flow.h:604
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.
The node type describes the capabilities and operations of a node.
Definition: sol-flow.h:796
uint16_t count
Number of members.
Definition: sol-flow.h:621
int(* open)(struct sol_flow_node *node, void *data, const struct sol_flow_node_options *options)
Member function to instantiate the node.
Definition: sol-flow.h:825
void(* close)(struct sol_flow_node *node, void *data)
Member function to delete the node.
Definition: sol-flow.h:830
void sol_flow_node_del(struct sol_flow_node *node)
Deletes a node.
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.
struct sol_flow_port_type_out sol_flow_port_type_out
Node's Output port structure.
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.
Data type describing Integer ranges.
Definition: sol-types.h:327
struct sol_flow_node_type sol_flow_node_type
The node type describes the capabilities and operations of a node.
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.
Data type to describe a location.
Definition: sol-types.h:146
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...
Data type to describe a RGB color.
Definition: sol-types.h:155
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.
const struct sol_flow_packet_type * packet_type
The packet type that the port will deliver.
Definition: sol-flow.h:998
static int port
Definition: server-sse.c:72
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.
Definition: sol-flow.h:568
int(* disconnect)(struct sol_flow_node *node, void *data, uint16_t port, uint16_t conn_id)
member function issued every time a connection is unmade on the port
Definition: sol-flow.h:1026
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. ...
Data type describing the default blob implementation.
Definition: sol-types.h:468
Node's Input port structure.
Definition: sol-flow.h:1014
struct sol_irange_spec irange_spec
Value of a irange spec member.
Definition: sol-flow.h:605
Node's Output port structure.
Definition: sol-flow.h:993
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.
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...
int(* connect)(struct sol_flow_node *node, void *data, uint16_t port, uint16_t conn_id)
member function issued every time a new connection is made to the port
Definition: sol-flow.h:1025
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.
Named options is an intermediate structure to handle Node Options parsing.
Definition: sol-flow.h:619
bool boolean
Value of a boolean member.
Definition: sol-flow.h:602
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.
sol_flow_node_options_member_type
Possible types for option attributes (or members).
Definition: sol-flow.h:563
int(* process)(struct sol_flow_node *node, void *data, uint16_t port, uint16_t conn_id, const struct sol_flow_packet *packet)
Member function issued every time a new packet arrives to the port.
Definition: sol-flow.h:1024
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.
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.
Definition: sol-flow.h:572
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.
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.
void(* init_type)(void)
Member function that allows initialization of node-specific data (packet types, logging domains...
Definition: sol-flow.h:837
void(* dispose_type)(struct sol_flow_node_type *type)
Called to dispose any extra resources.
Definition: sol-flow.h:845
const char * name
Member's name.
Definition: sol-flow.h:599
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. ...
struct sol_flow_node_type base
base part of the container node
Definition: sol-flow.h:960
const struct sol_flow_node_type * sol_flow_node_get_type(const struct sol_flow_node *node)
Get a node's type.
uint16_t flags
Node type flags.
Definition: sol-flow.h:804
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...
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.
Flag to set the node as Container (a "static flow" node is an example)
Definition: sol-flow.h:785
Soletta vector is an array that grows dynamically.
Definition: sol-vector.h:58
const char * sol_flow_node_get_id(const struct sol_flow_node *node)
Retrieves the node ID string.
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.
Definition: sol-flow.h:566
Data type describing a spec for Integer ranges.
Definition: sol-types.h:339
struct sol_flow_node_named_options_member sol_flow_node_named_options_member
Structure of a Options Member.
const char * string
Value of a string member.
Definition: sol-flow.h:609
Data type describing a spec for Double ranges.
Definition: sol-types.h:199
A packet type defines what's the content of a packet and how it's stored and retrieved.
Definition: sol-flow-packet.h:60
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.
void * sol_flow_node_get_private_data(const struct sol_flow_node *node)
Retrieves a node private data.
uint16_t data_size
Size of the whole sol_flow_node_type derivate in bytes.
Definition: sol-flow.h:802
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 pa...
enum sol_flow_node_options_member_type type
Member's type.
Definition: sol-flow.h:600
const void * default_options
The default options for this type.
Definition: sol-flow.h:807
Definition: sol-flow.h:564
int(* send)(struct sol_flow_node *container, struct sol_flow_node *source_node, uint16_t source_out_port_idx, struct sol_flow_packet *packet)
Member function issued when a child node sends packets to its output ports.
Definition: sol-flow.h:965
const struct sol_flow_node * sol_flow_node_get_parent(const struct sol_flow_node *node)
Gets the node's parent.
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.