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:
28:f57de550d450
Parent:
27:6bf6436d54a5
Child:
29:e44b1f827914
--- a/iothubtransporthttp.c	Tue Jan 24 15:23:18 2017 -0800
+++ b/iothubtransporthttp.c	Fri Feb 24 14:00:14 2017 -0800
@@ -11,6 +11,7 @@
 #include "iothub_transport_ll.h"
 #include "iothubtransporthttp.h"
 
+#include "azure_c_shared_utility/optimize_size.h"
 #include "azure_c_shared_utility/httpapiexsas.h"
 #include "azure_c_shared_utility/urlencode.h"
 #include "azure_c_shared_utility/xlogging.h"
@@ -859,7 +860,7 @@
     {
         /*Codes_SRS_TRANSPORTMULTITHTTP_17_103: [ If parameter deviceHandle is NULL then IoTHubTransportHttp_Subscribe shall fail and return a non-zero value. ]*/
         LogError("invalid arg passed to IoTHubTransportHttp_Subscribe");
-        result = __LINE__;
+        result = __FAILURE__;
     }
     else
     {
@@ -870,7 +871,7 @@
         {
             /*Codes_SRS_TRANSPORTMULTITHTTP_17_105: [ If the device structure is not found, then this function shall fail and return a non-zero value. ]*/
             LogError("did not find device in transport handle");
-            result = __LINE__;
+            result = __FAILURE__;
         }
         else
         {
@@ -914,7 +915,7 @@
 {
     /*Codes_SRS_TRANSPORTMULTITHTTP_02_003: [ IoTHubTransportHttp_Subscribe_DeviceTwin shall return a non-zero value. ]*/
     (void)handle;
-    int result = __LINE__;
+    int result = __FAILURE__;
     LogError("IoTHubTransportHttp_Subscribe_DeviceTwin Not supported");
     return result;
 }
@@ -929,7 +930,7 @@
 static int IoTHubTransportHttp_Subscribe_DeviceMethod(IOTHUB_DEVICE_HANDLE handle)
 {
     (void)handle;
-    int result = __LINE__;
+    int result = __FAILURE__;
     LogError("not implemented (yet)");
     return result;
 }
@@ -948,7 +949,7 @@
     (void)response_size;
     (void)status_response;
     LogError("not implemented (yet)");
-    return __LINE__;
+    return __FAILURE__;
 }
 
 /*produces a representation of the properties, if they exist*/
@@ -961,7 +962,7 @@
     size_t count;
     if (Map_GetInternals(map, &keys, &values, &count) != MAP_OK)
     {
-        result = __LINE__;
+        result = __FAILURE__;
         LogError("error while Map_GetInternals");
     }
     else
@@ -980,12 +981,12 @@
             if (STRING_concat(existing, ",\"properties\":") != 0)
             {
                 /*go ahead and return it*/
-                result = __LINE__;
+                result = __FAILURE__;
                 LogError("failed STRING_concat");
             }
             else if (appendMapToJSON(existing, keys, values, count) != 0)
             {
-                result = __LINE__;
+                result = __FAILURE__;
                 LogError("unable to append the properties");
             }
             else
@@ -1012,8 +1013,8 @@
     if (STRING_concat(existing, "{") != 0)
     {
         /*go on and return it*/
-        result = __LINE__;
         LogError("STRING_construct failed");
+        result = __FAILURE__;
     }
     else
     {
@@ -1035,13 +1036,13 @@
 
         if (i < count)
         {
-            result = __LINE__;
+            result = __FAILURE__;
             /*error, let it go through*/
         }
         else if (STRING_concat(existing, "}") != 0)
         {
-            result = __LINE__;
             LogError("unable to STRING_concat");
+            result = __FAILURE__;
         }
         else
         {