15 #define USER_AGENT_HEADER_FORMAT "MCL/" MCL_VERSION_STRING " (%s)" 21 MCL_DEBUG_ENTRY(
"mcl_core_configuration_t *configuration = <%p>, mcl_core_t **core = <%p>", configuration, core);
39 (*core)->configuration = configuration;
45 MCL_INFO(
"Core structure is initialized.");
57 mcl_bool_t critical_section_callbacks_are_used;
64 critical_section_callbacks_are_used = (
MCL_NULL != core->configuration->critical_section_enter_callback) &&
65 (
MCL_NULL != core->configuration->critical_section_leave_callback);
66 if (
MCL_FALSE != critical_section_callbacks_are_used)
68 result = core->configuration->critical_section_enter_callback();
78 MCL_INFO(
"Agent is successfully onboarded.");
87 MCL_INFO(
"Agent is already onboarded.");
91 if (
MCL_FALSE != critical_section_callbacks_are_used)
93 core->configuration->critical_section_leave_callback();
104 mcl_bool_t critical_section_callbacks_are_used;
111 critical_section_callbacks_are_used = (
MCL_NULL != core->configuration->critical_section_enter_callback) &&
112 (
MCL_NULL != core->configuration->critical_section_leave_callback);
113 if (
MCL_FALSE != critical_section_callbacks_are_used)
115 result = core->configuration->critical_section_enter_callback();
127 MCL_INFO(
"Key successfully rotated.");
139 if (
MCL_FALSE != critical_section_callbacks_are_used)
141 core->configuration->critical_section_leave_callback();
152 mcl_bool_t critical_section_callbacks_are_used;
159 critical_section_callbacks_are_used = (
MCL_NULL != core->configuration->critical_section_enter_callback) &&
160 (
MCL_NULL != core->configuration->critical_section_leave_callback);
161 if (
MCL_TRUE == critical_section_callbacks_are_used)
163 result = core->configuration->critical_section_enter_callback();
178 if (
MCL_TRUE == critical_section_callbacks_are_used)
180 core->configuration->critical_section_leave_callback();
207 MCL_ERROR(
"Failed to get access token.");
239 MCL_DEBUG_ENTRY(
"mcl_core_t *core = <%p>, char **token = <%p>", core, token);
249 else if(
MCL_NULL == core->core_processor->security_handler->access_token)
256 token_length =
string_util_strlen(core->core_processor->security_handler->access_token) + 1;
265 string_util_memcpy(*token, core->core_processor->security_handler->access_token, token_length);
278 MCL_DEBUG_ENTRY(
"mcl_core_t *core = <%p>, char **token_time = <%p>", core, token_time);
285 if (
MCL_NULL == core->core_processor->security_handler->last_token_time)
292 token_time_length =
string_util_strlen(core->core_processor->security_handler->last_token_time) + 1;
293 *token_time =
MCL_CALLOC(token_time_length, 1);
301 string_util_memcpy(*token_time, core->core_processor->security_handler->last_token_time, token_time_length);
319 http_client = core->core_processor->http_client;
335 host_name = core->configuration->mindsphere_hostname;
351 client_id = (
const char *)core->core_processor->security_handler->client_id;
#define MCL_FUNCTION_LEAVE_LABEL
mcl_error_t mcl_core_initialize(mcl_core_configuration_t *configuration, mcl_core_t **core)
void core_configuration_log(core_configuration_t *configuration)
Agent is already onboarded to the server, hence the library did not try to onboard again...
#define MCL_CALLOC(count, bytes)
#define MCL_DEBUG_ENTRY(...)
mcl_error_t mcl_core_get_last_token_time(mcl_core_t *core, char **token_time)
String utility module header file.
mcl_error_t core_configuration_validate(core_configuration_t *configuration)
#define MCL_ASSERT_CODE_MESSAGE(condition, return_code,...)
mcl_error_t mcl_core_get_last_access_token(mcl_core_t *core, char **token)
No access token exists in mcl_core_t handle.
mcl_http_client_t * mcl_core_get_http_client(mcl_core_t *core)
struct mcl_core_configuration_t mcl_core_configuration_t
struct mcl_core_t mcl_core_t
mcl_error_t mcl_core_rotate_key(mcl_core_t *core)
void string_util_memcpy(void *destination, const void *source, mcl_size_t count)
Agent is not onboarded to the server yet and does not possess an authentication key.
Definitions module header file.
#define MCL_ASSERT_STATEMENT_CODE_MESSAGE(condition, statement, return_code,...)
#define MCL_ASSERT_NOT_NULL(argument, return_variable)
const char * mcl_core_get_client_id(mcl_core_t *core)
const char * mcl_core_get_host_name(mcl_core_t *core)
mcl_bool_t mcl_core_is_onboarded(mcl_core_t *core)
Server time is not received from the server.
mcl_error_t core_processor_initialize(core_configuration_t *configuration, core_processor_t **core_processor)
void core_processor_destroy(core_processor_t **core_processor)
mcl_error_t mcl_core_onboard(mcl_core_t *core)
mcl_error_t mcl_core_get_access_token(mcl_core_t *core)
mcl_error_t core_processor_get_access_token(core_processor_t *core_processor)
Core module interface header file.
#define MCL_ASSERT_OK(code)
mcl_error_t mcl_core_update_credentials(mcl_core_t *core)
mcl_error_t core_processor_update_credentials(core_processor_t *core_processor)
mcl_error_t mcl_core_destroy(mcl_core_t **core)
#define MCL_DEBUG_LEAVE(...)
mcl_size_t string_util_strlen(const char *buffer)
mcl_error_t core_processor_register(core_processor_t *core_processor)
Memory module interface header file.