Skip to content

Commit

Permalink
capicxx-someip-runtime 3.2.3-r8 (COVESA#30)
Browse files Browse the repository at this point in the history
* capicxx-someip-runtime 3.2.3-r8

- Changed level logs from warning to info when address_aliasing is activated
- Fix incorrect timings in logs
- vSomeIP Security: Update vsomeip_sec
- Use steady_clock instead of high_resolution_clock
- Extend SomeIP::ClientId interface to be more flexible when creating instances
- Outputstream: Fix endianness issues when writing array lengths
- Linux: avoid static initialization of std::mutex.
- Changed the default width of a serialized enumeration from
  "backing type width" to 1 byte.
- Updated the subscriptionMutex_ to a recursive_mutex.
- Added OSS information for RSE.
- Fixed open source compliance issues.
- Ensure cleanup- and detach-thread do not attempt to join
  themself.
- Removed GENIVI copyright line
- Extended error message on event deserialization error.
- Implemented correct sending/receiving of boolean values.
- Initialize lastProcessing_ time
- Update android build files
- Array of uint8_t: Check remaining bytes before calling vector::assign.
- Add method to convert from capi client to someipclient.
- Fix Address overwriting
- Adapt to CommonAPI 3.2.2
- Added main loop supervisor

* Fix Copyright field and github link in README file
  • Loading branch information
dibpinto authored Oct 23, 2023
1 parent 29cb5c8 commit d346e0f
Show file tree
Hide file tree
Showing 33 changed files with 1,048 additions and 624 deletions.
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
39 changes: 22 additions & 17 deletions Android.bp
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
capi_someip_srcs = [
"src/CommonAPI/SomeIP/**/*.cpp"
]

cc_library_shared {
name: "libCommonAPI-SomeIP",
vendor: true,
srcs: capi_someip_srcs,
defaults: [
"capi_defaults"
],
name: "libcommonapi_someip",
defaults: ["libcommonapi_defaults"],

cppflags: [
"-D_GLIBCXX_USE_NANOSLEEP",
"-DBOOST_LOG_DYN_LINK",
"-pthread",
"-Wno-unused-private-field"
],


local_include_dirs: [
"include"
],
export_include_dirs: [
"include"
"include",
"internal",
],

shared_libs: [
"libCommonAPI",
"libvsomeip3"
"libboost_log",
"libboost_system",
"libboost_thread",
"libvsomeip3",
"libcommonapi",
],

export_include_dirs: [
"include",
],

srcs: [
"src/CommonAPI/SomeIP/**/*.cpp"
],
rtti: true
}

56 changes: 56 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Cannot convert to Android.bp as resource copying has not
# yet implemented for soong as of 12/16/2016

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := libcommonapi_someip_dlt
LOCAL_MODULE_TAGS := optional
LOCAL_CLANG := true
LOCAL_PROPRIETARY_MODULE := true

LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include

LOCAL_SRC_FILES += \
src/CommonAPI/SomeIP/Address.cpp \
src/CommonAPI/SomeIP/AddressTranslator.cpp \
src/CommonAPI/SomeIP/ClientId.cpp \
src/CommonAPI/SomeIP/Configuration.cpp \
src/CommonAPI/SomeIP/Connection.cpp \
src/CommonAPI/SomeIP/DispatchSource.cpp \
src/CommonAPI/SomeIP/Factory.cpp \
src/CommonAPI/SomeIP/InputStream.cpp \
src/CommonAPI/SomeIP/InstanceAvailabilityStatusChangedEvent.cpp \
src/CommonAPI/SomeIP/Message.cpp \
src/CommonAPI/SomeIP/OutputStream.cpp \
src/CommonAPI/SomeIP/Proxy.cpp \
src/CommonAPI/SomeIP/ProxyBase.cpp \
src/CommonAPI/SomeIP/ProxyManager.cpp \
src/CommonAPI/SomeIP/StringEncoder.cpp \
src/CommonAPI/SomeIP/StubAdapter.cpp \
src/CommonAPI/SomeIP/StubManager.cpp \
src/CommonAPI/SomeIP/SubscriptionStatusWrapper.cpp \
src/CommonAPI/SomeIP/Watch.cpp \

LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/internal

LOCAL_SHARED_LIBRARIES := \
libboost_log \
libboost_system \
libboost_thread \
libvsomeip_dlt \
libcommonapi_dlt \

LOCAL_CFLAGS := \
-frtti -fexceptions \
-Wno-ignored-attributes \
-Wno-unused-private-field \
-D_CRT_SECURE_NO_WARNINGS \
-DCOMMONAPI_INTERNAL_COMPILATION \
-DCOMMONAPI_LOGLEVEL=COMMONAPI_LOGLEVEL_VERBOSE \

include $(BUILD_SHARED_LIBRARY)

32 changes: 32 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
Changes
=======

v3.2.3-r8
- Changed level logs from warning to info when address_aliasing is activated
- Fix incorrect timings in logs
- vSomeIP Security: Update vsomeip_sec
- Use steady_clock instead of high_resolution_clock
- Extend SomeIP::ClientId interface to be more flexible when creating instances
- Outputstream: Fix endianness issues when writing array lengths

v3.2.3-r7
- Linux: avoid static initialization of std::mutex.
- Changed the default width of a serialized enumeration from
"backing type width" to 1 byte.

v3.2.3
- Updated the subscriptionMutex_ to a recursive_mutex.
- Added OSS information for RSE.
- Fixed open source compliance issues.
- Ensure cleanup- and detach-thread do not attempt to join
themself.
- Removed GENIVI copyright line
- Extended error message on event deserialization error.
- Implemented correct sending/receiving of boolean values.
- Initialize lastProcessing_ time
- Update android build files
- Array of uint8_t: Check remaining bytes before calling vector::assign.
- Add method to convert from capi client to someipclient.
- Fix Address overwriting

v3.2.2
- Adapt to CommonAPI 3.2.2
- Added main loop supervisor

v3.2.0
- Adapt to CommonAPI v3.2.0

Expand Down
28 changes: 13 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set (CMAKE_VERBOSE_MAKEFILE off)

set (LIBCOMMONAPI_SOMEIP_MAJOR_VERSION 3)
set (LIBCOMMONAPI_SOMEIP_MINOR_VERSION 2)
set (LIBCOMMONAPI_SOMEIP_PATCH_VERSION 0)
set (LIBCOMMONAPI_SOMEIP_PATCH_VERSION 3)

message(STATUS "Project name: ${PROJECT_NAME}")

Expand Down Expand Up @@ -116,16 +116,16 @@ endforeach ()
###################################################################################################

if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
FIND_PACKAGE(CommonAPI 3.2.0 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
FIND_PACKAGE(CommonAPI 3.2 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
else()
FIND_PACKAGE(CommonAPI 3.2.0 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
FIND_PACKAGE(CommonAPI 3.2 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
endif()

message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
message(STATUS "COMMONAPI_INCLUDE_DIRS: ${COMMONAPI_INCLUDE_DIRS}")
message(STATUS "CommonAPI Version: ${CommonAPI_VERSION}")

find_package (vsomeip3 3.1.0 REQUIRED)
find_package (vsomeip3 3.2.0 REQUIRED)
message(STATUS "Using vsomeip3 - v${vsomeip3_VERSION}")

include_directories (
Expand All @@ -141,7 +141,10 @@ list (SORT CommonAPI-SomeIP_SRC)
# CommonAPI
add_library (CommonAPI-SomeIP SHARED ${CommonAPI-SomeIP_SRC})
set_target_properties (CommonAPI-SomeIP PROPERTIES VERSION ${COMPONENT_VERSION} SOVERSION ${COMPONENT_VERSION})
target_link_libraries (CommonAPI-SomeIP CommonAPI ${VSOMEIP_LIBRARIES})
target_include_directories(CommonAPI-SomeIP INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${INSTALL_INCLUDE_DIR}>)
target_link_libraries(CommonAPI-SomeIP PUBLIC CommonAPI ${VSOMEIP_LIBRARIES})

if (MSVC)
target_link_libraries(CommonAPI-SomeIP ws2_32 Rpcrt4)
Expand Down Expand Up @@ -178,24 +181,15 @@ export (PACKAGE CommonAPI-SomeIP)
# Create the CommonAPI-SomeIPConfig.cmake and CommonAPI-SomeIPConfigVersion files
file (RELATIVE_PATH REL_INCLUDE_DIR "${ABSOLUTE_INSTALL_CMAKE_DIR}" "${ABSOLUTE_INSTALL_INCLUDE_DIR}")

# ... for the build tree
set (CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/CommonAPI-SomeIPConfig.cmake.in
"${PROJECT_BINARY_DIR}/CommonAPI-SomeIPConfig.cmake" @ONLY)

# ... for the install tree
set (CONF_INCLUDE_DIRS "\${COMMONAPI_SOMEIP_CMAKE_DIR}/${REL_INCLUDE_DIR}")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/CommonAPI-SomeIPConfig.cmake.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CommonAPI-SomeIPConfig.cmake" @ONLY)

# ... for both
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/CommonAPI-SomeIPConfigVersion.cmake.in
"${PROJECT_BINARY_DIR}/CommonAPI-SomeIPConfigVersion.cmake" @ONLY)

# Install the CommonAPI-SomeIPConfig.cmake and CommonAPI-SomeIPConfigVersion.cmake
install (
FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CommonAPI-SomeIPConfig.cmake"
"${PROJECT_BINARY_DIR}/CommonAPI-SomeIPConfig.cmake"
"${PROJECT_BINARY_DIR}/CommonAPI-SomeIPConfigVersion.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}"
)
Expand All @@ -211,6 +205,10 @@ install (
if(NOT WIN32)
configure_file(CommonAPI-SomeIP.pc.in ${PROJECT_BINARY_DIR}/CommonAPI-SomeIP.pc @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/CommonAPI-SomeIP.pc DESTINATION lib/pkgconfig)

# force all use of std::mutex and std::recursive_mutex to use runtime init
# instead of static initialization so mutexes can be hooked to enable PI as needed
add_definitions(-D_GTHREAD_USE_MUTEX_INIT_FUNC -D_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC)
endif()

##############################################################################
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
### CommonAPI C++ SOME/IP Runtime

##### Copyright
Copyright (C) 2016-2020, Bayerische Motoren Werke Aktiengesellschaft (BMW AG).
Copyright (C) 2016-2020, GENIVI Alliance, Inc.
Copyright (C) 2016-2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG).
Copyright (C) 2016-2023, COVESA

This file is part of GENIVI Project IPC Common API C++.
Contributions are licensed to the GENIVI Alliance under one or more Contribution License Agreements or MPL 2.0.
This file is part of COVESA Project IPC Common API C++.
Contributions are licensed to the COVESA under one or more Contribution License Agreements or MPL 2.0.

##### License
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, you can obtain one at http://mozilla.org/MPL/2.0/.
Expand All @@ -14,7 +14,7 @@ This Source Code Form is subject to the terms of the Mozilla Public License, v.
The user guide can be found in the documentation directory of the CommonAPI-SomeIP-Tools project as AsciiDoc document. A pdf version can be found at https://github.com/GENIVI/capicxx-someip-tools/releases.

##### Further information
https://genivi.github.io/capicxx-core-tools/
https://covesa.github.io/capicxx-core-tools/

##### Build Instructions for Linux

Expand Down
14 changes: 11 additions & 3 deletions cmake/CommonAPI-SomeIPConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# Config file for the CommonAPI-SomeIP package
# It defines the following variables
# COMMONAPI_SOMEIP_INCLUDE_DIRS - include directories for CommonAPI-SomeIP
# Exports the follwing targets:
# CommonAPI-SomeIP - CMake target for CommonAPI SomeIP
# Additionally, the following variables are defined:
# COMMONAPI_SOMEIP_VERSION - The CommonAPI-SomeIP version number

# Find dependencies
find_package(CommonAPI REQUIRED)
find_package(vsomeip3 REQUIRED)

# Compute paths
get_filename_component (COMMONAPI_SOMEIP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set (COMMONAPI_SOMEIP_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")

include ("${COMMONAPI_SOMEIP_CMAKE_DIR}/CommonAPI-SomeIPTargets.cmake")

# Legacy variable, kept for compatibility
get_target_property(COMMONAPI_SOMEIP_INCLUDE_DIRS CommonAPI-SomeIP INTERFACE_INCLUDE_DIRECTORIES)

set(COMMONAPI_SOMEIP_VERSION @PACKAGE_VERSION@)
set(COMMONAPI_SOMEIP_VERSION_STRING "@PACKAGE_VERSION@")
25 changes: 0 additions & 25 deletions include/CommonAPI/SomeIP/AddressTranslator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,38 +42,13 @@ class AddressTranslator {
service_id_t _service, instance_id_t _instance,
major_version_t _major, minor_version_t _minor);

COMMONAPI_EXPORT const Address & getAddressAlias(const Address &_address) const;
COMMONAPI_EXPORT method_id_t getMethodAlias(const Address &_address,
const method_id_t _method) const;
COMMONAPI_EXPORT eventgroup_id_t getEventgroupAlias(const Address &_address,
const eventgroup_id_t _eventgroup) const;

private:
COMMONAPI_EXPORT bool readConfiguration();
COMMONAPI_EXPORT void readServiceAlias(const std::string &_source,
const std::string &_target);
COMMONAPI_EXPORT void readMethodAlias(const std::string &_source,
const std::string &_target);
COMMONAPI_EXPORT void readEventgroupAlias(const std::string &_source,
const std::string &_target);
COMMONAPI_EXPORT bool readValue(const std::string &_data,
Address &_sourceAddress, uint16_t &_id, bool _readId);

COMMONAPI_EXPORT bool isValidService(const service_id_t) const;
COMMONAPI_EXPORT bool isValidInstance(const instance_id_t) const;
COMMONAPI_EXPORT bool isValidMethod(const method_id_t) const;
COMMONAPI_EXPORT bool isValidEventgroup(const eventgroup_id_t) const;

private:
std::string defaultConfig_;

std::map<CommonAPI::Address, Address> forwards_;
std::map<Address, CommonAPI::Address> backwards_;

typedef std::map<method_id_t, method_id_t> MethodAlias_t;
typedef std::map<eventgroup_id_t, eventgroup_id_t> EventgroupAlias_t;
typedef std::tuple<Address, MethodAlias_t, EventgroupAlias_t> Alias_t;
std::map<Address, Alias_t > aliases_;
#ifdef COMMONAPI_ENABLE_ADDRESS_ALIASES
std::map<CommonAPI::Address, CommonAPI::Address> others_;
#endif // COMMONAPI_ENABLE_ADDRESS_ALIASES
Expand Down
14 changes: 13 additions & 1 deletion include/CommonAPI/SomeIP/ClientId.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ class COMMONAPI_EXPORT_CLASS_EXPLICIT ClientId : public CommonAPI::ClientId{
friend struct std::hash< ClientId >;

public:
COMMONAPI_EXPORT ClientId(client_id_t client_id, uid_t _uid, gid_t _gid);
COMMONAPI_EXPORT ClientId();
COMMONAPI_EXPORT ClientId(client_id_t client_id,
const sec_client_t *_sec_client,
const std::string &_env);
COMMONAPI_EXPORT ClientId(client_id_t client_id,
const sec_client_t &_sec_client,
const std::string &_env);
COMMONAPI_EXPORT virtual ~ClientId();

COMMONAPI_EXPORT bool operator==(CommonAPI::ClientId& clientIdToCompare);
Expand All @@ -40,11 +46,17 @@ class COMMONAPI_EXPORT_CLASS_EXPLICIT ClientId : public CommonAPI::ClientId{
COMMONAPI_EXPORT client_id_t getClientId();
COMMONAPI_EXPORT uid_t getUid() const;
COMMONAPI_EXPORT gid_t getGid() const;
COMMONAPI_EXPORT std::string getEnv() const;
COMMONAPI_EXPORT std::string getHostAddress() const;

COMMONAPI_EXPORT static std::shared_ptr<ClientId> getSomeIPClient(const std::shared_ptr<CommonAPI::ClientId> _client);

protected:
client_id_t client_id_;
uid_t uid_;
gid_t gid_;
std::string env_;
std::string hostAddress_;
};

} // namespace SomeIP
Expand Down
Loading

0 comments on commit d346e0f

Please sign in to comment.