Skip to content

Commit

Permalink
platform: rework architecture and options, introduce weaks
Browse files Browse the repository at this point in the history
  • Loading branch information
joelguittet committed Oct 30, 2023
1 parent 1161d0d commit 4ba3cc5
Show file tree
Hide file tree
Showing 29 changed files with 994 additions and 111 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/build_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,24 @@ cd tests
mkdir build
cd build

# Build weak use case
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_NET_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_OTA_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/weak" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)

# Build ESP-IDF use case
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_MCU_CLIENT_BOARD_TYPE="esp-idf" -DCONFIG_MENDER_MCU_CLIENT_NET_TYPE="esp-idf" -DCONFIG_MENDER_MCU_CLIENT_RTOS_TYPE="freertos" -DCONFIG_MENDER_MCU_CLIENT_TLS_TYPE="mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_NET_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_OTA_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="freertos" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="esp-idf/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_MCU_CLIENT_BOARD_TYPE="esp-idf" -DCONFIG_MENDER_MCU_CLIENT_NET_TYPE="esp-idf" -DCONFIG_MENDER_MCU_CLIENT_RTOS_TYPE="freertos" -DCONFIG_MENDER_MCU_CLIENT_TLS_TYPE="mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=OFF -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_NET_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_OTA_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="freertos" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="esp-idf/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=OFF -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)

# Build Zephyr use case
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_MCU_CLIENT_BOARD_TYPE="zephyr" -DCONFIG_MENDER_MCU_CLIENT_NET_TYPE="zephyr" -DCONFIG_MENDER_MCU_CLIENT_RTOS_TYPE="zephyr" -DCONFIG_MENDER_MCU_CLIENT_TLS_TYPE="mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_NET_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_OTA_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="zephyr/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_MCU_CLIENT_BOARD_TYPE="zephyr" -DCONFIG_MENDER_MCU_CLIENT_NET_TYPE="zephyr" -DCONFIG_MENDER_MCU_CLIENT_RTOS_TYPE="zephyr" -DCONFIG_MENDER_MCU_CLIENT_TLS_TYPE="mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=OFF -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_NET_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_OTA_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="zephyr/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=OFF -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)

# Build Posix use case
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_MCU_CLIENT_BOARD_TYPE="posix" -DCONFIG_MENDER_MCU_CLIENT_NET_TYPE="curl" -DCONFIG_MENDER_MCU_CLIENT_RTOS_TYPE="posix" -DCONFIG_MENDER_MCU_CLIENT_TLS_TYPE="mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="posix" -DCONFIG_MENDER_PLATFORM_NET_TYPE="generic/curl" -DCONFIG_MENDER_PLATFORM_OTA_TYPE="posix" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="posix" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="posix" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_MCU_CLIENT_BOARD_TYPE="posix" -DCONFIG_MENDER_MCU_CLIENT_NET_TYPE="curl" -DCONFIG_MENDER_MCU_CLIENT_RTOS_TYPE="posix" -DCONFIG_MENDER_MCU_CLIENT_TLS_TYPE="mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=OFF -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="posix" -DCONFIG_MENDER_PLATFORM_NET_TYPE="generic/curl" -DCONFIG_MENDER_PLATFORM_OTA_TYPE="posix" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="posix" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="posix" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=OFF -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)
20 changes: 12 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,23 @@ cmake_minimum_required(VERSION 3.16.3)
# List of sources
file(GLOB SOURCES_TEMP
"${CMAKE_CURRENT_LIST_DIR}/core/src/*.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/board/${CONFIG_MENDER_MCU_CLIENT_BOARD_TYPE}/src/*.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/net/${CONFIG_MENDER_MCU_CLIENT_NET_TYPE}/src/*.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/rtos/${CONFIG_MENDER_MCU_CLIENT_RTOS_TYPE}/src/*.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/tls/${CONFIG_MENDER_MCU_CLIENT_TLS_TYPE}/src/*.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/log/${CONFIG_MENDER_PLATFORM_LOG_TYPE}/src/*.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/net/${CONFIG_MENDER_PLATFORM_NET_TYPE}/src/*.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/ota/${CONFIG_MENDER_PLATFORM_OTA_TYPE}/src/*.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/rtos/${CONFIG_MENDER_PLATFORM_RTOS_TYPE}/src/*.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/storage/${CONFIG_MENDER_PLATFORM_STORAGE_TYPE}/src/*.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/tls/${CONFIG_MENDER_PLATFORM_TLS_TYPE}/src/*.c"
"${CMAKE_CURRENT_LIST_DIR}/add-ons/src/*.c"
)

