1/*	$NetBSD: cert.h,v 1.2.6.1 2012/06/05 21:14:55 bouyer Exp $	*/
2
3/*
4 * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 1999-2001  Internet Software Consortium.
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19
20/* Id: cert.h,v 1.19 2007/06/19 23:47:16 tbox Exp  */
21
22#ifndef DNS_CERT_H
23#define DNS_CERT_H 1
24
25/*! \file dns/cert.h */
26
27#include <isc/lang.h>
28
29#include <dns/types.h>
30
31ISC_LANG_BEGINDECLS
32
33isc_result_t
34dns_cert_fromtext(dns_cert_t *certp, isc_textregion_t *source);
35/*%<
36 * Convert the text 'source' refers to into a certificate type.
37 * The text may contain either a mnemonic type name or a decimal type number.
38 *
39 * Requires:
40 *\li	'certp' is a valid pointer.
41 *
42 *\li	'source' is a valid text region.
43 *
44 * Returns:
45 *\li	#ISC_R_SUCCESS			on success
46 *\li	#ISC_R_RANGE			numeric type is out of range
47 *\li	#DNS_R_UNKNOWN			mnemonic type is unknown
48 */
49
50isc_result_t
51dns_cert_totext(dns_cert_t cert, isc_buffer_t *target);
52/*%<
53 * Put a textual representation of certificate type 'cert' into 'target'.
54 *
55 * Requires:
56 *\li	'cert' is a valid cert.
57 *
58 *\li	'target' is a valid text buffer.
59 *
60 * Ensures:
61 *\li	If the result is success:
62 *		The used space in 'target' is updated.
63 *
64 * Returns:
65 *\li	#ISC_R_SUCCESS			on success
66 *\li	#ISC_R_NOSPACE			target buffer is too small
67 */
68
69ISC_LANG_ENDDECLS
70
71#endif /* DNS_CERT_H */
72