Typedefs | Functions
Helper function to use eet over a network link

Function that reconstruct and prepare packet of Eet Data Serialization to be send. More...

Typedefs

typedef struct _Eet_Connection Eet_Connection
 Opaque handle to track paquet for a specific connection.
 
typedef Eina_Bool Eet_Read_Cb(const void *eet_data, size_t size, void *user_data)
 Called back when an Eet Data Serialization has been received completely and could be used.
 
typedef Eina_Bool Eet_Write_Cb(const void *data, size_t size, void *user_data)
 Called back when a packet containing Eet Data Serialization data is ready to be send.
 

Functions

EAPI Eet_Connectioneet_connection_new (Eet_Read_Cb *eet_read_cb, Eet_Write_Cb *eet_write_cb, const void *user_data)
 Instanciates a new connection to track. More...
 
EAPI int eet_connection_received (Eet_Connection *conn, const void *data, size_t size)
 Processes a raw packet received over the link. More...
 
EAPI Eina_Bool eet_connection_empty (Eet_Connection *conn)
 Tells if the Eet_Connection as received some partial data. More...
 
EAPI Eina_Bool eet_connection_send (Eet_Connection *conn, Eet_Data_Descriptor *edd, const void *data_in, const char *cipher_key)
 Converts a complex structure and prepare it to be send. More...
 
EAPI Eina_Bool eet_connection_node_send (Eet_Connection *conn, Eet_Node *node, const char *cipher_key)
 Converts a Eet_Node tree and prepare it to be send. More...
 
EAPI void * eet_connection_close (Eet_Connection *conn, Eina_Bool *on_going)
 Closes a connection and lost its track. More...
 

Detailed Description

Function that reconstruct and prepare packet of Eet Data Serialization to be send.

Function Documentation

◆ eet_connection_new()

EAPI Eet_Connection* eet_connection_new ( Eet_Read_Cb eet_read_cb,
Eet_Write_Cb eet_write_cb,
const void *  user_data 
)

Instanciates a new connection to track.

Parameters
eet_read_cbFunction to call when one Eet_Data packet has been fully assemble.
eet_write_cbFunction to call when one Eet_Data packet is ready to be send over the wire.
user_dataPointer provided to both functions to be used as a context handler.
Returns
NULL on failure, or a valid Eet_Connection handler.

For every connection to track you will need a separate Eet_Connection provider.

Since
1.2.4

◆ eet_connection_received()

EAPI int eet_connection_received ( Eet_Connection conn,
const void *  data,
size_t  size 
)

Processes a raw packet received over the link.

Parameters
connConnection handler to track.
dataRaw data packet.
sizeThe size of that packet.
Returns
0 on complete success, any other value indicate where in the stream it got wrong (It could be before that packet).

Every time you receive a packet related to your connection, you should pass it to that function so that it could process and assemble packet has you receive it. It will automatically call Eet_Read_Cb when one is fully received.

Since
1.2.4

◆ eet_connection_empty()

EAPI Eina_Bool eet_connection_empty ( Eet_Connection conn)

Tells if the Eet_Connection as received some partial data.

Parameters
connConnection handler to request.
Returns
EINA_TRUE if there is some data pending inside, EINA_FALSE otherwise.

Eet_Connection buffer data until the received data can be unserialized correctly. This function let you know if there is some data inside that buffer waiting for more data to be received before being processed.

Since
1.7

References EINA_FALSE, EINA_SAFETY_ON_NULL_RETURN_VAL, and EINA_TRUE.

◆ eet_connection_send()

EAPI Eina_Bool eet_connection_send ( Eet_Connection conn,
Eet_Data_Descriptor edd,
const void *  data_in,
const char *  cipher_key 
)

Converts a complex structure and prepare it to be send.

Parameters
connConnection handler to track.
eddThe data descriptor to use when encoding.
data_inThe pointer to the struct to encode into data.
cipher_keyThe key to use as cipher.
Returns
EINA_TRUE if the data where correctly send, EINA_FALSE if they don't.

This function serialize data_in with edd, assemble the packet and call Eet_Write_Cb when ready. The data passed Eet_Write_Cb are temporary allocated and will vanish just after the return of the callback.

See also
eet_data_descriptor_encode_cipher
Since
1.2.4

References eet_data_descriptor_encode_cipher(), EINA_FALSE, EINA_SAFETY_ON_NULL_RETURN_VAL, and EINA_TRUE.

◆ eet_connection_node_send()

EAPI Eina_Bool eet_connection_node_send ( Eet_Connection conn,
Eet_Node node,
const char *  cipher_key 
)

Converts a Eet_Node tree and prepare it to be send.

Parameters
connConnection handler to track.
nodeThe data tree to use when encoding.
cipher_keyThe key to use as cipher.
Returns
EINA_TRUE if the data where correctly send, EINA_FALSE if they don't.

This function serialize node, assemble the packet and call Eet_Write_Cb when ready. The data passed Eet_Write_Cb are temporary allocated and will vanish just after the return of the callback.

See also
eet_data_node_encode_cipher
Since
1.2.4

References eet_data_node_encode_cipher(), EINA_FALSE, EINA_SAFETY_ON_NULL_RETURN_VAL, and EINA_TRUE.

◆ eet_connection_close()

EAPI void* eet_connection_close ( Eet_Connection conn,
Eina_Bool on_going 
)

Closes a connection and lost its track.

Parameters
connConnection handler to close.
on_goingSignal if a partial packet wasn't completed.
Returns
the user_data passed to both callback.
Since
1.2.4

References EINA_FALSE, and EINA_TRUE.