# Add include directories
include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
include_directories(${CMAKE_CURRENT_LIST_DIR}/platform/board/${CONFIG_MENDER_MCU_CLIENT_BOARD_TYPE}/include)
include_directories(${CMAKE_CURRENT_LIST_DIR}/platform/net/${CONFIG_MENDER_MCU_CLIENT_NET_TYPE}/include)
include_directories(${CMAKE_CURRENT_LIST_DIR}/platform/rtos/${CONFIG_MENDER_MCU_CLIENT_RTOS_TYPE}/include)
include_directories(${CMAKE_CURRENT_LIST_DIR}/platform/tls/${CONFIG_MENDER_MCU_CLIENT_TLS_TYPE}/include)
include_directories(${CMAKE_CURRENT_LIST_DIR}/platform/log/${CONFIG_MENDER_PLATFORM_LOG_TYPE}/include)
include_directories(${CMAKE_CURRENT_LIST_DIR}/platform/net/${CONFIG_MENDER_PLATFORM_NET_TYPE}/include)
include_directories(${CMAKE_CURRENT_LIST_DIR}/platform/ota/${CONFIG_MENDER_PLATFORM_OTA_TYPE}/include)
include_directories(${CMAKE_CURRENT_LIST_DIR}/platform/rtos/${CONFIG_MENDER_PLATFORM_RTOS_TYPE}/include)
include_directories(${CMAKE_CURRENT_LIST_DIR}/platform/storage/${CONFIG_MENDER_PLATFORM_STORAGE_TYPE}/include)
include_directories(${CMAKE_CURRENT_LIST_DIR}/platform/tls/${CONFIG_MENDER_PLATFORM_TLS_TYPE}/include)

