193bf6008Sagc /*-
293bf6008Sagc  * Copyright (c) 2009 The NetBSD Foundation, Inc.
393bf6008Sagc  * All rights reserved.
493bf6008Sagc  *
593bf6008Sagc  * This code is derived from software contributed to The NetBSD Foundation
693bf6008Sagc  * by Alistair Crooks (agc@netbsd.org)
793bf6008Sagc  *
893bf6008Sagc  * Redistribution and use in source and binary forms, with or without
993bf6008Sagc  * modification, are permitted provided that the following conditions
1093bf6008Sagc  * are met:
1193bf6008Sagc  * 1. Redistributions of source code must retain the above copyright
1293bf6008Sagc  *    notice, this list of conditions and the following disclaimer.
1393bf6008Sagc  * 2. Redistributions in binary form must reproduce the above copyright
1493bf6008Sagc  *    notice, this list of conditions and the following disclaimer in the
1593bf6008Sagc  *    documentation and/or other materials provided with the distribution.
1693bf6008Sagc  *
1793bf6008Sagc  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1893bf6008Sagc  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1993bf6008Sagc  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2093bf6008Sagc  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2193bf6008Sagc  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2293bf6008Sagc  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2393bf6008Sagc  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2493bf6008Sagc  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2593bf6008Sagc  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2693bf6008Sagc  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2793bf6008Sagc  * POSSIBILITY OF SUCH DAMAGE.
2893bf6008Sagc  */
2993bf6008Sagc #ifndef NETPGPDEFS_H_
3093bf6008Sagc #define NETPGPDEFS_H_	1
3193bf6008Sagc 
3293bf6008Sagc #define PRItime		"ll"
3393bf6008Sagc 
3493bf6008Sagc #ifdef WIN32
3593bf6008Sagc #define PRIsize		"I"
3693bf6008Sagc #else
3793bf6008Sagc #define PRIsize		"z"
3893bf6008Sagc #endif
3993bf6008Sagc 
4093bf6008Sagc /* for silencing unused parameter warnings */
41*fc1f8641Sagc #define __PGP_USED(x)	/*LINTED*/(void)&(x)
4293bf6008Sagc 
4393bf6008Sagc #ifndef __UNCONST
4493bf6008Sagc #define __UNCONST(a)	((void *)(unsigned long)(const void *)(a))
4593bf6008Sagc #endif
4693bf6008Sagc 
4793bf6008Sagc /* number of elements in an array */
48*fc1f8641Sagc #define PGP_ARRAY_SIZE(a)       (sizeof(a)/sizeof(*(a)))
4993bf6008Sagc 
5047561e26Sagc void            hexdump(FILE *, const char *, const uint8_t *, size_t);
5193bf6008Sagc 
52*fc1f8641Sagc const char     *pgp_str_from_map(int, pgp_map_t *);
5393bf6008Sagc 
54*fc1f8641Sagc int             pgp_set_debug_level(const char *);
55*fc1f8641Sagc int             pgp_get_debug_level(const char *);
5693bf6008Sagc 
57*fc1f8641Sagc void		*pgp_new(size_t);
589b753456Sagc 
5993bf6008Sagc #define NETPGP_BUFSIZ	8192
6093bf6008Sagc 
6141335e2dSagc #define CALLBACK(t, cbinfo, pkt)	do {				\
6241335e2dSagc 	(pkt)->tag = (t);						\
63*fc1f8641Sagc 	if (pgp_callback(pkt, cbinfo) == PGP_RELEASE_MEMORY) {	\
64*fc1f8641Sagc 		pgp_parser_content_free(pkt);				\
6593bf6008Sagc 	}								\
6693bf6008Sagc } while(/* CONSTCOND */0)
6793bf6008Sagc 
6893bf6008Sagc #endif /* !NETPGPDEFS_H_ */
69