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
sol-flow.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Soletta (TM) Project
3  *
4  * Copyright (C) 2015 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #pragma once
20 
21 #include <stdbool.h>
22 #include <stddef.h>
23 #include <stdint.h>
24 #include <time.h>
25 
26 #include "sol-flow-packet.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
52 
53 struct sol_flow_node_type;
54 
55 struct sol_flow_packet;
56 
58 
70 struct sol_flow_node;
72 
91 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);
92 
102 void sol_flow_node_del(struct sol_flow_node *node);
103 
112 void *sol_flow_node_get_private_data(const struct sol_flow_node *node);
113 
123 const char *sol_flow_node_get_id(const struct sol_flow_node *node);
124 
133 const struct sol_flow_node *sol_flow_node_get_parent(const struct sol_flow_node *node);
134 
153 int sol_flow_send_packet(struct sol_flow_node *src, uint16_t src_port, struct sol_flow_packet *packet);
154 
155 /*
156  * Helper functions to create and send packets of specific types.
157  *
158  * They work like sol_flow_send_packet(), but besides creating,
159  * sending and freeing the packet, they'll also set their value.
160  */
161 
175 int sol_flow_send_error_packet(struct sol_flow_node *src, int code, const char *msg_fmt, ...) SOL_ATTR_PRINTF(3, 4);
176 
186 int sol_flow_send_error_packet_errno(struct sol_flow_node *src, int code);
187 
197 int sol_flow_send_error_packet_str(struct sol_flow_node *src, int code, const char *str);
198 
211 int sol_flow_send_bool_packet(struct sol_flow_node *src, uint16_t src_port, unsigned char value);
212 
225 int sol_flow_send_blob_packet(struct sol_flow_node *src, uint16_t src_port, const struct sol_blob *value);
226 
239 int sol_flow_send_json_object_packet(struct sol_flow_node *src, uint16_t src_port, const struct sol_blob *value);
240 
253 int sol_flow_send_json_array_packet(struct sol_flow_node *src, uint16_t src_port, const struct sol_blob *value);
254 
267 int sol_flow_send_byte_packet(struct sol_flow_node *src, uint16_t src_port, unsigned char value);
268 
283 int sol_flow_send_drange_packet(struct sol_flow_node *src, uint16_t src_port, const struct sol_drange *value);
284 
299 int sol_flow_send_drange_value_packet(struct sol_flow_node *src, uint16_t src_port, double value);
300 
315 int sol_flow_send_rgb_packet(struct sol_flow_node *src, uint16_t src_port, const struct sol_rgb *value);
316 
330 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);
331 
346 int sol_flow_send_direction_vector_packet(struct sol_flow_node *src, uint16_t src_port, const struct sol_direction_vector *value);
347 
361 int sol_flow_send_direction_vector_components_packet(struct sol_flow_node *src, uint16_t src_port, double x, double y, double z);
362 
375 int sol_flow_send_location_packet(struct sol_flow_node *src, uint16_t src_port, const struct sol_location *value);
376 
390 int sol_flow_send_location_components_packet(struct sol_flow_node *src, uint16_t src_port, double lat, double lon, double alt);
391 
404 int sol_flow_send_timestamp_packet(struct sol_flow_node *src, uint16_t src_port, const struct timespec *value);
405 
417 int sol_flow_send_empty_packet(struct sol_flow_node *src, uint16_t src_port);
418 
433 int sol_flow_send_irange_packet(struct sol_flow_node *src, uint16_t src_port, const struct sol_irange *value);
434 
449 int sol_flow_send_irange_value_packet(struct sol_flow_node *src, uint16_t src_port, int32_t value);
450 
466 int sol_flow_send_string_packet(struct sol_flow_node *src, uint16_t src_port, const char *value);
467 
482 int sol_flow_send_string_slice_packet(struct sol_flow_node *src, uint16_t src_port, const struct sol_str_slice value);
483 
502 int sol_flow_send_string_take_packet(struct sol_flow_node *src, uint16_t src_port, char *value);
503 
518 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);
519 
537 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);
538 
546 const struct sol_flow_node_type *sol_flow_node_get_type(const struct sol_flow_node *node);
547 
552 typedef struct sol_flow_node_options {
553 #ifndef SOL_NO_API_VERSION
554 #define SOL_FLOW_NODE_OPTIONS_API_VERSION (1)
555  uint16_t api_version;
556  uint16_t sub_api;
557 #endif
559 
574 };
575 
584 
594 
599  const char *name;
601  union {
602  bool boolean;
603  unsigned char byte;
604  int32_t i;
607  struct sol_rgb rgb;
609  const char *string;
610  double f;
611  };
613 
621  uint16_t count;
623 
634  const struct sol_flow_node_type *type,
635  const struct sol_flow_node_named_options *named_opts,
636  struct sol_flow_node_options **out_opts);
637 
648  struct sol_flow_node_named_options *named_opts,
649  const struct sol_flow_node_type *type,
650  const char *const *strv);
651 
658 void sol_flow_node_options_del(const struct sol_flow_node_type *type, struct sol_flow_node_options *options);
659 
667 void sol_flow_node_options_strv_del(char **opts_strv);
668 
675 
676 #include "sol-flow-buildopts.h"
677 
681 #define SOL_FLOW_NODE_PORT_ERROR_NAME ("ERROR")
682 
683 #ifdef SOL_FLOW_NODE_TYPE_DESCRIPTION_ENABLED
684 
687 typedef struct sol_flow_port_description {
688  const char *name;
689  const char *description;
690  const char *data_type;
691  uint16_t array_size;
692  uint16_t base_port_idx;
699  bool required;
700 } sol_flow_port_description;
701 
705 typedef struct sol_flow_node_options_member_description {
706  const char *name;
707  const char *description;
708  const char *data_type;
709  union {
710  bool b;
711  unsigned char byte;
712  int32_t i;
713  struct sol_irange_spec irange_spec;
714  struct sol_drange_spec drange_spec;
715  struct sol_direction_vector direction_vector;
716  struct sol_rgb rgb;
717  const char *s;
718  const void *ptr;
719  double f;
720  } defvalue;
721  uint16_t offset;
722  uint16_t size;
723  bool required;
724 } sol_flow_node_options_member_description;
725 
729 typedef struct sol_flow_node_options_description {
730  const struct sol_flow_node_options_member_description *members;
731  uint16_t data_size;
732 #ifndef SOL_NO_API_VERSION
733  uint16_t sub_api;
734 #endif
735  bool required;
736 } sol_flow_node_options_description;
737 
745 typedef struct sol_flow_node_type_description {
746 #ifndef SOL_NO_API_VERSION
747 
756 #define SOL_FLOW_NODE_TYPE_DESCRIPTION_API_VERSION (1)
757  uint16_t api_version;
758 #endif
759  const char *name;
767  const char *category;
768  const char *symbol;
769  const char *options_symbol;
770  const char *description;
771  const char *author;
772  const char *url;
773  const char *license;
774  const char *version;
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;
779 #endif
780 
786 };
787 
796 typedef struct sol_flow_node_type {
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;
801 #endif
802  uint16_t data_size;
803  uint16_t options_size;
804  uint16_t flags;
806  const void *type_data;
807  const void *default_options;
809  uint16_t ports_in_count;
810  uint16_t ports_out_count;
815  const struct sol_flow_port_type_in *(*get_port_in)(const struct sol_flow_node_type *type, uint16_t port);
816 
820  const struct sol_flow_port_type_out *(*get_port_out)(const struct sol_flow_node_type *type, uint16_t port);
821 
825  int (*open)(struct sol_flow_node *node, void *data, const struct sol_flow_node_options *options);
826 
830  void (*close)(struct sol_flow_node *node, void *data);
831 
837  void (*init_type)(void);
838 
845  void (*dispose_type)(struct sol_flow_node_type *type);
846 
847 #ifdef SOL_FLOW_NODE_TYPE_DESCRIPTION_ENABLED
848  const struct sol_flow_node_type_description *description;
849 #endif
851 
852 #ifdef SOL_FLOW_NODE_TYPE_DESCRIPTION_ENABLED
853 
862 int sol_flow_node_named_options_parse_member(
864  const char *value,
865  const struct sol_flow_node_options_member_description *mdesc);
866 #endif
867 
876 const struct sol_flow_port_type_in *sol_flow_node_type_get_port_in(const struct sol_flow_node_type *type, uint16_t port);
877 
886 const struct sol_flow_port_type_out *sol_flow_node_type_get_port_out(const struct sol_flow_node_type *type, uint16_t port);
887 
896 void sol_flow_node_type_del(struct sol_flow_node_type *type);
897 
898 #ifdef SOL_FLOW_NODE_TYPE_DESCRIPTION_ENABLED
899 
906 void sol_flow_foreach_builtin_node_type(bool (*cb)(void *data, const struct sol_flow_node_type *type), const void *data);
907 
916 const struct sol_flow_port_description *sol_flow_node_get_description_port_in(const struct sol_flow_node_type *type, uint16_t port);
917 
926 const struct sol_flow_port_description *sol_flow_node_get_description_port_out(const struct sol_flow_node_type *type, uint16_t port);
927 
938 uint16_t sol_flow_node_find_port_in(const struct sol_flow_node_type *type, const char *name);
939 
950 uint16_t sol_flow_node_find_port_out(const struct sol_flow_node_type *type, const char *name);
951 #endif
952 
965  int (*send)(struct sol_flow_node *container, struct sol_flow_node *source_node, uint16_t source_out_port_idx, struct sol_flow_packet *packet);
966 
977  int (*process)(struct sol_flow_node *container, uint16_t source_in_port_idx, struct sol_flow_packet *packet);
978 
982  void (*add)(struct sol_flow_node *container, struct sol_flow_node *node);
983 
987  void (*remove)(struct sol_flow_node *container, struct sol_flow_node *node);
989 
993 typedef struct sol_flow_port_type_out {
994 #ifndef SOL_NO_API_VERSION
995 #define SOL_FLOW_PORT_TYPE_OUT_API_VERSION (1)
996  uint16_t api_version;
997 #endif
1003  int (*connect)(struct sol_flow_node *node, void *data, uint16_t port, uint16_t conn_id);
1004 
1008  int (*disconnect)(struct sol_flow_node *node, void *data, uint16_t port, uint16_t conn_id);
1010 
1014 typedef struct sol_flow_port_type_in {
1015 #ifndef SOL_NO_API_VERSION
1016 #define SOL_FLOW_PORT_TYPE_IN_API_VERSION (1)
1017  uint16_t api_version;
1018 #endif
1024  int (*process)(struct sol_flow_node *node, void *data, uint16_t port, uint16_t conn_id, const struct sol_flow_packet *packet);
1025  int (*connect)(struct sol_flow_node *node, void *data, uint16_t port, uint16_t conn_id);
1026  int (*disconnect)(struct sol_flow_node *node, void *data, uint16_t port, uint16_t conn_id);
1028 
1058 #ifdef SOL_DYNAMIC_MODULES
1059 
1060 #define sol_flow_get_node_type(_mod, _type, _var) sol_flow_internal_get_node_type(_mod, #_type, _var)
1061 
1062 int sol_flow_internal_get_node_type(const char *modname, const char *symbol, const struct sol_flow_node_type ***type);
1063 
1064 #define sol_flow_get_packet_type(_mod, _type, _var) sol_flow_internal_get_packet_type(_mod, #_type, _var)
1065 
1066 int sol_flow_internal_get_packet_type(const char *module, const char *symbol, const struct sol_flow_packet_type **type);
1067 
1068 #else
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; })
1071 #endif /* SOL_DYNAMIC_MODULES */
1072 
1077 #ifdef __cplusplus
1078 }
1079 #endif
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
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
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.
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.