Skip to content

Commit

Permalink
includes: merge common and utils
Browse files Browse the repository at this point in the history
  • Loading branch information
joelguittet committed May 25, 2023
1 parent b0f6ee5 commit c73cd8b
Show file tree
Hide file tree
Showing 19 changed files with 54 additions and 106 deletions.
1 change: 0 additions & 1 deletion add-ons/src/mender-configure.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "mender-log.h"
#include "mender-rtos.h"
#include "mender-storage.h"
#include "mender-utils.h"

#ifdef CONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE

Expand Down
1 change: 0 additions & 1 deletion add-ons/src/mender-inventory.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "mender-inventory.h"
#include "mender-log.h"
#include "mender-rtos.h"
#include "mender-utils.h"

#ifdef CONFIG_MENDER_CLIENT_ADD_ON_INVENTORY

Expand Down
2 changes: 0 additions & 2 deletions core/src/mender-api.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@
* SOFTWARE.
*/

#include <cJSON.h>
#include "mender-api.h"
#include "mender-artifact.h"
#include "mender-http.h"
#include "mender-log.h"
#include "mender-tls.h"
#include "mender-utils.h"

/**
* @brief Paths of the mender-server APIs
Expand Down
2 changes: 0 additions & 2 deletions core/src/mender-artifact.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@
* SOFTWARE.
*/

#include <cJSON.h>
#include "mender-artifact.h"
#include "mender-log.h"
#include "mender-utils.h"

/**
* @brief TAR block size
Expand Down
2 changes: 0 additions & 2 deletions core/src/mender-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@
* SOFTWARE.
*/

#include <cJSON.h>
#include "mender-api.h"
#include "mender-client.h"
#include "mender-log.h"
#include "mender-rtos.h"
#include "mender-storage.h"
#include "mender-tls.h"
#include "mender-utils.h"

/**
* @brief Default host
Expand Down
2 changes: 0 additions & 2 deletions core/src/mender-utils.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
* SOFTWARE.
*/

#include <cJSON.h>
#include "mender-log.h"
#include "mender-utils.h"

char *
mender_utils_http_status_to_string(int status) {
Expand Down
3 changes: 1 addition & 2 deletions include/mender-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
extern "C" {
#endif /* __cplusplus */

#include <cJSON.h>
#include "mender-common.h"
#include "mender-utils.h"

/**
* @brief Mender API configuration
Expand Down
3 changes: 1 addition & 2 deletions include/mender-artifact.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
extern "C" {
#endif /* __cplusplus */

#include <cJSON.h>
#include "mender-common.h"
#include "mender-utils.h"

/**
* @brief Artifact state machine used to process input data stream
Expand Down
2 changes: 1 addition & 1 deletion include/mender-client.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
extern "C" {
#endif /* __cplusplus */

#include "mender-common.h"
#include "mender-utils.h"

/**
* @brief Mender client configuration
Expand Down
82 changes: 0 additions & 82 deletions include/mender-common.h

This file was deleted.

2 changes: 1 addition & 1 deletion include/mender-configure.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
extern "C" {
#endif /* __cplusplus */

#include "mender-common.h"
#include "mender-utils.h"

#ifdef CONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE

Expand Down
2 changes: 1 addition & 1 deletion include/mender-http.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
extern "C" {
#endif /* __cplusplus */

#include "mender-common.h"
#include "mender-utils.h"

/**
* @brief Mender HTTP configuration
Expand Down
2 changes: 1 addition & 1 deletion include/mender-inventory.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
extern "C" {
#endif /* __cplusplus */

#include "mender-common.h"
#include "mender-utils.h"

#ifdef CONFIG_MENDER_CLIENT_ADD_ON_INVENTORY

Expand Down
2 changes: 1 addition & 1 deletion include/mender-log.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
extern "C" {
#endif /* __cplusplus */

#include "mender-common.h"
#include "mender-utils.h"

/**
* @brief Mender log levels
Expand Down
2 changes: 1 addition & 1 deletion include/mender-ota.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
extern "C" {
#endif /* __cplusplus */

#include "mender-common.h"
#include "mender-utils.h"

/**
* @brief Begin new OTA deployment
Expand Down
2 changes: 1 addition & 1 deletion include/mender-rtos.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
extern "C" {
#endif /* __cplusplus */

#include "mender-common.h"
#include "mender-utils.h"

/**
* @brief Work parameters
Expand Down
2 changes: 1 addition & 1 deletion include/mender-storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
extern "C" {
#endif /* __cplusplus */

#include "mender-common.h"
#include "mender-utils.h"

/**
* @brief Initialize mender storage
Expand Down
2 changes: 1 addition & 1 deletion include/mender-tls.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
extern "C" {
#endif /* __cplusplus */

#include "mender-common.h"
#include "mender-utils.h"

/**
* @brief Initialize mender TLS
Expand Down
44 changes: 43 additions & 1 deletion include/mender-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,49 @@
extern "C" {
#endif /* __cplusplus */

#include "mender-common.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#include <cJSON.h>

/**
* @brief Mender error codes
*/
typedef enum {
MENDER_DONE = 1, /**< Done */
MENDER_OK = 0, /**< OK */
MENDER_FAIL = -1, /**< Failure */
MENDER_NOT_FOUND = -2, /**< Not found */
} mender_err_t;

/**
* @brief Deployment status
*/
typedef enum {
MENDER_DEPLOYMENT_STATUS_DOWNLOADING, /**< Status is "downloading" */
MENDER_DEPLOYMENT_STATUS_INSTALLING, /**< Status is "installing" */
MENDER_DEPLOYMENT_STATUS_REBOOTING, /**< Status is "rebooting" */
MENDER_DEPLOYMENT_STATUS_SUCCESS, /**< Status is "success" */
MENDER_DEPLOYMENT_STATUS_FAILURE, /**< Status is "failure" */
MENDER_DEPLOYMENT_STATUS_ALREADY_INSTALLED /**< Status is "already installed" */
} mender_deployment_status_t;

/**
* @brief Key-store item
*/
typedef struct {
char *name; /**< Name of the item */
char *value; /**< Value of the item */
} mender_keystore_item_t;

/**
* @brief Key-store
*/
typedef mender_keystore_item_t mender_keystore_t;

/**
* @brief Function used to print HTTP status as string
Expand Down

0 comments on commit c73cd8b

Please sign in to comment.