# Define version
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/VERSION" MENDER_CLIENT_VERSION)
Expand Down
14 changes: 7 additions & 7 deletions esp-idf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ list(APPEND srcs
"${CMAKE_CURRENT_LIST_DIR}/../core/src/mender-artifact.c"
"${CMAKE_CURRENT_LIST_DIR}/../core/src/mender-client.c"
"${CMAKE_CURRENT_LIST_DIR}/../core/src/mender-utils.c"
"${CMAKE_CURRENT_LIST_DIR}/../platform/board/esp-idf/src/mender-log.c"
"${CMAKE_CURRENT_LIST_DIR}/../platform/board/esp-idf/src/mender-ota.c"
"${CMAKE_CURRENT_LIST_DIR}/../platform/board/esp-idf/src/mender-storage.c"
"${CMAKE_CURRENT_LIST_DIR}/../platform/net/esp-idf/src/mender-http.c"
"${CMAKE_CURRENT_LIST_DIR}/../platform/rtos/freertos/src/mender-rtos.c"
"${CMAKE_CURRENT_LIST_DIR}/../platform/tls/mbedtls/src/mender-tls.c"
"${CMAKE_CURRENT_LIST_DIR}/../platform/log/${CONFIG_MENDER_PLATFORM_LOG_TYPE}/src/mender-log.c"
"${CMAKE_CURRENT_LIST_DIR}/../platform/net/${CONFIG_MENDER_PLATFORM_NET_TYPE}/src/mender-http.c"
"${CMAKE_CURRENT_LIST_DIR}/../platform/ota/${CONFIG_MENDER_PLATFORM_OTA_TYPE}/src/mender-ota.c"
"${CMAKE_CURRENT_LIST_DIR}/../platform/rtos/${CONFIG_MENDER_PLATFORM_RTOS_TYPE}/src/mender-rtos.c"
"${CMAKE_CURRENT_LIST_DIR}/../platform/storage/${CONFIG_MENDER_PLATFORM_STORAGE_TYPE}/src/mender-storage.c"
"${CMAKE_CURRENT_LIST_DIR}/../platform/tls/${CONFIG_MENDER_PLATFORM_TLS_TYPE}/src/mender-tls.c"
)
if(CONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE)
list(APPEND srcs
Expand All @@ -49,7 +49,7 @@ endif()
if(CONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT)
list(APPEND srcs
"${CMAKE_CURRENT_LIST_DIR}/../add-ons/src/mender-troubleshoot.c"
"${CMAKE_CURRENT_LIST_DIR}/../platform/net/esp-idf/src/mender-websocket.c"
"${CMAKE_CURRENT_LIST_DIR}/../platform/net/${CONFIG_MENDER_PLATFORM_NET_TYPE}/src/mender-websocket.c"
)
endif()

Expand Down
114 changes: 110 additions & 4 deletions esp-idf/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ menu "Mender General Options"
Setting this value to 0 permits to disable the periodic execution and relies on the application to do it.

choice MENDER_LOG_LEVEL
bool "Mender client log verbosity"
prompt "Mender client log verbosity"
default MENDER_LOG_LEVEL_INF
help
Specify how much output to see in Mender client logs.
Expand Down Expand Up @@ -126,7 +126,7 @@ menu "Mender Addons Options"
endif

config MENDER_CLIENT_ADD_ON_TROUBLESHOOT
bool "Mender client Troubleshoot"
bool "Mender client Troubleshoot (EXPERIMENTAL)"
default n
help
Troubleshoot add-on permits to perform debugging on the target from the Mender server.
Expand All @@ -145,7 +145,113 @@ menu "Mender Addons Options"

endmenu

menu "Mender Network Options"
menu "Mender Platform Options (ADVANCED)"

choice MENDER_PLATFORM_LOG_TYPE
prompt "Mender platform log implementation type"
default MENDER_PLATFORM_LOG_TYPE_DEFAULT
help
Specify platform log implementation type, select 'weak' to use you own implementation.

config MENDER_PLATFORM_LOG_TYPE_DEFAULT
bool "default"
config MENDER_PLATFORM_LOG_TYPE_WEAK
bool "weak"
endchoice

config MENDER_PLATFORM_LOG_TYPE
string "Mender platform log implementation type"
default "esp-idf" if MENDER_PLATFORM_LOG_TYPE_DEFAULT
default "generic/weak" if MENDER_PLATFORM_LOG_TYPE_WEAK

choice MENDER_PLATFORM_NET_TYPE
prompt "Mender platform network implementation type"
default MENDER_PLATFORM_NET_TYPE_DEFAULT
help
Specify platform network implementation type, select 'weak' to use you own implementation.

config MENDER_PLATFORM_NET_TYPE_DEFAULT
bool "default"
config MENDER_PLATFORM_NET_TYPE_WEAK
bool "weak"
endchoice

config MENDER_PLATFORM_NET_TYPE
string "Mender platform network implementation type"
default "esp-idf" if MENDER_PLATFORM_NET_TYPE_DEFAULT
default "generic/weak" if MENDER_PLATFORM_NET_TYPE_WEAK

choice MENDER_PLATFORM_OTA_TYPE
prompt "Mender platform OTA implementation type"
default MENDER_PLATFORM_OTA_TYPE_DEFAULT
help
Specify platform OTA implementation type, select 'weak' to use you own implementation.

config MENDER_PLATFORM_OTA_TYPE_DEFAULT
bool "default"
config MENDER_PLATFORM_OTA_TYPE_WEAK
bool "weak"
endchoice

config MENDER_PLATFORM_OTA_TYPE
string "Mender platform OTA implementation type"
default "esp-idf" if MENDER_PLATFORM_OTA_TYPE_DEFAULT
default "generic/weak" if MENDER_PLATFORM_OTA_TYPE_WEAK

choice MENDER_PLATFORM_RTOS_TYPE
prompt "Mender platform RTOS implementation type"
default MENDER_PLATFORM_RTOS_TYPE_DEFAULT
help
Specify platform RTOS implementation type, select 'weak' to use you own implementation.

config MENDER_PLATFORM_RTOS_TYPE_DEFAULT
bool "default"
config MENDER_PLATFORM_RTOS_TYPE_WEAK
bool "weak"
endchoice

config MENDER_PLATFORM_RTOS_TYPE
string "Mender platform RTOS implementation type"
default "freertos" if MENDER_PLATFORM_RTOS_TYPE_DEFAULT
default "generic/weak" if MENDER_PLATFORM_RTOS_TYPE_WEAK

choice MENDER_PLATFORM_STORAGE_TYPE
prompt "Mender platform storage implementation type"
default MENDER_PLATFORM_STORAGE_TYPE_NVS
help
Specify platform storage implementation type, select 'weak' to use you own implementation.

config MENDER_PLATFORM_STORAGE_TYPE_NVS
bool "nvs"
config MENDER_PLATFORM_STORAGE_TYPE_WEAK
bool "weak"
endchoice

config MENDER_PLATFORM_STORAGE_TYPE
string "Mender platform storage implementation type"
default "esp-idf/nvs" if MENDER_PLATFORM_STORAGE_TYPE_NVS
default "generic/weak" if MENDER_PLATFORM_STORAGE_TYPE_WEAK

choice MENDER_PLATFORM_TLS_TYPE
prompt "Mender platform TLS implementation type"
default MENDER_PLATFORM_TLS_TYPE_MBEDTLS
help
Specify platform TLS implementation type, select 'weak' to use you own implementation.

config MENDER_PLATFORM_TLS_TYPE_MBEDTLS
bool "mbedtls"
config MENDER_PLATFORM_TLS_TYPE_WEAK
bool "weak"
endchoice

config MENDER_PLATFORM_TLS_TYPE
string "Mender platform TLS implementation type"
default "generic/mbedtls" if MENDER_PLATFORM_TLS_TYPE_MBEDTLS
default "generic/weak" if MENDER_PLATFORM_TLS_TYPE_WEAK

endmenu

menu "Mender Network Options (ADVANCED)"

if MENDER_CLIENT_ADD_ON_TROUBLESHOOT

Expand Down Expand Up @@ -181,7 +287,7 @@ menu "Mender Network Options"

endmenu

menu "Mender Scheduler Options"
menu "Mender RTOS Options (ADVANCED)"

config MENDER_RTOS_WORK_QUEUE_STACK_SIZE
int "Mender RTOS Work Queue Stack Size (kB)"
Expand Down
1 change: 1 addition & 0 deletions include/mender-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ typedef enum {
MENDER_OK = 0, /**< OK */
MENDER_FAIL = -1, /**< Failure */
MENDER_NOT_FOUND = -2, /**< Not found */
MENDER_NOT_IMPLEMENTED = -3, /**< Not implemented */
} mender_err_t;

/**
Expand Down
File renamed without changes.
55 changes: 55 additions & 0 deletions platform/log/generic/weak/src/mender-log.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* @file mender-log.c
* @brief Mender logging interface for weak platform
*
* MIT License
*
* Copyright (c) 2022-2023 joelguittet and mender-mcu-client contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

#include "mender-log.h"

__attribute__((weak)) mender_err_t
mender_log_init(void) {

/* Nothing to do */
return MENDER_OK;
}

