Git Product home page Git Product logo

mindsphere / mindconnect-lib Goto Github PK

View Code? Open in Web Editor NEW
24.0 8.0 6.0 617 KB

MindConnect Library (MCL) - Use the MindConnect Library (MCL) to securely connect your on-site device. By cloning or downloading this repository, you accept the Development License Agreement, which you can read by following the link https://developer.mindsphere.io/license.html.

Home Page: https://documentation.mindsphere.io/MindSphere/resources/mindconnect-lib-v4/resources-mclib-overview.html

License: Other

CMake 3.41% HTML 2.08% Shell 0.15% Batchfile 0.07% C 89.93% Ruby 4.01% C++ 0.35%
mindsphere mindconnect mindconnect-library industrial-iot insights-hub siemens

mindconnect-lib's People

Contributors

mclib-dev avatar siemens-developer avatar sn0wcat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mindconnect-lib's Issues

Adding out-of-source ports will break cmakes add_subdirectory

Having something like that:

SET(MCL_HTTP_CLIENT "${CMAKE_CURRENT_LIST_DIR}/ports/my_fantastic_http_client")
SET(MCL_MCL_CRYPTO "${CMAKE_CURRENT_LIST_DIR}/ports/my_even_more_fantastic_crypto")

ADD_SUBDIRECTORY(mindconnect-lib)

will lead to:

CMake Error .../mindconnect-lib/mcl_core/src/CMakeLists.txt:104 (ADD_SUBDIRECTORY):
ADD_SUBDIRECTORY not given a binary directory but the given source directory ...

fix:

IF(NOT DEFINED MCL_CRYPTO)
	SET(MCL_CRYPTO ${MCL_CRYPTO_DEFAULT})
ENDIF()

