summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Muck <christian.muck@bmw.de>2011-09-05 15:02:23 +0200
committerChristian Muck <christian.muck@bmw.de>2011-09-05 15:02:23 +0200
commitd818704990324fbacd0c7cfb92ba1e7e73e59ab0 (patch)
treeed186088c3f7e2eef4bec828a0ce5a497e25ef7a /src
parent48928c656c68cc4a63e457c2511bbff457c87c36 (diff)
downloadDLT-daemon-d818704990324fbacd0c7cfb92ba1e7e73e59ab0.tar.gz
[GSW-62] DLT Library version check
Diffstat (limited to 'src')
-rwxr-xr-xsrc/daemon/dlt-daemon.c3
-rwxr-xr-xsrc/examples/dlt-example-user-func.c2
-rwxr-xr-xsrc/lib/CMakeLists.txt2
-rwxr-xr-xsrc/lib/dlt_user.c22
-rwxr-xr-xsrc/lib/dlt_user_cfg.h3
-rwxr-xr-xsrc/shared/dlt_common.c16
6 files changed, 39 insertions, 9 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index 2438368..4f30a86 100755
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -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"
diff --git a/src/examples/dlt-example-user-func.c b/src/examples/dlt-example-user-func.c
index 2180a6b..8939f1b 100755
--- a/src/examples/dlt-example-user-func.c
+++ b/src/examples/dlt-example-user-func.c
@@ -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");
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 4b0f4f0..5fc0802 100755
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -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
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c
index e1225bb..4493818 100755
--- a/src/lib/dlt_user.c
+++ b/src/lib/dlt_user.c
@@ -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'))
diff --git a/src/lib/dlt_user_cfg.h b/src/lib/dlt_user_cfg.h
index e6476f0..19228b4 100755
--- a/src/lib/dlt_user_cfg.h
+++ b/src/lib/dlt_user_cfg.h
@@ -104,6 +104,9 @@
/* Maximu length of a filename string */
#define DLT_USER_MAX_FILENAME_LENGTH 255
+/* Maximum length of a single version number */
+#define DLT_USER_MAX_LIB_VERSION_LENGTH 3
+
/* Length of buffer for constructing text output */
#define DLT_USER_TEXT_LENGTH 10024
diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c
index 22834dd..e5784c0 100755
--- a/src/shared/dlt_common.c
+++ b/src/shared/dlt_common.c
@@ -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)
{