46 "application/octet-stream",
50 "application/x-www-form-urlencoded",
99 #define CORRELATION_ID_BYTE_LENGTH 16 100 #define CORRELATION_ID_BUFFER_LENGTH ((CORRELATION_ID_BYTE_LENGTH * 2) + MCL_NULL_CHAR_SIZE) 117 MCL_DEBUG_ENTRY(
"connectivity_processor_t *connectivity_processor = <%p>, mcl_item_t *item = <%p>", connectivity_processor, item);
127 switch ((item)->type)
264 MCL_DEBUG_ENTRY(
"connectivity_processor_t *connectivity_processor = <%p>, mapping_t *mapping = <%p>", connectivity_processor, mapping);
343 MCL_INFO(
"HTTP 201 OK received from server for the request with correlation-id = \"%s\".", correlation_id);
348 MCL_ERROR(
"HTTP <%d> received from server for the request with correlation-id = \"%s\".", http_response->
status_code, correlation_id);
382 MCL_DEBUG_ENTRY(
"connectivity_processor_t *connectivity_processor = <%p>, data_source_configuration_t **configuration = <%p>",
383 connectivity_processor, configuration);
388 url_length = hostname_length + agent_id_length +
sizeof(
"/api/agentmanagement/v3/agents//dataSourceConfiguration");
398 char *position = url;
401 position += hostname_length;
407 position += agent_id_length;
476 MCL_DEBUG_ENTRY(
"store_t *store = <%p>, mcl_bool_t *store_fully_processed = <%p>, mcl_error_t exchange_response = <%d>",
477 store, store_fully_processed, exchange_response);
503 MCL_DEBUG_ENTRY(
"connectivity_processor_t *processor = <%p>, mcl_http_request_t *request = <%p>, const char *boundary = <%p>",
504 processor, request, boundary);
530 MCL_DEBUG_ENTRY(
"mcl_http_request_t *request = <%p>, const char *boundary = <%p>", request, boundary);
534 header_value =
MCL_MALLOC(header_value_length + 1);
566 MCL_DEBUG_ENTRY(
"mcl_http_request_t *request = <%p>, const char *access_token = <%s>", request, access_token);
586 MCL_DEBUG_ENTRY(
"mcl_http_response_t *response = <%p>, const char *correlation_id = <%p>", response, correlation_id);
590 MCL_INFO(
"HTTP 200 OK received from server for the request with correlation-id = \"%s\".", correlation_id);
595 MCL_ERROR(
"HTTP <%d> received from server for the request with correlation-id = \"%s\".", response->
status_code, correlation_id);
613 unsigned char *
id = (
unsigned char*) correlation_id;
632 MCL_DEBUG_ENTRY(
"char *buffer = <%p>, mcl_size_t size = <%u>, mcl_size_t count = <%u>, void *user_context = <%p>", buffer, size, count, user_context);
646 MCL_DEBUG_ENTRY(
"char *buffer = <%p>, mcl_size_t size = <%u>, mcl_size_t count = <%u>, void *user_context = <%p>", buffer, size, count, user_context);
651 write_size = (remaining_size < (size * count)) ? remaining_size : (size * count);
667 MCL_DEBUG_ENTRY(
"char *buffer = <%p>, mcl_size_t *buffer_size = <%p>, mcl_item_t *item = <%p>, const char *boundary = <%p>",
668 buffer, buffer_size, item, boundary);
734 MCL_DEBUG_ENTRY(
"store_t *store = <%p>, mcl_size_t max_http_payload_size = <%lu>", store, max_http_payload_size);
750 if (max_http_payload_size < (overhead_size + store_item->
item_size))
773 mcl_size_t remaining_size = max_http_payload_size;
776 MCL_DEBUG_ENTRY(
"store_t *store = <%p>, mcl_size_t max_http_payload_size = <%lu>", store, max_http_payload_size);
785 if (remaining_size >= store_item->
item_size)
792 needed_buffer_size = max_http_payload_size - remaining_size;
796 return needed_buffer_size;
812 store_item = current_store_item;
827 MCL_DEBUG_ENTRY(
"store_t *store = <%p>, mcl_size_t max_http_payload_size = <%lu>, char *boundary = <%p>, mcl_uint8_t **body = <%p>, "\
828 "mcl_size_t *body_size = <%p>", store, max_http_payload_size, boundary, body, body_size);
832 buffer_size = remaining_size;
851 code =
_add_item_to_buffer((
char *)(*body + (buffer_size - remaining_size)), &remaining_size, store_item->
item, boundary);
863 if ((buffer_size != remaining_size) && (
MCL_OK ==
multipart_close((
char *)(*body + (buffer_size - remaining_size)), &remaining_size, boundary)))
865 *body_size = buffer_size - remaining_size;
883 MCL_DEBUG_ENTRY(
"mcl_item_t *item = <%p>, mcl_size_t max_http_payload_size = <%lu>, char *boundary = <%p>, mcl_uint8_t **body = <%p>, "\
884 "mcl_size_t *body_size = <%lu>", item, max_http_payload_size, boundary, body, body_size);
894 remaining_size = *body_size;
896 if (*body_size > max_http_payload_size)
918 code =
multipart_close((
char *) (*body + (*body_size - remaining_size)), &remaining_size, boundary);
926 else if (0 != remaining_size)
928 *body_size -= remaining_size;
946 for (index = 0; index < count; ++index)
967 for (index = 0; index < count; ++index)
994 return fully_processed;
1002 MCL_DEBUG_ENTRY(
"char *buffer = <%p>, mcl_size_t *buffer_size = <%p>, custom_data_t *custom_data = <%p>, const char *boundary = <%p>",
1003 buffer, buffer_size, custom_data, boundary);
1023 MCL_DEBUG_ENTRY(
"mapping_t *mapping = <%p>, const char *agent_id = <%p>, char **json = <%p>", mapping, agent_id, json);
1039 const char *entity_id;
1043 entity_id = agent_id;
const mcl_uint8_t * buffer
Buffer of custom data.
End of content type enumeration.
MCL_CORE_EXPORT mcl_error_t mcl_http_request_initialize(mcl_http_request_t **http_request)
static mcl_bool_t _remove_uploaded_store_items(store_t *store)
Content type is text plain.
Content type is multipart mixed.
MCL_CORE_EXPORT void mcl_file_util_rewind(void *file_descriptor)
Data source configuration module header file.
static mcl_error_t _prepare_body_for_store(store_t *store, mcl_size_t max_http_payload_size, char *boundary, mcl_uint8_t **body, mcl_size_t *body_size)
mcl_error_t event_validate(event_t *event)
custom_data_payload_t * payload
Payload of custom data.
Item type data source configuration.
E_MCL_HTTP_STATUS_CODE status_code
MCL_CORE_EXPORT mcl_error_t mcl_json_util_initialize(E_MCL_JSON_TYPE json_type, mcl_json_t **root)
Content type is application/x-www-form-urlencoded.
mcl_error_t multipart_add_tuple(char *buffer, mcl_size_t *buffer_size, void *item, const char *boundary)
MCL_HTTP_REQUEST_PARAMETER_BODY_SIZE
void * item
Item to be added to the store.
mcl_size_t size
Size of custom data.
static mcl_error_t _prepare_body(mcl_item_t *item, mcl_size_t max_http_payload_size, char *boundary, mcl_uint8_t **body, mcl_size_t *body_size)
static mcl_error_t _scan_store_after_exchange(store_t *store, mcl_bool_t *store_fully_processed, mcl_error_t exchange_response)
static mcl_error_t _prepare_mapping_json(mapping_t *mapping, const char *agent_id, char **json)
MCL_CORE_EXPORT mcl_error_t mcl_http_request_set_parameter(mcl_http_request_t *http_request, E_MCL_HTTP_REQUEST_PARAMETER parameter, const void *value)
static mcl_size_t _select_store_items_to_exchange(store_t *store, mcl_size_t max_http_payload_size)
mcl_size_t multipart_get_overhead_size(void)
char * entity_id
Entity ID.
mcl_size_t multipart_get_tuple_size(void *item, const char *payload_content_type)
MCL_UNEXPECTED_RESULT_CODE
mcl_list_t * item_list
Contains store_item_t items.
#define CORRELATION_ID_BUFFER_LENGTH
void store_item_destroy(store_item_t **store_item)
Current item has been added to the current http request.
MCL_CORE_EXPORT mcl_error_t mcl_json_util_add_bool(mcl_json_t *root, const char *object_name, const mcl_bool_t bool_value)
#define MCL_DEBUG_ENTRY(...)
Store module header file.
mcl_error_t data_source_configuration_validate(data_source_configuration_t *data_source_configuration)
mcl_bool_t keep_mapping
Custom parameters for the mapping.
void(* mcl_list_item_destroy_callback)(void **item)
static mcl_size_t _get_item_size(mcl_item_t *item)
mcl_error_t multipart_add_tuple_with_callback(char *buffer, mcl_size_t *buffer_size, void *item, const char *boundary, const char *payload_content_type, multipart_add_payload_callback callback, void *user_context)
MCL_CORE_EXPORT mcl_error_t mcl_json_util_add_string(mcl_json_t *root, const char *object_name, const char *object_value)
mcl_error_t connectivity_processor_exchange(connectivity_processor_t *connectivity_processor, mcl_item_t *item)
MCL_CORE_EXPORT mcl_size_t mcl_string_util_strlen(const char *buffer)
The store trying to be exchanged has no data inside.
MCL_CORE_EXPORT mcl_error_t mcl_list_next(mcl_list_t *list, mcl_list_node_t **node)
#define MCL_ERROR_STRING(string)
MCL_CORE_EXPORT void mcl_json_util_destroy(mcl_json_t **root)
MCL_CORE_EXPORT mcl_error_t mcl_http_request_add_header(mcl_http_request_t *http_request, const char *header_name, const char *header_value)
Content type is application json.
char * data_point_id
Mapping ID.
mcl_error_t timeseries_validate(timeseries_t *timeseries)
Connectivity processor module header file for connectivity module.
MCL_CORE_EXPORT mcl_error_t mcl_list_remove_with_content(mcl_list_t *list, mcl_list_node_t *node, mcl_list_item_destroy_callback callback)
mcl_size_t max_http_payload_size
static const char * content_type_values[CONTENT_TYPE_VALUES_END]
static mcl_size_t _file_payload_callback(char *buffer, mcl_size_t size, mcl_size_t count, void *user_context)
MCL_HTTP_REQUEST_PARAMETER_URL
Timeseries module header file.
MCL_CORE_EXPORT void mcl_file_util_fread(void *data, mcl_size_t size, mcl_size_t count, void *file_descriptor, mcl_size_t *actual_count)
#define MCL_CONNECTIVITY_CODE_TO_STRING(code)
static mcl_size_t _custom_data_payload_callback(char *buffer, mcl_size_t size, mcl_size_t count, void *user_context)
static void _revert_store_item_status(store_t *store)
char * property_name
Property name.
static mcl_error_t _add_custom_data_to_buffer(char *buffer, mcl_size_t *buffer_size, custom_data_t *custom_data, const char *boundary)
mcl_error_t mapping_validate(mapping_t *mapping)
MCL_CORE_EXPORT mcl_error_t mcl_string_util_concatenate(const char *string_1, const char *string_2, char **result)
This item is not processed before, selected for current request.
static mcl_error_t _check_store_size(store_t *store, mcl_size_t max_http_payload_size)
MCL_CORE_EXPORT void mcl_http_request_destroy(mcl_http_request_t **http_request)
mcl_error_t json_parse_item(const char *json_string, mcl_size_t string_length, void **item)
mcl_size_t item_size
Size of the item in the store.
This item is not processed before.
MCL_CORE_EXPORT void mcl_string_util_memcpy(void *destination, const void *source, mcl_size_t count)
MCL_HTTP_REQUEST_PARAMETER_BODY
static mcl_error_t _add_authorization_header(mcl_http_request_t *request, const char *access_token)
E_MCL_STORE_ITEM_STATUS status
Status of item in the store.
MCL_CORE_EXPORT mcl_error_t mcl_http_response_get_status(mcl_http_response_t *http_response)
MCL_CORE_EXPORT mcl_error_t mcl_string_util_snprintf(char *string, mcl_size_t length, const char *format,...)
MCL_CORE_EXPORT void mcl_list_reset(mcl_list_t *list)
MCL_CORE_EXPORT mcl_error_t mcl_http_client_send(mcl_http_client_t *http_client, mcl_http_request_t *http_request, mcl_http_response_t **http_response)
static mcl_error_t _add_http_headers_for_exchange(connectivity_processor_t *processor, mcl_http_request_t *request, const char *boundary)
static mcl_error_t _add_multipart_mixed_content_type_header(mcl_http_request_t *request, const char *boundary)
mcl_error_t multipart_close(char *buffer, mcl_size_t *buffer_size, const char *boundary)
E_MCL_ITEM_TYPE type
Item type.
#define MCL_ITEM_PREAMBLE
mcl_error_t multipart_generate_boundary(char **boundary)
static mcl_error_t _add_item_to_buffer(char *buffer, mcl_size_t *buffer_size, mcl_item_t *item, const char *boundary)
Event module header file.
mcl_http_client_t * http_client
Item exceeds max http payload request.
Transfer encoding chunked.
Custom data module header file.
mcl_error_t file_validate(file_t *file)
MCL_CORE_EXPORT mcl_error_t mcl_random_generate_bytes(unsigned char *buffer, mcl_size_t size)
mcl_error_t connectivity_processor_get_data_source_configuration(connectivity_processor_t *connectivity_processor, data_source_configuration_t **configuration)
There is not enough space in the http request for the current item.
MCL_HTTP_STATUS_CODE_SUCCESS
static mcl_error_t _evaluate_response_for_exchange(mcl_http_response_t *response, const char *correlation_id)
Content type is application octet stream.
MCL_CORE_EXPORT void mcl_http_response_destroy(mcl_http_response_t **http_response)
static mcl_error_t _generate_correlation_id_string(char *correlation_id)
mcl_error_t custom_data_validate(custom_data_t *custom_data)
MCL_CORE_EXPORT mcl_error_t mcl_json_util_to_string(mcl_json_t *root, char **json_string)
#define MCL_NULL_CHAR_SIZE
#define MCL_MALLOC(bytes)
#define CORRELATION_ID_BYTE_LENGTH
custom_data_t * custom_data
#define MCL_DEBUG_LEAVE(...)
MCL_HTTP_REQUEST_PARAMETER_METHOD
mcl_error_t connectivity_processor_create_mapping(connectivity_processor_t *connectivity_processor, mapping_t *mapping)
MCL_HTTP_STATUS_CODE_CREATED
char * property_set_name
Property set name.
static store_item_t * _get_next_selected_store_item(store_t *store)
Multipart module header file.
char * content_type
Content type of custom data.