change some parameters in the library to meet the needs of the website httpbin.org
Fork of MiniTLS-GPL by
core/debug.h@0:35aa5be3b78d, 2014-06-06 (annotated)
- Committer:
- MiniTLS
- Date:
- Fri Jun 06 10:49:02 2014 +0000
- Revision:
- 0:35aa5be3b78d
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MiniTLS | 0:35aa5be3b78d | 1 | /* |
MiniTLS | 0:35aa5be3b78d | 2 | MuTLS - A super trimmed down TLS/SSL Library for embedded devices |
MiniTLS | 0:35aa5be3b78d | 3 | Author: Donatien Garnier |
MiniTLS | 0:35aa5be3b78d | 4 | Copyright (C) 2013-2014 AppNearMe Ltd |
MiniTLS | 0:35aa5be3b78d | 5 | |
MiniTLS | 0:35aa5be3b78d | 6 | This program is free software; you can redistribute it and/or |
MiniTLS | 0:35aa5be3b78d | 7 | modify it under the terms of the GNU General Public License |
MiniTLS | 0:35aa5be3b78d | 8 | as published by the Free Software Foundation; either version 2 |
MiniTLS | 0:35aa5be3b78d | 9 | of the License, or (at your option) any later version. |
MiniTLS | 0:35aa5be3b78d | 10 | |
MiniTLS | 0:35aa5be3b78d | 11 | This program is distributed in the hope that it will be useful, |
MiniTLS | 0:35aa5be3b78d | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
MiniTLS | 0:35aa5be3b78d | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MiniTLS | 0:35aa5be3b78d | 14 | GNU General Public License for more details. |
MiniTLS | 0:35aa5be3b78d | 15 | |
MiniTLS | 0:35aa5be3b78d | 16 | You should have received a copy of the GNU General Public License |
MiniTLS | 0:35aa5be3b78d | 17 | along with this program; if not, write to the Free Software |
MiniTLS | 0:35aa5be3b78d | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
MiniTLS | 0:35aa5be3b78d | 19 | *//** |
MiniTLS | 0:35aa5be3b78d | 20 | * \file debug.h |
MiniTLS | 0:35aa5be3b78d | 21 | * \copyright Copyright (c) AppNearMe Ltd 2013 |
MiniTLS | 0:35aa5be3b78d | 22 | * \author Donatien Garnier |
MiniTLS | 0:35aa5be3b78d | 23 | */ |
MiniTLS | 0:35aa5be3b78d | 24 | |
MiniTLS | 0:35aa5be3b78d | 25 | #ifndef DEBUG_H_ |
MiniTLS | 0:35aa5be3b78d | 26 | #define DEBUG_H_ |
MiniTLS | 0:35aa5be3b78d | 27 | |
MiniTLS | 0:35aa5be3b78d | 28 | #include "fwk.h" |
MiniTLS | 0:35aa5be3b78d | 29 | |
MiniTLS | 0:35aa5be3b78d | 30 | #ifdef __cplusplus |
MiniTLS | 0:35aa5be3b78d | 31 | extern "C" { |
MiniTLS | 0:35aa5be3b78d | 32 | #endif |
MiniTLS | 0:35aa5be3b78d | 33 | |
MiniTLS | 0:35aa5be3b78d | 34 | #if !DEBUG_DISABLED |
MiniTLS | 0:35aa5be3b78d | 35 | |
MiniTLS | 0:35aa5be3b78d | 36 | void debug(int level, const char* module, int line, const char* fmt, ...); |
MiniTLS | 0:35aa5be3b78d | 37 | void debugx_enter(void); |
MiniTLS | 0:35aa5be3b78d | 38 | void debugx(const char* fmt, ...); |
MiniTLS | 0:35aa5be3b78d | 39 | void debugx_leave(void); |
MiniTLS | 0:35aa5be3b78d | 40 | void assert_failed(const char* module, int line, const char* condition); |
MiniTLS | 0:35aa5be3b78d | 41 | |
MiniTLS | 0:35aa5be3b78d | 42 | #define assert(condition) do{ if(!(condition)){ assert_failed(__MODULE__, __LINE__, #condition); } } while(0) |
MiniTLS | 0:35aa5be3b78d | 43 | |
MiniTLS | 0:35aa5be3b78d | 44 | #else |
MiniTLS | 0:35aa5be3b78d | 45 | #ifdef __DEBUG__ |
MiniTLS | 0:35aa5be3b78d | 46 | #undef __DEBUG__ |
MiniTLS | 0:35aa5be3b78d | 47 | #define __DEBUG__ 0 |
MiniTLS | 0:35aa5be3b78d | 48 | #endif |
MiniTLS | 0:35aa5be3b78d | 49 | |
MiniTLS | 0:35aa5be3b78d | 50 | #define assert(condition) |
MiniTLS | 0:35aa5be3b78d | 51 | |
MiniTLS | 0:35aa5be3b78d | 52 | #endif |
MiniTLS | 0:35aa5be3b78d | 53 | |
MiniTLS | 0:35aa5be3b78d | 54 | #if __DEBUG__ > 0 |
MiniTLS | 0:35aa5be3b78d | 55 | #ifndef __MODULE__ |
MiniTLS | 0:35aa5be3b78d | 56 | #error "__MODULE__ must be defined" |
MiniTLS | 0:35aa5be3b78d | 57 | #endif |
MiniTLS | 0:35aa5be3b78d | 58 | #endif |
MiniTLS | 0:35aa5be3b78d | 59 | |
MiniTLS | 0:35aa5be3b78d | 60 | #if __DEBUG__ >= 1 |
MiniTLS | 0:35aa5be3b78d | 61 | #define ERR(...) do{ debug(1, __MODULE__, __LINE__, __VA_ARGS__); }while(0) |
MiniTLS | 0:35aa5be3b78d | 62 | #else |
MiniTLS | 0:35aa5be3b78d | 63 | #define ERR(...) |
MiniTLS | 0:35aa5be3b78d | 64 | #endif |
MiniTLS | 0:35aa5be3b78d | 65 | |
MiniTLS | 0:35aa5be3b78d | 66 | #if __DEBUG__ >= 2 |
MiniTLS | 0:35aa5be3b78d | 67 | #define WARN(...) do{ debug(2, __MODULE__, __LINE__, __VA_ARGS__); }while(0) |
MiniTLS | 0:35aa5be3b78d | 68 | #else |
MiniTLS | 0:35aa5be3b78d | 69 | #define WARN(...) |
MiniTLS | 0:35aa5be3b78d | 70 | #endif |
MiniTLS | 0:35aa5be3b78d | 71 | |
MiniTLS | 0:35aa5be3b78d | 72 | #if __DEBUG__ >= 3 |
MiniTLS | 0:35aa5be3b78d | 73 | #define DBG(...) do{ debug(3, __MODULE__, __LINE__, __VA_ARGS__); }while(0) |
MiniTLS | 0:35aa5be3b78d | 74 | #define DBGX_ENTER() do{ debugx_enter(); }while(0) |
MiniTLS | 0:35aa5be3b78d | 75 | #define DBGX(...) do{ debugx(__VA_ARGS__); }while(0) |
MiniTLS | 0:35aa5be3b78d | 76 | #define DBGX_LEAVE() do{ debugx_leave(); }while(0) |
MiniTLS | 0:35aa5be3b78d | 77 | #define DBG_BLOCK(x) x |
MiniTLS | 0:35aa5be3b78d | 78 | #else |
MiniTLS | 0:35aa5be3b78d | 79 | #define DBG(...) |
MiniTLS | 0:35aa5be3b78d | 80 | #define DBGX_ENTER() |
MiniTLS | 0:35aa5be3b78d | 81 | #define DBGX(...) |
MiniTLS | 0:35aa5be3b78d | 82 | #define DBGX_LEAVE() |
MiniTLS | 0:35aa5be3b78d | 83 | #define DBG_BLOCK(x) |
MiniTLS | 0:35aa5be3b78d | 84 | #endif |
MiniTLS | 0:35aa5be3b78d | 85 | |
MiniTLS | 0:35aa5be3b78d | 86 | #if __DEBUG__ >= 4 |
MiniTLS | 0:35aa5be3b78d | 87 | #define VERB(...) do{ debug(4, __MODULE__, __LINE__, __VA_ARGS__); }while(0) |
MiniTLS | 0:35aa5be3b78d | 88 | #else |
MiniTLS | 0:35aa5be3b78d | 89 | #define VERB(...) |
MiniTLS | 0:35aa5be3b78d | 90 | #endif |
MiniTLS | 0:35aa5be3b78d | 91 | |
MiniTLS | 0:35aa5be3b78d | 92 | #ifdef __cplusplus |
MiniTLS | 0:35aa5be3b78d | 93 | } |
MiniTLS | 0:35aa5be3b78d | 94 | #endif |
MiniTLS | 0:35aa5be3b78d | 95 | |
MiniTLS | 0:35aa5be3b78d | 96 | #endif |
MiniTLS | 0:35aa5be3b78d | 97 |