1 /* 2 * Copyright (c) 2004-2006 Maxim Sobolev <sobomax@FreeBSD.org> 3 * Copyright (c) 2006-2015 Sippy Software, Inc., http://www.sippysoft.com 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28 /* IPOLICE_FLAGS: DONT_REMOVE */ 29 30 #ifndef _RTPP_DEBUG_H_ 31 #define _RTPP_DEBUG_H_ 32 33 #define RTPP_DBG_YES 1 34 #define RTPP_DBG_NO 0 35 36 #if defined(RTPP_DEBUG) 37 # if defined(RTPP_DEBUG_MAX) 38 /* Supported levels 0, 1, 2. 1 - basic debug & debug when I/O fails, */ 39 /* 2 - debug on every packet */ 40 # define RTPP_DEBUG_netio 2 41 /* Supported levels 0, 1. */ 42 # define RTPP_DEBUG_timers 1 43 /* Catch fatal signals and try to pring backtrace */ 44 /* Supported levels 0, 1. */ 45 # define RTPP_DEBUG_catchtrace 1 46 /* Supported levels 0, 1. */ 47 # define RTPP_DEBUG_refcnt 1 48 /* Supported levels 0, 1. */ 49 # define RTPP_DEBUG_analyze 1 50 # else /* !RTPP_DEBUG_MAX */ 51 # define RTPP_DEBUG_netio RTPP_DBG_YES 52 # define RTPP_DEBUG_timers RTPP_DBG_NO 53 # define RTPP_DEBUG_catchtrace RTPP_DBG_NO 54 # define RTPP_DEBUG_refcnt RTPP_DBG_NO 55 # define RTPP_DEBUG_analyze RTPP_DBG_NO 56 # endif /* RTPP_DEBUG_MAX */ 57 #else /* !RTPP_DEBUG */ 58 # define RTPP_DEBUG_netio RTPP_DBG_NO 59 # define RTPP_DEBUG_timers RTPP_DBG_NO 60 # define RTPP_DEBUG_catchtrace RTPP_DBG_NO 61 # define RTPP_DEBUG_refcnt RTPP_DBG_NO 62 # define RTPP_DEBUG_analyze RTPP_DBG_NO 63 #endif 64 65 #if defined(RTPP_DEBUG) 66 #include <assert.h> 67 68 #define RTPP_DBG_ASSERT(...) assert(__VA_ARGS__) 69 #else 70 #define RTPP_DBG_ASSERT(...) 71 #endif 72 73 #endif 74