Skip to content
Snippets Groups Projects
Commit a1f359b3 authored by Constantin P.'s avatar Constantin P. 💬
Browse files

Merge branch 'feature-12763' into 'master'

feature-12763

See merge request !427
parents 628e8fd0 811f08dc
No related branches found
No related tags found
3 merge requests!474Develop port 01.25,!455Develop port 02 12,!427feature-12763
Pipeline #47244 passed with stage
in 24 minutes and 53 seconds
......@@ -3,6 +3,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "uthash.h"
#include "dap_common.h"
typedef struct dap_config_item dap_config_item_t;
......@@ -47,6 +48,7 @@ const char** dap_config_get_array_str(dap_config_t *a_config, const char *a_sect
char **dap_config_get_item_str_path_array(dap_config_t *a_config, const char *a_section, const char *a_item_name, uint16_t *array_length);
void dap_config_get_item_str_path_array_free(char **paths_array, uint16_t *array_length);
double dap_config_get_item_double_default(dap_config_t *a_config, const char *a_section, const char *a_item_name, double a_default);
int dap_config_stream_addrs_parse(dap_config_t *a_cfg, const char *a_config, const char *a_section, dap_stream_node_addr_t **a_addrs, uint16_t *a_addrs_count);
#define dap_config_get_item_bool(a_conf, a_path, a_item) dap_config_get_item_bool_default(a_conf, a_path, a_item, false)
......
......@@ -540,3 +540,21 @@ void dap_config_close(dap_config_t *a_conf) {
void dap_config_deinit() {
}
int dap_config_stream_addrs_parse(dap_config_t *a_cfg, const char *a_config, const char *a_section, dap_stream_node_addr_t **a_addrs, uint16_t *a_addrs_count)
{
dap_return_val_if_pass(!a_cfg || !a_config || !a_config || !a_section || !a_addrs_count, -1);
const char **l_nodes_addrs = dap_config_get_array_str(a_cfg, a_config, a_section, a_addrs_count);
if (*a_addrs_count) {
log_it(L_DEBUG, "Start parse stream addrs in cofnig %s section %s", a_config, a_section);
DAP_NEW_Z_COUNT_RET_VAL(*a_addrs, dap_stream_node_addr_t, *a_addrs_count, -2, NULL);
for (uint16_t i = 0; i < *a_addrs_count; ++i) {
if (dap_stream_node_addr_from_str(*a_addrs + i, l_nodes_addrs[i])) {
log_it(L_ERROR, "Incorrect format of %s address \"%s\", fix net config and restart node", a_section, l_nodes_addrs[i]);
return -3;
}
log_it(L_DEBUG, "Stream addr " NODE_ADDR_FP_STR " parsed successfully", NODE_ADDR_FP_ARGS_S((*a_addrs)[i]));
}
}
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment