key_debug.h revision 256281
1139749Simp/*	$FreeBSD: stable/10/sys/netipsec/key_debug.h 195727 2009-07-16 21:13:04Z rwatson $	*/
2139749Simp/*	$KAME: key_debug.h,v 1.10 2001/08/05 08:37:52 itojun Exp $	*/
365312Smsmith
465312Smsmith/*-
565312Smsmith * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
682092Sscottl * All rights reserved.
796554Sobrien *
865312Smsmith * Redistribution and use in source and binary forms, with or without
982092Sscottl * modification, are permitted provided that the following conditions
1065312Smsmith * are met:
1182092Sscottl * 1. Redistributions of source code must retain the above copyright
1265312Smsmith *    notice, this list of conditions and the following disclaimer.
1365312Smsmith * 2. Redistributions in binary form must reproduce the above copyright
1465312Smsmith *    notice, this list of conditions and the following disclaimer in the
1582092Sscottl *    documentation and/or other materials provided with the distribution.
1665312Smsmith * 3. Neither the name of the project nor the names of its contributors
1765312Smsmith *    may be used to endorse or promote products derived from this software
1865312Smsmith *    without specific prior written permission.
1965312Smsmith *
2065312Smsmith * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
2165312Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2265312Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2365312Smsmith * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2465312Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2565312Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2665312Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2782092Sscottl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2865312Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2965312Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3096554Sobrien * SUCH DAMAGE.
3165312Smsmith */
3265312Smsmith
3365312Smsmith#ifndef _NETIPSEC_KEY_DEBUG_H_
3465312Smsmith#define _NETIPSEC_KEY_DEBUG_H_
3565312Smsmith
3682092Sscottl#ifdef _KERNEL
3765312Smsmith/* debug flags */
3865312Smsmith#define KEYDEBUG_STAMP		0x00000001 /* path */
3965312Smsmith#define KEYDEBUG_DATA		0x00000002 /* data */
4065312Smsmith#define KEYDEBUG_DUMP		0x00000004 /* dump */
4165312Smsmith
4265312Smsmith#define KEYDEBUG_KEY		0x00000010 /* key processing */
4382092Sscottl#define KEYDEBUG_ALG		0x00000020 /* ciph & auth algorithm */
4465312Smsmith#define KEYDEBUG_IPSEC		0x00000040 /* ipsec processing */
4565312Smsmith
4665312Smsmith#define KEYDEBUG_KEY_STAMP	(KEYDEBUG_KEY | KEYDEBUG_STAMP)
4765312Smsmith#define KEYDEBUG_KEY_DATA	(KEYDEBUG_KEY | KEYDEBUG_DATA)
4882092Sscottl#define KEYDEBUG_KEY_DUMP	(KEYDEBUG_KEY | KEYDEBUG_DUMP)
4965312Smsmith#define KEYDEBUG_ALG_STAMP	(KEYDEBUG_ALG | KEYDEBUG_STAMP)
5065312Smsmith#define KEYDEBUG_ALG_DATA	(KEYDEBUG_ALG | KEYDEBUG_DATA)
5165312Smsmith#define KEYDEBUG_ALG_DUMP	(KEYDEBUG_ALG | KEYDEBUG_DUMP)
5282092Sscottl#define KEYDEBUG_IPSEC_STAMP	(KEYDEBUG_IPSEC | KEYDEBUG_STAMP)
5365312Smsmith#define KEYDEBUG_IPSEC_DATA	(KEYDEBUG_IPSEC | KEYDEBUG_DATA)
5465312Smsmith#define KEYDEBUG_IPSEC_DUMP	(KEYDEBUG_IPSEC | KEYDEBUG_DUMP)
5565312Smsmith
5665312Smsmith#define KEYDEBUG(lev,arg) \
5782092Sscottl	do { if ((V_key_debug_level & (lev)) == (lev)) { arg; } } while (0)
5865312Smsmith
5965312SmsmithVNET_DECLARE(u_int32_t, key_debug_level);
6065312Smsmith#define	V_key_debug_level	VNET(key_debug_level)
6165312Smsmith#endif /*_KERNEL*/
6265312Smsmith
6382092Sscottlstruct sadb_msg;
6465312Smsmithstruct sadb_ext;
6596554Sobrienextern void kdebug_sadb __P((struct sadb_msg *));
6665312Smsmithextern void kdebug_sadb_x_policy __P((struct sadb_ext *));
6782092Sscottl
6865312Smsmith#ifdef _KERNEL
6965312Smsmithstruct secpolicy;
7065312Smsmithstruct secpolicyindex;
7165312Smsmithstruct secasindex;
7282092Sscottlstruct secasvar;
7365312Smsmithstruct secreplay;
7482092Sscottlstruct mbuf;
7565312Smsmithextern void kdebug_secpolicy __P((struct secpolicy *));
7696554Sobrienextern void kdebug_secpolicyindex __P((struct secpolicyindex *));
7765312Smsmithextern void kdebug_secasindex __P((struct secasindex *));
7865312Smsmithextern void kdebug_secasv __P((struct secasvar *));
7987826Sobrienextern void kdebug_mbufhdr __P((struct mbuf *));
8087826Sobrienextern void kdebug_mbuf __P((struct mbuf *));
8187826Sobrien#endif /*_KERNEL*/
8265312Smsmith
8365312Smsmithstruct sockaddr;
8465312Smsmithextern void kdebug_sockaddr __P((struct sockaddr *));
8565312Smsmith
8665312Smsmithextern void ipsec_hexdump __P((caddr_t, int));
8765312Smsmithextern void ipsec_bindump __P((caddr_t, int));
8865312Smsmith
8965312Smsmith#endif /* _NETIPSEC_KEY_DEBUG_H_ */
9065312Smsmith