automotive-dlt
|
#include "dlt_daemon_connection_types.h"
#include "dlt_daemon_event_handler_types.h"
#include "dlt-daemon.h"
Go to the source code of this file.
Functions | |
int | dlt_connection_send_multiple (DltConnection *, void *, int, void *, int, int) |
Send up to two messages through a connection. More... | |
DltConnection * | dlt_connection_get_next (DltConnection *, int) |
Get the next connection filtered with a type mask. More... | |
int | dlt_connection_create_remaining (DltDaemonLocal *) |
int | dlt_connection_create (DltDaemonLocal *, DltEventHandler *, int, int, DltConnectionType) |
Creates a connection and registers it to the DltEventHandler. More... | |
void | dlt_connection_destroy (DltConnection *) |
Destroys a connection. More... | |
void * | dlt_connection_get_callback (DltConnection *) |
Get the callback from a specific connection. More... | |
Definition in file dlt_daemon_connection.h.
int dlt_connection_create | ( | DltDaemonLocal * | daemon_local, |
DltEventHandler * | evh, | ||
int | fd, | ||
int | mask, | ||
DltConnectionType | type | ||
) |
Creates a connection and registers it to the DltEventHandler.
The function will allocate memory for the connection, and give the pointer to the DltEventHandler in order to register it for incoming events. The connection is then destroyed later on, once it's not needed anymore or it the event handler is destroyed.
daemon_local | Structure were some needed information is. |
evh | DltEventHandler to register the connection to. |
fd | File descriptor of the connection. |
mask | Event list bit mask. |
type | Connection type. |
Definition at line 346 of file dlt_daemon_connection.c.
References ACTIVE, connectionId, dlt_connection_get_receiver(), DLT_DAEMON_TEXTBUFSIZE, dlt_event_handler_find_connection(), dlt_event_handler_register_connection(), dlt_log(), DltConnection::id, NULL, DltConnection::receiver, DltConnection::status, and DltConnection::type.
Referenced by create_timer_fd(), dlt_daemon_init_fifo(), dlt_daemon_init_serial(), dlt_daemon_local_connection_init(), dlt_daemon_process_client_connect(), dlt_daemon_process_control_connect(), dlt_gateway_establish_connections(), and dlt_gateway_process_on_demand_request().
int dlt_connection_create_remaining | ( | DltDaemonLocal * | ) |
void dlt_connection_destroy | ( | DltConnection * | to_destroy | ) |
Destroys a connection.
This function closes and frees the corresponding connection. This is expected to be called by the connection owner: the DltEventHandler. Ownership of the connection is given during the registration to the DltEventHandler.
to_destroy | Connection to be destroyed. |
Definition at line 320 of file dlt_daemon_connection.c.
References dlt_connection_destroy_receiver(), DLT_CONNECTION_TYPE_MAX, DltReceiver::fd, DltConnection::id, DltConnection::receiver, and DltConnection::type.
Referenced by dlt_daemon_remove_connection().
void* dlt_connection_get_callback | ( | DltConnection * | con | ) |
Get the callback from a specific connection.
The callback retrieved that way is used to handle event for this connection. It as been chosen to proceed that way instead of having the callback directly in the structure in order to have some way to check that the structure is still valid, or at least gracefully handle errors instead of crashing.
con | The connection to retrieve the callback from. |
Definition at line 257 of file dlt_daemon_connection.c.
References DLT_CONNECTION_APP_MSG, DLT_CONNECTION_CLIENT_CONNECT, DLT_CONNECTION_CLIENT_MSG_SERIAL, DLT_CONNECTION_CLIENT_MSG_TCP, DLT_CONNECTION_CONTROL_CONNECT, DLT_CONNECTION_CONTROL_MSG, DLT_CONNECTION_GATEWAY, DLT_CONNECTION_GATEWAY_TIMER, DLT_CONNECTION_ONE_S_TIMER, DLT_CONNECTION_SIXTY_S_TIMER, DLT_CONNECTION_SYSTEMD_TIMER, DLT_CONNECTION_TYPE_MAX, dlt_daemon_process_client_connect(), dlt_daemon_process_client_messages(), dlt_daemon_process_client_messages_serial(), dlt_daemon_process_control_connect(), dlt_daemon_process_control_messages(), dlt_daemon_process_one_s_timer(), dlt_daemon_process_sixty_s_timer(), dlt_daemon_process_systemd_timer(), dlt_daemon_process_user_messages(), dlt_gateway_process_gateway_timer(), dlt_gateway_process_passive_node_messages(), NULL, and DltConnection::type.
Referenced by dlt_daemon_handle_event().
DltConnection* dlt_connection_get_next | ( | DltConnection * | current, |
int | type_mask | ||
) |
Get the next connection filtered with a type mask.
In some cases we need the next connection available of a specific type or specific different types. This function returns the next available connection that is of one of the types included in the mask. The current connection can be returned.
current | The current connection pointer. |
type_mask | A bit mask representing the connection types to be filtered. |
Definition at line 151 of file dlt_daemon_connection.c.
References DltConnection::next, and DltConnection::type.
Referenced by dlt_daemon_client_send_all_multiple().
int dlt_connection_send_multiple | ( | DltConnection * | con, |
void * | data1, | ||
int | size1, | ||
void * | data2, | ||
int | size2, | ||
int | sendserialheader | ||
) |
Send up to two messages through a connection.
We often need to send 2 messages through a specific connection, plus the serial header. This function groups these different calls.
con | The connection to send the messages through. |
data1 | The first message to be sent. |
size1 | The size of the first message. |
data2 | The second message to be send. |
size2 | The second message size. |
sendserialheader | Whether we need or not to send the serial header. |
Definition at line 105 of file dlt_daemon_connection.c.
References dlt_connection_send(), DLT_DAEMON_ERROR_UNKNOWN, DLT_RETURN_OK, dltSerialHeader, and NULL.
Referenced by dlt_daemon_client_send_all_multiple().