Microsoft Azure IoTHub client HTTP transport

Dependents:   iothub_client_sample_http simplesample_http temp_sensor_anomaly

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

Revision:
21:b601705c82a8
Parent:
20:b652f2e4cccf
Child:
22:e0add922c564
--- a/iothubtransporthttp.c	Mon Jul 18 16:44:33 2016 -0700
+++ b/iothubtransporthttp.c	Fri Jul 29 15:52:52 2016 -0700
@@ -514,7 +514,7 @@
             bool was_x509_ok = false; /*there's nothing "created" in the case of x509, it is a flag indicating that x509 is used*/
 
             /*Codes_SRS_TRANSPORTMULTITHTTP_17_038: [ Otherwise, IoTHubTransportHttp_Register shall allocate the IOTHUB_DEVICE_HANDLE structure. ]*/
-            bool was_resultCreated_ok = ((result = malloc(sizeof(HTTPTRANSPORT_PERDEVICE_DATA))) != NULL);
+			bool was_resultCreated_ok = ((result = (HTTPTRANSPORT_PERDEVICE_DATA *) malloc(sizeof(HTTPTRANSPORT_PERDEVICE_DATA))) != NULL);
             bool was_create_deviceId_ok = was_resultCreated_ok && create_deviceId(result, device->deviceId);
 
             if (was_create_deviceId_ok)
@@ -575,7 +575,7 @@
                 result->iotHubClientHandle = iotHubClientHandle;
                 result->waitingToSend = waitingToSend;
                 DList_InitializeListHead(&(result->eventConfirmations));
-                result->transportHandle = handle;
+				result->transportHandle = (HTTPTRANSPORT_HANDLE_DATA *) handle;
             }
             else
             {
@@ -620,7 +620,7 @@
 
     HTTPTRANSPORT_HANDLE_DATA* handleData = deviceHandleData->transportHandle;
 
-    listItem = VECTOR_find_if(handleData->perDeviceList, findDeviceHandle, deviceHandle);
+	listItem = (IOTHUB_DEVICE_HANDLE *) VECTOR_find_if(handleData->perDeviceList, findDeviceHandle, deviceHandle);
     if (listItem == NULL)
     {
         LogError("device handle not found in transport device list");
@@ -831,15 +831,15 @@
         /*Codes_SRS_TRANSPORTMULTITHTTP_17_013: [ Otherwise, IoTHubTransportHttp_Destroy shall free all the resources currently in use. ]*/
         for (size_t i = 0; i < deviceListSize; i++)
         {
-            listItem = VECTOR_element(handleData->perDeviceList, i);
+			listItem = (IOTHUB_DEVICE_HANDLE *) VECTOR_element(handleData->perDeviceList, i);
             HTTPTRANSPORT_PERDEVICE_DATA* perDeviceItem = (HTTPTRANSPORT_PERDEVICE_DATA*)(*listItem);
             destroy_perDeviceData(perDeviceItem);
             free(perDeviceItem);
         }
 
-        destroy_hostName(handle);
-        destroy_httpApiExHandle(handle);
-        destroy_perDeviceList(handle);
+		destroy_hostName((HTTPTRANSPORT_HANDLE_DATA *) handle);
+		destroy_httpApiExHandle((HTTPTRANSPORT_HANDLE_DATA *) handle);
+		destroy_perDeviceList((HTTPTRANSPORT_HANDLE_DATA *)handle);
         free(handle);
     }
 }
@@ -2028,8 +2028,8 @@
         /*Codes_SRS_TRANSPORTMULTITHTTP_17_051: [ IF the list is empty, then IoTHubTransportHttp_DoWork shall do nothing. ]*/
         for (size_t i = 0; i < deviceListSize; i++)
         {
-            listItem = VECTOR_element(handleData->perDeviceList, i);
-            HTTPTRANSPORT_PERDEVICE_DATA* perDeviceItem = *(HTTPTRANSPORT_PERDEVICE_DATA**)(listItem);
+			listItem = (IOTHUB_DEVICE_HANDLE *) VECTOR_element(handleData->perDeviceList, i);
+			HTTPTRANSPORT_PERDEVICE_DATA* perDeviceItem = *(HTTPTRANSPORT_PERDEVICE_DATA**)(listItem);
             DoEvent(handleData, perDeviceItem, perDeviceItem->iotHubClientHandle);
             DoMessages(handleData, perDeviceItem, perDeviceItem->iotHubClientHandle);