[388] | 1 | // Copyright (c) Microsoft. All rights reserved.
|
---|
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
---|
| 3 |
|
---|
| 4 | #ifndef IOTHUB_CLIENT_PRIVATE_H
|
---|
| 5 | #define IOTHUB_CLIENT_PRIVATE_H
|
---|
| 6 |
|
---|
| 7 | #include <stdbool.h>
|
---|
| 8 |
|
---|
| 9 | #include "azure_c_shared_utility/constbuffer.h"
|
---|
| 10 | #include "azure_c_shared_utility/doublylinkedlist.h"
|
---|
| 11 | #include "azure_c_shared_utility/tickcounter.h"
|
---|
| 12 | #include "azure_c_shared_utility/umock_c_prod.h"
|
---|
| 13 |
|
---|
| 14 | #include "iothub_message.h"
|
---|
| 15 | #include "internal/iothub_transport_ll_private.h"
|
---|
| 16 | #include "iothub_client_core_common.h"
|
---|
| 17 | #include "iothub_client_core_ll.h"
|
---|
| 18 |
|
---|
| 19 | #ifdef USE_EDGE_MODULES
|
---|
| 20 | #include "internal/iothub_client_edge.h"
|
---|
| 21 | #endif
|
---|
| 22 |
|
---|
| 23 | #ifdef __cplusplus
|
---|
| 24 | extern "C"
|
---|
| 25 | {
|
---|
| 26 | #endif
|
---|
| 27 |
|
---|
| 28 | #define CLIENT_DEVICE_TYPE_PREFIX "iothubclient"
|
---|
| 29 | #define CLIENT_DEVICE_BACKSLASH "/"
|
---|
| 30 |
|
---|
| 31 | typedef bool(*IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC_EX)(MESSAGE_CALLBACK_INFO* messageData, void* userContextCallback);
|
---|
| 32 |
|
---|
| 33 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClientCore_LL_SetMessageCallback_Ex, IOTHUB_CLIENT_CORE_LL_HANDLE, iotHubClientHandle, IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC_EX, messageCallback, void*, userContextCallback);
|
---|
| 34 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClientCore_LL_SendMessageDisposition, IOTHUB_CLIENT_CORE_LL_HANDLE, iotHubClientHandle, MESSAGE_CALLBACK_INFO*, messageData, IOTHUBMESSAGE_DISPOSITION_RESULT, disposition);
|
---|
| 35 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClientCore_LL_SetInputMessageCallbackEx, IOTHUB_CLIENT_CORE_LL_HANDLE, iotHubClientHandle, const char*, inputName, IOTHUB_CLIENT_MESSAGE_CALLBACK_ASYNC_EX, eventHandlerCallbackEx, void *, userContextCallback, size_t, userContextCallbackLength);
|
---|
| 36 | MOCKABLE_FUNCTION(, int, IoTHubClientCore_LL_GetTransportCallbacks, TRANSPORT_CALLBACKS_INFO*, transport_cb);
|
---|
| 37 |
|
---|
| 38 | #ifdef USE_EDGE_MODULES
|
---|
| 39 | /* (Should be replaced after iothub_client refactor)*/
|
---|
| 40 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_EDGE_HANDLE, IoTHubClientCore_LL_GetEdgeHandle, IOTHUB_CLIENT_CORE_LL_HANDLE, iotHubClientHandle);
|
---|
| 41 | MOCKABLE_FUNCTION(, IOTHUB_CLIENT_RESULT, IoTHubClientCore_LL_GenericMethodInvoke, IOTHUB_CLIENT_CORE_LL_HANDLE, iotHubClientHandle, const char*, deviceId, const char*, moduleId, const char*, methodName, const char*, methodPayload, unsigned int, timeout, int*, responseStatus, unsigned char**, responsePayload, size_t*, responsePayloadSize);
|
---|
| 42 | #endif
|
---|
| 43 |
|
---|
| 44 | typedef struct IOTHUB_MESSAGE_LIST_TAG
|
---|
| 45 | {
|
---|
| 46 | IOTHUB_MESSAGE_HANDLE messageHandle;
|
---|
| 47 | IOTHUB_CLIENT_EVENT_CONFIRMATION_CALLBACK callback;
|
---|
| 48 | void* context;
|
---|
| 49 | DLIST_ENTRY entry;
|
---|
| 50 | tickcounter_ms_t ms_timesOutAfter; /* a value of "0" means "no timeout", if the IOTHUBCLIENT_LL's handle tickcounter > msTimesOutAfer then the message shall timeout*/
|
---|
| 51 | tickcounter_ms_t message_timeout_value;
|
---|
| 52 | }IOTHUB_MESSAGE_LIST;
|
---|
| 53 |
|
---|
| 54 | typedef struct IOTHUB_DEVICE_TWIN_TAG
|
---|
| 55 | {
|
---|
| 56 | uint32_t item_id;
|
---|
| 57 | tickcounter_ms_t ms_timesOutAfter; /* a value of "0" means "no timeout", if the IOTHUBCLIENT_LL's handle tickcounter > msTimesOutAfer then the message shall timeout*/
|
---|
| 58 | IOTHUB_CLIENT_REPORTED_STATE_CALLBACK reported_state_callback;
|
---|
| 59 | CONSTBUFFER_HANDLE report_data_handle;
|
---|
| 60 | void* context;
|
---|
| 61 | DLIST_ENTRY entry;
|
---|
| 62 | IOTHUB_CLIENT_CORE_LL_HANDLE client_handle;
|
---|
| 63 | IOTHUB_DEVICE_HANDLE device_handle;
|
---|
| 64 | } IOTHUB_DEVICE_TWIN;
|
---|
| 65 |
|
---|
| 66 | union IOTHUB_IDENTITY_INFO_TAG
|
---|
| 67 | {
|
---|
| 68 | IOTHUB_DEVICE_TWIN* device_twin;
|
---|
| 69 | IOTHUB_MESSAGE_LIST* iothub_message;
|
---|
| 70 | };
|
---|
| 71 |
|
---|
| 72 | #ifdef __cplusplus
|
---|
| 73 | }
|
---|
| 74 | #endif
|
---|
| 75 |
|
---|
| 76 | #endif /* IOTHUB_CLIENT_PRIVATE_H */
|
---|