Core processor module header file. More...
Go to the source code of this file.
Data Structures | |
struct | core_processor_t |
Functions | |
MCL_LOCAL mcl_error_t | core_processor_initialize (core_configuration_t *configuration, core_processor_t **core_processor) |
MCL_LOCAL mcl_error_t | core_processor_register (core_processor_t *core_processor) |
MCL_LOCAL mcl_error_t | core_processor_update_credentials (core_processor_t *core_processor) |
MCL_LOCAL mcl_error_t | core_processor_get_access_token (core_processor_t *core_processor) |
MCL_LOCAL void | core_processor_destroy (core_processor_t **core_processor) |
Core processor module header file.
This module contains the functions for composing the http requests to send to MindSphere endpoints and parse the received http responses.
Definition in file core_processor.h.
MCL_LOCAL void core_processor_destroy | ( | core_processor_t ** | core_processor | ) |
This function destroys the core processor handle.
[in] | core_processor | Core processor handle to be destroyed. |
Definition at line 752 of file core_processor.c.
References MCL_DEBUG, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FREE, mcl_http_client_destroy(), MCL_NULL, and security_handler_destroy().
Referenced by core_processor_initialize(), and mcl_core_destroy().
MCL_LOCAL mcl_error_t core_processor_get_access_token | ( | core_processor_t * | core_processor | ) |
This function is called by mcl_core_get_access_token.
[in] | core_processor | Core processor handle to be used. |
Definition at line 622 of file core_processor.c.
References _compose_access_token_request_payload(), _content_type_values, _generate_correlation_id_string(), security_handler_t::access_token, core_processor_t::configuration, CONTENT_TYPE_URL_ENCODED, core_processor_t::http_client, HTTP_HEADER_CONTENT_TYPE, HTTP_HEADER_CORRELATION_ID, http_header_names, HTTP_HEADER_SERVER_TIME, JSON_NAME_ACCESS_TOKEN, json_util_destroy(), json_util_get_object_item(), json_util_get_string(), json_util_parse(), security_handler_t::last_token_time, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_ERROR, MCL_FREE, mcl_http_client_send(), MCL_HTTP_POST, mcl_http_request_add_header(), mcl_http_request_destroy(), mcl_http_request_initialize(), MCL_HTTP_REQUEST_PARAMETER_BODY, MCL_HTTP_REQUEST_PARAMETER_BODY_SIZE, MCL_HTTP_REQUEST_PARAMETER_METHOD, MCL_HTTP_REQUEST_PARAMETER_URL, mcl_http_request_set_parameter(), mcl_http_response_destroy(), mcl_http_response_get_header(), mcl_http_response_get_status(), MCL_INFO, MCL_NULL, MCL_OK, mcl_http_response_t::payload, mcl_http_response_t::payload_size, core_processor_t::security_handler, mcl_http_response_t::status_code, string_util_strlen(), and core_configuration_t::token_endpoint.
Referenced by mcl_core_get_access_token().
MCL_LOCAL mcl_error_t core_processor_initialize | ( | core_configuration_t * | configuration, |
core_processor_t ** | core_processor | ||
) |
This function initializes core processor.
[in] | configuration | The configuration parameters to be used for initialization. |
[out] | core_processor | The newly initialized core processor. |
Definition at line 125 of file core_processor.c.
References _custom_load_register_info(), _load_initial_credentials(), mcl_http_client_configuration_t::certificate, core_configuration_t::certificate_is_file, mcl_http_client_configuration_t::certificate_is_file, core_processor_destroy(), endpoint_uri, ENDPOINT_URI_ACCESS_TOKEN, ENDPOINT_URI_REGISTER, core_configuration_t::http_request_timeout, mcl_http_client_configuration_t::http_request_timeout, json_util_initialize_json_library(), MCL_ASSERT_CODE_MESSAGE, MCL_ASSERT_STATEMENT_CODE_MESSAGE, MCL_CREDENTIALS_NOT_LOADED, MCL_DEBUG, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, mcl_http_client_initialize(), MCL_INFO, MCL_NEW, MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, core_configuration_t::mindsphere_certificate, core_configuration_t::mindsphere_port, mcl_http_client_configuration_t::port, core_configuration_t::proxy_domain, mcl_http_client_configuration_t::proxy_domain, core_configuration_t::proxy_hostname, mcl_http_client_configuration_t::proxy_hostname, core_configuration_t::proxy_password, mcl_http_client_configuration_t::proxy_password, core_configuration_t::proxy_port, mcl_http_client_configuration_t::proxy_port, core_configuration_t::proxy_type, mcl_http_client_configuration_t::proxy_type, core_configuration_t::proxy_username, mcl_http_client_configuration_t::proxy_username, security_handler_initialize(), security_initialize(), string_util_concatenate(), core_configuration_t::user_agent, and mcl_http_client_configuration_t::user_agent.
Referenced by mcl_core_initialize().
MCL_LOCAL mcl_error_t core_processor_register | ( | core_processor_t * | core_processor | ) |
This function is called by mcl_core_onboard and mcl_core_rotate_key.
[in] | core_processor | Core processor handle to be used. |
Definition at line 252 of file core_processor.c.
References _bearer_format, _client_id_format, _compose_rsa_key_rotation_json(), _compose_rsa_onboarding_json(), _content_type_values, _generate_correlation_id_string(), _process_registration_response(), _string_identifier, security_handler_t::client_id, core_processor_t::configuration, CONTENT_TYPE_APPLICATION_JSON, core_processor_t::http_client, HTTP_HEADER_ACCEPT, HTTP_HEADER_AUTHORIZATION, HTTP_HEADER_CONTENT_TYPE, HTTP_HEADER_CORRELATION_ID, http_header_names, core_configuration_t::initial_access_token, MCL_ASSERT_STATEMENT_CODE_MESSAGE, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_ERROR, MCL_FAIL, MCL_FREE, mcl_http_client_send(), MCL_HTTP_POST, MCL_HTTP_PUT, mcl_http_request_add_header(), mcl_http_request_destroy(), mcl_http_request_initialize(), MCL_HTTP_REQUEST_PARAMETER_BODY, MCL_HTTP_REQUEST_PARAMETER_BODY_SIZE, MCL_HTTP_REQUEST_PARAMETER_METHOD, MCL_HTTP_REQUEST_PARAMETER_URL, mcl_http_request_set_parameter(), mcl_http_response_destroy(), MCL_MALLOC, MCL_NULL, MCL_NULL_CHAR_SIZE, MCL_OK, MCL_OUT_OF_MEMORY, MCL_SECURITY_RSA_3072, MCL_SECURITY_SHARED_SECRET, core_configuration_t::register_endpoint, security_handler_t::registration_access_token, security_handler_t::registration_uri, core_processor_t::security_handler, core_configuration_t::security_profile, string_util_snprintf(), and string_util_strlen().
Referenced by mcl_core_onboard(), and mcl_core_rotate_key().
MCL_LOCAL mcl_error_t core_processor_update_credentials | ( | core_processor_t * | core_processor | ) |
This function is called by mcl_core_update_credentials.
[in] | core_processor | Core processor handle to be used. |
Definition at line 480 of file core_processor.c.
References _check_client_secret(), _check_rsa_private_key(), security_handler_t::client_id, security_handler_t::client_secret, core_processor_t::configuration, core_configuration_t::credentials_load_callback, core_configuration_t::credentials_save_callback, MCL_ASSERT_CODE_MESSAGE, MCL_CREDENTIALS_UP_TO_DATE, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FAIL, MCL_FREE, MCL_NULL, MCL_OK, MCL_SECURITY_SHARED_SECRET, MCL_TRUE, rsa_t::private_key, rsa_t::public_key, security_handler_t::registration_access_token, security_handler_t::rsa, mcl_credentials_load_callback_t::rsa, core_processor_t::security_handler, core_configuration_t::security_profile, mcl_credentials_load_callback_t::shared_secret, mcl_credentials_save_callback_t::shared_secret, string_util_strlen(), and string_util_strncmp().
Referenced by mcl_core_update_credentials().