This is a fork due to permission issues

Dependencies:   mbed Socket lwip-eth lwip-sys lwip

Fork of 6_songs-from-the-cloud by MakingMusicWorkshop

Committer:
timbeight
Date:
Thu May 19 16:02:10 2016 +0000
Revision:
1:0ddbe2d3319c
Parent:
0:f7c60d3e7b8a
This is my first commit while in the class.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maclobdell 0:f7c60d3e7b8a 1 /*
maclobdell 0:f7c60d3e7b8a 2 * Copyright (c) 2015 ARM Limited. All rights reserved.
maclobdell 0:f7c60d3e7b8a 3 * SPDX-License-Identifier: Apache-2.0
maclobdell 0:f7c60d3e7b8a 4 * Licensed under the Apache License, Version 2.0 (the License); you may
maclobdell 0:f7c60d3e7b8a 5 * not use this file except in compliance with the License.
maclobdell 0:f7c60d3e7b8a 6 * You may obtain a copy of the License at
maclobdell 0:f7c60d3e7b8a 7 *
maclobdell 0:f7c60d3e7b8a 8 * http://www.apache.org/licenses/LICENSE-2.0
maclobdell 0:f7c60d3e7b8a 9 *
maclobdell 0:f7c60d3e7b8a 10 * Unless required by applicable law or agreed to in writing, software
maclobdell 0:f7c60d3e7b8a 11 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
maclobdell 0:f7c60d3e7b8a 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
maclobdell 0:f7c60d3e7b8a 13 * See the License for the specific language governing permissions and
maclobdell 0:f7c60d3e7b8a 14 * limitations under the License.
maclobdell 0:f7c60d3e7b8a 15 */
maclobdell 0:f7c60d3e7b8a 16
maclobdell 0:f7c60d3e7b8a 17 /**
maclobdell 0:f7c60d3e7b8a 18 * \file ns_trace.h
maclobdell 0:f7c60d3e7b8a 19 * Trace interface for NanoStack library as well as application.
maclobdell 0:f7c60d3e7b8a 20 * This file provide simple but flexible way to handle software traces.
maclobdell 0:f7c60d3e7b8a 21 * Trace library are abstract layer, which use stdout (printf) by default,
maclobdell 0:f7c60d3e7b8a 22 * but outputs can be easily redirect to custom function, for example to
maclobdell 0:f7c60d3e7b8a 23 * store traces to memory or other interfaces.
maclobdell 0:f7c60d3e7b8a 24 *
maclobdell 0:f7c60d3e7b8a 25 * usage example:
maclobdell 0:f7c60d3e7b8a 26 * \code(main.c:)
maclobdell 0:f7c60d3e7b8a 27 * #include "ns_trace.h"
maclobdell 0:f7c60d3e7b8a 28 * #define TRACE_GROUP "main"
maclobdell 0:f7c60d3e7b8a 29 *
maclobdell 0:f7c60d3e7b8a 30 * int main(void){
maclobdell 0:f7c60d3e7b8a 31 * trace_init(); // initialize trace library
maclobdell 0:f7c60d3e7b8a 32 * tr_debug("this is debug msg"); //print debug message to stdout: "[DBG]
maclobdell 0:f7c60d3e7b8a 33 * tr_err("this is error msg");
maclobdell 0:f7c60d3e7b8a 34 * tr_warn("this is warning msg");
maclobdell 0:f7c60d3e7b8a 35 * tr_info("this is info msg");
maclobdell 0:f7c60d3e7b8a 36 * return 0;
maclobdell 0:f7c60d3e7b8a 37 * }
maclobdell 0:f7c60d3e7b8a 38 * \endcode
maclobdell 0:f7c60d3e7b8a 39 *
maclobdell 0:f7c60d3e7b8a 40 */
maclobdell 0:f7c60d3e7b8a 41 #ifndef NS_TRACE_H_
maclobdell 0:f7c60d3e7b8a 42 #define NS_TRACE_H_
maclobdell 0:f7c60d3e7b8a 43 #include "ns_types.h"
maclobdell 0:f7c60d3e7b8a 44
maclobdell 0:f7c60d3e7b8a 45 #ifdef __cplusplus
maclobdell 0:f7c60d3e7b8a 46 extern "C" {
maclobdell 0:f7c60d3e7b8a 47 #endif
maclobdell 0:f7c60d3e7b8a 48
maclobdell 0:f7c60d3e7b8a 49 /** 3 upper bits are trace modes related,
maclobdell 0:f7c60d3e7b8a 50 and 5 lower bits are trace level configuration */
maclobdell 0:f7c60d3e7b8a 51
maclobdell 0:f7c60d3e7b8a 52 /** Config mask */
maclobdell 0:f7c60d3e7b8a 53 #define TRACE_MASK_CONFIG 0xE0
maclobdell 0:f7c60d3e7b8a 54 /** Trace level mask */
maclobdell 0:f7c60d3e7b8a 55 #define TRACE_MASK_LEVEL 0x1F
maclobdell 0:f7c60d3e7b8a 56
maclobdell 0:f7c60d3e7b8a 57 /** plain trace data instead of "headers" */
maclobdell 0:f7c60d3e7b8a 58 #define TRACE_MODE_PLAIN 0x80
maclobdell 0:f7c60d3e7b8a 59 /** color mode */
maclobdell 0:f7c60d3e7b8a 60 #define TRACE_MODE_COLOR 0x40
maclobdell 0:f7c60d3e7b8a 61 /** Use print CR before trace line */
maclobdell 0:f7c60d3e7b8a 62 #define TRACE_CARRIAGE_RETURN 0x20
maclobdell 0:f7c60d3e7b8a 63
maclobdell 0:f7c60d3e7b8a 64 /** used to activate all trace levels */
maclobdell 0:f7c60d3e7b8a 65 #define TRACE_ACTIVE_LEVEL_ALL 0x1F
maclobdell 0:f7c60d3e7b8a 66 /** print all traces same as above */
maclobdell 0:f7c60d3e7b8a 67 #define TRACE_ACTIVE_LEVEL_DEBUG 0x1f
maclobdell 0:f7c60d3e7b8a 68 /** print info,warn and error traces */
maclobdell 0:f7c60d3e7b8a 69 #define TRACE_ACTIVE_LEVEL_INFO 0x0f
maclobdell 0:f7c60d3e7b8a 70 /** print warn and error traces */
maclobdell 0:f7c60d3e7b8a 71 #define TRACE_ACTIVE_LEVEL_WARN 0x07
maclobdell 0:f7c60d3e7b8a 72 /** print only error trace */
maclobdell 0:f7c60d3e7b8a 73 #define TRACE_ACTIVE_LEVEL_ERROR 0x03
maclobdell 0:f7c60d3e7b8a 74 /** print only cmd line data */
maclobdell 0:f7c60d3e7b8a 75 #define TRACE_ACTIVE_LEVEL_CMD 0x01
maclobdell 0:f7c60d3e7b8a 76 /** trace nothing */
maclobdell 0:f7c60d3e7b8a 77 #define TRACE_ACTIVE_LEVEL_NONE 0x00
maclobdell 0:f7c60d3e7b8a 78
maclobdell 0:f7c60d3e7b8a 79 /** this print is some deep information for debug purpose */
maclobdell 0:f7c60d3e7b8a 80 #define TRACE_LEVEL_DEBUG 0x10
maclobdell 0:f7c60d3e7b8a 81 /** Info print, for general purpose prints */
maclobdell 0:f7c60d3e7b8a 82 #define TRACE_LEVEL_INFO 0x08
maclobdell 0:f7c60d3e7b8a 83 /** warning prints, which shouldn't causes any huge problems */
maclobdell 0:f7c60d3e7b8a 84 #define TRACE_LEVEL_WARN 0x04
maclobdell 0:f7c60d3e7b8a 85 /** Error prints, which causes probably problems, e.g. out of mem. */
maclobdell 0:f7c60d3e7b8a 86 #define TRACE_LEVEL_ERROR 0x02
maclobdell 0:f7c60d3e7b8a 87 /** special level for cmdline. Behaviours like "plain mode" */
maclobdell 0:f7c60d3e7b8a 88 #define TRACE_LEVEL_CMD 0x01
maclobdell 0:f7c60d3e7b8a 89
maclobdell 0:f7c60d3e7b8a 90 //usage macros:
maclobdell 0:f7c60d3e7b8a 91 #define tr_info(...) tracef(TRACE_LEVEL_INFO, TRACE_GROUP, __VA_ARGS__) //!< Print info message
maclobdell 0:f7c60d3e7b8a 92 #define tr_debug(...) tracef(TRACE_LEVEL_DEBUG, TRACE_GROUP, __VA_ARGS__) //!< Print debug message
maclobdell 0:f7c60d3e7b8a 93 #define tr_warning(...) tracef(TRACE_LEVEL_WARN, TRACE_GROUP, __VA_ARGS__) //!< Print warning message
maclobdell 0:f7c60d3e7b8a 94 #define tr_warn(...) tracef(TRACE_LEVEL_WARN, TRACE_GROUP, __VA_ARGS__) //!< Alternative warning message
maclobdell 0:f7c60d3e7b8a 95 #define tr_error(...) tracef(TRACE_LEVEL_ERROR, TRACE_GROUP, __VA_ARGS__) //!< Print Error Message
maclobdell 0:f7c60d3e7b8a 96 #define tr_err(...) tracef(TRACE_LEVEL_ERROR, TRACE_GROUP, __VA_ARGS__) //!< Alternative error message
maclobdell 0:f7c60d3e7b8a 97 #define tr_cmdline(...) tracef(TRACE_LEVEL_CMD, TRACE_GROUP, __VA_ARGS__) //!< Special print for cmdline. See more from TRACE_LEVEL_CMD -level
maclobdell 0:f7c60d3e7b8a 98
maclobdell 0:f7c60d3e7b8a 99 /** Possible to skip all traces in compile time */
maclobdell 0:f7c60d3e7b8a 100 #if defined(FEA_TRACE_SUPPORT) || defined(HAVE_DEBUG) || (defined(YOTTA_CFG) && !defined(NDEBUG)) /*backward compatible*/
maclobdell 0:f7c60d3e7b8a 101
maclobdell 0:f7c60d3e7b8a 102 #if defined __GNUC__ || defined __CC_ARM
maclobdell 0:f7c60d3e7b8a 103 /**
maclobdell 0:f7c60d3e7b8a 104 * Initialize trace functionality. This method must be called from application process.
maclobdell 0:f7c60d3e7b8a 105 * @return 0 when all success, otherwise non zero
maclobdell 0:f7c60d3e7b8a 106 */
maclobdell 0:f7c60d3e7b8a 107 int trace_init( void );
maclobdell 0:f7c60d3e7b8a 108 /**
maclobdell 0:f7c60d3e7b8a 109 * Free trace memory. This method must be called from application process.
maclobdell 0:f7c60d3e7b8a 110 */
maclobdell 0:f7c60d3e7b8a 111 void trace_free( void );
maclobdell 0:f7c60d3e7b8a 112 /**
maclobdell 0:f7c60d3e7b8a 113 * Set trace configurations
maclobdell 0:f7c60d3e7b8a 114 * Possible parameters:
maclobdell 0:f7c60d3e7b8a 115 *
maclobdell 0:f7c60d3e7b8a 116 * TRACE_MODE_COLOR
maclobdell 0:f7c60d3e7b8a 117 * TRACE_MODE_PLAIN (this exclude color mode)
maclobdell 0:f7c60d3e7b8a 118 * TRACE_CARRIAGE_RETURN (print CR before trace line)
maclobdell 0:f7c60d3e7b8a 119 *
maclobdell 0:f7c60d3e7b8a 120 * TRACE_ACTIVE_LEVEL_ALL - to activate all trace levels
maclobdell 0:f7c60d3e7b8a 121 * or TRACE_ACTIVE_LEVEL_DEBUG (alternative)
maclobdell 0:f7c60d3e7b8a 122 * TRACE_ACTIVE_LEVEL_INFO
maclobdell 0:f7c60d3e7b8a 123 * TRACE_ACTIVE_LEVEL_WARN
maclobdell 0:f7c60d3e7b8a 124 * TRACE_ACTIVE_LEVEL_ERROR
maclobdell 0:f7c60d3e7b8a 125 * TRACE_ACTIVE_LEVEL_CMD
maclobdell 0:f7c60d3e7b8a 126 * TRACE_LEVEL_NONE - to deactivate all traces
maclobdell 0:f7c60d3e7b8a 127 *
maclobdell 0:f7c60d3e7b8a 128 * @param config Byte size Bit-mask. Bits are descripted above.
maclobdell 0:f7c60d3e7b8a 129 * usage e.g.
maclobdell 0:f7c60d3e7b8a 130 * @code
maclobdell 0:f7c60d3e7b8a 131 * set_trace_config( TRACE_ACTIVE_LEVEL_ALL|TRACE_MODE_COLOR );
maclobdell 0:f7c60d3e7b8a 132 * @endcode
maclobdell 0:f7c60d3e7b8a 133 */
maclobdell 0:f7c60d3e7b8a 134 void set_trace_config(uint8_t config);
maclobdell 0:f7c60d3e7b8a 135 /** get trace configurations
maclobdell 0:f7c60d3e7b8a 136 * @return trace configuration byte
maclobdell 0:f7c60d3e7b8a 137 */
maclobdell 0:f7c60d3e7b8a 138 uint8_t get_trace_config(void);
maclobdell 0:f7c60d3e7b8a 139 /**
maclobdell 0:f7c60d3e7b8a 140 * Set trace prefix function
maclobdell 0:f7c60d3e7b8a 141 * pref_f -function return string with null terminated
maclobdell 0:f7c60d3e7b8a 142 * Can be used for e.g. time string
maclobdell 0:f7c60d3e7b8a 143 * e.g.
maclobdell 0:f7c60d3e7b8a 144 * char* trace_time(){ return "rtc-time-in-string"; }
maclobdell 0:f7c60d3e7b8a 145 * set_trace_prefix_function( &trace_time );
maclobdell 0:f7c60d3e7b8a 146 */
maclobdell 0:f7c60d3e7b8a 147 void set_trace_prefix_function( char* (*pref_f)(size_t) );
maclobdell 0:f7c60d3e7b8a 148 /**
maclobdell 0:f7c60d3e7b8a 149 * Set trace suffix function
maclobdell 0:f7c60d3e7b8a 150 * suffix -function return string with null terminated
maclobdell 0:f7c60d3e7b8a 151 * Can be used for e.g. time string
maclobdell 0:f7c60d3e7b8a 152 * e.g.
maclobdell 0:f7c60d3e7b8a 153 * char* trace_suffix(){ return " END"; }
maclobdell 0:f7c60d3e7b8a 154 * set_trace_suffix_function( &trace_suffix );
maclobdell 0:f7c60d3e7b8a 155 */
maclobdell 0:f7c60d3e7b8a 156 void set_trace_suffix_function(char* (*suffix_f)(void) );
maclobdell 0:f7c60d3e7b8a 157 /**
maclobdell 0:f7c60d3e7b8a 158 * Set trace print function
maclobdell 0:f7c60d3e7b8a 159 * By default, trace module print using printf() function,
maclobdell 0:f7c60d3e7b8a 160 * but with this you can write own print function,
maclobdell 0:f7c60d3e7b8a 161 * for e.g. to other IO device.
maclobdell 0:f7c60d3e7b8a 162 */
maclobdell 0:f7c60d3e7b8a 163 void set_trace_print_function( void (*print_f)(const char*) );
maclobdell 0:f7c60d3e7b8a 164 /**
maclobdell 0:f7c60d3e7b8a 165 * Set trace print function for tr_cmdline()
maclobdell 0:f7c60d3e7b8a 166 */
maclobdell 0:f7c60d3e7b8a 167 void set_trace_cmdprint_function( void (*printf)(const char*) );
maclobdell 0:f7c60d3e7b8a 168 /**
maclobdell 0:f7c60d3e7b8a 169 * When trace group contains text in filters,
maclobdell 0:f7c60d3e7b8a 170 * trace print will be ignored.
maclobdell 0:f7c60d3e7b8a 171 * e.g.:
maclobdell 0:f7c60d3e7b8a 172 * set_trace_exclude_filters("mygr");
maclobdell 0:f7c60d3e7b8a 173 * tracef(TRACE_ACTIVE_LEVEL_DEBUG, "ougr", "This is not printed");
maclobdell 0:f7c60d3e7b8a 174 */
maclobdell 0:f7c60d3e7b8a 175 void set_trace_exclude_filters(char* filters);
maclobdell 0:f7c60d3e7b8a 176 /** get trace exclude filters
maclobdell 0:f7c60d3e7b8a 177 */
maclobdell 0:f7c60d3e7b8a 178 const char* get_trace_exclude_filters(void);
maclobdell 0:f7c60d3e7b8a 179 /**
maclobdell 0:f7c60d3e7b8a 180 * When trace group contains text in filter,
maclobdell 0:f7c60d3e7b8a 181 * trace will be printed.
maclobdell 0:f7c60d3e7b8a 182 * e.g.:
maclobdell 0:f7c60d3e7b8a 183 * set_trace_include_filters("mygr");
maclobdell 0:f7c60d3e7b8a 184 * tracef(TRACE_ACTIVE_LEVEL_DEBUG, "mygr", "Hi There");
maclobdell 0:f7c60d3e7b8a 185 * tracef(TRACE_ACTIVE_LEVEL_DEBUG, "grp2", "This is not printed");
maclobdell 0:f7c60d3e7b8a 186 */
maclobdell 0:f7c60d3e7b8a 187 void set_trace_include_filters(char* filters);
maclobdell 0:f7c60d3e7b8a 188 /** get trace include filters
maclobdell 0:f7c60d3e7b8a 189 */
maclobdell 0:f7c60d3e7b8a 190 const char* get_trace_include_filters(void);
maclobdell 0:f7c60d3e7b8a 191 /**
maclobdell 0:f7c60d3e7b8a 192 * General trace function
maclobdell 0:f7c60d3e7b8a 193 * This should be used every time when user want to print out something important thing
maclobdell 0:f7c60d3e7b8a 194 * Usage e.g.
maclobdell 0:f7c60d3e7b8a 195 * tracef( TRACE_LEVEL_INFO, "mygr", "Hello world!");
maclobdell 0:f7c60d3e7b8a 196 *
maclobdell 0:f7c60d3e7b8a 197 * @param dlevel debug level
maclobdell 0:f7c60d3e7b8a 198 * @param grp trace group
maclobdell 0:f7c60d3e7b8a 199 * @param fmt trace format (like printf)
maclobdell 0:f7c60d3e7b8a 200 * @param ... variable arguments related to fmt
maclobdell 0:f7c60d3e7b8a 201 */
maclobdell 0:f7c60d3e7b8a 202 void tracef(uint8_t dlevel, const char* grp, const char *fmt, ...) __attribute__ ((__format__(__printf__, 3, 4)));
maclobdell 0:f7c60d3e7b8a 203 /**
maclobdell 0:f7c60d3e7b8a 204 * Get last trace from buffer
maclobdell 0:f7c60d3e7b8a 205 */
maclobdell 0:f7c60d3e7b8a 206 const char* trace_last(void);
maclobdell 0:f7c60d3e7b8a 207 /**
maclobdell 0:f7c60d3e7b8a 208 * tracef helping function for convert ipv6
maclobdell 0:f7c60d3e7b8a 209 * table to human readable string.
maclobdell 0:f7c60d3e7b8a 210 * usage e.g.
maclobdell 0:f7c60d3e7b8a 211 * char ipv6[16] = {...}; // ! array length is 16 bytes !
maclobdell 0:f7c60d3e7b8a 212 * tracef(TRACE_LEVEL_INFO, "mygr", "ipv6 addr: %s", trace_ipv6(ipv6));
maclobdell 0:f7c60d3e7b8a 213 *
maclobdell 0:f7c60d3e7b8a 214 * @param add_ptr IPv6 Address pointer
maclobdell 0:f7c60d3e7b8a 215 * @return temporary buffer where ipv6 is in string format
maclobdell 0:f7c60d3e7b8a 216 */
maclobdell 0:f7c60d3e7b8a 217 char* trace_ipv6(const void *addr_ptr);
maclobdell 0:f7c60d3e7b8a 218 /**
maclobdell 0:f7c60d3e7b8a 219 * tracef helping function for print ipv6 prefix
maclobdell 0:f7c60d3e7b8a 220 * usage e.g.
maclobdell 0:f7c60d3e7b8a 221 * char ipv6[16] = {...}; // ! array length is 16 bytes !
maclobdell 0:f7c60d3e7b8a 222 * tracef(TRACE_LEVEL_INFO, "mygr", "ipv6 addr: %s", trace_ipv6_prefix(ipv6, 4));
maclobdell 0:f7c60d3e7b8a 223 *
maclobdell 0:f7c60d3e7b8a 224 * @param prefix IPv6 Address pointer
maclobdell 0:f7c60d3e7b8a 225 * @param prefix_len prefix length
maclobdell 0:f7c60d3e7b8a 226 * @return temporary buffer where ipv6 is in string format
maclobdell 0:f7c60d3e7b8a 227 */
maclobdell 0:f7c60d3e7b8a 228 char* trace_ipv6_prefix(const uint8_t *prefix, uint8_t prefix_len);
maclobdell 0:f7c60d3e7b8a 229 /**
maclobdell 0:f7c60d3e7b8a 230 * tracef helping function for convert hex-array to string.
maclobdell 0:f7c60d3e7b8a 231 * usage e.g.
maclobdell 0:f7c60d3e7b8a 232 * char myarr[] = {0x10, 0x20};
maclobdell 0:f7c60d3e7b8a 233 * tracef(TRACE_LEVEL_INFO, "mygr", "arr: %s", trace_array(myarr, 2));
maclobdell 0:f7c60d3e7b8a 234 *
maclobdell 0:f7c60d3e7b8a 235 * @param buf hex array pointer
maclobdell 0:f7c60d3e7b8a 236 * @param len buffer length
maclobdell 0:f7c60d3e7b8a 237 * @return temporary buffer where string copied
maclobdell 0:f7c60d3e7b8a 238 */
maclobdell 0:f7c60d3e7b8a 239 char* trace_array(const uint8_t* buf, uint16_t len);
maclobdell 0:f7c60d3e7b8a 240
maclobdell 0:f7c60d3e7b8a 241
maclobdell 0:f7c60d3e7b8a 242 /*
maclobdell 0:f7c60d3e7b8a 243 * obsolete - only because of backward compatible reason
maclobdell 0:f7c60d3e7b8a 244 * As soon as all these functions are replaced by new tracef() function, these can be removed.
maclobdell 0:f7c60d3e7b8a 245 */
maclobdell 0:f7c60d3e7b8a 246
maclobdell 0:f7c60d3e7b8a 247 /** obsolete function */
maclobdell 0:f7c60d3e7b8a 248 void debugf(const char *fmt, ...) __attribute__ ((__format__(__printf__, 1, 2))); //!< obsolete function
maclobdell 0:f7c60d3e7b8a 249 void debug(const char *s); //!< obsolete function
maclobdell 0:f7c60d3e7b8a 250 void debug_put(char c); //!< obsolete function
maclobdell 0:f7c60d3e7b8a 251 void debug_hex(uint8_t x); //!< obsolete function
maclobdell 0:f7c60d3e7b8a 252 void debug_int(int i); //!< obsolete function
maclobdell 0:f7c60d3e7b8a 253 void printf_array(const void *buf, uint16_t len); //!< obsolete function
maclobdell 0:f7c60d3e7b8a 254 void printf_string(const void *buf, uint16_t len); //!< obsolete function
maclobdell 0:f7c60d3e7b8a 255 void printf_ipv6_address(const void *addr); //!< obsolete function
maclobdell 0:f7c60d3e7b8a 256
maclobdell 0:f7c60d3e7b8a 257 #else //__GNUC__ || __CC_ARM
maclobdell 0:f7c60d3e7b8a 258 int trace_init( void );
maclobdell 0:f7c60d3e7b8a 259 void trace_free( void );
maclobdell 0:f7c60d3e7b8a 260 void set_trace_config(uint8_t config);
maclobdell 0:f7c60d3e7b8a 261 void set_trace_prefix_function( char* (*pref_f)(size_t) );
maclobdell 0:f7c60d3e7b8a 262 void set_trace_print_function( void (*print_f)(const char*) );
maclobdell 0:f7c60d3e7b8a 263 void set_trace_cmdprint_function( void (*printf)(const char*) );
maclobdell 0:f7c60d3e7b8a 264 void set_trace_exclude_filters(char* filters);
maclobdell 0:f7c60d3e7b8a 265 const char* get_trace_exclude_filters(void);
maclobdell 0:f7c60d3e7b8a 266 void set_trace_include_filters(char* filters);
maclobdell 0:f7c60d3e7b8a 267 const char* get_trace_include_filters(void);
maclobdell 0:f7c60d3e7b8a 268 void tracef(uint8_t dlevel, const char* grp, const char *fmt, ...);
maclobdell 0:f7c60d3e7b8a 269 char* trace_ipv6(const void *addr_ptr);
maclobdell 0:f7c60d3e7b8a 270 char* trace_array(const uint8_t* buf, uint16_t len);
maclobdell 0:f7c60d3e7b8a 271 char* trace_ipv6_prefix(const uint8_t *prefix, uint8_t prefix_len);
maclobdell 0:f7c60d3e7b8a 272
maclobdell 0:f7c60d3e7b8a 273 //obsolete functions:
maclobdell 0:f7c60d3e7b8a 274 void debugf(const char *fmt, ...);
maclobdell 0:f7c60d3e7b8a 275 void debug(const char *s);
maclobdell 0:f7c60d3e7b8a 276 void debug_put(char c);
maclobdell 0:f7c60d3e7b8a 277 void debug_hex(uint8_t x);
maclobdell 0:f7c60d3e7b8a 278 void debug_int(int i);
maclobdell 0:f7c60d3e7b8a 279 void printf_array(const void *buf, uint16_t len);
maclobdell 0:f7c60d3e7b8a 280 void printf_string(const void *buf, uint16_t len);
maclobdell 0:f7c60d3e7b8a 281 void printf_ipv6_address(const void *addr);
maclobdell 0:f7c60d3e7b8a 282
maclobdell 0:f7c60d3e7b8a 283 #endif
maclobdell 0:f7c60d3e7b8a 284
maclobdell 0:f7c60d3e7b8a 285
maclobdell 0:f7c60d3e7b8a 286 #else /*FEA_TRACE_SUPPORT*/
maclobdell 0:f7c60d3e7b8a 287
maclobdell 0:f7c60d3e7b8a 288 // trace functionality not supported
maclobdell 0:f7c60d3e7b8a 289 #define trace_init(...) ((int) 0)
maclobdell 0:f7c60d3e7b8a 290 #define trace_free(...) ((void) 0)
maclobdell 0:f7c60d3e7b8a 291 #define set_trace_config(...) ((void) 0)
maclobdell 0:f7c60d3e7b8a 292 #define set_trace_prefix_function(...) ((void) 0)
maclobdell 0:f7c60d3e7b8a 293 #define set_trace_print_function(...) ((void) 0)
maclobdell 0:f7c60d3e7b8a 294 #define set_trace_cmdprint_function(...) ((void) 0)
maclobdell 0:f7c60d3e7b8a 295 #define set_trace_exclude_filters(...) ((void) 0)
maclobdell 0:f7c60d3e7b8a 296 #define set_trace_include_filters(...) ((void) 0)
maclobdell 0:f7c60d3e7b8a 297 #define get_trace_exclude_filters(...) ((const char*) 0)
maclobdell 0:f7c60d3e7b8a 298 #define get_trace_include_filters(...) ((const char*) 0)
maclobdell 0:f7c60d3e7b8a 299
maclobdell 0:f7c60d3e7b8a 300 #define tracef(...) ((void) 0)
maclobdell 0:f7c60d3e7b8a 301 #define trace_ipv6(...) ((char*) 0)
maclobdell 0:f7c60d3e7b8a 302 #define trace_array(...) ((char*) 0)
maclobdell 0:f7c60d3e7b8a 303 #define trace_ipv6_prefix(...) ((char*) 0)
maclobdell 0:f7c60d3e7b8a 304
maclobdell 0:f7c60d3e7b8a 305 //obsolete
maclobdell 0:f7c60d3e7b8a 306 #define debugf(...) ((void) 0)
maclobdell 0:f7c60d3e7b8a 307 #define debug(s) ((void) 0)
maclobdell 0:f7c60d3e7b8a 308 #define debug_put(c) ((void) 0)
maclobdell 0:f7c60d3e7b8a 309 #define debug_hex(x) ((void) 0)
maclobdell 0:f7c60d3e7b8a 310 #define debug_int(i) ((void) 0)
maclobdell 0:f7c60d3e7b8a 311 #define printf_array(buf, len) ((void) 0)
maclobdell 0:f7c60d3e7b8a 312 #define printf_string(buf, len) ((void) 0)
maclobdell 0:f7c60d3e7b8a 313 #define printf_ipv6_address(addr) ((void) 0)
maclobdell 0:f7c60d3e7b8a 314
maclobdell 0:f7c60d3e7b8a 315 #endif /*FEA_TRACE_SUPPORT*/
maclobdell 0:f7c60d3e7b8a 316
maclobdell 0:f7c60d3e7b8a 317 #ifdef __cplusplus
maclobdell 0:f7c60d3e7b8a 318 }
maclobdell 0:f7c60d3e7b8a 319 #endif
maclobdell 0:f7c60d3e7b8a 320 #endif /* NS_TRACE_H_ */