1135446Strhodes/*
2193149Sdougb * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
3135446Strhodes * Copyright (C) 1999-2001  Internet Software Consortium.
4135446Strhodes *
5193149Sdougb * Permission to use, copy, modify, and/or distribute this software for any
6135446Strhodes * purpose with or without fee is hereby granted, provided that the above
7135446Strhodes * copyright notice and this permission notice appear in all copies.
8135446Strhodes *
9135446Strhodes * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10135446Strhodes * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11135446Strhodes * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12135446Strhodes * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13135446Strhodes * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14135446Strhodes * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15135446Strhodes * PERFORMANCE OF THIS SOFTWARE.
16135446Strhodes */
17135446Strhodes
18234010Sdougb/* $Id: cert.h,v 1.19 2007/06/19 23:47:16 tbox Exp $ */
19135446Strhodes
20135446Strhodes#ifndef DNS_CERT_H
21135446Strhodes#define DNS_CERT_H 1
22135446Strhodes
23193149Sdougb/*! \file dns/cert.h */
24170222Sdougb
25135446Strhodes#include <isc/lang.h>
26135446Strhodes
27135446Strhodes#include <dns/types.h>
28135446Strhodes
29135446StrhodesISC_LANG_BEGINDECLS
30135446Strhodes
31135446Strhodesisc_result_t
32135446Strhodesdns_cert_fromtext(dns_cert_t *certp, isc_textregion_t *source);
33170222Sdougb/*%<
34135446Strhodes * Convert the text 'source' refers to into a certificate type.
35135446Strhodes * The text may contain either a mnemonic type name or a decimal type number.
36135446Strhodes *
37135446Strhodes * Requires:
38170222Sdougb *\li	'certp' is a valid pointer.
39135446Strhodes *
40170222Sdougb *\li	'source' is a valid text region.
41135446Strhodes *
42135446Strhodes * Returns:
43170222Sdougb *\li	#ISC_R_SUCCESS			on success
44170222Sdougb *\li	#ISC_R_RANGE			numeric type is out of range
45170222Sdougb *\li	#DNS_R_UNKNOWN			mnemonic type is unknown
46135446Strhodes */
47135446Strhodes
48135446Strhodesisc_result_t
49135446Strhodesdns_cert_totext(dns_cert_t cert, isc_buffer_t *target);
50170222Sdougb/*%<
51135446Strhodes * Put a textual representation of certificate type 'cert' into 'target'.
52135446Strhodes *
53135446Strhodes * Requires:
54170222Sdougb *\li	'cert' is a valid cert.
55135446Strhodes *
56170222Sdougb *\li	'target' is a valid text buffer.
57135446Strhodes *
58135446Strhodes * Ensures:
59170222Sdougb *\li	If the result is success:
60135446Strhodes *		The used space in 'target' is updated.
61135446Strhodes *
62135446Strhodes * Returns:
63170222Sdougb *\li	#ISC_R_SUCCESS			on success
64170222Sdougb *\li	#ISC_R_NOSPACE			target buffer is too small
65135446Strhodes */
66135446Strhodes
67135446StrhodesISC_LANG_ENDDECLS
68135446Strhodes
69135446Strhodes#endif /* DNS_CERT_H */
70