Demo using MBED TLS

Dependencies:   EthernetInterface NTPClient iothub_amqp_transport iothub_client mbed-rtos mbed

Fork of iothub_client_sample_amqp by Azure IoT

Committer:
markrad
Date:
Thu Jan 05 00:20:03 2017 +0000
Revision:
58:f50b97b08851
Sample using MBED TLS

Who changed what in which revision?

UserRevisionLine numberNew contents of line
markrad 58:f50b97b08851 1 // Copyright (c) Microsoft. All rights reserved.
markrad 58:f50b97b08851 2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
markrad 58:f50b97b08851 3
markrad 58:f50b97b08851 4 #include <stdlib.h>
markrad 58:f50b97b08851 5 #ifdef _CRTDBG_MAP_ALLOC
markrad 58:f50b97b08851 6 #include <crtdbg.h>
markrad 58:f50b97b08851 7 #endif
markrad 58:f50b97b08851 8 #include <stdarg.h>
markrad 58:f50b97b08851 9 #include <stdio.h>
markrad 58:f50b97b08851 10 #include "azure_c_shared_utility/xlogging.h"
markrad 58:f50b97b08851 11
markrad 58:f50b97b08851 12 void consolelogger_log(LOG_CATEGORY log_category, const char* file, const char* func, const int line, unsigned int options, const char* format, ...)
markrad 58:f50b97b08851 13 {
markrad 58:f50b97b08851 14 va_list args;
markrad 58:f50b97b08851 15 va_start(args, format);
markrad 58:f50b97b08851 16
markrad 58:f50b97b08851 17 time_t t = time(NULL);
markrad 58:f50b97b08851 18
markrad 58:f50b97b08851 19 switch (log_category)
markrad 58:f50b97b08851 20 {
markrad 58:f50b97b08851 21 case LOG_INFO:
markrad 58:f50b97b08851 22 (void)printf("Info: ");
markrad 58:f50b97b08851 23 break;
markrad 58:f50b97b08851 24 case LOG_ERROR:
markrad 58:f50b97b08851 25 (void)printf("Error: Time:%.24s File:%s Func:%s Line:%d ", ctime(&t), file, func, line);
markrad 58:f50b97b08851 26 break;
markrad 58:f50b97b08851 27 default:
markrad 58:f50b97b08851 28 break;
markrad 58:f50b97b08851 29 }
markrad 58:f50b97b08851 30
markrad 58:f50b97b08851 31 (void)vprintf(format, args);
markrad 58:f50b97b08851 32 va_end(args);
markrad 58:f50b97b08851 33
markrad 58:f50b97b08851 34 (void)log_category;
markrad 58:f50b97b08851 35 if (options & LOG_LINE)
markrad 58:f50b97b08851 36 {
markrad 58:f50b97b08851 37 (void)printf("\r\n");
markrad 58:f50b97b08851 38 }
markrad 58:f50b97b08851 39 }