2 * modified by Jun-ichiro itojun Itoh <itojun@itojun.org>, 1997
5 * in6_debug.h -- Insipired by Craig Metz's Net/2 in6_debug.h, but
6 * not quite as heavyweight (initially, anyway).
8 * In particular, if function exit-entries are to be
9 * documented, do them in a lightweight fashion.
11 * Copyright 1995 by Dan McDonald, Bao Phan, and Randall Atkinson,
12 * All Rights Reserved.
13 * All Rights under this copyright have been assigned to NRL.
16 /*----------------------------------------------------------------------
17 # @(#)COPYRIGHT 1.1a (NRL) 17 August 1995
21 All of the documentation and software included in this software
22 distribution from the US Naval Research Laboratory (NRL) are
23 copyrighted by their respective developers.
25 This software and documentation were developed at NRL by various
26 people. Those developers have each copyrighted the portions that they
27 developed at NRL and have assigned All Rights for those portions to
28 NRL. Outside the USA, NRL also has copyright on the software
29 developed at NRL. The affected files all contain specific copyright
30 notices and those notices must be retained in any derived work.
34 NRL grants permission for redistribution and use in source and binary
35 forms, with or without modification, of the software and documentation
36 created at NRL provided that the following conditions are met:
38 1. Redistributions of source code must retain the above copyright
39 notice, this list of conditions and the following disclaimer.
40 2. Redistributions in binary form must reproduce the above copyright
41 notice, this list of conditions and the following disclaimer in the
42 documentation and/or other materials provided with the distribution.
43 3. All advertising materials mentioning features or use of this software
44 must display the following acknowledgement:
46 This product includes software developed at the Information
47 Technology Division, US Naval Research Laboratory.
49 4. Neither the name of the NRL nor the names of its contributors
50 may be used to endorse or promote products derived from this software
51 without specific prior written permission.
53 THE SOFTWARE PROVIDED BY NRL IS PROVIDED BY NRL AND CONTRIBUTORS ``AS
54 IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
55 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
56 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NRL OR
57 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
58 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
59 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
60 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
61 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
62 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
63 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65 The views and conclusions contained in the software and documentation
66 are those of the authors and should not be interpreted as representing
67 official policies, either expressed or implied, of the US Naval
68 Research Laboratory (NRL).
70 ----------------------------------------------------------------------*/
74 /* IDL_* is IPv6 Debug Level */
76 #define IDL_ALL 0xFFFFFFFE /* Report all messages. */
77 #define IDL_NONE 0 /* Report no messages. */
79 #define IDL_CRITICAL 3
81 #define IDL_MAJOR_EVENT 10
83 #define IDL_GROSS_EVENT 20
84 #define IDL_FINISHED 0xFFFFFFF0
87 * Make sure argument for DPRINTF is in parentheses.
89 * For both DPRINTF and DDO, and attempt was made to make both macros
90 * be usable as normal C statments. There is a small amount of compiler
91 * trickery (if-else clauses with effectively null statements), which may
92 * cause a few compilers to complain.
98 * DPRINTF() is a general printf statement. The "arg" is literally what
99 * would follow the function name printf, which means it has to be in
100 * parenthesis. Unlimited arguments can be used this way.
103 * DPRINTF(IDL_MAJOR_EVENT,("Hello, world. IP version %d.\n",vers));
105 #define DPRINTF(lev,arg) \
106 if ((lev) < in6_debug_level) { \
109 in6_debug_level = in6_debug_level
112 * DDO() executes a series of statements at a certain debug level. The
113 * "stmt" argument is a statement in the sense of a "statement list" in a
114 * C grammar. "stmt" does not have to end with a semicolon.
117 * DDO(IDL_CRITICAL,dump_ipv6(header), dump_inpcb(inp));
119 #define DDO(lev,stmt) \
120 if ((lev) < in6_debug_level) { \
123 in6_debug_level = in6_debug_level
126 * DP() is a shortcut for DPRINTF(). Basically:
128 * DP(lev, var, fmt) == DPRINTF(IDL_lev, ("var = %fmt\n", var))
130 * It is handy for printing single variables without a lot of typing.
134 * DP(CRITICAL,length,d);
135 * same as DPRINTF(IDL_CRITICAL, ("length = %d\n", length))
137 #define DP(lev, var, fmt) DPRINTF(IDL_ ## lev, (#var " = %" #fmt "\n", var))
141 extern void in6_debug_init __P((void));
143 extern void dump_in6_addr __P((struct in6_addr *));
145 extern void dump_in_addr __P((struct in_addr *));
147 extern void dump_sockaddr_in6 __P((struct sockaddr_in6 *));
149 extern void dump_sockaddr_in __P((struct sockaddr_in *));
150 extern void dump_sockaddr __P((struct sockaddr *));
151 extern void dump_sockaddr_dl __P((struct sockaddr_dl *));
152 extern void dump_smart_sockaddr __P((struct sockaddr *));
154 extern void dump_ipv6 __P((struct ip6 *));
155 extern void dump_ipv6_icmp __P((struct icmp6 *));
157 extern void dump_mbuf_hdr __P((struct mbuf *));
158 extern void dump_mbuf __P((struct mbuf *));
159 extern void dump_mchain __P((struct mbuf *));
160 extern void dump_tcpdump __P((struct mbuf *));
161 extern void dump_ifa __P((struct ifaddr *));
162 extern void dump_ifp __P((struct ifnet *));
163 extern void dump_route __P((struct route *));
164 extern void dump_rtentry __P((struct rtentry *));
165 extern void dump_inpcb __P((struct inpcb *));
167 extern void dump_in6pcb __P((struct in6pcb *));
169 extern void dump_buf __P((char *, int));
170 extern void dump_keytblnode __P((struct key_tblnode *));
171 extern void dump_secassoc __P((struct key_secassoc *));
172 extern void dump_keymsghdr __P((struct key_msghdr *));
173 extern void dump_keymsginfo __P((struct key_msgdata *));
175 #else /* ! KEY_DEBUG */
177 #define DPRINTF(lev,arg)
178 #define DDO(lev, stmt)
181 #endif /* KEY_DEBUG */
183 #ifndef INET6_DEBUG_C
184 extern unsigned int in6_debug_level;