__attribute__((weak)) mender_err_t
mender_log_print(uint8_t level, const char *filename, const char *function, int line, char *format, ...) {

(void)level;
(void)filename;
(void)function;
(void)line;
(void)format;

/* Nothing to do */
return MENDER_OK;
}

__attribute__((weak)) mender_err_t
mender_log_exit(void) {

/* Nothing to do */
return MENDER_OK;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
67 changes: 67 additions & 0 deletions platform/net/generic/weak/src/mender-http.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* @file mender-http.c
* @brief Mender HTTP interface for weak platform
*
* MIT License
*
* Copyright (c) 2022-2023 joelguittet and mender-mcu-client contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

#include "mender-http.h"

__attribute__((weak)) mender_err_t
mender_http_init(mender_http_config_t *config) {

(void)config;

/* Nothing to do */
return MENDER_OK;
}

__attribute__((weak)) mender_err_t
mender_http_perform(char * jwt,
char * path,
mender_http_method_t method,
char * payload,
char * signature,
mender_err_t (*callback)(mender_http_client_event_t, void *, size_t, void *),
void *params,
int * status) {

(void)jwt;
(void)path;
(void)method;
(void)payload;
(void)signature;
(void)callback;
(void)params;
(void)status;

/* Nothing to do */
return MENDER_NOT_IMPLEMENTED;
}

__attribute__((weak)) mender_err_t
mender_http_exit(void) {

/* Nothing to do */
return MENDER_OK;
}
Loading

0 comments on commit 4ba3cc5

Please sign in to comment.