automotive-dlt
dlt_gateway.h File Reference
#include "dlt-daemon.h"
#include "dlt_gateway_types.h"
Include dependency graph for dlt_gateway.h:
This graph shows which files directly or indirectly include this file:

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)
 
DltReceiverdlt_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)
 

Detailed Description

Author
Christoph Lipka clipk.nosp@m.a@jp.nosp@m..adit.nosp@m.-jv..nosp@m.com

Definition in file dlt_gateway.h.

Function Documentation

void dlt_gateway_deinit ( DltGateway g,
int  verbose 
)

De-initialize the gateway. All internal data will be freed.

Parameters
gDltGateway pointer
verboseverbose 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.

Parameters
gDltGateway
daemon_localDltDaemonLocal
verboseverbose flag
Returns
0 on success, -1 on error

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 
)
DltReceiver* dlt_gateway_get_connection_receiver ( DltGateway g,
int  fd 
)

Return the receiver for a given file descriptor

Parameters
gDltGateway
fdfile descriptor
Returns
Pointer to DltReceiver on success, NULL otherwise

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

Parameters
daemon_localpointer to DltDaemonLocal
verboseverbose flag
Returns
0 on success, -1 on error

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

Parameters
daemonDltDaemon
daemon_loocalDltDaemonLocal
verboseverbose flag
Returns
0 on success, -1 otherwise

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 
)
void print_gateway_connection_details ( const DltGateway g)