[GSW-62] DLT Library version check
authorChristian Muck <christian.muck@bmw.de>
Mon, 5 Sep 2011 13:02:23 +0000 (15:02 +0200)
committerChristian Muck <christian.muck@bmw.de>
Mon, 5 Sep 2011 13:02:23 +0000 (15:02 +0200)
19 files changed:
CMakeLists.txt
LIMITATIONS [deleted file]
README.txt [deleted file]
ReleaseNotes.txt
include/dlt/CMakeLists.txt
include/dlt/dlt_common.h
include/dlt/dlt_user.h
include/dlt/dlt_user_macros.h
include/dlt/dlt_version.h [new file with mode: 0755]
include/dlt/dlt_version.h.cmake [new file with mode: 0755]
src/daemon/dlt-daemon.c
src/examples/dlt-example-user-func.c
src/lib/CMakeLists.txt
src/lib/dlt_user.c
src/lib/dlt_user_cfg.h
src/shared/dlt_common.c
svnversion.h.cmake [deleted file]
version.h [deleted file]
version.h.cmake [deleted file]

index ae1b99b..44e7447 100755 (executable)
@@ -46,33 +46,30 @@ PROJECT( automotive-dlt )
 SET( ${PROJECT_NAME}_MAJOR_VERSION 2 )\r
 SET( ${PROJECT_NAME}_MINOR_VERSION 2 )\r
 SET( ${PROJECT_NAME}_PATCH_LEVEL 0 )\r
-set(GENIVI_PROJECT_VERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_LEVEL})\r
 SET( ${PROJECT_NAME}_VERSION_STATE  )\r
-SET( ${PROJECT_NAME}_REVISION 1666 )\r
+SET( GENIVI_PROJECT_VERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_LEVEL})\r
 \r
-# Write version information into include file\r
 SET( PRINT_MAJOR_VERSION ${${PROJECT_NAME}_MAJOR_VERSION})\r
 SET( PRINT_MINOR_VERSION ${${PROJECT_NAME}_MINOR_VERSION})\r
 SET( PRINT_PATCH_LEVEL ${${PROJECT_NAME}_PATCH_LEVEL})\r
 SET( PRINT_VERSION ${GENIVI_PROJECT_VERSION})\r
 SET( PRINT_VERSION_STATE ${${PROJECT_NAME}_VERSION_STATE})\r
-SET( PRINT_VERSION_REVISION ${${PROJECT_NAME}_REVISION})\r
 \r
-# Print version information\r
-MESSAGE("VERSION ${PRINT_VERSION}")\r
-MESSAGE("VERSION_STATE ${PRINT_VERSION_STATE}")\r
-MESSAGE("REVISION ${PRINT_VERSION_REVISION}")\r
+IF(NOT DEFINED PRINT_REVISION)\r
+       execute_process(COMMAND git describe --tags WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} \r
+       OUTPUT_VARIABLE PRINT_REVISION \r
+       OUTPUT_STRIP_TRAILING_WHITESPACE)\r
+ENDIF(NOT DEFINED PRINT_REVISION)\r
 \r
 ##################### RPM CONFIG ########################\r
-\r
-SET( GENIVI_RPM_RELEASE "1${SVN_REVISION}")\r
+SET( GENIVI_RPM_RELEASE "1${IDLT_VERSION}")\r
 SET( LICENSE "LGPL v2.1 with special exception" )\r
 SET( SPEC_DIR "package")\r
 \r
 #########################################################\r
 SET(GENIVI_BUILDSYSTEM_AVAILABLE $ENV{GENIVI_BUILDSYSTEM})\r
 IF(GENIVI_BUILDSYSTEM_AVAILABLE)\r
-INCLUDE($ENV{GENIVI_BUILDSYSTEM}/cmake_extensions/GeniviCMakeExtensions.cmake)\r
+       INCLUDE($ENV{GENIVI_BUILDSYSTEM}/cmake_extensions/GeniviCMakeExtensions.cmake)\r
 ENDIF(GENIVI_BUILDSYSTEM_AVAILABLE)\r
 \r
 \r
@@ -173,8 +170,7 @@ CHECK_FUNCTION_EXISTS( strstr HAVE_FUNC_STRSTR)
 CHECK_FUNCTION_EXISTS( strtol HAVE_FUNC_STRTOL)\r
 \r
 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_SOURCE_DIR}/config.h @ONLY)\r
-CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/svnversion.h.cmake ${CMAKE_SOURCE_DIR}/svnversion.h @ONLY)\r
-CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/version.h.cmake ${CMAKE_SOURCE_DIR}/version.h @ONLY)\r
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/dlt/dlt_version.h.cmake ${CMAKE_SOURCE_DIR}/include/dlt/dlt_version.h @ONLY)\r
 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/doxygen.cfg.cmake ${CMAKE_SOURCE_DIR}/doxygen.cfg @ONLY)\r
 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/automotive-dlt.pc.cmake ${CMAKE_SOURCE_DIR}/automotive-dlt.pc @ONLY)\r
 #CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/package/automotive-dlt.spec.cmake ${CMAKE_SOURCE_DIR}/package/automotive-dlt.spec ESCAPE_QUOTES)\r
@@ -184,6 +180,8 @@ OPTION(ENABLE_BUILD_DOC "Set to ON to build Documentation" OFF)
 \r
 MESSAGE( STATUS )\r
 MESSAGE( STATUS "-------------------------------------------------------------------------------" )\r
+MESSAGE( STATUS "Build for Version ${PRINT_VERSION} build ${PRINT_REVISION}")\r
+MESSAGE( STATUS "VERSION_STATE ${PRINT_VERSION_STATE}")\r
 MESSAGE( STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" )\r
 MESSAGE( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" )\r
 MESSAGE( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" )\r
diff --git a/LIMITATIONS b/LIMITATIONS
deleted file mode 100755 (executable)
index 831374e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-KNOWN LIMITATIONS:
-(26.07.2010)
-
-Client:
-- Only one daemon connection is supported
-
-Daemon:
-- Missing features, see TODO
-
-User:
-- Only one application, but multiple contexts, are possible in each user application
diff --git a/README.txt b/README.txt
deleted file mode 100755 (executable)
index f1e7ee9..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-License
--------
-See file: LICENSE.txt
-The full LGPL license: LGPL.txt
index 7acb10c..beece75 100755 (executable)
@@ -23,6 +23,14 @@ Alexander.AW.Wenzel@bmw.de
 \r
 Changes in this release\r
 -----------------------\r
+2.3.0\r
+\r
+Improvements\r
+   \r
+    * [GSW-62] DLT Library version check\r
+    * [GSW-28] Directory where persistent data is stored is not configurable \r
+    * [GSW-46] DLT client library sets a huge stack size for internal thread \r
+    * [GSW-59] Statically allocated large array \r
 \r
 2.2.0:\r
 \r
index fcdbaea..6ddcfad 100755 (executable)
@@ -35,6 +35,6 @@
  # @licence end@
 ########
 
-install(FILES dlt.h dlt_user.h dlt_user_macros.h dlt_client.h dlt_protocol.h dlt_common.h dlt_types.h
+install(FILES dlt.h dlt_user.h dlt_user_macros.h dlt_client.h dlt_protocol.h dlt_common.h dlt_types.h dlt_version.h
         DESTINATION include/dlt
        COMPONENT devel)
index 44c1f33..c745afc 100755 (executable)
@@ -1044,6 +1044,18 @@ extern "C"
      */
     void dlt_get_version(char *buf);
 
+    /**
+    * Print dlt major version to buffer
+    * @param buf Pointer to buffer
+    */
+    void dlt_get_major_version(char *buf);
+
+    /**
+    * Print dlt minor version to buffer
+    * @param buf Pointer to buffer
+    */
+    void dlt_get_minor_version(char *buf);
+
 #endif
 
     /* Function prototypes which should be used only internally */
index a1b6229..263a5f2 100755 (executable)
@@ -382,7 +382,7 @@ int dlt_free();
  * @param description long name of the application
  * @return negative value if there was an error
  */
-int dlt_register_app(const char *appid, const char * description);
+int dlt_register_app(const char *appid, const char * description, const char * user_major_version, const char * user_minor_version);
 
 /**
  * Unregister an application in the daemon.
@@ -440,6 +440,14 @@ int dlt_register_injection_callback(DltContext *handle, uint32_t service_id,
 int dlt_verbose_mode(void);
 
 /**
+ * Check the version of dlt library with library version used of the application.
+ * @param Major version number of application - see dlt_version.h
+ * @param Minor version number of application - see dlt_version.h
+ * @return negative value if there is a mismatch
+ */
+int dlt_user_check_library_version(const char *user_major_version,const char *user_minor_version);
+
+/**
  * Switch to non-verbose mode
  *
  */
index 78ef66d..979026a 100755 (executable)
  * @licence end@
  */
 
-
 /*******************************************************************************
-**                                                                            **
-**  SRC-MODULE: dlt_user_macros.h                                             **
-**                                                                            **
-**  TARGET    : linux                                                         **
-**                                                                            **
-**  PROJECT   : DLT                                                           **
-**                                                                            **
-**  AUTHOR    : Alexander Wenzel Alexander.AW.Wenzel@bmw.de                   **
-**              Markus Klein                                                  **
-**                                                                            **
-**  PURPOSE   :                                                               **
-**                                                                            **
-**  REMARKS   :                                                               **
-**                                                                            **
-**  PLATFORM DEPENDANT [yes/no]: yes                                          **
-**                                                                            **
-**  TO BE CHANGED BY USER [yes/no]: no                                        **
-**                                                                            **
-*******************************************************************************/
+ **                                                                            **
+ **  SRC-MODULE: dlt_user_macros.h                                             **
+ **                                                                            **
+ **  TARGET    : linux                                                         **
+ **                                                                            **
+ **  PROJECT   : DLT                                                           **
+ **                                                                            **
+ **  AUTHOR    : Alexander Wenzel Alexander.AW.Wenzel@bmw.de                   **
+ **              Markus Klein                                                  **
+ **                                                                            **
+ **  PURPOSE   :                                                               **
+ **                                                                            **
+ **  REMARKS   :                                                               **
+ **                                                                            **
+ **  PLATFORM DEPENDANT [yes/no]: yes                                          **
+ **                                                                            **
+ **  TO BE CHANGED BY USER [yes/no]: no                                        **
+ **                                                                            **
+ *******************************************************************************/
 
 /*******************************************************************************
-**                      Author Identity                                       **
-********************************************************************************
-**                                                                            **
-** Initials     Name                       Company                            **
-** --------     -------------------------  ---------------------------------- **
-**  aw          Alexander Wenzel           BMW                                **
-**  mk          Markus Klein               Fraunhofer ESK                     **
-*******************************************************************************/
+ **                      Author Identity                                       **
+ ********************************************************************************
+ **                                                                            **
+ ** Initials     Name                       Company                            **
+ ** --------     -------------------------  ---------------------------------- **
+ **  aw          Alexander Wenzel           BMW                                **
+ **  mk          Markus Klein               Fraunhofer ESK                     **
+ *******************************************************************************/
 
 /*******************************************************************************
-**                      Revision Control History                              **
-*******************************************************************************/
+ **                      Revision Control History                              **
+ *******************************************************************************/
 
 /*
  * $LastChangedRevision: 1515 $
 #ifndef DLT_USER_MACROS_H
 #define DLT_USER_MACORS_H
 
+#include "dlt_version.h"
+
 /**
 \defgroup userapi DLT User API
 \addtogroup userapi
 \{
-*/
+ \defgroup userapi DLT User API
+ \addtogroup userapi
+ \{
+ */
 
 /**************************************************************************************************
-* The folowing macros define a macro interface for DLT
-**************************************************************************************************/
+ * The folowing macros define a macro interface for DLT
+ **************************************************************************************************/
 
 /**
  * Create an object for a new context.
@@ -114,7 +115,8 @@ extern DltContext CONTEXT;
  * @param DESCRIPTION ASCII string containing description
  */
 #define DLT_REGISTER_APP(APPID,DESCRIPTION) \
-    dlt_register_app( APPID, DESCRIPTION);
+               dlt_register_app( APPID, DESCRIPTION, PACKAGE_MAJOR_VERSION, PACKAGE_MINOR_VERSION );
+
 
 /**
  * Unregister application.
@@ -137,9 +139,9 @@ extern DltContext CONTEXT;
  * @param CONTEXTID context id with maximal four characters
  * @param DESCRIPTION ASCII string containing description
  * @param LOGLEVEL log level to be pre-set for this context
         (DLT_LOG_DEFAULT is not allowed here)
+ (DLT_LOG_DEFAULT is not allowed here)
  * @param TRACESTATUS trace status to be pre-set for this context
                (DLT_TRACE_STATUS_DEFAULT is not allowed here)
+ (DLT_TRACE_STATUS_DEFAULT is not allowed here)
  */
 #define DLT_REGISTER_CONTEXT_LL_TS(CONTEXT,CONTEXTID,DESCRIPTION,LOGLEVEL,TRACESTATUS) \
        dlt_register_context_ll_ts(&(CONTEXT), CONTEXTID, DESCRIPTION, LOGLEVEL, TRACESTATUS);
@@ -167,8 +169,8 @@ extern DltContext CONTEXT;
  * @param ARGS variable list of arguments
  */
 #ifdef _MSC_VER
-  /* DLT_LOG is not supported by MS Visual C++ */
-  /* use function interface instead            */
+/* DLT_LOG is not supported by MS Visual C++ */
+/* use function interface instead            */
 #else
 #define DLT_LOG(CONTEXT,LOGLEVEL,ARGS...) \
        { \
@@ -187,12 +189,12 @@ extern DltContext CONTEXT;
  * @param LOGLEVEL the log level of the log message
  * @param MSGID the message id of log message
  * @param ARGS variable list of arguments: 
         calls to DLT_STRING(), DLT_BOOL(), DLT_FLOAT32(), DLT_FLOAT64(),
         DLT_INT(), DLT_UINT(), DLT_RAW()
+ calls to DLT_STRING(), DLT_BOOL(), DLT_FLOAT32(), DLT_FLOAT64(),
+ DLT_INT(), DLT_UINT(), DLT_RAW()
  */
 #ifdef _MSC_VER
-  /* DLT_LOG_ID is not supported by MS Visual C++ */
-  /* use function interface instead               */
+/* DLT_LOG_ID is not supported by MS Visual C++ */
+/* use function interface instead               */
 #else
 #define DLT_LOG_ID(CONTEXT,LOGLEVEL,MSGID,ARGS...) \
        { \
@@ -311,7 +313,6 @@ extern DltContext CONTEXT;
         dlt_log_string(&(CONTEXT), LOGLEVEL, TEXT); \
     }
 
-
 /**
  * Send log message with string parameter and integer parameter.
  * @param CONTEXT object containing information about one special logging context
@@ -408,7 +409,7 @@ extern DltContext CONTEXT;
        dlt_disable_local_print();
 
 /**
 \}
-*/
+ \}
+ */
 
 #endif /* DLT_USER_MACROS_H */
diff --git a/include/dlt/dlt_version.h b/include/dlt/dlt_version.h
new file mode 100755 (executable)
index 0000000..48d37a2
--- /dev/null
@@ -0,0 +1,12 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+#ifndef __VERSION_H_
+#define __VERSION_H_
+
+#define PACKAGE_VERSION_STATE ""
+#define PACKAGE_VERSION "2.2.0"
+#define PACKAGE_MAJOR_VERSION "2"
+#define PACKAGE_MINOR_VERSION "2"
+#define PACKAGE_PATCH_LEVEL "0"
+#define PACKAGE_REVISION "v2.2.0-9-g48928c6"
+
+#endif
diff --git a/include/dlt/dlt_version.h.cmake b/include/dlt/dlt_version.h.cmake
new file mode 100755 (executable)
index 0000000..f217db3
--- /dev/null
@@ -0,0 +1,12 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+#ifndef __VERSION_H_
+#define __VERSION_H_
+
+#define PACKAGE_VERSION_STATE "@PRINT_VERSION_STATE@"
+#define PACKAGE_VERSION "@PRINT_VERSION@"
+#define PACKAGE_MAJOR_VERSION "@PRINT_MAJOR_VERSION@"
+#define PACKAGE_MINOR_VERSION "@PRINT_MINOR_VERSION@"
+#define PACKAGE_PATCH_LEVEL "@PRINT_PATCH_LEVEL@"
+#define PACKAGE_REVISION "@PRINT_REVISION@"
+
+#endif
index 2438368..4f30a86 100755 (executable)
@@ -98,9 +98,6 @@
 #include <sys/time.h>
 #include <linux/stat.h>
 
-#include "version.h"
-#include "svnversion.h"
-
 #include "dlt_types.h"
 #include "dlt-daemon.h"
 #include "dlt-daemon_cfg.h"
index 2180a6b..8939f1b 100755 (executable)
@@ -217,7 +217,7 @@ int main(int argc, char* argv[])
         }
     }
 
-    dlt_register_app("LOG","Test Application for Logging");
+    dlt_register_app("LOG","Test Application for Logging", PACKAGE_MAJOR_VERSION,PACKAGE_MINOR_VERSION);
 
     dlt_register_context(&mycontext,"TEST","Test Context for Logging");
 
index 4b0f4f0..5fc0802 100755 (executable)
@@ -45,7 +45,7 @@ ENDIF(GPROF_DLT_LIB)
 
 target_link_libraries(dlt rt ${CMAKE_THREAD_LIBS_INIT})
 
-set_target_properties(dlt PROPERTIES VERSION 2.2.0 SOVERSION 2)
+set_target_properties(dlt PROPERTIES VERSION ${PRINT_VERSION} SOVERSION ${PRINT_MAJOR_VERSION})
 
 install(TARGETS dlt
        LIBRARY DESTINATION lib
index e1225bb..4493818 100755 (executable)
@@ -124,6 +124,24 @@ static int dlt_user_log_check_user_message(void);
 static void dlt_user_log_reattach_to_daemon(void);
 static int dlt_user_log_send_overflow(void);
 
+int dlt_user_check_library_version(const char *user_major_version,const char *user_minor_version){
+
+       char str[200];
+       char lib_major_version[DLT_USER_MAX_LIB_VERSION_LENGTH];
+       char lib_minor_version[DLT_USER_MAX_LIB_VERSION_LENGTH];
+
+       dlt_get_major_version( lib_major_version);
+       dlt_get_minor_version( lib_minor_version);
+
+       if( (strcmp(lib_major_version,user_major_version)!=0) || (strcmp(lib_minor_version,user_minor_version)!=0))
+       {
+               sprintf(str,"DLT Library version check failed! Installed DLT library version is %s.%s - Application using DLT library version %s.%s\n",lib_major_version,lib_minor_version,user_major_version,user_minor_version);
+               dlt_log(LOG_WARNING, str);
+               return -1;
+       }
+       return 0;
+}
+
 int dlt_init(void)
 {
     char filename[DLT_USER_MAX_FILENAME_LENGTH];
@@ -372,7 +390,7 @@ int dlt_free(void)
 
 
 
-int dlt_register_app(const char *appid, const char * description)
+int dlt_register_app(const char *appid, const char * description, const char * user_major_version,const char * user_minor_version)
 {
     int ret;
 
@@ -382,6 +400,8 @@ int dlt_register_app(const char *appid, const char * description)
         {
             return -1;
         }
+
+        dlt_user_check_library_version(user_major_version, user_minor_version);
     }
 
     if ((appid==0) || (appid[0]=='\0'))
index e6476f0..19228b4 100755 (executable)
 /* Maximu length of a filename string */\r
 #define DLT_USER_MAX_FILENAME_LENGTH         255\r
 \r
+/* Maximum length of a single version number */\r
+#define DLT_USER_MAX_LIB_VERSION_LENGTH                3\r
+\r
 /* Length of buffer for constructing text output */\r
 #define DLT_USER_TEXT_LENGTH              10024\r
 \r
index 22834dd..e5784c0 100755 (executable)
@@ -86,8 +86,7 @@
 #include "dlt_common.h"
 #include "dlt_common_cfg.h"
 
-#include "version.h"
-#include "svnversion.h"
+#include "dlt_version.h"
 
 #if defined (__WIN32__) || defined (_MSC_VER)
 #include <winsock2.h> /* for socket(), connect(), send(), and recv() */
@@ -3081,9 +3080,20 @@ speed_t dlt_convert_serial_speed(int baudrate)
 void dlt_get_version(char *buf)
 {
     sprintf(buf,"DLT Package Version: %s %s, Package Revision: %s, build on %s %s\n",
-            PACKAGE_VERSION, PACKAGE_VERSION_STATE, SVN_VERSION, __DATE__ , __TIME__ );
+            PACKAGE_VERSION, PACKAGE_VERSION_STATE, PACKAGE_REVISION, __DATE__ , __TIME__ );
 }
 
+void dlt_get_major_version(char *buf)
+{
+       sprintf(buf,"%s",PACKAGE_MAJOR_VERSION);
+}
+
+void dlt_get_minor_version(char *buf)
+{
+    sprintf(buf,"%s",PACKAGE_MINOR_VERSION);
+}
+
+
 uint32_t dlt_uptime(void)
 {
 
diff --git a/svnversion.h.cmake b/svnversion.h.cmake
deleted file mode 100755 (executable)
index d95074f..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
-#define SVN_VERSION "@PRINT_VERSION_REVISION@"
diff --git a/version.h b/version.h
deleted file mode 100755 (executable)
index 776199f..0000000
--- a/version.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef __VERSION_H_
-#define __VERSION_H_
-
-#define PACKAGE_VERSION_STATE ""
-#define PACKAGE_VERSION "2.2.0"
-
-#endif
diff --git a/version.h.cmake b/version.h.cmake
deleted file mode 100755 (executable)
index d4fea8a..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef __VERSION_H_
-#define __VERSION_H_
-
-#define PACKAGE_VERSION_STATE "@PRINT_VERSION_STATE@"
-#define PACKAGE_VERSION "@PRINT_VERSION@"
-
-#endif