IF(IS_ABSOLUTE ${MCL_CRYPTO})
	IF(NOT IS_DIRECTORY ${MCL_CRYPTO})
		MESSAGE(FATAL_ERROR "Invalid crypto setting:${MCL_CRYPTO}")
	ENDIF()
	SET(MCL_CRYPTO_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/crypto")
ELSE()
	SET(MCL_CRYPTO "crypto/${MCL_CRYPTO}")
	IF(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${MCL_CRYPTO}")
		MESSAGE(FATAL_ERROR "Invalid crypto setting:${MCL_CRYPTO}")
	ENDIF()
ENDIF()

IF(NOT DEFINED MCL_HTTP_CLIENT)
	SET(MCL_HTTP_CLIENT ${MCL_HTTP_CLIENT_DEFAULT})
ENDIF()

IF(IS_ABSOLUTE ${MCL_HTTP_CLIENT})
	IF(NOT IS_DIRECTORY ${MCL_HTTP_CLIENT})
		MESSAGE(FATAL_ERROR "Invalid HTTP client setting:${MCL_HTTP_CLIENT}")
	ENDIF()
	SET(MCL_HTTP_CLIENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/http_client")
ELSE()
	SET(MCL_HTTP_CLIENT "http_client/${MCL_HTTP_CLIENT}")
	IF(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${MCL_HTTP_CLIENT}")
		MESSAGE(FATAL_ERROR "Invalid HTTP client setting:${MCL_HTTP_CLIENT}")
	ENDIF()
ENDIF()

IF(NOT DEFINED MCL_FILE_UTIL)
	SET(MCL_FILE_UTIL ${MCL_FILE_UTIL_DEFAULT})
ENDIF()

IF(IS_ABSOLUTE ${MCL_FILE_UTIL})
	IF(NOT IS_DIRECTORY ${MCL_FILE_UTIL})
		MESSAGE(FATAL_ERROR "Invalid file util setting:${MCL_FILE_UTIL}")
	ENDIF()
	SET(MCL_FILE_UTIL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/file_util")
ELSE()
	SET(MCL_FILE_UTIL "file_util/${MCL_FILE_UTIL}")
	IF(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${MCL_FILE_UTIL}")
		MESSAGE(FATAL_ERROR "Invalid file util setting:${MCL_FILE_UTIL}")
	ENDIF()
ENDIF()

IF(NOT DEFINED MCL_MEMORY)
	SET(MCL_MEMORY ${MCL_MEMORY_DEFAULT})
ENDIF()

IF(IS_ABSOLUTE ${MCL_MEMORY})
	IF(NOT IS_DIRECTORY ${MCL_MEMORY})
		MESSAGE(FATAL_ERROR "Invalid memory setting:${MCL_MEMORY}")
	ENDIF()
	SET(MCL_MEMORY_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/memory")
ELSE()
	SET(MCL_MEMORY "memory/${MCL_MEMORY}")
	IF(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${MCL_MEMORY}")
		MESSAGE(FATAL_ERROR "Invalid memory setting:${MCL_MEMORY}")
	ENDIF()
ENDIF()

ADD_SUBDIRECTORY(${MCL_CRYPTO} ${MCL_CRYPTO_BINARY_DIR})
ADD_SUBDIRECTORY(${MCL_HTTP_CLIENT} ${MCL_HTTP_CLIENT_BINARY_DIR})
ADD_SUBDIRECTORY(${MCL_FILE_UTIL} ${MCL_FILE_UTIL_BINARY_DIR})
ADD_SUBDIRECTORY(${MCL_MEMORY} ${MCL_MEMORY_BINARY_DIR})

Error LNK2019: unresolved external symbol custom_load_function_shared_secret referenced in function

I succesfully build the project according to the build_helper_win64.bat on windows.
I added all the necessary includes and lib files to my visual studio 2022 project and am trying to upload some files.

For this I copied the file content of "\mcl_connectivity\examples\file_upload.c" to my main and added the "\mcl_connectivity\examples\callbacks" header and source file to my project.

But I get a compile error:

Error LNK2019: unresolved external symbol custom_load_function_shared_secret referenced in function

for the lines 93/94 of file_upload.c:
mcl_core_configuration_set_parameter(core_configuration, MCL_CORE_CONFIGURATION_PARAMETER_CREDENTIALS_LOAD_CALLBACK, custom_load_function_shared_secret);
mcl_core_configuration_set_parameter(core_configuration, MCL_CORE_CONFIGURATION_PARAMETER_CREDENTIALS_SAVE_CALLBACK, custom_save_function_shared_secret);

Is there a solution for this or did I do an error at the setup.

This error occurs not only at file_upload but as well in all other examples files using the "custom_save_function_shared_secret" function.

Question on versioning strategy

From the version numbers I guessed that this project uses semantic versioning. But this does not seem to be the case as breaking changes (e.g. minimal required versions of external dependencies) are updated on patch versions.

This makes it very hard to integrate this component in systems that use a Linux distribution as a base (like Industrial Linux).
All non vendored (external) dependencies should be provided by the system to profit from security fixes in these libraries. Please note, that distros backport critical security fixes while keeping the ABI compatible, hence do not update the SOVERSION.
By that, just by looking at the version number of e.g. curl on a debian buster, you cannot tell if the version is vulnerable.

With the MCL approach of bumping the minimal required versions of external components due to security arguments contradicts this and in the end makes deployments less secure.

Is this strategy actually intended, or is this just by accident and can be changed in the future?
If not, please only require minimal versions based on your API requirements, but not on some pseudo security aspects.

Structure of credentials.txt

I would like to know, how the created credentials file is structured.
I know it consists of:
{SHARED_SECRET}{ClientSecret}{???}{RegistrationAccessToken}{RegistrationURI}

But something is missing and i am not sure what exactly it is. Can someone provide informations?

porting minonnect library from version 3.0 to version 4.3.1 as we are using new tisdk(texas instrument) 8.2.0.24

We have downloaded minconnect lib from the link https://github.com/mindsphere/mindconnect-lib
and we are following the https://documentation.mindsphere.io/MindSphere/resources/mindconnect-lib-v4/resources-mclib-migration-guide.html

Example:
In version 3.0 we have used mcl_store_new_time_series(store, timeseries_version,
configuration_id, NULL, &time_series); in the migration steps its mentioned that we have to use mcl_timeseries_initialize() and mcl_timeseries_set_parameter() this means we have to replace version 3.0 api mcl_store_new_time_series(store, timeseries_version,
configuration_id, NULL, &time_series); with version 4.3.2 2 API's like mcl_timeseries_initialize() and mcl_timeseries_set_parameter() as 2 different api's?

how can we map the arguments from version 3 to version 4 apis's
Similarty how can we use the same parameters in version 4 of minconnect..

there are other api which we need clariffications to use like
mcl_communication_exchange(communication, store,NUll) in version 3 and in version 4 mcl_connectivity_exchange() how can we map?

Below are the other API which we need clarifications?

v3.0 v4.3.2
mcl_configuration_initialize(&configuration) mcl_connectivity_configuration_initialize(&connectivity_configuration) (Replaced)
configuration->proxy_hostname mcl_core_configuration_set_parameter() (Replaced)
mcl_communication_initialize(configuration, &communication) mcl_core_initialize (core_configuration, &core) and mcl_connectivity_initialize(connectivity_configuration, &connectivity ) (Replaced)
mcl_communication_exchange(communication, store,NULL) mcl_connectivity_exchange(communication, store, NULL); (Replaced)
mcl_store_new_data_source_configuration mcl_data_source_configuration_initialize (Replaced)
mcl_data_source_configuration_get_id Not Available to find similar API
mcl_data_source_configuration_add_data_source mcl_data_source_configuration_add_data_source (Available)
mcl_data_source_configuration_add_data_point Not Available to find similar API
mcl_log_util_set_output_level Not Available to find similar API
mcl_log_util_finalize Not Available to find similar API
mcl_store_new_time_series Not Available to find similar API
mcl_time_series_new_value_set Not Available to find similar API
mcl_time_series_add_value Not Available to find similar API
mcl_communication_exchange Not Available to find similar API
mcl_communication_destroy Not Available to find similar API
mcl_configuration_initialize Not Available to find similar API

please provide the document if any

No information about contribution

Hi,

I could not find any information on how you can contribute to this project? Is this already possible or coming at a later stage?

build_helper_win64.bat compiling in debug mode instead of release

I compiled the project with the build_helper_win64.bat script and included all libs and dlls to my project.
When using my executable on another system I got the following error: vcruntime140d.dll and ucrtbased.dll missing (https://answers.microsoft.com/en-us/windows/forum/all/missing-msvcp140ddll-vcruntime140ddll-and/46d00f17-4050-4fbe-b46f-3791fbc28311)(https://stackoverflow.com/questions/59494854/c-program-not-running-on-windows-systems-without-vs-installed-vcruntime140-dl).

This error results from a dependency being compiled in debug mode, which requires additonal vc runtimes on the system to execute the debug mode.

I tracked the error down to the mcl_core.dll, mcl_connectivity.dll and mcl_deployment.dll. After compiling this dlls by hand with code generation Multi-threaded DLL /MD everything worked fine.

I was not able to adapt this changes to the build_helper_win64.bat script.
It would be nice if you could do so.

Thanks.

TARGET_INCLUDE_DIRECTORIES contains invalid in-source dirs

When using target_link_libraries from a third party lib, which itself is a install target in an export set, cmake fails.

example:
TARGET_LINK_LIBRARIES(3rdparty PRIVATE mcl_core mcl_connectivity mcl_data_lake)

problem:
TARGET_INCLUDE_DIRECTORIES(${PROJECT_LIBRARY_OUTPUT} PUBLIC ${MCL_CORE_INCLUDE_DIRECTORIES})

this will "pull" source directories although we have install targets and is therefore invalid.

fix:

from

TARGET_INCLUDE_DIRECTORIES(${PROJECT_LIBRARY_OUTPUT} PUBLIC ${MCL_CORE_INCLUDE_DIRECTORIES})

to:

TARGET_INCLUDE_DIRECTORIES(${PROJECT_LIBRARY_OUTPUT}
    SYSTEM PUBLIC
    $<BUILD_INTERFACE:${MCL_CORE_CMAKE_ROOT_DIR}/include>
	$<BUILD_INTERFACE:${MCL_CORE_CMAKE_ROOT_DIR}/lib>
    $<INSTALL_INTERFACE:${PACKAGE_DESTINATION_INCLUDE}>
	PRIVATE
	$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
    )

that applies to all mcl_targets

mcl_core_configuration_set_parameter misses shared_secret

Please add setting to add shared_secret callbacks:

e.g.

MCL_CORE_CONFIGURATION_PARAMETER_CREDENTIALS_SHARED_LOAD_CALLBACK, 
MCL_CORE_CONFIGURATION_PARAMETER_CREDENTIALS_SHARED_SAVE_CALLBACK,

and

 case MCL_CORE_CONFIGURATION_PARAMETER_CREDENTIALS_SHARED_LOAD_CALLBACK:
      configuration->credentials_load_callback.shared_secret = (mcl_credentials_load_shared_secret_callback_t)value;
      break;

case MCL_CORE_CONFIGURATION_PARAMETER_CREDENTIALS_SHARED_SAVE_CALLBACK:
    configuration->credentials_save_callback.shared_secret = (mcl_credentials_save_shared_secret_callback_t)value;
    break;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.