automotive-dlt
dlt-logstorage-common.c File Reference
#include <errno.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/socket.h>
#include "dlt_common.h"
#include "dlt_protocol.h"
#include "dlt_client.h"
#include "dlt-control-common.h"
#include "dlt-logstorage-common.h"
#include "dlt-logstorage-prop.h"
Include dependency graph for dlt-logstorage-common.c:

Go to the source code of this file.

Data Structures

struct  LogstorageOptions
 

Macros

#define pr_fmt(fmt)   "Logstorage common: "fmt
 

Functions

DltLogstorageHandler get_handler_type (void)
 
void set_handler_type (char *type)
 
int get_default_event_type (void)
 
void set_default_event_type (long type)
 
char * get_default_path (void)
 
void set_default_path (char *path)
 
DltLogstorageCtrlget_logstorage_control (void)
 
void * dlt_logstorage_get_handler_cb (void)
 
int dlt_logstorage_get_handler_fd (void)
 
int dlt_logstorage_init_handler (void)
 Initialized the handler based on configuration. More...
 
int dlt_logstorage_deinit_handler (void)
 Clean-up the handler based on configuration. More...
 
int dlt_logstorage_check_config_file (char *mnt_point)
 Search for config file in given mount point. More...
 
int dlt_logstorage_check_directory_permission (char *mnt_point)
 Check if given mount point is writable. More...
 
static DltControlMsgBodyprepare_message_body (DltControlMsgBody **body, int conn_type, char *path)
 Prepares the body of the message to be send to DLT. More...
 
int dlt_logstorage_send_event (int type, char *mount_point)
 Send a logstorage event to DLT. More...
 

Variables

static struct LogstorageOptions g_options
 
static DltLogstorageCtrl lctrl
 

Detailed Description

app begin@ Copyright (C) 2013 - 2015 Advanced Driver Information Technology. This code is developed by Advanced Driver Information Technology. Copyright of Advanced Driver Information Technology, Bosch and DENSO.

This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps.

Author
Syed Hameed shame.nosp@m.ed@j.nosp@m.p.adi.nosp@m.t-jv.nosp@m..com ADIT 2013 - 2015
Christoph Lipka clipk.nosp@m.a@jp.nosp@m..adit.nosp@m.-jv..nosp@m.com ADIT 2015
Frederic Berat fbera.nosp@m.t@de.nosp@m..adit.nosp@m.-jv..nosp@m.com ADIT 2015

For further information see http://www.genivi.org/. end@

Definition in file dlt-logstorage-common.c.

Macro Definition Documentation

#define pr_fmt (   fmt)    "Logstorage common: "fmt

Definition at line 54 of file dlt-logstorage-common.c.

Function Documentation

int dlt_logstorage_check_config_file ( char *  mnt_point)

Search for config file in given mount point.

The file is searched at the top directory. The function exits once it founds it.

Parameters
mnt_pointThe mount point to check
Returns
1 if the file is found, 0 otherwise.

Definition at line 196 of file dlt-logstorage-common.c.

References CONF_NAME, NULL, pr_error, and pr_verbose.

Referenced by check_mountpoint_from_partition(), and dlt_logstorage_ctrl_single_request().

int dlt_logstorage_check_directory_permission ( char *  mnt_point)

Check if given mount point is writable.

Parameters
mnt_pointThe mount point to check
Returns
1 if the file is writable, 0 otherwise.

Definition at line 248 of file dlt-logstorage-common.c.

References NULL, and pr_error.

Referenced by dlt_logstorage_ctrl_single_request().

int dlt_logstorage_deinit_handler ( void  )

Clean-up the handler based on configuration.

Returns
0 on success, -1 otherwise.

Definition at line 171 of file dlt-logstorage-common.c.

References CTRL_PROPRIETARY, CTRL_UDEV, dlt_logstorage_prop_deinit(), dlt_logstorage_udev_deinit(), and get_handler_type().

Referenced by dlt_logstorage_ctrl_setup_event_loop().

void* dlt_logstorage_get_handler_cb ( void  )
int dlt_logstorage_get_handler_fd ( void  )

Definition at line 142 of file dlt-logstorage-common.c.

References DltLogstorageCtrl::fd.

Referenced by dlt_logstorage_ctrl_setup_event_loop().

int dlt_logstorage_init_handler ( void  )

Initialized the handler based on configuration.

Returns
0 on success, -1 otherwise.

Definition at line 151 of file dlt-logstorage-common.c.

References CTRL_PROPRIETARY, CTRL_UDEV, dlt_logstorage_prop_init(), dlt_logstorage_udev_init(), and get_handler_type().

Referenced by dlt_logstorage_ctrl_setup_event_loop().

int dlt_logstorage_send_event ( int  type,
char *  mount_point 
)

Send a logstorage event to DLT.

Parameters
typeThe type of the event (Mounted/Unmounting)
mount_pointThe mount point for this event
Returns
0 On success, -1 otherwise.

Definition at line 327 of file dlt-logstorage-common.c.

References DltControlMsgBody::data, dlt_control_send_message(), get_timeout(), NULL, pr_error, and prepare_message_body().

Referenced by check_mountpoint_from_partition(), and dlt_logstorage_ctrl_single_request().

int get_default_event_type ( void  )
char* get_default_path ( void  )
DltLogstorageCtrl* get_logstorage_control ( void  )
static DltControlMsgBody* prepare_message_body ( DltControlMsgBody **  body,
int  conn_type,
char *  path 
)
static

Prepares the body of the message to be send to DLT.

Parameters
bodyA pointer to the MsgBody structure pointer
conn_typeThe type of the event (Mounted/Unmounting)
pathThe mount point path.
Returns
The body once built or NULL.

Definition at line 272 of file dlt-logstorage-common.c.

References DltControlMsgBody::data, DLT_MOUNT_PATH_MAX, DLT_SERVICE_ID_OFFLINE_LOGSTORAGE, NULL, pr_error, and pr_verbose.

Referenced by dlt_logstorage_send_event().

void set_default_event_type ( long  type)

Definition at line 109 of file dlt-logstorage-common.c.

References LogstorageOptions::event_type, and g_options.

Referenced by parse_args().

void set_default_path ( char *  path)

Definition at line 119 of file dlt-logstorage-common.c.

References LogstorageOptions::device_path, DLT_MOUNT_PATH_MAX, g_options, and NULL.

Referenced by parse_args().

void set_handler_type ( char *  type)

Variable Documentation