key_debug.h revision 181803
1184588Sdfr/*	$FreeBSD: head/sys/netipsec/key_debug.h 181803 2008-08-17 23:27:27Z bz $	*/
2184588Sdfr/*	$KAME: key_debug.h,v 1.10 2001/08/05 08:37:52 itojun Exp $	*/
3184588Sdfr
4184588Sdfr/*-
5184588Sdfr * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6184588Sdfr * All rights reserved.
7184588Sdfr *
8184588Sdfr * Redistribution and use in source and binary forms, with or without
9184588Sdfr * modification, are permitted provided that the following conditions
10184588Sdfr * are met:
11184588Sdfr * 1. Redistributions of source code must retain the above copyright
12184588Sdfr *    notice, this list of conditions and the following disclaimer.
13184588Sdfr * 2. Redistributions in binary form must reproduce the above copyright
14184588Sdfr *    notice, this list of conditions and the following disclaimer in the
15184588Sdfr *    documentation and/or other materials provided with the distribution.
16184588Sdfr * 3. Neither the name of the project nor the names of its contributors
17184588Sdfr *    may be used to endorse or promote products derived from this software
18184588Sdfr *    without specific prior written permission.
19184588Sdfr *
20184588Sdfr * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
21184588Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22184588Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23184588Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
24184588Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25184588Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26184588Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27184588Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28184588Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29184588Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30184588Sdfr * SUCH DAMAGE.
31184588Sdfr */
32184588Sdfr
33184588Sdfr#ifndef _NETIPSEC_KEY_DEBUG_H_
34184588Sdfr#define _NETIPSEC_KEY_DEBUG_H_
35184588Sdfr
36184588Sdfr#ifdef _KERNEL
37184588Sdfr/* debug flags */
38184588Sdfr#define KEYDEBUG_STAMP		0x00000001 /* path */
39184588Sdfr#define KEYDEBUG_DATA		0x00000002 /* data */
40184588Sdfr#define KEYDEBUG_DUMP		0x00000004 /* dump */
41184588Sdfr
42184588Sdfr#define KEYDEBUG_KEY		0x00000010 /* key processing */
43184588Sdfr#define KEYDEBUG_ALG		0x00000020 /* ciph & auth algorithm */
44184588Sdfr#define KEYDEBUG_IPSEC		0x00000040 /* ipsec processing */
45184588Sdfr
46184588Sdfr#define KEYDEBUG_KEY_STAMP	(KEYDEBUG_KEY | KEYDEBUG_STAMP)
47184588Sdfr#define KEYDEBUG_KEY_DATA	(KEYDEBUG_KEY | KEYDEBUG_DATA)
48184588Sdfr#define KEYDEBUG_KEY_DUMP	(KEYDEBUG_KEY | KEYDEBUG_DUMP)
49184588Sdfr#define KEYDEBUG_ALG_STAMP	(KEYDEBUG_ALG | KEYDEBUG_STAMP)
50184588Sdfr#define KEYDEBUG_ALG_DATA	(KEYDEBUG_ALG | KEYDEBUG_DATA)
51184588Sdfr#define KEYDEBUG_ALG_DUMP	(KEYDEBUG_ALG | KEYDEBUG_DUMP)
52184588Sdfr#define KEYDEBUG_IPSEC_STAMP	(KEYDEBUG_IPSEC | KEYDEBUG_STAMP)
53184588Sdfr#define KEYDEBUG_IPSEC_DATA	(KEYDEBUG_IPSEC | KEYDEBUG_DATA)
54184588Sdfr#define KEYDEBUG_IPSEC_DUMP	(KEYDEBUG_IPSEC | KEYDEBUG_DUMP)
55184588Sdfr
56184588Sdfr#define KEYDEBUG(lev,arg) \
57184588Sdfr	do { if ((V_key_debug_level & (lev)) == (lev)) { arg; } } while (0)
58184588Sdfr
59184588Sdfrextern u_int32_t key_debug_level;
60184588Sdfr#endif /*_KERNEL*/
61184588Sdfr
62184588Sdfrstruct sadb_msg;
63184588Sdfrstruct sadb_ext;
64184588Sdfrextern void kdebug_sadb __P((struct sadb_msg *));
65184588Sdfrextern void kdebug_sadb_x_policy __P((struct sadb_ext *));
66184588Sdfr
67184588Sdfr#ifdef _KERNEL
68184588Sdfrstruct secpolicy;
69184588Sdfrstruct secpolicyindex;
70184588Sdfrstruct secasindex;
71184588Sdfrstruct secasvar;
72184588Sdfrstruct secreplay;
73184588Sdfrstruct mbuf;
74184588Sdfrextern void kdebug_secpolicy __P((struct secpolicy *));
75184588Sdfrextern void kdebug_secpolicyindex __P((struct secpolicyindex *));
76184588Sdfrextern void kdebug_secasindex __P((struct secasindex *));
77184588Sdfrextern void kdebug_secasv __P((struct secasvar *));
78184588Sdfrextern void kdebug_mbufhdr __P((struct mbuf *));
79184588Sdfrextern void kdebug_mbuf __P((struct mbuf *));
80184588Sdfr#endif /*_KERNEL*/
81184588Sdfr
82184588Sdfrstruct sockaddr;
83184588Sdfrextern void kdebug_sockaddr __P((struct sockaddr *));
84184588Sdfr
85184588Sdfrextern void ipsec_hexdump __P((caddr_t, int));
86184588Sdfrextern void ipsec_bindump __P((caddr_t, int));
87184588Sdfr
88184588Sdfr#endif /* _NETIPSEC_KEY_DEBUG_H_ */
89184588Sdfr