1From 7acb528db20c08d90f72fa317b8e1ccf4d270cdc Mon Sep 17 00:00:00 2001
2From: Matthew Russell <matthew.g.russell@gmail.com>
3Date: Wed, 10 Apr 2024 06:23:27 -0400
4Subject: [PATCH 1/2] Update to C++17 (#560)
5
6* Upgrading to C++17
7
8* Code Quality: Address compiler warnings
9
10- Fixing narrowing issues
11- Removing useless copies
12- Removing unused lines
13- unused-lambda-capture
14- Removes unused variables
15- Fix some casts (modernize c-style, or simply remove useless casts)
16- Explicitly deleting unused endpoint_impl copy and move constructors
17- Removing redundant std::bind
18- Improving const correctness
19- Moving thread init to constructor body
20- Moved check_routing_credentials_ inside vsomeip security section where it's used
21- Using =default destructor instead of empty destructor
22
23Thread init:
24Moving the initialization of these threads into the constructor body to
25ensure that they do not start with an incomplete "this".  As they
26capture this, it is possible that if the new thread begins before the
27object is fully constructed, the new thread might operate on
28uninitialized members of "this".
29
30* Attempting to fix syntax error on MSVC
31
32* Adjusting PR to conform to Covesa style
33
34* Using curly brace initialization
35
36* Using static_cast to narrow its_device.size() to a socklen_t
37
38* Avoided double integer promotion
39
40Upstream-Status: Backport [https://github.com/COVESA/vsomeip/pull/560]
41Signed-off-by: Khem Raj <raj.khem@gmail.com>
42---
43 Android.bp                                    |  2 +-
44 CMakeLists.txt                                | 11 ++-
45 examples/hello_world/hello_world_service.hpp  | 12 +--
46 .../configuration/include/internal.hpp.in     |  6 +-
47 .../include/internal_android.hpp              | 10 +--
48 .../configuration/src/configuration_impl.cpp  | 13 ++--
49 .../endpoints/include/endpoint_impl.hpp       |  3 +
50 .../local_server_endpoint_impl_receive_op.hpp |  4 +-
51 .../local_uds_client_endpoint_impl.hpp        |  2 +-
52 .../local_uds_server_endpoint_impl.hpp        |  2 +-
53 .../udp_server_endpoint_impl_receive_op.hpp   |  2 +-
54 .../endpoints/src/endpoint_manager_base.cpp   |  2 +-
55 .../src/local_uds_client_endpoint_impl.cpp    |  5 --
56 .../src/local_uds_server_endpoint_impl.cpp    |  6 --
57 .../src/tcp_client_endpoint_impl.cpp          |  2 +-
58 .../src/tcp_server_endpoint_impl.cpp          | 14 ++--
59 .../src/udp_client_endpoint_impl.cpp          |  2 +-
60 .../src/udp_server_endpoint_impl.cpp          |  4 +-
61 .../message/include/message_base_impl.hpp     |  2 -
62 implementation/message/src/deserializer.cpp   |  4 +-
63 .../plugin/src/plugin_manager_impl.cpp        |  2 +-
64 .../routing/src/routing_manager_base.cpp      | 10 +--
65 .../runtime/include/application_impl.hpp      |  4 +-
66 .../runtime/src/application_impl.cpp          |  7 +-
67 implementation/security/src/policy.cpp        |  4 +-
68 implementation/security/src/security.cpp      |  1 +
69 .../src/service_discovery_impl.cpp            | 34 +++++----
70 interface/vsomeip/constants.hpp               | 74 +++++++++----------
71 .../application_tests/application_test.cpp    |  1 +
72 tools/vsomeip_ctrl.cpp                        |  9 ++-
73 30 files changed, 129 insertions(+), 125 deletions(-)
74
75diff --git a/Android.bp b/Android.bp
76index c6caa4de..f314f22b 100644
77--- a/Android.bp
78+++ b/Android.bp
79@@ -30,9 +30,9 @@ libvsomeip_sd_srcs = [
80
81 cc_defaults {
82     name: "vsomeip_defaults",
83+    cpp_std: "c++17",
84
85     cppflags: [
86-        "-std=c++14",
87         "-fexceptions",
88         "-Wno-non-virtual-dtor",
89         "-Wno-unused-const-variable",
90diff --git a/CMakeLists.txt b/CMakeLists.txt
91index ab399a69..3d947055 100644
92--- a/CMakeLists.txt
93+++ b/CMakeLists.txt
94@@ -64,6 +64,8 @@ if(NOT CMAKE_BUILD_TYPE)
95   set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
96 endif()
97
98+set(CMAKE_CXX_STANDARD 17)
99+
100 # OS
101 if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
102     set(DL_LIBRARY "dl")
103@@ -248,13 +250,13 @@ if (MSVC)
104     # add_definitions(-DVSOMEIP_DLL_COMPILATION) now it is controlled per target
105     SET(BOOST_WINDOWS_VERSION "0x600" CACHE STRING "Set the same Version as the Version with which Boost was built, otherwise there will be errors. (normaly 0x600 is for Windows 7 and 0x501 is for Windows XP)")
106     # Disable warning C4250 since it warns that the compiler is correctly following the C++ Standard. It's a "We-Are-Doing-Things-By-The-Book" notice, not a real warning.
107-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_WIN32_WINNT=${BOOST_WINDOWS_VERSION} -DWIN32 -DBOOST_ASIO_DISABLE_IOCP /EHsc /std:c++14 /wd4250")
108+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_WIN32_WINNT=${BOOST_WINDOWS_VERSION} -DWIN32 -DBOOST_ASIO_DISABLE_IOCP /EHsc /wd4250")
109     set(USE_RT "")
110     link_directories(${Boost_LIBRARY_DIR_DEBUG})
111 elseif(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
112     set(USE_RT "")
113 else()
114-    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OS_CXX_FLAGS} -g ${OPTIMIZE} -std=c++14 ${NO_DEPRECATED} ${EXPORTSYMBOLS}")
115+    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OS_CXX_FLAGS} -g ${OPTIMIZE} ${NO_DEPRECATED} ${EXPORTSYMBOLS}")
116     set(USE_RT "rt")
117 endif()
118
119@@ -268,6 +270,7 @@ list(SORT ${VSOMEIP_NAME}-cfg_SRC)
120 if (VSOMEIP_ENABLE_MULTIPLE_ROUTING_MANAGERS EQUAL 0)
121     add_library(${VSOMEIP_NAME}-cfg SHARED ${${VSOMEIP_NAME}-cfg_SRC})
122     set_target_properties (${VSOMEIP_NAME}-cfg PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
123+    target_compile_features(${VSOMEIP_NAME}-cfg PRIVATE cxx_std_17)
124     if (MSVC)
125         set_target_properties(${VSOMEIP_NAME}-cfg PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION_PLUGIN")
126     endif()
127@@ -302,6 +305,7 @@ list(SORT ${VSOMEIP_NAME}_SRC)
128
129 add_library(${VSOMEIP_NAME} SHARED ${${VSOMEIP_NAME}_SRC})
130 set_target_properties (${VSOMEIP_NAME} PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
131+target_compile_features(${VSOMEIP_NAME} PRIVATE cxx_std_17)
132 if (MSVC)
133     set_target_properties(${VSOMEIP_NAME} PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION")
134 else ()
135@@ -331,6 +335,7 @@ file(GLOB ${VSOMEIP_NAME}-sd_SRC
136 list(SORT ${VSOMEIP_NAME}-sd_SRC)
137
138 add_library(${VSOMEIP_NAME}-sd SHARED ${${VSOMEIP_NAME}-sd_SRC})
139+target_compile_features(${VSOMEIP_NAME}-sd PRIVATE cxx_std_17)
140 set_target_properties (${VSOMEIP_NAME}-sd PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
141 if (MSVC)
142     set_target_properties(${VSOMEIP_NAME}-sd PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION_PLUGIN")
143@@ -348,6 +353,7 @@ file(GLOB_RECURSE ${VSOMEIP_NAME}-e2e_SRC
144 list(SORT ${VSOMEIP_NAME}-e2e_SRC)
145
146 add_library(${VSOMEIP_NAME}-e2e SHARED ${${VSOMEIP_NAME}-e2e_SRC})
147+target_compile_features(${VSOMEIP_NAME}-e2e PRIVATE cxx_std_17)
148 set_target_properties (${VSOMEIP_NAME}-e2e PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
149 if (MSVC)
150     set_target_properties(${VSOMEIP_NAME}-e2e PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION_PLUGIN")
151@@ -375,6 +381,7 @@ file(GLOB_RECURSE ${VSOMEIP_COMPAT_NAME}_SRC
152 list(SORT ${VSOMEIP_COMPAT_NAME}_SRC)
153
154 add_library(${VSOMEIP_COMPAT_NAME} SHARED ${${VSOMEIP_COMPAT_NAME}_SRC})
155+target_compile_features(${VSOMEIP_COMPAT_NAME} PRIVATE cxx_std_17)
156 set_target_properties (${VSOMEIP_COMPAT_NAME} PROPERTIES VERSION ${VSOMEIP_COMPAT_VERSION} SOVERSION ${VSOMEIP_COMPAT_MAJOR_VERSION})
157 if (MSVC)
158     set_target_properties(${VSOMEIP_COMPAT_NAME} PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION_PLUGIN")
159diff --git a/examples/hello_world/hello_world_service.hpp b/examples/hello_world/hello_world_service.hpp
160index 7ac3b1e7..b04cacea 100644
161--- a/examples/hello_world/hello_world_service.hpp
162+++ b/examples/hello_world/hello_world_service.hpp
163@@ -11,12 +11,12 @@
164 #if defined ANDROID || defined __ANDROID__
165 #include "android/log.h"
166 #define LOG_TAG "hello_world_service"
167-#define LOG_INF(...) fprintf(stdout, __VA_ARGS__), fprintf(stdout, "\n"), (void)__android_log_print(ANDROID_LOG_INFO, LOG_TAG, ##__VA_ARGS__)
168-#define LOG_ERR(...) fprintf(stderr, __VA_ARGS__), fprintf(stderr, "\n"), (void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, ##__VA_ARGS__)
169+#define LOG_INF(...) std::fprintf(stdout, __VA_ARGS__), std::fprintf(stdout, "\n"), (void)__android_log_print(ANDROID_LOG_INFO, LOG_TAG, ##__VA_ARGS__)
170+#define LOG_ERR(...) std::fprintf(stderr, __VA_ARGS__), std::fprintf(stderr, "\n"), (void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, ##__VA_ARGS__)
171 #else
172 #include <cstdio>
173-#define LOG_INF(...) fprintf(stdout, __VA_ARGS__), fprintf(stdout, "\n")
174-#define LOG_ERR(...) fprintf(stderr, __VA_ARGS__), fprintf(stderr, "\n")
175+#define LOG_INF(...) std::fprintf(stdout, __VA_ARGS__), std::fprintf(stdout, "\n")
176+#define LOG_ERR(...) std::fprintf(stderr, __VA_ARGS__), std::fprintf(stderr, "\n")
177 #endif
178
179 static vsomeip::service_t service_id = 0x1111;
180@@ -32,9 +32,9 @@ public:
181     hello_world_service() :
182                     rtm_(vsomeip::runtime::get()),
183                     app_(rtm_->create_application()),
184-                    stop_(false),
185-                    stop_thread_(std::bind(&hello_world_service::stop, this))
186+                    stop_(false)
187     {
188+        stop_thread_ = std::thread{&hello_world_service::stop, this};
189     }
190
191     ~hello_world_service()
192diff --git a/implementation/configuration/include/internal.hpp.in b/implementation/configuration/include/internal.hpp.in
193index 72c8d503..eff4efad 100644
194--- a/implementation/configuration/include/internal.hpp.in
195+++ b/implementation/configuration/include/internal.hpp.in
196@@ -141,14 +141,14 @@ typedef enum {
197     IS_SUBSCRIBING
198 } subscription_state_e;
199
200-const std::uint32_t MESSAGE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
201+inline constexpr std::uint32_t MESSAGE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
202
203-const std::uint32_t QUEUE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
204+inline constexpr std::uint32_t QUEUE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
205
206 #define VSOMEIP_DEFAULT_NPDU_DEBOUNCING_NANO         2 * 1000 * 1000
207 #define VSOMEIP_DEFAULT_NPDU_MAXIMUM_RETENTION_NANO  5 * 1000 * 1000
208
209-const std::uint32_t MAX_RECONNECTS_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
210+inline constexpr std::uint32_t MAX_RECONNECTS_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
211
212 const std::uint32_t ANY_UID = 0xFFFFFFFF;
213 const std::uint32_t ANY_GID = 0xFFFFFFFF;
214diff --git a/implementation/configuration/include/internal_android.hpp b/implementation/configuration/include/internal_android.hpp
215index f5425722..8757a85a 100644
216--- a/implementation/configuration/include/internal_android.hpp
217+++ b/implementation/configuration/include/internal_android.hpp
218@@ -128,17 +128,17 @@ typedef enum {
219     IS_SUBSCRIBING
220 } subscription_state_e;
221
222-const std::uint32_t MESSAGE_SIZE_UNLIMITED = std::numeric_limits<std::uint32_t>::max();
223+inline constexpr std::uint32_t MESSAGE_SIZE_UNLIMITED = std::numeric_limits<std::uint32_t>::max();
224
225-const std::uint32_t QUEUE_SIZE_UNLIMITED = std::numeric_limits<std::uint32_t>::max();
226+inline constexpr std::uint32_t QUEUE_SIZE_UNLIMITED = std::numeric_limits<std::uint32_t>::max();
227
228 #define VSOMEIP_DEFAULT_NPDU_DEBOUNCING_NANO         2 * 1000 * 1000
229 #define VSOMEIP_DEFAULT_NPDU_MAXIMUM_RETENTION_NANO  5 * 1000 * 1000
230
231-const std::uint32_t MAX_RECONNECTS_UNLIMITED = std::numeric_limits<std::uint32_t>::max();
232+inline constexpr std::uint32_t MAX_RECONNECTS_UNLIMITED = std::numeric_limits<std::uint32_t>::max();
233
234-const std::uint32_t ANY_UID = 0xFFFFFFFF;
235-const std::uint32_t ANY_GID = 0xFFFFFFFF;
236+inline constexpr std::uint32_t ANY_UID = 0xFFFFFFFF;
237+inline constexpr std::uint32_t ANY_GID = 0xFFFFFFFF;
238
239 enum class port_type_e {
240     PT_OPTIONAL,
241diff --git a/implementation/configuration/src/configuration_impl.cpp b/implementation/configuration/src/configuration_impl.cpp
242index ca1bd1dc..380b2906 100644
243--- a/implementation/configuration/src/configuration_impl.cpp
244+++ b/implementation/configuration/src/configuration_impl.cpp
245@@ -333,7 +333,7 @@ bool configuration_impl::load(const std::string &_name) {
246
247     // Tell, if reading of configuration file(s) failed.
248     // (This may file if the logger configuration is incomplete/missing).
249-    for (auto f : its_failed)
250+    for (const auto& f : its_failed)
251         VSOMEIP_WARNING << "Reading of configuration file \""
252             << f << "\" failed. Configuration may be incomplete.";
253
254@@ -342,7 +342,7 @@ bool configuration_impl::load(const std::string &_name) {
255
256     std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
257
258-    for (auto i : its_input) {
259+    for (const auto& i : its_input) {
260         if (utility::is_file(i))
261             VSOMEIP_INFO << "Using configuration file: \"" << i << "\".";
262
263@@ -561,7 +561,7 @@ bool configuration_impl::load_data(const std::vector<configuration_element> &_el
264
265         if (is_logging_loaded_) {
266             logger::logger_impl::init(shared_from_this());
267-            for (auto w : its_warnings)
268+            for (const auto& w : its_warnings)
269                 VSOMEIP_WARNING << w;
270         }
271     }
272@@ -3255,7 +3255,7 @@ void configuration_impl::trim(std::string &_s) {
273         std::find_if(
274             _s.begin(),
275             _s.end(),
276-            [](unsigned char ch) { return !std::isspace(ch); }
277+            [](const auto ch) { return !std::isspace(ch); }
278         )
279     );
280
281@@ -3263,8 +3263,9 @@ void configuration_impl::trim(std::string &_s) {
282         std::find_if(
283             _s.rbegin(),
284             _s.rend(),
285-            [](unsigned char ch) { return !std::isspace(ch); }).base(),
286-            _s.end()
287+            [](const auto ch) { return !std::isspace(ch); }
288+        ).base(),
289+        _s.end()
290     );
291 }
292
293diff --git a/implementation/endpoints/include/endpoint_impl.hpp b/implementation/endpoints/include/endpoint_impl.hpp
294index 9d2b303c..685eba4e 100644
295--- a/implementation/endpoints/include/endpoint_impl.hpp
296+++ b/implementation/endpoints/include/endpoint_impl.hpp
297@@ -34,6 +34,9 @@ public:
298                   std::uint32_t _max_message_size,
299                   configuration::endpoint_queue_limit_t _queue_limit,
300                   const std::shared_ptr<configuration>& _configuration);
301+    endpoint_impl(endpoint_impl<Protocol> const&) = delete;
302+    endpoint_impl(endpoint_impl<Protocol> const&&) = delete;
303+
304     virtual ~endpoint_impl();
305
306     void enable_magic_cookies();
307diff --git a/implementation/endpoints/include/local_server_endpoint_impl_receive_op.hpp b/implementation/endpoints/include/local_server_endpoint_impl_receive_op.hpp
308index 53f4769a..b1d8991d 100644
309--- a/implementation/endpoints/include/local_server_endpoint_impl_receive_op.hpp
310+++ b/implementation/endpoints/include/local_server_endpoint_impl_receive_op.hpp
311@@ -25,8 +25,8 @@ struct storage :
312 {
313     socket_type_t &socket_;
314     receive_handler_t handler_;
315-    byte_t *buffer_;
316-    std::size_t length_;
317+    byte_t *buffer_ = nullptr;
318+    size_t length_;
319     uid_t uid_;
320     gid_t gid_;
321     size_t bytes_;
322diff --git a/implementation/endpoints/include/local_uds_client_endpoint_impl.hpp b/implementation/endpoints/include/local_uds_client_endpoint_impl.hpp
323index d7eede3f..e1e1aaa2 100644
324--- a/implementation/endpoints/include/local_uds_client_endpoint_impl.hpp
325+++ b/implementation/endpoints/include/local_uds_client_endpoint_impl.hpp
326@@ -25,7 +25,7 @@ public:
327                                    const endpoint_type& _remote,
328                                    boost::asio::io_context &_io,
329                                    const std::shared_ptr<configuration>& _configuration);
330-    virtual ~local_uds_client_endpoint_impl();
331+    virtual ~local_uds_client_endpoint_impl() = default;
332
333     void start();
334     void stop();
335diff --git a/implementation/endpoints/include/local_uds_server_endpoint_impl.hpp b/implementation/endpoints/include/local_uds_server_endpoint_impl.hpp
336index 1e78822d..a4ed2eb5 100644
337--- a/implementation/endpoints/include/local_uds_server_endpoint_impl.hpp
338+++ b/implementation/endpoints/include/local_uds_server_endpoint_impl.hpp
339@@ -50,7 +50,7 @@ public:
340             const std::shared_ptr<configuration>& _configuration,
341             bool _is_routing_endpoint);
342
343-    virtual ~local_uds_server_endpoint_impl();
344+    virtual ~local_uds_server_endpoint_impl() = default;
345
346     void start();
347     void stop();
348diff --git a/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp b/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp
349index 1e4f0fe0..35638cd7 100644
350--- a/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp
351+++ b/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp
352@@ -35,7 +35,7 @@ struct storage :
353     socket_type_t &socket_;
354     endpoint_type_t &sender_;
355     receive_handler_t handler_;
356-    byte_t *buffer_;
357+    byte_t *buffer_ = nullptr;
358     size_t length_;
359     std::uint8_t multicast_id_;
360     bool is_v4_;
361diff --git a/implementation/endpoints/src/endpoint_manager_base.cpp b/implementation/endpoints/src/endpoint_manager_base.cpp
362index 9dff9785..4e484454 100644
363--- a/implementation/endpoints/src/endpoint_manager_base.cpp
364+++ b/implementation/endpoints/src/endpoint_manager_base.cpp
365@@ -38,7 +38,7 @@ std::shared_ptr<endpoint> endpoint_manager_base::create_local(client_t _client)
366     return create_local_unlocked(_client);
367 }
368
369-void endpoint_manager_base::remove_local(client_t _client) {
370+void endpoint_manager_base::remove_local(const client_t _client) {
371     std::shared_ptr<endpoint> its_endpoint(find_local(_client));
372     if (its_endpoint) {
373         its_endpoint->register_error_handler(nullptr);
374diff --git a/implementation/endpoints/src/local_uds_client_endpoint_impl.cpp b/implementation/endpoints/src/local_uds_client_endpoint_impl.cpp
375index 0b7e261c..56c621db 100644
376--- a/implementation/endpoints/src/local_uds_client_endpoint_impl.cpp
377+++ b/implementation/endpoints/src/local_uds_client_endpoint_impl.cpp
378@@ -40,12 +40,7 @@ local_uds_client_endpoint_impl::local_uds_client_endpoint_impl(
379     is_supporting_magic_cookies_ = false;
380 }
381
382-local_uds_client_endpoint_impl::~local_uds_client_endpoint_impl() {
383-
384-}
385-
386 bool local_uds_client_endpoint_impl::is_local() const {
387-
388     return true;
389 }
390
391diff --git a/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp b/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp
392index 948fe925..33876c56 100644
393--- a/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp
394+++ b/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp
395@@ -104,17 +104,11 @@ local_uds_server_endpoint_impl::local_uds_server_endpoint_impl(
396 #endif
397 }
398
399-local_uds_server_endpoint_impl::~local_uds_server_endpoint_impl() {
400-
401-}
402-
403 bool local_uds_server_endpoint_impl::is_local() const {
404-
405     return true;
406 }
407
408 void local_uds_server_endpoint_impl::start() {
409-
410     std::lock_guard<std::mutex> its_lock(acceptor_mutex_);
411     if (acceptor_.is_open()) {
412         connection::ptr new_connection = connection::create(
413diff --git a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
414index f42d93d4..e6755157 100644
415--- a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
416+++ b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
417@@ -178,7 +178,7 @@ void tcp_client_endpoint_impl::connect() {
418         std::string its_device(configuration_->get_device());
419         if (its_device != "") {
420             if (setsockopt(socket_->native_handle(),
421-                    SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), (socklen_t)its_device.size()) == -1) {
422+                    SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), static_cast<socklen_t>(its_device.size())) == -1) {
423                 VSOMEIP_WARNING << "TCP Client: Could not bind to device \"" << its_device << "\"";
424             }
425         }
426diff --git a/implementation/endpoints/src/tcp_server_endpoint_impl.cpp b/implementation/endpoints/src/tcp_server_endpoint_impl.cpp
427index f83252ae..5aef72be 100644
428--- a/implementation/endpoints/src/tcp_server_endpoint_impl.cpp
429+++ b/implementation/endpoints/src/tcp_server_endpoint_impl.cpp
430@@ -55,7 +55,7 @@ tcp_server_endpoint_impl::tcp_server_endpoint_impl(
431     std::string its_device(configuration_->get_device());
432     if (its_device != "") {
433         if (setsockopt(acceptor_.native_handle(),
434-                SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), (socklen_t)its_device.size()) == -1) {
435+                SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), static_cast<socklen_t>(its_device.size())) == -1) {
436             VSOMEIP_WARNING << "TCP Server: Could not bind to device \"" << its_device << "\"";
437         }
438     }
439@@ -295,8 +295,8 @@ void tcp_server_endpoint_impl::accept_cbk(const connection::ptr& _connection,
440         auto its_ep = std::dynamic_pointer_cast<tcp_server_endpoint_impl>(
441                 shared_from_this());
442         its_timer->async_wait([its_timer, its_ep]
443-                               (const boost::system::error_code& _error) {
444-            if (!_error) {
445+                               (const boost::system::error_code& _error_inner) {
446+            if (!_error_inner) {
447                 its_ep->start();
448             }
449         });
450@@ -853,12 +853,12 @@ void tcp_server_endpoint_impl::connection::handle_recv_buffer_exception(
451             << std::setfill('0') << std::hex;
452
453     for (std::size_t i = 0; i < recv_buffer_size_ && i < 16; i++) {
454-        its_message << std::setw(2) << (int) (recv_buffer_[i]) << " ";
455+        its_message << std::setw(2) << static_cast<int>(recv_buffer_[i]) << " ";
456     }
457
458     its_message << " Last 16 Bytes captured: ";
459     for (int i = 15; recv_buffer_size_ > 15 && i >= 0; i--) {
460-        its_message << std::setw(2) <<  (int) (recv_buffer_[static_cast<size_t>(i)]) << " ";
461+        its_message << std::setw(2) <<  static_cast<int>(recv_buffer_[static_cast<size_t>(i)]) << " ";
462     }
463     VSOMEIP_ERROR << its_message.str();
464     recv_buffer_.clear();
465@@ -954,7 +954,7 @@ void tcp_server_endpoint_impl::print_status() {
466     std::lock_guard<std::mutex> its_lock(mutex_);
467     connections_t its_connections;
468     {
469-        std::lock_guard<std::mutex> its_lock(connections_mutex_);
470+        std::lock_guard<std::mutex> its_lock_inner(connections_mutex_);
471         its_connections = connections_;
472     }
473
474@@ -1027,7 +1027,7 @@ void tcp_server_endpoint_impl::connection::wait_until_sent(const boost::system::
475         }
476     }
477     {
478-        std::lock_guard<std::mutex> its_lock(its_server->connections_mutex_);
479+        std::lock_guard<std::mutex> its_lock_inner(its_server->connections_mutex_);
480         stop();
481     }
482     its_server->remove_connection(this);
483diff --git a/implementation/endpoints/src/udp_client_endpoint_impl.cpp b/implementation/endpoints/src/udp_client_endpoint_impl.cpp
484index d6952228..f52b2354 100644
485--- a/implementation/endpoints/src/udp_client_endpoint_impl.cpp
486+++ b/implementation/endpoints/src/udp_client_endpoint_impl.cpp
487@@ -67,7 +67,7 @@ void udp_client_endpoint_impl::connect() {
488                     << get_address_port_remote();
489         }
490         socket_->set_option(boost::asio::socket_base::receive_buffer_size(
491-                udp_receive_buffer_size_), its_error);
492+                static_cast<int>(udp_receive_buffer_size_)), its_error);
493         if (its_error) {
494             VSOMEIP_WARNING << "udp_client_endpoint_impl::connect: couldn't set "
495                     << "SO_RCVBUF: " << its_error.message()
496diff --git a/implementation/endpoints/src/udp_server_endpoint_impl.cpp b/implementation/endpoints/src/udp_server_endpoint_impl.cpp
497index 48e35c5d..587fb94c 100644
498--- a/implementation/endpoints/src/udp_server_endpoint_impl.cpp
499+++ b/implementation/endpoints/src/udp_server_endpoint_impl.cpp
500@@ -72,7 +72,7 @@ udp_server_endpoint_impl::udp_server_endpoint_impl(
501     std::string its_device(configuration_->get_device());
502     if (its_device != "") {
503         if (setsockopt(unicast_socket_.native_handle(),
504-                SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), (socklen_t)its_device.size()) == -1) {
505+                SOL_SOCKET, SO_BINDTODEVICE, its_device.c_str(), static_cast<socklen_t>(its_device.size())) == -1) {
506             VSOMEIP_WARNING << "UDP Server: Could not bind to device \"" << its_device << "\"";
507         }
508     }
509@@ -108,7 +108,7 @@ udp_server_endpoint_impl::udp_server_endpoint_impl(
510     const int its_udp_recv_buffer_size =
511             configuration_->get_udp_receive_buffer_size();
512     unicast_socket_.set_option(boost::asio::socket_base::receive_buffer_size(
513-            its_udp_recv_buffer_size), ec);
514+            static_cast<int>(its_udp_recv_buffer_size)), ec);
515
516     if (ec) {
517         VSOMEIP_WARNING << "udp_server_endpoint_impl: couldn't set "
518diff --git a/implementation/message/include/message_base_impl.hpp b/implementation/message/include/message_base_impl.hpp
519index acad2e89..2c953e98 100644
520--- a/implementation/message/include/message_base_impl.hpp
521+++ b/implementation/message/include/message_base_impl.hpp
522@@ -6,8 +6,6 @@
523 #ifndef VSOMEIP_V3_MESSAGE_BASE_IMPL_HPP
524 #define VSOMEIP_V3_MESSAGE_BASE_IMPL_HPP
525
526-#include <boost/thread.hpp>
527-
528 #include <vsomeip/export.hpp>
529 #include <vsomeip/message.hpp>
530
531diff --git a/implementation/message/src/deserializer.cpp b/implementation/message/src/deserializer.cpp
532index 3c4eddfa..bfa723d3 100644
533--- a/implementation/message/src/deserializer.cpp
534+++ b/implementation/message/src/deserializer.cpp
535@@ -115,8 +115,8 @@ bool deserializer::deserialize(std::string &_target, std::size_t _length) {
536     if (_length > remaining_ || _length > _target.capacity()) {
537         return false;
538     }
539-    _target.assign(position_, position_ + long(_length));
540-    position_ += long(_length);
541+    _target.assign(position_, position_ + static_cast<std::vector<byte_t>::difference_type>(_length));
542+    position_ += static_cast<std::vector<byte_t>::difference_type>(_length);
543     remaining_ -= _length;
544
545     return true;
546diff --git a/implementation/plugin/src/plugin_manager_impl.cpp b/implementation/plugin/src/plugin_manager_impl.cpp
547index bea96d01..23b7b892 100644
548--- a/implementation/plugin/src/plugin_manager_impl.cpp
549+++ b/implementation/plugin/src/plugin_manager_impl.cpp
550@@ -164,7 +164,7 @@ bool plugin_manager_impl::unload_plugin(plugin_type_e _type) {
551         }
552     } else {
553         VSOMEIP_ERROR << "plugin_manager_impl::unload_plugin didn't find plugin"
554-                << " type:" << (int)_type;
555+                << " type:" << static_cast<int>(_type);
556         return false;
557     }
558     return plugins_.erase(_type);
559diff --git a/implementation/routing/src/routing_manager_base.cpp b/implementation/routing/src/routing_manager_base.cpp
560index dde6b260..047e6566 100644
561--- a/implementation/routing/src/routing_manager_base.cpp
562+++ b/implementation/routing/src/routing_manager_base.cpp
563@@ -1184,8 +1184,8 @@ void routing_manager_base::remove_local(client_t _client,
564         std::lock_guard<std::mutex> its_lock(local_services_mutex_);
565         // Finally remove all services that are implemented by the client.
566         std::set<std::pair<service_t, instance_t>> its_services;
567-        for (auto& s : local_services_) {
568-            for (auto& i : s.second) {
569+        for (const auto& s : local_services_) {
570+            for (const auto& i : s.second) {
571                 if (std::get<2>(i.second) == _client) {
572                     its_services.insert({ s.first, i.first });
573                     host_->on_availability(s.first, i.first, availability_state_e::AS_UNAVAILABLE,
574@@ -1202,9 +1202,9 @@ void routing_manager_base::remove_local(client_t _client,
575
576         // remove disconnected client from offer service history
577         std::set<std::tuple<service_t, instance_t, client_t>> its_clients;
578-        for (auto& s : local_services_history_) {
579-            for (auto& i : s.second) {
580-                for (auto& c : i.second) {
581+        for (const auto& s : local_services_history_) {
582+            for (const auto& i : s.second) {
583+                for (const auto& c : i.second) {
584                     if (c == _client) {
585                         its_clients.insert(std::make_tuple(s.first, i.first, c));
586                     }
587diff --git a/implementation/runtime/include/application_impl.hpp b/implementation/runtime/include/application_impl.hpp
588index 67187a87..c647b531 100644
589--- a/implementation/runtime/include/application_impl.hpp
590+++ b/implementation/runtime/include/application_impl.hpp
591@@ -309,7 +309,7 @@ private:
592     std::shared_ptr<sync_handler> get_next_handler();
593     void reschedule_availability_handler(const std::shared_ptr<sync_handler> &_handler);
594     bool has_active_dispatcher();
595-    bool is_active_dispatcher(const std::thread::id &_id);
596+    bool is_active_dispatcher(const std::thread::id &_id) const;
597     void remove_elapsed_dispatchers();
598
599     void shutdown();
600@@ -436,7 +436,7 @@ private:
601     // Dispatcher threads that are running
602     std::set<std::thread::id> running_dispatchers_;
603     // Mutex to protect access to dispatchers_ & elapsed_dispatchers_
604-    std::mutex dispatcher_mutex_;
605+    mutable std::mutex dispatcher_mutex_;
606
607     // Condition to wakeup the dispatcher thread
608     mutable std::condition_variable dispatcher_condition_;
609diff --git a/implementation/runtime/src/application_impl.cpp b/implementation/runtime/src/application_impl.cpp
610index aba906b7..db880b42 100644
611--- a/implementation/runtime/src/application_impl.cpp
612+++ b/implementation/runtime/src/application_impl.cpp
613@@ -426,7 +426,8 @@ void application_impl::start() {
614             std::lock_guard<std::mutex> its_lock(dispatcher_mutex_);
615             is_dispatching_ = true;
616             auto its_main_dispatcher = std::make_shared<std::thread>(
617-                    std::bind(&application_impl::main_dispatch, shared_from_this()));
618+                    &application_impl::main_dispatch, shared_from_this()
619+            );
620             dispatchers_[its_main_dispatcher->get_id()] = its_main_dispatcher;
621         }
622
623@@ -1792,7 +1793,7 @@ void application_impl::main_dispatch() {
624             }
625         } else {
626             std::shared_ptr<sync_handler> its_handler;
627-            while (is_dispatching_  && is_active_dispatcher(its_id)
628+            while (is_dispatching_ && is_active_dispatcher(its_id)
629                    && (its_handler = get_next_handler())) {
630                 its_lock.unlock();
631                 invoke_handler(its_handler);
632@@ -2048,7 +2049,7 @@ bool application_impl::has_active_dispatcher() {
633     return false;
634 }
635
636-bool application_impl::is_active_dispatcher(const std::thread::id &_id) {
637+bool application_impl::is_active_dispatcher(const std::thread::id &_id) const {
638     while (is_dispatching_) {
639         if (dispatcher_mutex_.try_lock()) {
640             for (const auto &d : dispatchers_) {
641diff --git a/implementation/security/src/policy.cpp b/implementation/security/src/policy.cpp
642index 36341223..da0bbd86 100644
643--- a/implementation/security/src/policy.cpp
644+++ b/implementation/security/src/policy.cpp
645@@ -175,7 +175,7 @@ policy::deserialize_ids(const byte_t * &_data, uint32_t &_size,
646         if (its_result == false)
647             return false;
648
649-        for (const auto i : its_instances)
650+        for (const auto& i : its_instances)
651             its_ids += std::make_pair(i, its_methods);
652
653         its_array_length -= (its_current_size - _size);
654@@ -379,7 +379,7 @@ policy::serialize_interval_set(
655     uint32_t its_interval_set_size(0);
656     serialize_u32(its_interval_set_size, _data);
657
658-    for (const auto i : _intervals)
659+    for (const auto& i : _intervals)
660         serialize_interval(i, _data);
661
662     its_interval_set_size = static_cast<uint32_t>(_data.size()
663diff --git a/implementation/security/src/security.cpp b/implementation/security/src/security.cpp
664index a3b6ab3f..19ff73da 100644
665--- a/implementation/security/src/security.cpp
666+++ b/implementation/security/src/security.cpp
667@@ -14,6 +14,7 @@
668 #include "../../plugin/include/plugin_manager.hpp"
669
670 #include <array>
671+#include <iomanip>
672 #include <tuple>
673
674 #ifndef _WIN32
675diff --git a/implementation/service_discovery/src/service_discovery_impl.cpp b/implementation/service_discovery/src/service_discovery_impl.cpp
676index de6e8467..c3880457 100644
677--- a/implementation/service_discovery/src/service_discovery_impl.cpp
678+++ b/implementation/service_discovery/src/service_discovery_impl.cpp
679@@ -5,8 +5,10 @@
680
681 #include <vsomeip/constants.hpp>
682
683-#include <random>
684+#include <chrono>
685+#include <iomanip>
686 #include <forward_list>
687+#include <random>
688 #include <thread>
689
690 #include <vsomeip/internal/logger.hpp>
691@@ -869,7 +871,7 @@ service_discovery_impl::create_eventgroup_entry(
692                 << std::setw(4) << _service << "."
693                 << std::setw(4) << _instance << "."
694                 << std::setw(4) << _eventgroup << "] "
695-                << (uint16_t) _reliability_type;
696+                << static_cast<uint16_t>(_reliability_type);
697         return its_data;
698     }
699     std::shared_ptr<eventgroupentry_impl> its_entry, its_other;
700@@ -1074,7 +1076,7 @@ service_discovery_impl::insert_subscription_ack(
701     // Selective
702     if (_clients.size() > 1 || (*(_clients.begin())) != 0) {
703         auto its_selective_option = std::make_shared<selective_option_impl>();
704-        (void)its_selective_option->set_clients(_clients);
705+        static_cast<void>(its_selective_option->set_clients(_clients));
706
707         its_data.options_.push_back(its_selective_option);
708     }
709@@ -1136,7 +1138,7 @@ service_discovery_impl::on_message(
710         static bool must_start_last_msg_received_timer(true);
711         boost::system::error_code ec;
712
713-        std::lock_guard<std::mutex> its_lock(last_msg_received_timer_mutex_);
714+        std::lock_guard<std::mutex> its_lock_inner(last_msg_received_timer_mutex_);
715         if (0 < last_msg_received_timer_.cancel(ec) || must_start_last_msg_received_timer) {
716             must_start_last_msg_received_timer = false;
717             last_msg_received_timer_.expires_from_now(
718@@ -1272,7 +1274,7 @@ service_discovery_impl::on_message(
719         }
720
721         {
722-            std::unique_lock<std::recursive_mutex> its_lock(its_acknowledgement->get_lock());
723+            std::unique_lock<std::recursive_mutex> its_lock_inner(its_acknowledgement->get_lock());
724             its_acknowledgement->complete();
725             // TODO: Check the following logic...
726             if (its_acknowledgement->has_subscription()) {
727@@ -1543,7 +1545,7 @@ service_discovery_impl::process_offerservice_serviceentry(
728                                     << std::setw(4) << _instance << "."
729                                     << std::setw(4) << eg << "]"
730                                     << " using reliability type:  "
731-                                    << std::setw(4) << (uint16_t) offer_type;
732+                                    << std::setw(4) << static_cast<uint16_t>(offer_type);
733                         its_info->set_reliability(offer_type);
734                     }
735                 }
736@@ -1947,7 +1949,7 @@ service_discovery_impl::process_eventgroupentry(
737                     << ": SOME/IP length field in SubscribeEventGroup message header: ["
738                     << std::dec << _entry->get_owning_message()->get_someip_length()
739                     << "] bytes, is shorter than length of deserialized message: ["
740-                    << (uint32_t) _entry->get_owning_message()->get_length() << "] bytes. "
741+                    << static_cast<uint32_t>(_entry->get_owning_message()->get_length()) << "] bytes. "
742                     << its_sender.to_string(ec) << " session: "
743                     << std::hex << std::setw(4) << std::setfill('0') << its_session;
744             return;
745@@ -2238,7 +2240,7 @@ service_discovery_impl::process_eventgroupentry(
746                 boost::system::error_code ec;
747                 VSOMEIP_WARNING << __func__
748                     << ": Unsupported eventgroup option ["
749-                    << std::hex << (int)its_option->get_type() << "] "
750+                    << std::hex << static_cast<int>(its_option->get_type()) << "] "
751                     << its_sender.to_string(ec) << " session: "
752                     << std::hex << std::setw(4) << std::setfill('0') << its_session;
753                 if (its_ttl > 0) {
754@@ -2332,7 +2334,7 @@ service_discovery_impl::handle_eventgroup_subscription(
755                 << std::setw(4) << _instance << "."
756                 << std::setw(4) << _eventgroup << "]"
757                 << " not valid: Event configuration ("
758-                << (std::uint32_t)_info->get_reliability()
759+                << static_cast<std::uint32_t>(_info->get_reliability())
760                 << ") does not match the provided endpoint options: "
761                 << _first_address.to_string(ec) << ":" << std::dec << _first_port << " "
762                 << _second_address.to_string(ec) << ":" << _second_port;
763@@ -2355,14 +2357,14 @@ service_discovery_impl::handle_eventgroup_subscription(
764         boost::system::error_code ec;
765         // TODO: Add session id
766         VSOMEIP_ERROR << __func__
767-                << ": Requested major version:[" << (uint32_t) _major
768+                << ": Requested major version:[" << static_cast<uint32_t>(_major)
769                 << "] in subscription to service: ["
770                 << std::hex << std::setfill('0')
771                 << std::setw(4) << _service << "."
772                 << std::setw(4) << _instance << "."
773                 << std::setw(4) << _eventgroup << "]"
774                 << " does not match with services major version:["
775-                << (uint32_t) _info->get_major() << "] subscriber: "
776+                << static_cast<uint32_t>(_info->get_major()) << "] subscriber: "
777                 << _first_address.to_string(ec) << ":" << std::dec << _first_port;
778         if (_ttl > 0) {
779             insert_subscription_ack(_acknowledgement, its_info, 0, nullptr, _clients);
780@@ -3107,8 +3109,8 @@ service_discovery_impl::move_offers_into_main_phase(
781     const auto its_timer = repetition_phase_timers_.find(_timer);
782     if (its_timer != repetition_phase_timers_.end()) {
783         for (const auto& its_service : its_timer->second) {
784-            for (const auto& instance : its_service.second) {
785-                instance.second->set_is_in_mainphase(true);
786+            for (const auto& its_instance : its_service.second) {
787+                its_instance.second->set_is_in_mainphase(true);
788             }
789         }
790         repetition_phase_timers_.erase(_timer);
791@@ -3125,7 +3127,7 @@ service_discovery_impl::stop_offer_service(
792     bool stop_offer_required(false);
793     // Delete from initial phase offers
794     {
795-        std::lock_guard<std::mutex> its_lock(collected_offers_mutex_);
796+        std::lock_guard<std::mutex> its_lock_inner(collected_offers_mutex_);
797         if (collected_offers_.size()) {
798             auto its_service_it = collected_offers_.find(its_service);
799             if (its_service_it != collected_offers_.end()) {
800@@ -3147,7 +3149,7 @@ service_discovery_impl::stop_offer_service(
801
802     // Delete from repetition phase offers
803     {
804-        std::lock_guard<std::mutex> its_lock(repetition_phase_timers_mutex_);
805+        std::lock_guard<std::mutex> its_lock_inner(repetition_phase_timers_mutex_);
806         for (auto rpt = repetition_phase_timers_.begin();
807                 rpt != repetition_phase_timers_.end();) {
808             auto its_service_it = rpt->second.find(its_service);
809@@ -3866,7 +3868,7 @@ reliability_type_e service_discovery_impl::get_eventgroup_reliability(
810                         << std::setw(4) << _instance << "."
811                         << std::setw(4) << _eventgroup << "]"
812                         << " using reliability type:  "
813-                        << std::setw(4) << (uint16_t) its_reliability;
814+                        << std::setw(4) << static_cast<uint16_t>(its_reliability);
815             its_info->set_reliability(its_reliability);
816         }
817     } else {
818diff --git a/interface/vsomeip/constants.hpp b/interface/vsomeip/constants.hpp
819index 2b040c5e..2519b57f 100644
820--- a/interface/vsomeip/constants.hpp
821+++ b/interface/vsomeip/constants.hpp
822@@ -13,54 +13,54 @@
823
824 namespace vsomeip_v3 {
825
826-const major_version_t DEFAULT_MAJOR = 0x00;
827-const minor_version_t DEFAULT_MINOR = 0x00000000;
828-const ttl_t DEFAULT_TTL = 0xFFFFFF; // "until next reboot"
829+inline constexpr major_version_t DEFAULT_MAJOR = 0x00;
830+inline constexpr minor_version_t DEFAULT_MINOR = 0x00000000;
831+inline constexpr ttl_t DEFAULT_TTL = 0xFFFFFF; // "until next reboot"
832
833 const std::string DEFAULT_MULTICAST = "224.0.0.0";
834-const uint16_t DEFAULT_PORT = 30500;
835-const uint16_t ILLEGAL_PORT = 0xFFFF;
836-const uint16_t ANY_PORT = 0;
837-
838-const uint16_t NO_TRACE_FILTER_EXPRESSION = 0x0000;
839-
840-const service_t ANY_SERVICE = 0xFFFF;
841-const instance_t ANY_INSTANCE = 0xFFFF;
842-const eventgroup_t ANY_EVENTGROUP = 0xFFFF;
843-const method_t ANY_METHOD = 0xFFFF;
844-const major_version_t ANY_MAJOR = 0xFF;
845-const minor_version_t ANY_MINOR = 0xFFFFFFFF;
846-
847-const eventgroup_t DEFAULT_EVENTGROUP = 0x0001;
848-
849-const client_t ILLEGAL_CLIENT = 0x0000;
850-const method_t INVALID_METHOD = 0x0000;
851-
852-const byte_t MAGIC_COOKIE_CLIENT_MESSAGE = 0x00;
853-const byte_t MAGIC_COOKIE_SERVICE_MESSAGE = 0x80;
854-const length_t MAGIC_COOKIE_SIZE = 0x00000008;
855-const request_t MAGIC_COOKIE_REQUEST = 0xDEADBEEF;
856-const client_t MAGIC_COOKIE_CLIENT = 0xDEAD;
857-const protocol_version_t MAGIC_COOKIE_PROTOCOL_VERSION = 0x01;
858-const interface_version_t MAGIC_COOKIE_INTERFACE_VERSION = 0x01;
859-const message_type_e MAGIC_COOKIE_CLIENT_MESSAGE_TYPE =
860+inline constexpr uint16_t DEFAULT_PORT = 30500;
861+inline constexpr uint16_t ILLEGAL_PORT = 0xFFFF;
862+inline constexpr uint16_t ANY_PORT = 0;
863+
864+inline constexpr uint16_t NO_TRACE_FILTER_EXPRESSION = 0x0000;
865+
866+inline constexpr service_t ANY_SERVICE = 0xFFFF;
867+inline constexpr instance_t ANY_INSTANCE = 0xFFFF;
868+inline constexpr eventgroup_t ANY_EVENTGROUP = 0xFFFF;
869+inline constexpr method_t ANY_METHOD = 0xFFFF;
870+inline constexpr major_version_t ANY_MAJOR = 0xFF;
871+inline constexpr minor_version_t ANY_MINOR = 0xFFFFFFFF;
872+
873+inline constexpr eventgroup_t DEFAULT_EVENTGROUP = 0x0001;
874+
875+inline constexpr client_t ILLEGAL_CLIENT = 0x0000;
876+inline constexpr method_t INVALID_METHOD = 0x0000;
877+
878+inline constexpr byte_t MAGIC_COOKIE_CLIENT_MESSAGE = 0x00;
879+inline constexpr byte_t MAGIC_COOKIE_SERVICE_MESSAGE = 0x80;
880+inline constexpr length_t MAGIC_COOKIE_SIZE = 0x00000008;
881+inline constexpr request_t MAGIC_COOKIE_REQUEST = 0xDEADBEEF;
882+inline constexpr client_t MAGIC_COOKIE_CLIENT = 0xDEAD;
883+inline constexpr protocol_version_t MAGIC_COOKIE_PROTOCOL_VERSION = 0x01;
884+inline constexpr interface_version_t MAGIC_COOKIE_INTERFACE_VERSION = 0x01;
885+inline constexpr message_type_e MAGIC_COOKIE_CLIENT_MESSAGE_TYPE =
886         message_type_e::MT_REQUEST_NO_RETURN;
887-const message_type_e MAGIC_COOKIE_SERVICE_MESSAGE_TYPE =
888+inline constexpr message_type_e MAGIC_COOKIE_SERVICE_MESSAGE_TYPE =
889         message_type_e::MT_NOTIFICATION;
890-const return_code_e MAGIC_COOKIE_RETURN_CODE = return_code_e::E_OK;
891+inline constexpr return_code_e MAGIC_COOKIE_RETURN_CODE = return_code_e::E_OK;
892
893-const byte_t CLIENT_COOKIE[] = { 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
894+inline constexpr byte_t CLIENT_COOKIE[] = { 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
895         0xDE, 0xAD, 0xBE, 0xEF, 0x01, 0x01, 0x01, 0x00 };
896
897-const byte_t SERVICE_COOKIE[] = { 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00,
898+inline constexpr byte_t SERVICE_COOKIE[] = { 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00,
899         0x08, 0xDE, 0xAD, 0xBE, 0xEF, 0x01, 0x01, 0x02, 0x00 };
900
901-const event_t ANY_EVENT = 0xFFFF;
902-const client_t ANY_CLIENT = 0xFFFF;
903+inline constexpr event_t ANY_EVENT = 0xFFFF;
904+inline constexpr client_t ANY_CLIENT = 0xFFFF;
905
906-const int VSOMEIP_ALL = -1;
907+inline constexpr int VSOMEIP_ALL = -1;
908
909-const pending_security_update_id_t DEFAULT_SECURITY_UPDATE_ID = 0x0;
910+inline constexpr pending_security_update_id_t DEFAULT_SECURITY_UPDATE_ID = 0x0;
911
912 } // namespace vsomeip_v3
913
914diff --git a/test/network_tests/application_tests/application_test.cpp b/test/network_tests/application_tests/application_test.cpp
915index a4a1923d..c70b6cd5 100644
916--- a/test/network_tests/application_tests/application_test.cpp
917+++ b/test/network_tests/application_tests/application_test.cpp
918@@ -3,6 +3,7 @@
919 // License, v. 2.0. If a copy of the MPL was not distributed with this
920 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
921
922+#include <atomic>
923 #include <thread>
924 #include <mutex>
925 #include <condition_variable>
926diff --git a/tools/vsomeip_ctrl.cpp b/tools/vsomeip_ctrl.cpp
927index 74510427..3e74a832 100644
928--- a/tools/vsomeip_ctrl.cpp
929+++ b/tools/vsomeip_ctrl.cpp
930@@ -29,7 +29,6 @@ public:
931         instance_(_instance),
932         app_(vsomeip::runtime::get()->create_application("vsomeip_ctrl")),
933         wait_service_available_(true),
934-        send_thread_(std::bind(&vsomeip_sender::send, this)),
935         service_id_(0x0),
936         method_id_(0x0),
937         length_(0),
938@@ -39,6 +38,8 @@ public:
939         return_code_(vsomeip::return_code_e::E_UNKNOWN),
940         wait_for_answer_(true)
941     {
942+        send_thread_ = std::thread{&vsomeip_sender::send, this};
943+
944         if (user_message_.size() < VSOMEIP_PAYLOAD_POS) {
945             VSOMEIP_ERROR << "Provided message is to short, min. length "
946                     "is 16 Bytes, exiting.";
947@@ -117,11 +118,11 @@ public:
948             << std::setw(4) << _response->get_instance() << "]:";
949         VSOMEIP_INFO << "########## begin message";
950         VSOMEIP_INFO << std::hex << std::setw(4)  << std::setfill('0')
951-                << _response->get_service()
952+                << _response->get_service()
953                 << std::hex << std::setw(4) << std::setfill('0')
954                 << _response->get_method()
955                 << " # service id / instance id";
956-        VSOMEIP_INFO << std::hex << std::setw(8)  << std::setfill('0')
957+        VSOMEIP_INFO << std::hex << std::setw(8)  << std::setfill('0')
958                 << _response->get_length() << " # length";
959         VSOMEIP_INFO << std::hex << std::setw(4)  << std::setfill('0')
960                 << _response->get_client()
961@@ -243,7 +244,7 @@ private:
962         }
963
964         if (use_tcp_ && user_message_.size() > VSOMEIP_MAX_TCP_MESSAGE_SIZE) {
965-            VSOMEIP_WARNING << "Max allowed message size for TCP is "
966+            VSOMEIP_WARNING << "Max allowed message size for TCP is "
967                     << std::dec << VSOMEIP_MAX_TCP_MESSAGE_SIZE
968                     << ". Provided message size is: " << user_message_.size();
969         }
970