3 * Copyright (C) 2012 BMW AG
5 * This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps.
7 * Contributions are licensed to the GENIVI Alliance under one or more
8 * Contribution License Agreements.
11 * This Source Code Form is subject to the terms of the
12 * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
13 * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
16 * \author Lassi Marttala <lassi.lm.marttala@partner.bmw.de> BMW 2012
19 * For further information see http://www.genivi.org/.
23 /*******************************************************************************
25 ** SRC-MODULE: dlt-system.h **
31 ** AUTHOR : Lassi Marttala <lassi.lm.marttala@partner.bmw.de> **
37 ** PLATFORM DEPENDANT [yes/no]: yes **
39 ** TO BE CHANGED BY USER [yes/no]: no **
41 *******************************************************************************/
43 /*******************************************************************************
45 ********************************************************************************
47 ** Initials Name Company **
48 ** -------- ------------------------- ---------------------------------- **
49 ** lm Lassi Marttala BMW **
50 *******************************************************************************/
55 // DLT related includes.
57 #include "dlt_common.h"
60 #define DEFAULT_CONF_FILE "/etc/dlt-system.conf"
61 #define DLT_SYSTEM_LOG_FILE_MAX 32
62 #define DLT_SYSTEM_LOG_DIRS_MAX 32
63 #define DLT_SYSTEM_LOG_PROCESSES_MAX 32
65 #define DLT_SYSTEM_MODE_OFF 0
66 #define DLT_SYSTEM_MODE_STARTUP 1
67 #define DLT_SYSTEM_MODE_REGULAR 2
74 #define MALLOC_ASSERT(x) if(x == NULL) {\
75 fprintf(stderr, "Out of memory\n");\
79 * Configuration structures.
80 * Please see dlt-system.conf for explanation of all the options.
83 // Command line options
85 char *ConfigurationFileName;
87 } DltSystemCliOptions;
89 // Configuration shell options
94 // Configuration syslog options
101 // Configuration journal options
115 int TimeoutBetweenLogs;
118 // Variable number of file transfer dirs
120 int Compression[DLT_SYSTEM_LOG_DIRS_MAX];
121 int CompressionLevel[DLT_SYSTEM_LOG_DIRS_MAX];
122 char *Directory[DLT_SYSTEM_LOG_DIRS_MAX];
123 } FiletransferOptions;
128 // Variable number of files to transfer
130 char *ContextId[DLT_SYSTEM_LOG_FILE_MAX];
131 char *Filename[DLT_SYSTEM_LOG_FILE_MAX];
132 int Mode[DLT_SYSTEM_LOG_FILE_MAX];
133 int TimeDelay[DLT_SYSTEM_LOG_FILE_MAX];
140 // Variable number of processes
142 char *Name[DLT_SYSTEM_LOG_PROCESSES_MAX];
143 char *Filename[DLT_SYSTEM_LOG_PROCESSES_MAX];
144 int Mode[DLT_SYSTEM_LOG_PROCESSES_MAX];
145 int TimeDelay[DLT_SYSTEM_LOG_PROCESSES_MAX];
151 SyslogOptions Syslog;
152 JournalOptions Journal;
153 FiletransferOptions Filetransfer;
154 LogFileOptions LogFile;
155 LogProcessOptions LogProcesses;
156 } DltSystemConfiguration;
159 pthread_t threads[MAX_THREADS];
165 * Forward declarations for the whole application
168 // In dlt-system-options.c
169 int read_command_line(DltSystemCliOptions *options, int argc, char *argv[]);
170 int read_configuration_file(DltSystemConfiguration *config, char *file_name);
172 // In dlt-process-handling.c
174 void start_threads(DltSystemConfiguration *config);
176 void dlt_system_signal_handler(int sig);
177 void register_with_dlt(DltSystemConfiguration *config);
179 // Thread initiators:
182 void start_filetransfer(DltSystemConfiguration *conf);
183 void start_logfile(DltSystemConfiguration *conf);
184 void start_logprocess(DltSystemConfiguration *conf);
186 #if defined(DLT_SYSTEMD_WATCHDOG_ENABLE)
187 void start_systemd_watchdog(DltSystemConfiguration *conf);
190 #if defined(DLT_SYSTEMD_JOURNAL_ENABLE)
191 void start_systemd_journal(DltSystemConfiguration *conf);
194 #endif /* DLT_SYSTEM_H_ */