Soletta™ Framework
|
Flow packet is the fundamental data structure used to pass information between nodes in a flow. More...
Data Structures | |
struct | sol_flow_packet_type |
A packet type defines what's the content of a packet and how it's stored and retrieved. More... | |
Typedefs | |
typedef struct sol_flow_packet | sol_flow_packet |
A packet is a generic container for different kinds (types) of contents. More... | |
typedef struct sol_flow_packet_type | sol_flow_packet_type |
A packet type defines what's the content of a packet and how it's stored and retrieved. More... | |
Functions | |
const char * | sol_flow_get_packet_type_name (const struct sol_str_slice type) |
Returns the packet type variable as string. More... | |
void | sol_flow_packet_del (struct sol_flow_packet *packet) |
Deletes a packet. More... | |
struct sol_flow_packet * | sol_flow_packet_dup (const struct sol_flow_packet *packet) |
Duplicates a packet. More... | |
int | sol_flow_packet_get (const struct sol_flow_packet *packet, void *output) |
Retrieves the packet's content. More... | |
int | sol_flow_packet_get_blob (const struct sol_flow_packet *packet, struct sol_blob **value) |
Retrieves the content of a Blob packet. More... | |
int | sol_flow_packet_get_bool (const struct sol_flow_packet *packet, bool *boolean) |
Retrieves the content of a Boolean packet. More... | |
int | sol_flow_packet_get_byte (const struct sol_flow_packet *packet, unsigned char *byte) |
Retrieves the content of a Byte packet. More... | |
int | sol_flow_packet_get_composed_members (const struct sol_flow_packet *packet, struct sol_flow_packet ***children, uint16_t *len) |
Retrieves the list of packets contained in the composed packet . More... | |
int | sol_flow_packet_get_composed_members_packet_types (const struct sol_flow_packet_type *type, const struct sol_flow_packet_type ***children, uint16_t *len) |
Retrieves the list of packet types that composes type . More... | |
int | sol_flow_packet_get_direction_vector (const struct sol_flow_packet *packet, struct sol_direction_vector *direction_vector) |
Retrieves the content of a Direction Vector packet. More... | |
int | sol_flow_packet_get_direction_vector_components (const struct sol_flow_packet *packet, double *x, double *y, double *z) |
Retrieves the direction components contained in a Direction Vector packet. More... | |
int | sol_flow_packet_get_drange (const struct sol_flow_packet *packet, struct sol_drange *drange) |
Retrieves the content of an Drange packet. More... | |
int | sol_flow_packet_get_drange_value (const struct sol_flow_packet *packet, double *value) |
Retrieves the Drange value of an Drange packet. More... | |
int | sol_flow_packet_get_error (const struct sol_flow_packet *packet, int *code, const char **msg) |
Retrieves the content of an Error packet. More... | |
int | sol_flow_packet_get_http_response (const struct sol_flow_packet *packet, int *response_code, const char **url, const char **content_type, const struct sol_blob **content, struct sol_vector *cookies, struct sol_vector *headers) |
Retrieves the content of a Timestamp packet. More... | |
int | sol_flow_packet_get_irange (const struct sol_flow_packet *packet, struct sol_irange *irange) |
Retrieves the content of an Irange packet. More... | |
int | sol_flow_packet_get_irange_value (const struct sol_flow_packet *packet, int32_t *value) |
Retrieves the Irange value of an Irange packet. More... | |
int | sol_flow_packet_get_json_array (const struct sol_flow_packet *packet, struct sol_blob **value) |
Retrieves the content of a JSON Array packet. More... | |
int | sol_flow_packet_get_json_object (const struct sol_flow_packet *packet, struct sol_blob **value) |
Retrieves the content of a JSON Object packet. More... | |
int | sol_flow_packet_get_location (const struct sol_flow_packet *packet, struct sol_location *location) |
Retrieves the content of a Location packet. More... | |
int | sol_flow_packet_get_location_components (const struct sol_flow_packet *packet, double *lat, double *lon, double *alt) |
Retrieves the location components contained in a Location packet. More... | |
int | sol_flow_packet_get_rgb (const struct sol_flow_packet *packet, struct sol_rgb *rgb) |
Retrieves the content of a RGB packet. More... | |
int | sol_flow_packet_get_rgb_components (const struct sol_flow_packet *packet, uint32_t *red, uint32_t *green, uint32_t *blue) |
Retrieves the RGB components contained in a RGB packet. More... | |
int | sol_flow_packet_get_string (const struct sol_flow_packet *packet, const char **value) |
Retrieves the content of a String packet. More... | |
int | sol_flow_packet_get_timestamp (const struct sol_flow_packet *packet, struct timespec *timestamp) |
Retrieves the content of a Timestamp packet. More... | |
const struct sol_flow_packet_type * | sol_flow_packet_get_type (const struct sol_flow_packet *packet) |
Retrieves the packet's type. More... | |
bool | sol_flow_packet_is_composed_type (const struct sol_flow_packet_type *type) |
Checks if a given packet type is a composed packet type. More... | |
struct sol_flow_packet * | sol_flow_packet_new (const struct sol_flow_packet_type *type, const void *value) |
Creates a packet. More... | |
struct sol_flow_packet * | sol_flow_packet_new_blob (const struct sol_blob *value) |
Creates a new packet of type Blob. More... | |
struct sol_flow_packet * | sol_flow_packet_new_bool (bool boolean) |
Creates a new packet of type Boolean. More... | |
struct sol_flow_packet * | sol_flow_packet_new_byte (unsigned char byte) |
Creates a new packet of type Byte. More... | |
struct sol_flow_packet * | sol_flow_packet_new_direction_vector (const struct sol_direction_vector *direction_vector) |
Creates a new packet of type Direction Vector. More... | |
struct sol_flow_packet * | sol_flow_packet_new_direction_vector_components (double x, double y, double z) |
Creates a new packet of type Direction Vector from the given x , y and z components. More... | |
struct sol_flow_packet * | sol_flow_packet_new_drange (const struct sol_drange *drange) |
Creates a new packet of type Drange. More... | |
struct sol_flow_packet * | sol_flow_packet_new_drange_value (double value) |
Creates a new packet of type Drange with initial value value and default spec. More... | |
struct sol_flow_packet * | sol_flow_packet_new_empty (void) |
Creates a new packet of type Empty. More... | |
struct sol_flow_packet * | sol_flow_packet_new_error (int code, const char *msg) |
Creates a new packet of type Error. More... | |
struct sol_flow_packet * | sol_flow_packet_new_http_response (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) |
Creates a new packet of type HTTP Response. More... | |
struct sol_flow_packet * | sol_flow_packet_new_irange (const struct sol_irange *irange) |
Creates a new packet of type Irange. More... | |
struct sol_flow_packet * | sol_flow_packet_new_irange_value (int32_t value) |
Creates a new packet of type Irange with initial value value and default spec. More... | |
struct sol_flow_packet * | sol_flow_packet_new_json_array (const struct sol_blob *value) |
Creates a new packet of type JSON Array. More... | |
struct sol_flow_packet * | sol_flow_packet_new_json_object (const struct sol_blob *value) |
Creates a new packet of type JSON Object. More... | |
struct sol_flow_packet * | sol_flow_packet_new_location (const struct sol_location *location) |
Creates a new packet of type Location. More... | |
struct sol_flow_packet * | sol_flow_packet_new_location_components (double lat, double lon, double alt) |
Creates a new packet of type Location from the given lat , lon , alt components. More... | |
struct sol_flow_packet * | sol_flow_packet_new_rgb (const struct sol_rgb *rgb) |
Creates a new packet of type RGB. More... | |
struct sol_flow_packet * | sol_flow_packet_new_rgb_components (uint32_t red, uint32_t green, uint32_t blue) |
Creates a new packet of type RGB from the given red , green and blue components. More... | |
struct sol_flow_packet * | sol_flow_packet_new_string (const char *value) |
Creates a new packet of type String. More... | |
struct sol_flow_packet * | sol_flow_packet_new_string_slice (struct sol_str_slice slice) |
Creates a new packet of type String from string slice slice . More... | |
struct sol_flow_packet * | sol_flow_packet_new_string_take (char *value) |
Similar to sol_flow_packet_new_string() but takes ownership of value to use as the packet content. More... | |
struct sol_flow_packet * | sol_flow_packet_new_timestamp (const struct timespec *timestamp) |
Creates a new packet of type Timestamp. More... | |
const struct sol_flow_packet_type * | sol_flow_packet_type_composed_new (const struct sol_flow_packet_type **types) |
Creates a new packet type that is composed by the packets types in types . More... | |
const struct sol_flow_packet_type * | sol_flow_packet_type_from_string (const struct sol_str_slice type) |
Returns the packet type from string. More... | |
Flow packet is the fundamental data structure used to pass information between nodes in a flow.
A packet is a generic container for different kinds (types) of contents.
typedef struct sol_flow_packet_type sol_flow_packet_type |
A packet type defines what's the content of a packet and how it's stored and retrieved.
const char* sol_flow_get_packet_type_name | ( | const struct sol_str_slice | type | ) |
Returns the packet type variable as string.
This function will return the sol_flow_packet_type variable for a given type as string. A common use for this function is when one is generating code for meta types nodes that will be used by sol-fbp-generator.
Example:
type | The Soletta type name (int, blob, error, string, location etc.) |
NULL
if the type was not found. void sol_flow_packet_del | ( | struct sol_flow_packet * | packet | ) |
Deletes a packet.
packet | Packet to be deleted |
struct sol_flow_packet* sol_flow_packet_dup | ( | const struct sol_flow_packet * | packet | ) |
Duplicates a packet.
packet | Packet to be duplicated |
NULL
otherwise int sol_flow_packet_get | ( | const struct sol_flow_packet * | packet, |
void * | output | ||
) |
Retrieves the packet's content.
packet | The packet |
output | Where to store a copy the packet's content |
0
on success, error code (always negative) otherwise int sol_flow_packet_get_blob | ( | const struct sol_flow_packet * | packet, |
struct sol_blob ** | value | ||
) |
Retrieves the content of a Blob packet.
packet | The packet |
value | The retrieved content |
0
if the content was successfully retrieved, error code (always negative) otherwise. int sol_flow_packet_get_bool | ( | const struct sol_flow_packet * | packet, |
bool * | boolean | ||
) |
Retrieves the content of a Boolean packet.
packet | The packet |
boolean | The retrieved content |
0
if the content was successfully retrieved, error code (always negative) otherwise. Referenced by mytype_func(), and writer_in_process().
int sol_flow_packet_get_byte | ( | const struct sol_flow_packet * | packet, |
unsigned char * | byte | ||
) |
Retrieves the content of a Byte packet.
packet | The packet |
byte | The retrieved content |
0
if the content was successfully retrieved, error code (always negative) otherwise. int sol_flow_packet_get_composed_members | ( | const struct sol_flow_packet * | packet, |
struct sol_flow_packet *** | children, | ||
uint16_t * | len | ||
) |
Retrieves the list of packets contained in the composed packet
.
A composed packet is an instance of a composed packet type.
packet | The composed packet |
children | Retrieved list of packets that composes packet |
len | Length of the list |
0
on success, error code (always negative) otherwise int sol_flow_packet_get_composed_members_packet_types | ( | const struct sol_flow_packet_type * | type, |
const struct sol_flow_packet_type *** | children, | ||
uint16_t * | len | ||
) |
Retrieves the list of packet types that composes type
.
type | The packet type |
children | Retrieved list of packet types that composes type |
len | Length of the list |
0
on success, error code (always negative) otherwise int sol_flow_packet_get_direction_vector | ( | const struct sol_flow_packet * | packet, |
struct sol_direction_vector * | direction_vector | ||
) |
Retrieves the content of a Direction Vector packet.
packet | The packet |
direction_vector | The retrieved content |
0
if the content was successfully retrieved, error code (always negative) otherwise.int sol_flow_packet_get_direction_vector_components | ( | const struct sol_flow_packet * | packet, |
double * | x, | ||
double * | y, | ||
double * | z | ||
) |
Retrieves the direction components contained in a Direction Vector packet.
packet | The packet |
x | Retrieved x component |
y | Retrieved y component |
z | Retrieved z component |
0
if the content was successfully retrieved, error code (always negative) otherwise.int sol_flow_packet_get_drange | ( | const struct sol_flow_packet * | packet, |
struct sol_drange * | drange | ||
) |
Retrieves the content of an Drange packet.
packet | The packet |
drange | The retrieved content |
0
if the content was successfully retrieved, error code (always negative) otherwise.Referenced by logic_process().
int sol_flow_packet_get_drange_value | ( | const struct sol_flow_packet * | packet, |
double * | value | ||
) |
Retrieves the Drange value of an Drange packet.
packet | The packet |
value | Drange value contained in the packet |
0
if the value was successfully retrieved, error code (always negative) otherwise.int sol_flow_packet_get_error | ( | const struct sol_flow_packet * | packet, |
int * | code, | ||
const char ** | msg | ||
) |
Retrieves the content of an Error packet.
packet | The packet |
code | Retrieved error code |
msg | Retrieved error message |
0
if the content was successfully retrieved, error code (always negative) otherwise. int sol_flow_packet_get_http_response | ( | const struct sol_flow_packet * | packet, |
int * | response_code, | ||
const char ** | url, | ||
const char ** | content_type, | ||
const struct sol_blob ** | content, | ||
struct sol_vector * | cookies, | ||
struct sol_vector * | headers | ||
) |
Retrieves the content of a Timestamp packet.
packet | The packet |
response_code | Retrieved response code |
url | Retrieved response URL |
content_type | Retrieved response content type |
content | Retrieved response content |
cookies | Retrieved response cookies |
headers | Retrieved response headers |
0
if all content was successfully retrieved, error code (always negative) otherwise. int sol_flow_packet_get_irange | ( | const struct sol_flow_packet * | packet, |
struct sol_irange * | irange | ||
) |
Retrieves the content of an Irange packet.
packet | The packet |
irange | The retrieved content |
0
if the content was successfully retrieved, error code (always negative) otherwise.Referenced by logic_process().
int sol_flow_packet_get_irange_value | ( | const struct sol_flow_packet * | packet, |
int32_t * | value | ||
) |
Retrieves the Irange value of an Irange packet.
packet | The packet |
value | Irange value contained in the packet |
0
if the value was successfully retrieved, error code (always negative) otherwise.Referenced by get_int32_packet_and_log(), isodd(), and mytype_func().
int sol_flow_packet_get_json_array | ( | const struct sol_flow_packet * | packet, |
struct sol_blob ** | value | ||
) |
Retrieves the content of a JSON Array packet.
packet | The packet |
value | The retrieved content |
0
if the content was successfully retrieved, error code (always negative) otherwise. int sol_flow_packet_get_json_object | ( | const struct sol_flow_packet * | packet, |
struct sol_blob ** | value | ||
) |
Retrieves the content of a JSON Object packet.
packet | The packet |
value | The retrieved content |
0
if the content was successfully retrieved, error code (always negative) otherwise. int sol_flow_packet_get_location | ( | const struct sol_flow_packet * | packet, |
struct sol_location * | location | ||
) |
Retrieves the content of a Location packet.
packet | The packet |
location | The retrieved content |
0
if the content was successfully retrieved, error code (always negative) otherwise. int sol_flow_packet_get_location_components | ( | const struct sol_flow_packet * | packet, |
double * | lat, | ||
double * | lon, | ||
double * | alt | ||
) |
Retrieves the location components contained in a Location packet.
packet | The packet |
lat | Retrieved latitude component |
lon | Retrieved longitutde component |
alt | Retrieved altitude component |
0
if the content was successfullu retrieved, error code (always negative) otherwise.int sol_flow_packet_get_rgb | ( | const struct sol_flow_packet * | packet, |
struct sol_rgb * | rgb | ||
) |
Retrieves the content of a RGB packet.
packet | The packet |
rgb | The retrieved content |
0
if the content was successfully retrieved, error code (always negative) otherwise.int sol_flow_packet_get_rgb_components | ( | const struct sol_flow_packet * | packet, |
uint32_t * | red, | ||
uint32_t * | green, | ||
uint32_t * | blue | ||
) |
Retrieves the RGB components contained in a RGB packet.
packet | The packet |
red | Retrieved red component |
green | Retrieved green component |
blue | Retrieved blue component |
0
if the content was successfully retrieved, error code (always negative) otherwise.int sol_flow_packet_get_string | ( | const struct sol_flow_packet * | packet, |
const char ** | value | ||
) |
Retrieves the content of a String packet.
packet | The packet |
value | The retrieved content |
0
if the content was successfully retrieved, error code (always negative) otherwise. int sol_flow_packet_get_timestamp | ( | const struct sol_flow_packet * | packet, |
struct timespec * | timestamp | ||
) |
Retrieves the content of a Timestamp packet.
packet | The packet |
timestamp | The retrieved content |
0
if the content was successfully retrieved, error code (always negative) otherwise. const struct sol_flow_packet_type* sol_flow_packet_get_type | ( | const struct sol_flow_packet * | packet | ) |
Retrieves the packet's type.
packet | The packet |
NULL
on errors bool sol_flow_packet_is_composed_type | ( | const struct sol_flow_packet_type * | type | ) |
Checks if a given packet type is a composed packet type.
type | Packet type to check |
true
if packet type type
is composed, false
otherwise struct sol_flow_packet* sol_flow_packet_new | ( | const struct sol_flow_packet_type * | type, |
const void * | value | ||
) |
Creates a packet.
type | The packet's type |
value | Data to use in the packet initialization |
NULL
on errors struct sol_flow_packet* sol_flow_packet_new_blob | ( | const struct sol_blob * | value | ) |
Creates a new packet of type Blob.
value | Initial blob |
struct sol_flow_packet* sol_flow_packet_new_bool | ( | bool | boolean | ) |
Creates a new packet of type Boolean.
boolean | Initial value |
struct sol_flow_packet* sol_flow_packet_new_byte | ( | unsigned char | byte | ) |
Creates a new packet of type Byte.
byte | Initial value |
struct sol_flow_packet* sol_flow_packet_new_direction_vector | ( | const struct sol_direction_vector * | direction_vector | ) |
Creates a new packet of type Direction Vector.
direction_vector | Initial value |
struct sol_flow_packet* sol_flow_packet_new_direction_vector_components | ( | double | x, |
double | y, | ||
double | z | ||
) |
Creates a new packet of type Direction Vector from the given x
, y
and z
components.
x | Initial x value |
y | Initial y value |
z | Initial z value |
struct sol_flow_packet* sol_flow_packet_new_drange | ( | const struct sol_drange * | drange | ) |
Creates a new packet of type Drange.
drange | Initial value |
struct sol_flow_packet* sol_flow_packet_new_drange_value | ( | double | value | ) |
Creates a new packet of type Drange with initial value value
and default spec.
value | Initial value |
struct sol_flow_packet* sol_flow_packet_new_empty | ( | void | ) |
Creates a new packet of type Empty.
struct sol_flow_packet* sol_flow_packet_new_error | ( | int | code, |
const char * | msg | ||
) |
Creates a new packet of type Error.
code | Error code |
msg | Error message |
struct sol_flow_packet* sol_flow_packet_new_http_response | ( | 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 | ||
) |
Creates a new packet of type HTTP Response.
response_code | The response code |
url | Response URL |
content_type | The response content type |
content | The response content |
cookies | Response cookies |
headers | Response headers |
struct sol_flow_packet* sol_flow_packet_new_irange | ( | const struct sol_irange * | irange | ) |
Creates a new packet of type Irange.
irange | Initial value |
struct sol_flow_packet* sol_flow_packet_new_irange_value | ( | int32_t | value | ) |
Creates a new packet of type Irange with initial value value
and default spec.
value | Initial value |
struct sol_flow_packet* sol_flow_packet_new_json_array | ( | const struct sol_blob * | value | ) |
Creates a new packet of type JSON Array.
NUL
terminated.value | Initial blob containing a JSON Array. |
struct sol_flow_packet* sol_flow_packet_new_json_object | ( | const struct sol_blob * | value | ) |
Creates a new packet of type JSON Object.
NUL
terminated.value | Initial blob containing a JSON Object. |
struct sol_flow_packet* sol_flow_packet_new_location | ( | const struct sol_location * | location | ) |
Creates a new packet of type Location.
location | Initial value |
struct sol_flow_packet* sol_flow_packet_new_location_components | ( | double | lat, |
double | lon, | ||
double | alt | ||
) |
Creates a new packet of type Location from the given lat
, lon
, alt
components.
lat | Initial latitude value |
lon | Initial longitude value |
alt | Initial altitude value |
struct sol_flow_packet* sol_flow_packet_new_rgb | ( | const struct sol_rgb * | rgb | ) |
Creates a new packet of type RGB.
rgb | Initial RGB value |
struct sol_flow_packet* sol_flow_packet_new_rgb_components | ( | uint32_t | red, |
uint32_t | green, | ||
uint32_t | blue | ||
) |
Creates a new packet of type RGB from the given red
, green
and blue
components.
red | Initial red value |
green | Initial green value |
blue | Initial blue value |
struct sol_flow_packet* sol_flow_packet_new_string | ( | const char * | value | ) |
Creates a new packet of type String.
value | Initial string |
struct sol_flow_packet* sol_flow_packet_new_string_slice | ( | struct sol_str_slice | slice | ) |
Creates a new packet of type String from string slice slice
.
slice | String slice with the initial content |
struct sol_flow_packet* sol_flow_packet_new_string_take | ( | char * | value | ) |
Similar to sol_flow_packet_new_string() but takes ownership of value
to use as the packet content.
Instead of copying the initial string to the packets content, takes ownership of value
memory.
value | Initial string |
struct sol_flow_packet* sol_flow_packet_new_timestamp | ( | const struct timespec * | timestamp | ) |
Creates a new packet of type Timestamp.
timestamp | Initial value |
const struct sol_flow_packet_type* sol_flow_packet_type_composed_new | ( | const struct sol_flow_packet_type ** | types | ) |
Creates a new packet type that is composed by the packets types in types
.
types | Initial list of packet types |
const struct sol_flow_packet_type* sol_flow_packet_type_from_string | ( | const struct sol_str_slice | type | ) |
Returns the packet type from string.
This function will return the sol_flow_packet_type based on its string name. If the type starts with "composed:", then it will search for composed packets with that signature and if none exists, then it will try to create one.
type | The Soletta type name (int, blob, error, string, composed:int,boolean...) |
NULL
if the type was not found. const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_ANY |
Type of the Any packet.
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_BLOB |
Type of the Blob packet.
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_BOOL |
Type of the Boolean packet.
Referenced by startup().
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_BYTE |
Type of the Byte packet.
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_DIRECTION_VECTOR |
Type of the Direction Vector packet.
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_DRANGE |
Type of the Drange packet.
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_EMPTY |
Type of the Empty packet.
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_ERROR |
Type of the Error packet.
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_HTTP_RESPONSE |
Type of the Http Response packet.
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_IRANGE |
Type of the Irange packet.
Referenced by startup().
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_JSON_ARRAY |
Type of the JSON Array packet.
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_JSON_OBJECT |
Type of the JSON Object packet.
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_LOCATION |
Type of the Location packet.
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_RGB |
Type of the RGB packet.
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_STRING |
Type of the String packet.
Referenced by startup().
const struct sol_flow_packet_type* SOL_FLOW_PACKET_TYPE_TIMESTAMP |
Type of the Timestamp packet.