1 /* 2 * Project : ipv6calc/lib 3 * File : libipv6calcdebug.h 4 * Version : $Id: 4c54d967102db09a097060935324ecc97cffa5af $ 5 * Copyright : 2002-2019 by Peter Bieringer <pb (at) bieringer.de> 6 * 7 * Information: 8 * Debug information 9 */ 10 11 12 #ifndef _libipv6calcdebug_h_ 13 14 #define _libipv6calcdebug_h_ 15 16 #define DEBUG_ipv6calc_ALL -1 17 18 //reserved for debug levels of dedicated binary 0x00000001l 19 //reserved for debug levels of dedicated binary 0x00000002l 20 //reserved for debug levels of dedicated binary 0x00000004l 21 22 #define DEBUG_ipv6calcoptions 0x00000008l 23 24 #define DEBUG_libipv6calc 0x00000010l 25 #define DEBUG_libipv6addr 0x00000020l 26 #define DEBUG_libipv4addr 0x00000040l 27 #define DEBUG_libipv6calctypes 0x00000080l 28 29 #define DEBUG_librfc3041 0x00000100l 30 #define DEBUG_librfc1884 0x00000200l 31 #define DEBUG_librfc2874 0x00000400l 32 #define DEBUG_librfc1886 0x00000800l 33 34 #define DEBUG_librfc3056 0x00001000l 35 #define DEBUG_libifinet6 0x00002000l 36 #define DEBUG_libieee 0x00004000l 37 #define DEBUG_libeui64 0x00008000l 38 39 #define DEBUG_libmac 0x00010000l 40 #define DEBUG_libipaddr 0x00020000l 41 42 #define DEBUG_libipv6calc_db_wrapper 0x00100000l 43 #define DEBUG_libipv6calc_db_wrapper_GeoIP 0x00200000l 44 #define DEBUG_libipv6calc_db_wrapper_GeoIP2 0x00200000l 45 #define DEBUG_libipv6calc_db_wrapper_IP2Location 0x00400000l 46 #define DEBUG_libipv6calc_db_wrapper_GeoIP_verbose 0x00800000l 47 48 #define DEBUG_libipv6addr_iidrandomdetection 0x01000000l 49 #define DEBUG_libipv6addr_anonymization_unknown_break 0x02000000l 50 51 #define DEBUG_libipv6calc_db_wrapper_DBIP 0x10000000l 52 #define DEBUG_libipv6calc_db_wrapper_DBIP2 0x10000000l 53 #define DEBUG_libipv6calc_db_wrapper_External 0x20000000l 54 #define DEBUG_libipv6calc_db_wrapper_BuiltIn 0x40000000l 55 #define DEBUG_libipv6calc_db_wrapper_MMDB 0x80000000l 56 57 /* debug print with args */ 58 #define DEBUGPRINT_WA(d, t, ...) \ 59 if ((ipv6calc_debug & (d)) != 0) { \ 60 if (ipv6calc_debug == DEBUG_ipv6calc_ALL) { \ 61 fprintf(stderr, "%s/%s:%d[0x%08lx]: " t "\n", __FILE__, __func__, __LINE__, d, __VA_ARGS__); \ 62 } else { \ 63 fprintf(stderr, "%s/%s:%d: " t "\n", __FILE__, __func__, __LINE__, __VA_ARGS__); \ 64 }; \ 65 }; 66 67 /* debug print no args */ 68 #define DEBUGPRINT_NA(d, t) \ 69 if ((ipv6calc_debug & (d)) != 0) { \ 70 if (ipv6calc_debug == DEBUG_ipv6calc_ALL) { \ 71 fprintf(stderr, "%s/%s:%d[0x%08lx]: " t "\n", __FILE__, __func__, __LINE__, d); \ 72 } else { \ 73 fprintf(stderr, "%s/%s:%d: " t "\n", __FILE__, __func__, __LINE__); \ 74 }; \ 75 }; 76 77 /* error print with args */ 78 #define ERRORPRINT_WA(t, ...) \ 79 fprintf(stderr, "%s/%s:%d: " t "\n", __FILE__, __func__, __LINE__, __VA_ARGS__); 80 81 /* error print no args */ 82 #define ERRORPRINT_NA(t) \ 83 fprintf(stderr, "%s/%s:%d: " t "\n", __FILE__, __func__, __LINE__); 84 85 /* begin/end of debug section */ 86 #define DEBUGSECTION_BEGIN(d) if ((ipv6calc_debug & (d)) != 0) { 87 #define DEBUGSECTION_ELSE } else { 88 #define DEBUGSECTION_END }; 89 90 91 #endif 92 93 /* global debug value */ 94 extern long int ipv6calc_debug; 95