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:
Tue Mar 20 10:29:00 2018 -0700
Revision:
85:de16c0a8a196
Parent:
66:a419827cb051
Child:
88:248736be106e
1.2.1

Who changed what in which revision?

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