xref: /netbsd-src/external/mpl/dhcp/bind/dist/lib/dns/include/dns/cert.h (revision 4afad4b7fa6d4a0d3dedf41d1587a7250710ae54)
1 /*	$NetBSD: cert.h,v 1.1 2024/02/18 20:57:35 christos Exp $	*/
2 
3 /*
4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5  *
6  * SPDX-License-Identifier: MPL-2.0
7  *
8  * This Source Code Form is subject to the terms of the Mozilla Public
9  * License, v. 2.0. If a copy of the MPL was not distributed with this
10  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
11  *
12  * See the COPYRIGHT file distributed with this work for additional
13  * information regarding copyright ownership.
14  */
15 
16 #ifndef DNS_CERT_H
17 #define DNS_CERT_H 1
18 
19 /*! \file dns/cert.h */
20 
21 #include <isc/lang.h>
22 
23 #include <dns/types.h>
24 
25 ISC_LANG_BEGINDECLS
26 
27 isc_result_t
28 dns_cert_fromtext(dns_cert_t *certp, isc_textregion_t *source);
29 /*%<
30  * Convert the text 'source' refers to into a certificate type.
31  * The text may contain either a mnemonic type name or a decimal type number.
32  *
33  * Requires:
34  *\li	'certp' is a valid pointer.
35  *
36  *\li	'source' is a valid text region.
37  *
38  * Returns:
39  *\li	#ISC_R_SUCCESS			on success
40  *\li	#ISC_R_RANGE			numeric type is out of range
41  *\li	#DNS_R_UNKNOWN			mnemonic type is unknown
42  */
43 
44 isc_result_t
45 dns_cert_totext(dns_cert_t cert, isc_buffer_t *target);
46 /*%<
47  * Put a textual representation of certificate type 'cert' into 'target'.
48  *
49  * Requires:
50  *\li	'cert' is a valid cert.
51  *
52  *\li	'target' is a valid text buffer.
53  *
54  * Ensures:
55  *\li	If the result is success:
56  *		The used space in 'target' is updated.
57  *
58  * Returns:
59  *\li	#ISC_R_SUCCESS			on success
60  *\li	#ISC_R_NOSPACE			target buffer is too small
61  */
62 
63 ISC_LANG_ENDDECLS
64 
65 #endif /* DNS_CERT_H */
66