WIP. send a large constant string twice a second, in order to test out the transport with something indicative of our required load.

Dependencies:   FXOS8700CQ NTPClient azure_umqtt_c iothub_mqtt_transport mbed-rtos mbed wolfSSL Socket lwip-eth lwip-sys lwip

Fork of FXOS8700CQ_To_Azure_IoT by Mark Radbourne

Committer:
markrad
Date:
Thu Dec 08 00:11:40 2016 +0000
Revision:
3:c0556ff7b8e3
Hack the code to get restart working

Who changed what in which revision?

UserRevisionLine numberNew contents of line
markrad 3:c0556ff7b8e3 1 // Copyright (c) Microsoft. All rights reserved.
markrad 3:c0556ff7b8e3 2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
markrad 3:c0556ff7b8e3 3
markrad 3:c0556ff7b8e3 4 #include <stdlib.h>
markrad 3:c0556ff7b8e3 5 #ifdef _CRTDBG_MAP_ALLOC
markrad 3:c0556ff7b8e3 6 #include <crtdbg.h>
markrad 3:c0556ff7b8e3 7 #endif
markrad 3:c0556ff7b8e3 8 #include "azure_c_shared_utility/gballoc.h"
markrad 3:c0556ff7b8e3 9
markrad 3:c0556ff7b8e3 10 #include "azure_c_shared_utility/hmacsha256.h"
markrad 3:c0556ff7b8e3 11 #include "azure_c_shared_utility/hmac.h"
markrad 3:c0556ff7b8e3 12 #include "azure_c_shared_utility/strings.h"
markrad 3:c0556ff7b8e3 13
markrad 3:c0556ff7b8e3 14 HMACSHA256_RESULT HMACSHA256_ComputeHash(const unsigned char* key, size_t keyLen, const unsigned char* payload, size_t payloadLen, BUFFER_HANDLE hash)
markrad 3:c0556ff7b8e3 15 {
markrad 3:c0556ff7b8e3 16 HMACSHA256_RESULT result;
markrad 3:c0556ff7b8e3 17
markrad 3:c0556ff7b8e3 18 if (key == NULL ||
markrad 3:c0556ff7b8e3 19 keyLen == 0 ||
markrad 3:c0556ff7b8e3 20 payload == NULL ||
markrad 3:c0556ff7b8e3 21 payloadLen == 0 ||
markrad 3:c0556ff7b8e3 22 hash == NULL)
markrad 3:c0556ff7b8e3 23 {
markrad 3:c0556ff7b8e3 24 result = HMACSHA256_INVALID_ARG;
markrad 3:c0556ff7b8e3 25 }
markrad 3:c0556ff7b8e3 26 else
markrad 3:c0556ff7b8e3 27 {
markrad 3:c0556ff7b8e3 28 if ((BUFFER_enlarge(hash, 32) != 0) ||
markrad 3:c0556ff7b8e3 29 (hmac(SHA256, payload, (int)payloadLen, key, (int)keyLen, BUFFER_u_char(hash) ) != 0))
markrad 3:c0556ff7b8e3 30 {
markrad 3:c0556ff7b8e3 31 result = HMACSHA256_ERROR;
markrad 3:c0556ff7b8e3 32 }
markrad 3:c0556ff7b8e3 33 else
markrad 3:c0556ff7b8e3 34 {
markrad 3:c0556ff7b8e3 35 result = HMACSHA256_OK;
markrad 3:c0556ff7b8e3 36 }
markrad 3:c0556ff7b8e3 37 }
markrad 3:c0556ff7b8e3 38
markrad 3:c0556ff7b8e3 39 return result;
markrad 3:c0556ff7b8e3 40 }