Microsoft Azure IoTHub client libraries

Dependents:   sht15_remote_monitoring RobotArmDemo iothub_client_sample_amqp f767zi_mqtt ... more

This library implements the Microsoft Azure IoTHub client library. The code is replicated from https://github.com/Azure/azure-iot-sdks

Committer:
AzureIoTClient
Date:
Thu Oct 04 09:15:49 2018 -0700
Revision:
93:7c0bbb86b167
Parent:
92:97148cf9aa2a
1.2.10

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AzureIoTClient 88:248736be106e 1 // Copyright (c) Microsoft. All rights reserved.
AzureIoTClient 88:248736be106e 2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
AzureIoTClient 88:248736be106e 3
AzureIoTClient 88:248736be106e 4 #ifndef IOTHUB_TRANSPORT_LL_PRIVATE_H
AzureIoTClient 88:248736be106e 5 #define IOTHUB_TRANSPORT_LL_PRIVATE_H
AzureIoTClient 88:248736be106e 6
AzureIoTClient 88:248736be106e 7 #include "iothub_transport_ll.h"
AzureIoTClient 88:248736be106e 8 #include "internal/iothub_client_authorization.h"
AzureIoTClient 88:248736be106e 9
AzureIoTClient 88:248736be106e 10
AzureIoTClient 88:248736be106e 11 union IOTHUB_IDENTITY_INFO_TAG;
AzureIoTClient 88:248736be106e 12 typedef union IOTHUB_IDENTITY_INFO_TAG IOTHUB_IDENTITY_INFO;
AzureIoTClient 88:248736be106e 13
AzureIoTClient 88:248736be106e 14 #include "azure_c_shared_utility/doublylinkedlist.h"
AzureIoTClient 88:248736be106e 15 #include "azure_c_shared_utility/strings.h"
AzureIoTClient 88:248736be106e 16 #include "iothub_message.h"
AzureIoTClient 88:248736be106e 17 #include "internal/iothub_client_authorization.h"
AzureIoTClient 88:248736be106e 18
AzureIoTClient 88:248736be106e 19 struct MESSAGE_DISPOSITION_CONTEXT_TAG;
AzureIoTClient 88:248736be106e 20 typedef struct MESSAGE_DISPOSITION_CONTEXT_TAG* MESSAGE_DISPOSITION_CONTEXT_HANDLE;
AzureIoTClient 88:248736be106e 21 typedef struct MESSAGE_CALLBACK_INFO_TAG
AzureIoTClient 88:248736be106e 22 {
AzureIoTClient 88:248736be106e 23 IOTHUB_MESSAGE_HANDLE messageHandle;
AzureIoTClient 88:248736be106e 24 MESSAGE_DISPOSITION_CONTEXT_HANDLE transportContext;
AzureIoTClient 88:248736be106e 25 }MESSAGE_CALLBACK_INFO;
AzureIoTClient 88:248736be106e 26
AzureIoTClient 88:248736be106e 27 #include "iothub_client_ll.h"
AzureIoTClient 88:248736be106e 28
AzureIoTClient 88:248736be106e 29 #ifdef __cplusplus
AzureIoTClient 88:248736be106e 30 extern "C"
AzureIoTClient 88:248736be106e 31 {
AzureIoTClient 88:248736be106e 32 #endif
AzureIoTClient 88:248736be106e 33
AzureIoTClient 92:97148cf9aa2a 34 /** @brief This struct captures device configuration. */
AzureIoTClient 88:248736be106e 35 typedef struct IOTHUB_DEVICE_CONFIG_TAG
AzureIoTClient 88:248736be106e 36 {
AzureIoTClient 92:97148cf9aa2a 37 /** @brief A string that identifies the device. */
AzureIoTClient 88:248736be106e 38 const char* deviceId;
AzureIoTClient 88:248736be106e 39
AzureIoTClient 92:97148cf9aa2a 40 /** @brief The device key used to authenticate the device. */
AzureIoTClient 88:248736be106e 41 const char* deviceKey;
AzureIoTClient 88:248736be106e 42
AzureIoTClient 92:97148cf9aa2a 43 /** @brief The device SAS used to authenticate the device in place of using the device key. */
AzureIoTClient 88:248736be106e 44 const char* deviceSasToken;
AzureIoTClient 88:248736be106e 45
AzureIoTClient 88:248736be106e 46 IOTHUB_AUTHORIZATION_HANDLE authorization_module; // with either SAS Token, x509 Certs, and Device SAS Token
AzureIoTClient 89:a2ed767a532e 47
AzureIoTClient 89:a2ed767a532e 48 /** @brief A string that identifies the module. Optional. */
AzureIoTClient 89:a2ed767a532e 49 const char* moduleId;
AzureIoTClient 88:248736be106e 50 } IOTHUB_DEVICE_CONFIG;
AzureIoTClient 88:248736be106e 51
AzureIoTClient 88:248736be106e 52 typedef STRING_HANDLE (*pfIoTHubTransport_GetHostname)(TRANSPORT_LL_HANDLE handle);
AzureIoTClient 88:248736be106e 53 typedef IOTHUB_CLIENT_RESULT(*pfIoTHubTransport_SetOption)(TRANSPORT_LL_HANDLE handle, const char *optionName, const void* value);
AzureIoTClient 88:248736be106e 54 typedef TRANSPORT_LL_HANDLE(*pfIoTHubTransport_Create)(const IOTHUBTRANSPORT_CONFIG* config);
AzureIoTClient 88:248736be106e 55 typedef void (*pfIoTHubTransport_Destroy)(TRANSPORT_LL_HANDLE handle);
AzureIoTClient 88:248736be106e 56 typedef IOTHUB_DEVICE_HANDLE(*pfIotHubTransport_Register)(TRANSPORT_LL_HANDLE handle, const IOTHUB_DEVICE_CONFIG* device, IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, PDLIST_ENTRY waitingToSend);
AzureIoTClient 88:248736be106e 57 typedef void(*pfIotHubTransport_Unregister)(IOTHUB_DEVICE_HANDLE deviceHandle);
AzureIoTClient 88:248736be106e 58 typedef int (*pfIoTHubTransport_Subscribe)(IOTHUB_DEVICE_HANDLE handle);
AzureIoTClient 88:248736be106e 59 typedef void (*pfIoTHubTransport_Unsubscribe)(IOTHUB_DEVICE_HANDLE handle);
AzureIoTClient 88:248736be106e 60 typedef void (*pfIoTHubTransport_DoWork)(TRANSPORT_LL_HANDLE handle, IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle);
AzureIoTClient 88:248736be106e 61 typedef int(*pfIoTHubTransport_SetRetryPolicy)(TRANSPORT_LL_HANDLE handle, IOTHUB_CLIENT_RETRY_POLICY retryPolicy, size_t retryTimeoutLimitInSeconds);
AzureIoTClient 88:248736be106e 62 typedef IOTHUB_CLIENT_RESULT(*pfIoTHubTransport_GetSendStatus)(IOTHUB_DEVICE_HANDLE handle, IOTHUB_CLIENT_STATUS *iotHubClientStatus);
AzureIoTClient 88:248736be106e 63 typedef int (*pfIoTHubTransport_Subscribe_DeviceTwin)(IOTHUB_DEVICE_HANDLE handle);
AzureIoTClient 88:248736be106e 64 typedef void (*pfIoTHubTransport_Unsubscribe_DeviceTwin)(IOTHUB_DEVICE_HANDLE handle);
AzureIoTClient 88:248736be106e 65 typedef IOTHUB_CLIENT_RESULT(*pfIotHubTransport_SendMessageDisposition)(MESSAGE_CALLBACK_INFO* messageData, IOTHUBMESSAGE_DISPOSITION_RESULT disposition);
AzureIoTClient 88:248736be106e 66 typedef IOTHUB_PROCESS_ITEM_RESULT(*pfIoTHubTransport_ProcessItem)(TRANSPORT_LL_HANDLE handle, IOTHUB_IDENTITY_TYPE item_type, IOTHUB_IDENTITY_INFO* iothub_item);
AzureIoTClient 88:248736be106e 67 typedef int(*pfIoTHubTransport_Subscribe_DeviceMethod)(IOTHUB_DEVICE_HANDLE handle);
AzureIoTClient 88:248736be106e 68 typedef void(*pfIoTHubTransport_Unsubscribe_DeviceMethod)(IOTHUB_DEVICE_HANDLE handle);
AzureIoTClient 88:248736be106e 69 typedef int(*pfIoTHubTransport_DeviceMethod_Response)(IOTHUB_DEVICE_HANDLE handle, METHOD_HANDLE methodId, const unsigned char* response, size_t response_size, int status_response);
AzureIoTClient 89:a2ed767a532e 70 typedef int(*pfIoTHubTransport_Subscribe_InputQueue)(IOTHUB_DEVICE_HANDLE handle);
AzureIoTClient 89:a2ed767a532e 71 typedef void(*pfIoTHubTransport_Unsubscribe_InputQueue)(IOTHUB_DEVICE_HANDLE handle);
AzureIoTClient 88:248736be106e 72
AzureIoTClient 88:248736be106e 73 #define TRANSPORT_PROVIDER_FIELDS \
AzureIoTClient 88:248736be106e 74 pfIotHubTransport_SendMessageDisposition IoTHubTransport_SendMessageDisposition; \
AzureIoTClient 88:248736be106e 75 pfIoTHubTransport_Subscribe_DeviceMethod IoTHubTransport_Subscribe_DeviceMethod; \
AzureIoTClient 88:248736be106e 76 pfIoTHubTransport_Unsubscribe_DeviceMethod IoTHubTransport_Unsubscribe_DeviceMethod;\
AzureIoTClient 88:248736be106e 77 pfIoTHubTransport_DeviceMethod_Response IoTHubTransport_DeviceMethod_Response; \
AzureIoTClient 88:248736be106e 78 pfIoTHubTransport_Subscribe_DeviceTwin IoTHubTransport_Subscribe_DeviceTwin; \
AzureIoTClient 88:248736be106e 79 pfIoTHubTransport_Unsubscribe_DeviceTwin IoTHubTransport_Unsubscribe_DeviceTwin; \
AzureIoTClient 88:248736be106e 80 pfIoTHubTransport_ProcessItem IoTHubTransport_ProcessItem; \
AzureIoTClient 88:248736be106e 81 pfIoTHubTransport_GetHostname IoTHubTransport_GetHostname; \
AzureIoTClient 88:248736be106e 82 pfIoTHubTransport_SetOption IoTHubTransport_SetOption; \
AzureIoTClient 88:248736be106e 83 pfIoTHubTransport_Create IoTHubTransport_Create; \
AzureIoTClient 88:248736be106e 84 pfIoTHubTransport_Destroy IoTHubTransport_Destroy; \
AzureIoTClient 88:248736be106e 85 pfIotHubTransport_Register IoTHubTransport_Register; \
AzureIoTClient 88:248736be106e 86 pfIotHubTransport_Unregister IoTHubTransport_Unregister; \
AzureIoTClient 88:248736be106e 87 pfIoTHubTransport_Subscribe IoTHubTransport_Subscribe; \
AzureIoTClient 88:248736be106e 88 pfIoTHubTransport_Unsubscribe IoTHubTransport_Unsubscribe; \
AzureIoTClient 88:248736be106e 89 pfIoTHubTransport_DoWork IoTHubTransport_DoWork; \
AzureIoTClient 88:248736be106e 90 pfIoTHubTransport_SetRetryPolicy IoTHubTransport_SetRetryPolicy; \
AzureIoTClient 89:a2ed767a532e 91 pfIoTHubTransport_GetSendStatus IoTHubTransport_GetSendStatus; \
AzureIoTClient 89:a2ed767a532e 92 pfIoTHubTransport_Subscribe_InputQueue IoTHubTransport_Subscribe_InputQueue; \
AzureIoTClient 89:a2ed767a532e 93 pfIoTHubTransport_Unsubscribe_InputQueue IoTHubTransport_Unsubscribe_InputQueue /*there's an intentional missing ; on this line*/
AzureIoTClient 88:248736be106e 94
AzureIoTClient 88:248736be106e 95 struct TRANSPORT_PROVIDER_TAG
AzureIoTClient 88:248736be106e 96 {
AzureIoTClient 88:248736be106e 97 TRANSPORT_PROVIDER_FIELDS;
AzureIoTClient 88:248736be106e 98 };
AzureIoTClient 88:248736be106e 99
AzureIoTClient 88:248736be106e 100 #ifdef __cplusplus
AzureIoTClient 88:248736be106e 101 }
AzureIoTClient 88:248736be106e 102 #endif
AzureIoTClient 88:248736be106e 103
AzureIoTClient 88:248736be106e 104 #endif /* IOTHUB_TRANSPORT_LL_PRIVATE_H */