1105197Ssam/*	$FreeBSD$	*/
2105197Ssam/*	$KAME: key_debug.h,v 1.10 2001/08/05 08:37:52 itojun Exp $	*/
3105197Ssam
4139823Simp/*-
5105197Ssam * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6105197Ssam * All rights reserved.
7105197Ssam *
8105197Ssam * Redistribution and use in source and binary forms, with or without
9105197Ssam * modification, are permitted provided that the following conditions
10105197Ssam * are met:
11105197Ssam * 1. Redistributions of source code must retain the above copyright
12105197Ssam *    notice, this list of conditions and the following disclaimer.
13105197Ssam * 2. Redistributions in binary form must reproduce the above copyright
14105197Ssam *    notice, this list of conditions and the following disclaimer in the
15105197Ssam *    documentation and/or other materials provided with the distribution.
16105197Ssam * 3. Neither the name of the project nor the names of its contributors
17105197Ssam *    may be used to endorse or promote products derived from this software
18105197Ssam *    without specific prior written permission.
19105197Ssam *
20105197Ssam * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
21105197Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22105197Ssam * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23105197Ssam * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
24105197Ssam * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25105197Ssam * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26105197Ssam * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27105197Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28105197Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29105197Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30105197Ssam * SUCH DAMAGE.
31105197Ssam */
32105197Ssam
33105197Ssam#ifndef _NETIPSEC_KEY_DEBUG_H_
34105197Ssam#define _NETIPSEC_KEY_DEBUG_H_
35105197Ssam
36105197Ssam#ifdef _KERNEL
37105197Ssam/* debug flags */
38105197Ssam#define KEYDEBUG_STAMP		0x00000001 /* path */
39105197Ssam#define KEYDEBUG_DATA		0x00000002 /* data */
40105197Ssam#define KEYDEBUG_DUMP		0x00000004 /* dump */
41105197Ssam
42105197Ssam#define KEYDEBUG_KEY		0x00000010 /* key processing */
43105197Ssam#define KEYDEBUG_ALG		0x00000020 /* ciph & auth algorithm */
44105197Ssam#define KEYDEBUG_IPSEC		0x00000040 /* ipsec processing */
45105197Ssam
46105197Ssam#define KEYDEBUG_KEY_STAMP	(KEYDEBUG_KEY | KEYDEBUG_STAMP)
47105197Ssam#define KEYDEBUG_KEY_DATA	(KEYDEBUG_KEY | KEYDEBUG_DATA)
48105197Ssam#define KEYDEBUG_KEY_DUMP	(KEYDEBUG_KEY | KEYDEBUG_DUMP)
49105197Ssam#define KEYDEBUG_ALG_STAMP	(KEYDEBUG_ALG | KEYDEBUG_STAMP)
50105197Ssam#define KEYDEBUG_ALG_DATA	(KEYDEBUG_ALG | KEYDEBUG_DATA)
51105197Ssam#define KEYDEBUG_ALG_DUMP	(KEYDEBUG_ALG | KEYDEBUG_DUMP)
52105197Ssam#define KEYDEBUG_IPSEC_STAMP	(KEYDEBUG_IPSEC | KEYDEBUG_STAMP)
53105197Ssam#define KEYDEBUG_IPSEC_DATA	(KEYDEBUG_IPSEC | KEYDEBUG_DATA)
54105197Ssam#define KEYDEBUG_IPSEC_DUMP	(KEYDEBUG_IPSEC | KEYDEBUG_DUMP)
55105197Ssam
56105197Ssam#define KEYDEBUG(lev,arg) \
57181803Sbz	do { if ((V_key_debug_level & (lev)) == (lev)) { arg; } } while (0)
58105197Ssam
59195699SrwatsonVNET_DECLARE(u_int32_t, key_debug_level);
60195727Srwatson#define	V_key_debug_level	VNET(key_debug_level)
61105197Ssam#endif /*_KERNEL*/
62105197Ssam
63105197Ssamstruct sadb_msg;
64105197Ssamstruct sadb_ext;
65283902Saeextern void kdebug_sadb(struct sadb_msg *);
66283902Saeextern void kdebug_sadb_x_policy(struct sadb_ext *);
67105197Ssam
68105197Ssam#ifdef _KERNEL
69105197Ssamstruct secpolicy;
70105197Ssamstruct secpolicyindex;
71105197Ssamstruct secasindex;
72105197Ssamstruct secasvar;
73105197Ssamstruct secreplay;
74105197Ssamstruct mbuf;
75283902Saeextern void kdebug_secpolicy(struct secpolicy *);
76283902Saeextern void kdebug_secpolicyindex(struct secpolicyindex *);
77283902Saeextern void kdebug_secasindex(struct secasindex *);
78283902Saeextern void kdebug_secasv(struct secasvar *);
79283902Saeextern void kdebug_mbufhdr(struct mbuf *);
80283902Saeextern void kdebug_mbuf(struct mbuf *);
81105197Ssam#endif /*_KERNEL*/
82105197Ssam
83105197Ssamstruct sockaddr;
84283902Saeextern void kdebug_sockaddr(struct sockaddr *);
85105197Ssam
86283902Saeextern void ipsec_hexdump(caddr_t, int);
87283902Saeextern void ipsec_bindump(caddr_t, int);
88105197Ssam
89105197Ssam#endif /* _NETIPSEC_KEY_DEBUG_H_ */
90