A super trimmed down TLS stack, GPL licensed
Dependents: MiniTLS-HTTPS-Example
MiniTLS - A super trimmed down TLS/SSL Library for embedded devices Author: Donatien Garnier Copyright (C) 2013-2014 AppNearMe Ltd
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
core/debug.c@4:cbaf466d717d, 2014-06-10 (annotated)
- Committer:
- MiniTLS
- Date:
- Tue Jun 10 14:23:09 2014 +0000
- Revision:
- 4:cbaf466d717d
- Parent:
- 3:eb324ffffd2b
Fixes for mbed
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MiniTLS | 3:eb324ffffd2b | 1 | /* |
MiniTLS | 3:eb324ffffd2b | 2 | MiniTLS - A super trimmed down TLS/SSL Library for embedded devices |
MiniTLS | 3:eb324ffffd2b | 3 | Author: Donatien Garnier |
MiniTLS | 3:eb324ffffd2b | 4 | Copyright (C) 2013-2014 AppNearMe Ltd |
MiniTLS | 3:eb324ffffd2b | 5 | |
MiniTLS | 3:eb324ffffd2b | 6 | This program is free software; you can redistribute it and/or |
MiniTLS | 3:eb324ffffd2b | 7 | modify it under the terms of the GNU General Public License |
MiniTLS | 3:eb324ffffd2b | 8 | as published by the Free Software Foundation; either version 2 |
MiniTLS | 3:eb324ffffd2b | 9 | of the License, or (at your option) any later version. |
MiniTLS | 3:eb324ffffd2b | 10 | |
MiniTLS | 3:eb324ffffd2b | 11 | This program is distributed in the hope that it will be useful, |
MiniTLS | 3:eb324ffffd2b | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
MiniTLS | 3:eb324ffffd2b | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MiniTLS | 3:eb324ffffd2b | 14 | GNU General Public License for more details. |
MiniTLS | 3:eb324ffffd2b | 15 | |
MiniTLS | 3:eb324ffffd2b | 16 | You should have received a copy of the GNU General Public License |
MiniTLS | 3:eb324ffffd2b | 17 | along with this program; if not, write to the Free Software |
MiniTLS | 3:eb324ffffd2b | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
MiniTLS | 3:eb324ffffd2b | 19 | *//* |
MiniTLS | 3:eb324ffffd2b | 20 | debug.c |
MiniTLS | 3:eb324ffffd2b | 21 | * Copyright (c) AppNearMe Ltd 2013 |
MiniTLS | 3:eb324ffffd2b | 22 | * Author: Donatien Garnier |
MiniTLS | 3:eb324ffffd2b | 23 | */ |
MiniTLS | 3:eb324ffffd2b | 24 | |
MiniTLS | 3:eb324ffffd2b | 25 | #include "fwk.h" |
MiniTLS | 3:eb324ffffd2b | 26 | |
MiniTLS | 3:eb324ffffd2b | 27 | #if !DEBUG_DISABLED |
MiniTLS | 3:eb324ffffd2b | 28 | |
MiniTLS | 3:eb324ffffd2b | 29 | #ifdef __cplusplus |
MiniTLS | 3:eb324ffffd2b | 30 | extern "C" |
MiniTLS | 3:eb324ffffd2b | 31 | { |
MiniTLS | 3:eb324ffffd2b | 32 | #endif |
MiniTLS | 3:eb324ffffd2b | 33 | |
MiniTLS | 3:eb324ffffd2b | 34 | #include "debug.h" |
MiniTLS | 3:eb324ffffd2b | 35 | |
MiniTLS | 3:eb324ffffd2b | 36 | #include "stdio.h" |
MiniTLS | 3:eb324ffffd2b | 37 | #include "stdarg.h" |
MiniTLS | 3:eb324ffffd2b | 38 | |
MiniTLS | 3:eb324ffffd2b | 39 | void debug(int level, const char* module, int line, const char* fmt, ...) |
MiniTLS | 3:eb324ffffd2b | 40 | { |
MiniTLS | 3:eb324ffffd2b | 41 | va_list argp; |
MiniTLS | 3:eb324ffffd2b | 42 | |
MiniTLS | 3:eb324ffffd2b | 43 | //TODO add a mutex system at some point here |
MiniTLS | 3:eb324ffffd2b | 44 | switch(level) |
MiniTLS | 3:eb324ffffd2b | 45 | { |
MiniTLS | 3:eb324ffffd2b | 46 | default: |
MiniTLS | 3:eb324ffffd2b | 47 | case 1: |
MiniTLS | 3:eb324ffffd2b | 48 | printf("[ERROR]"); |
MiniTLS | 3:eb324ffffd2b | 49 | break; |
MiniTLS | 3:eb324ffffd2b | 50 | case 2: |
MiniTLS | 3:eb324ffffd2b | 51 | printf("[WARN]"); |
MiniTLS | 3:eb324ffffd2b | 52 | break; |
MiniTLS | 3:eb324ffffd2b | 53 | case 3: |
MiniTLS | 3:eb324ffffd2b | 54 | printf("[DBG]"); |
MiniTLS | 3:eb324ffffd2b | 55 | break; |
MiniTLS | 3:eb324ffffd2b | 56 | case 4: |
MiniTLS | 3:eb324ffffd2b | 57 | printf("[VERB]"); |
MiniTLS | 3:eb324ffffd2b | 58 | break; |
MiniTLS | 3:eb324ffffd2b | 59 | } |
MiniTLS | 3:eb324ffffd2b | 60 | |
MiniTLS | 3:eb324ffffd2b | 61 | printf(" Module %s - Line %d: ", module, line); |
MiniTLS | 3:eb324ffffd2b | 62 | |
MiniTLS | 3:eb324ffffd2b | 63 | va_start(argp, fmt); |
MiniTLS | 3:eb324ffffd2b | 64 | vprintf(fmt, argp); |
MiniTLS | 3:eb324ffffd2b | 65 | va_end(argp); |
MiniTLS | 3:eb324ffffd2b | 66 | |
MiniTLS | 3:eb324ffffd2b | 67 | printf("\r\n"); |
MiniTLS | 3:eb324ffffd2b | 68 | } |
MiniTLS | 3:eb324ffffd2b | 69 | |
MiniTLS | 3:eb324ffffd2b | 70 | void debugx_enter(void) |
MiniTLS | 3:eb324ffffd2b | 71 | { |
MiniTLS | 3:eb324ffffd2b | 72 | |
MiniTLS | 3:eb324ffffd2b | 73 | } |
MiniTLS | 3:eb324ffffd2b | 74 | |
MiniTLS | 3:eb324ffffd2b | 75 | void debugx(const char* fmt, ...) |
MiniTLS | 3:eb324ffffd2b | 76 | { |
MiniTLS | 3:eb324ffffd2b | 77 | va_list argp; |
MiniTLS | 3:eb324ffffd2b | 78 | |
MiniTLS | 3:eb324ffffd2b | 79 | va_start(argp, fmt); |
MiniTLS | 3:eb324ffffd2b | 80 | vprintf(fmt, argp); |
MiniTLS | 3:eb324ffffd2b | 81 | va_end(argp); |
MiniTLS | 3:eb324ffffd2b | 82 | } |
MiniTLS | 3:eb324ffffd2b | 83 | |
MiniTLS | 3:eb324ffffd2b | 84 | void debugx_leave(void) |
MiniTLS | 3:eb324ffffd2b | 85 | { |
MiniTLS | 3:eb324ffffd2b | 86 | printf("\r\n"); |
MiniTLS | 3:eb324ffffd2b | 87 | } |
MiniTLS | 3:eb324ffffd2b | 88 | |
MiniTLS | 3:eb324ffffd2b | 89 | void assert_failed(const char* module, int line, const char* condition) |
MiniTLS | 3:eb324ffffd2b | 90 | { |
MiniTLS | 3:eb324ffffd2b | 91 | printf("[ASSERT FAILED] Module %s - Line %d: %s\r\n", module, line, condition); |
MiniTLS | 3:eb324ffffd2b | 92 | } |
MiniTLS | 3:eb324ffffd2b | 93 | |
MiniTLS | 3:eb324ffffd2b | 94 | #ifdef __cplusplus |
MiniTLS | 3:eb324ffffd2b | 95 | } |
MiniTLS | 3:eb324ffffd2b | 96 | #endif |
MiniTLS | 3:eb324ffffd2b | 97 | |
MiniTLS | 3:eb324ffffd2b | 98 | #endif |
MiniTLS | 3:eb324ffffd2b | 99 |