automotive-dlt
|
Go to the source code of this file.
Functions | |
int | dlt_gateway_init (DltDaemonLocal *daemon_local, int verbose) |
void | dlt_gateway_deinit (DltGateway *g, int verbose) |
int | dlt_gateway_establish_connections (DltGateway *g, DltDaemonLocal *daemon_local, int verbose) |
DltReceiver * | dlt_gateway_get_connection_receiver (DltGateway *g, int fd) |
int | dlt_gateway_process_passive_node_messages (DltDaemon *daemon, DltDaemonLocal *daemon_local, DltReceiver *recv, int verbose) |
int | dlt_gateway_process_gateway_timer (DltDaemon *daemon, DltDaemonLocal *daemon_local, DltReceiver *rec, int verbose) |
int | dlt_gateway_forward_control_message (DltGateway *g, DltDaemonLocal *daemon_local, DltMessage *msg, char *ecu, int verbose) |
int | dlt_gateway_process_on_demand_request (DltGateway *g, DltDaemonLocal *daemon_local, char *node_id, int connection_status, int verbose) |
void | dlt_gateway_send_control_message (DltGatewayConnection *con, DltGateway *g, DltDaemonLocal *daemon_local, int verbose) |
void | print_gateway_connection_details (const DltGateway *g) |
Definition in file dlt_gateway.h.
void dlt_gateway_deinit | ( | DltGateway * | g, |
int | verbose | ||
) |
De-initialize the gateway. All internal data will be freed.
g | DltGateway pointer |
verbose | verbose flag |
Definition at line 613 of file dlt_gateway.c.
References DltGatewayConnection::client, DltGateway::connections, dlt_client_cleanup(), DltGatewayConnection::ecuid, DltGatewayConnection::ip_address, NULL, DltGateway::num_connections, and PRINT_FUNCTION_VERBOSE.
int dlt_gateway_establish_connections | ( | DltGateway * | g, |
DltDaemonLocal * | daemon_local, | ||
int | verbose | ||
) |
Establish all connections to passive nodes that are configured to be started on daemon startup and add this connections to the main event loop.
TODO: This function is called during gateway initialization and in main loop whenever the epoll returns. This may need to be improved.
g | DltGateway |
daemon_local | DltDaemonLocal |
verbose | verbose flag |
Definition at line 636 of file dlt_gateway.c.
References DltGatewayConnection::client, DltGateway::connections, dlt_client_connect(), dlt_connection_create(), DLT_CONNECTION_GATEWAY, DLT_GATEWAY_CONNECTED, DLT_GATEWAY_DISABLED, DLT_GATEWAY_ON_DEMAND, dlt_gateway_send_control_message(), dlt_log(), NULL, DltGateway::num_connections, DltDaemonLocal::pEvent, PRINT_FUNCTION_VERBOSE, DltGatewayConnection::reconnect_cnt, DltClient::sock, DltGatewayConnection::status, DltGatewayConnection::timeout, DltGatewayConnection::timeout_cnt, and DltGatewayConnection::trigger.
Referenced by dlt_gateway_init(), and dlt_gateway_process_gateway_timer().
int dlt_gateway_forward_control_message | ( | DltGateway * | g, |
DltDaemonLocal * | daemon_local, | ||
DltMessage * | msg, | ||
char * | ecu, | ||
int | verbose | ||
) |
Forward control messages to the specified passive node DLT Daemon.
g | DltGateway |
daemon_local | DltDaemonLocal |
msg | DltMessage |
ecu | Identifier of the passive node |
verbose | verbose flag |
Definition at line 957 of file dlt_gateway.c.
References DltGatewayConnection::client, DltGateway::connections, sDltMessage::databuffer, sDltMessage::datasize, DLT_GATEWAY_CONNECTED, dlt_log(), dltSerialHeader, DltGatewayConnection::ecuid, sDltMessage::headerbuffer, sDltMessage::headersize, NULL, DltGateway::num_connections, PRINT_FUNCTION_VERBOSE, DltGatewayConnection::send_serial, DltClient::sock, and DltGatewayConnection::status.
Referenced by dlt_daemon_client_process_control(), and dlt_gateway_send_control_message().
DltReceiver* dlt_gateway_get_connection_receiver | ( | DltGateway * | g, |
int | fd | ||
) |
Return the receiver for a given file descriptor
g | DltGateway |
fd | file descriptor |
Definition at line 710 of file dlt_gateway.c.
References DltGatewayConnection::client, DltGateway::connections, DLT_GATEWAY_CONNECTED, NULL, DltGateway::num_connections, DltClient::receiver, DltClient::sock, and DltGatewayConnection::status.
Referenced by dlt_connection_get_receiver().
int dlt_gateway_init | ( | DltDaemonLocal * | daemon_local, |
int | verbose | ||
) |
Initialize the gateway to passive nodes
TODO: Make path to configuration file configurable
daemon_local | pointer to DltDaemonLocal |
verbose | verbose flag |
Definition at line 577 of file dlt_gateway.c.
References dlt_gateway_configure(), dlt_gateway_establish_connections(), dlt_log(), DltDaemonLocal::flags, DltDaemonFlags::gatewayConfigFile, DltDaemonFlags::lflag, NULL, DltDaemonLocal::pGateway, PRINT_FUNCTION_VERBOSE, and DltGateway::send_serial.
Referenced by main().
int dlt_gateway_process_gateway_timer | ( | DltDaemon * | daemon, |
DltDaemonLocal * | daemon_local, | ||
DltReceiver * | rec, | ||
int | verbose | ||
) |
Process gateway timer
daemon | DltDaemon |
daemon_loocal | DltDaemonLocal |
verbose | verbose flag |
Definition at line 914 of file dlt_gateway.c.
References DLT_DAEMON_TEXTBUFSIZE, dlt_gateway_establish_connections(), dlt_log(), DltReceiver::fd, NULL, DltDaemonLocal::pGateway, and PRINT_FUNCTION_VERBOSE.
Referenced by dlt_connection_get_callback().
int dlt_gateway_process_on_demand_request | ( | DltGateway * | g, |
DltDaemonLocal * | daemon_local, | ||
char * | node_id, | ||
int | connection_status, | ||
int | verbose | ||
) |
Process on demand connect/disconnect of passive nodes
g | DltGateway |
node_id | Passive Node identifier |
connection_status | Connection status |
Definition at line 1034 of file dlt_gateway.c.
References DltGatewayConnection::client, DltGateway::connections, dlt_client_cleanup(), dlt_client_connect(), dlt_connection_create(), DLT_CONNECTION_GATEWAY, dlt_event_handler_unregister_connection(), DLT_GATEWAY_CONNECTED, DLT_GATEWAY_DISCONNECTED, DLT_ID_SIZE, dlt_log(), DltGatewayConnection::ecuid, NULL, DltGateway::num_connections, DltDaemonLocal::pEvent, PRINT_FUNCTION_VERBOSE, DltClient::sock, and DltGatewayConnection::status.
Referenced by dlt_daemon_control_passive_node_connect().
int dlt_gateway_process_passive_node_messages | ( | DltDaemon * | daemon, |
DltDaemonLocal * | daemon_local, | ||
DltReceiver * | recv, | ||
int | verbose | ||
) |
Process incoming messages from passive nodes
daemon | DltDaemon |
daemon_local | DltDaemonLocal |
recv | DltReceiver structure |
verbose | verbose flag |
Definition at line 731 of file dlt_gateway.c.
References DltReceiver::buf, DltReceiver::bytesRcvd, DltGatewayConnection::client, DltGateway::connections, sDltMessage::databuffer, sDltMessage::datasize, dlt_daemon_client_send(), DLT_DAEMON_ERROR_OK, DLT_DAEMON_SEND_TO_ALL, DLT_DAEMON_TEXTBUFSIZE, dlt_event_handler_unregister_connection(), DLT_GATEWAY_DISABLED, DLT_GATEWAY_DISCONNECTED, DLT_GATEWAY_RECONNECT_MAX, dlt_log(), DLT_MESSAGE_ERROR_OK, dlt_message_free(), dlt_message_init(), dlt_message_read(), dlt_receiver_move_to_begin(), dlt_receiver_receive_socket(), dlt_receiver_remove(), dltSerialHeader, DltGatewayConnection::ecuid, DltReceiver::fd, sDltMessage::found_serialheader, sDltMessage::headerbuffer, sDltMessage::headersize, NULL, DltGateway::num_connections, DltDaemonLocal::pEvent, DltDaemonLocal::pGateway, PRINT_FUNCTION_VERBOSE, DltGatewayConnection::reconnect_cnt, DltClient::sock, DltGatewayConnection::status, DltGatewayConnection::timeout_cnt, and DltGatewayConnection::trigger.
Referenced by dlt_connection_get_callback().
void dlt_gateway_send_control_message | ( | DltGatewayConnection * | con, |
DltGateway * | g, | ||
DltDaemonLocal * | daemon_local, | ||
int | verbose | ||
) |
Send control message to passive node.
con | DltGatewayConnection |
g | DltGateway |
daemon_local | DltDaemonLocal |
verbose | verbose flag |
Definition at line 1123 of file dlt_gateway.c.
References DltGatewayConnection::control_msgs, sDltMessage::databuffer, sDltMessage::databuffersize, sDltMessage::datasize, DLT_DAEMON_TEXTBUFSIZE, dlt_gateway_forward_control_message(), DLT_GATEWAY_MAX_STARTUP_CTRL_MSG, DLT_HTOBE_16, DLT_HTYP_MSBF, DLT_HTYP_PROTOCOL_VERSION1, DLT_HTYP_UEH, DLT_HTYP_WEID, DLT_HTYP_WTMS, dlt_log(), dlt_message_free(), dlt_message_init(), dlt_message_set_extraparameters(), DLT_MSIN_CONTROL_REQUEST, DLT_RETURN_ERROR, DLT_SERVICE_ID_GET_LOG_INFO, DLT_SERVICE_ID_GET_SOFTWARE_VERSION, dlt_set_id(), dlt_set_storageheader(), DLT_STANDARD_HEADER_EXTRA_SIZE, dlt_uptime(), DltGatewayConnection::ecuid, sDltMessage::extendedheader, sDltMessage::headerbuffer, sDltMessage::headerextra, sDltMessage::headersize, NULL, PRINT_FUNCTION_VERBOSE, sDltMessage::standardheader, and sDltMessage::storageheader.
Referenced by dlt_gateway_establish_connections().
void print_gateway_connection_details | ( | const DltGateway * | g | ) |