Line data Source code
1 : /* $Id: gmp_trace.h 346474 2009-11-14 10:18:58Z ssiano $ 2 : * 3 : * gmp_trace.h - GMP role-independent trace support 4 : * 5 : * Dave Katz, March 2008 6 : * 7 : * Copyright (c) 2008, Juniper Networks, Inc. 8 : * Copyright Contributors to the OpenSDN project 9 : * All rights reserved. 10 : */ 11 : 12 : /* Packet tracing flags */ 13 : 14 : #define GMP_TRACE_QUERY 0x00000001 /* Query packets */ 15 : #define GMP_TRACE_QUERY_DETAIL 0x00000002 /* Detailed query packets */ 16 : #define GMP_TRACE_REPORT 0x00000004 /* Report packets */ 17 : #define GMP_TRACE_REPORT_DETAIL 0x00000008 /* Detailed report packets */ 18 : #define GMP_TRACE_LEAVE 0x00000010 /* Leave packets */ 19 : #define GMP_TRACE_LEAVE_DETAIL 0x00000020 /* Detailed leave packets */ 20 : #define GMP_TRACE_PACKET_BAD 0x00000040 /* Bad packets */ 21 : #define GMP_TRACE_PACKET (GMP_TRACE_QUERY | GMP_TRACE_REPORT | \ 22 : GMP_TRACE_LEAVE) /* Packets */ 23 : #define GMP_TRACE_PACKET_DETAIL (GMP_TRACE_QUERY_DETAIL | \ 24 : GMP_TRACE_REPORT_DETAIL | \ 25 : GMP_TRACE_LEAVE_DETAIL) /* Detail packets */ 26 : 27 : /* 28 : * gmp_trace_set 29 : * 30 : * Returns TRUE if the specified trace flag is in use, or FALSE if not. 31 : */ 32 : static inline boolean 33 1152 : gmp_trace_set (uint32_t traceflags, uint32_t tracebits) 34 : { 35 1152 : return ((traceflags & tracebits) != 0); 36 : } 37 : 38 : /* 39 : * gmp_trace 40 : * 41 : * Conditionally trace. 42 : */ 43 : #define gmp_trace(context, traceflags, flag, ...) \ 44 : if (gmp_trace_set((traceflags), (flag))) \ 45 : gmpx_trace((context), __VA_ARGS__) 46 : 47 : extern const char *gmp_proto_string(gmp_proto proto); 48 : extern const char *gmp_filter_mode_string(gmp_filter_mode mode); 49 : extern const char *gmp_generic_version_string(gmp_version ver); 50 : extern const char *gmp_report_type_string(gmp_report_rectype type);