1135446Strhodes/*
2193149Sdougb * Copyright (C) 2004-2008  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: rcode.h,v 1.21 2008/09/25 04:02:39 tbox Exp $ */
19135446Strhodes
20135446Strhodes#ifndef DNS_RCODE_H
21135446Strhodes#define DNS_RCODE_H 1
22135446Strhodes
23193149Sdougb/*! \file dns/rcode.h */
24170222Sdougb
25135446Strhodes#include <isc/lang.h>
26135446Strhodes
27135446Strhodes#include <dns/types.h>
28135446Strhodes
29135446StrhodesISC_LANG_BEGINDECLS
30135446Strhodes
31135446Strhodesisc_result_t dns_rcode_fromtext(dns_rcode_t *rcodep, isc_textregion_t *source);
32170222Sdougb/*%<
33135446Strhodes * Convert the text 'source' refers to into a DNS error value.
34135446Strhodes *
35135446Strhodes * Requires:
36170222Sdougb *\li	'rcodep' is a valid pointer.
37135446Strhodes *
38170222Sdougb *\li	'source' is a valid text region.
39135446Strhodes *
40135446Strhodes * Returns:
41170222Sdougb *\li	#ISC_R_SUCCESS			on success
42170222Sdougb *\li	#DNS_R_UNKNOWN			type is unknown
43135446Strhodes */
44135446Strhodes
45135446Strhodesisc_result_t dns_rcode_totext(dns_rcode_t rcode, isc_buffer_t *target);
46170222Sdougb/*%<
47135446Strhodes * Put a textual representation of error 'rcode' into 'target'.
48135446Strhodes *
49135446Strhodes * Requires:
50170222Sdougb *\li	'rcode' is a valid rcode.
51135446Strhodes *
52170222Sdougb *\li	'target' is a valid text buffer.
53135446Strhodes *
54135446Strhodes * Ensures:
55170222Sdougb *\li	If the result is success:
56135446Strhodes *		The used space in 'target' is updated.
57135446Strhodes *
58135446Strhodes * Returns:
59170222Sdougb *\li	#ISC_R_SUCCESS			on success
60170222Sdougb *\li	#ISC_R_NOSPACE			target buffer is too small
61135446Strhodes */
62135446Strhodes
63135446Strhodesisc_result_t dns_tsigrcode_fromtext(dns_rcode_t *rcodep,
64135446Strhodes				    isc_textregion_t *source);
65170222Sdougb/*%<
66135446Strhodes * Convert the text 'source' refers to into a TSIG/TKEY error value.
67135446Strhodes *
68135446Strhodes * Requires:
69170222Sdougb *\li	'rcodep' is a valid pointer.
70135446Strhodes *
71170222Sdougb *\li	'source' is a valid text region.
72135446Strhodes *
73135446Strhodes * Returns:
74170222Sdougb *\li	#ISC_R_SUCCESS			on success
75170222Sdougb *\li	#DNS_R_UNKNOWN			type is unknown
76135446Strhodes */
77135446Strhodes
78135446Strhodesisc_result_t dns_tsigrcode_totext(dns_rcode_t rcode, isc_buffer_t *target);
79170222Sdougb/*%<
80135446Strhodes * Put a textual representation of TSIG/TKEY error 'rcode' into 'target'.
81135446Strhodes *
82135446Strhodes * Requires:
83170222Sdougb *\li	'rcode' is a valid TSIG/TKEY error code.
84135446Strhodes *
85170222Sdougb *\li	'target' is a valid text buffer.
86135446Strhodes *
87135446Strhodes * Ensures:
88170222Sdougb *\li	If the result is success:
89135446Strhodes *		The used space in 'target' is updated.
90135446Strhodes *
91135446Strhodes * Returns:
92170222Sdougb *\li	#ISC_R_SUCCESS			on success
93170222Sdougb *\li	#ISC_R_NOSPACE			target buffer is too small
94135446Strhodes */
95135446Strhodes
96193149Sdougbisc_result_t
97193149Sdougbdns_hashalg_fromtext(unsigned char *hashalg, isc_textregion_t *source);
98193149Sdougb/*%<
99193149Sdougb * Convert the text 'source' refers to into a has algorithm value.
100193149Sdougb *
101193149Sdougb * Requires:
102193149Sdougb *\li	'hashalg' is a valid pointer.
103193149Sdougb *
104193149Sdougb *\li	'source' is a valid text region.
105193149Sdougb *
106193149Sdougb * Returns:
107193149Sdougb *\li	#ISC_R_SUCCESS			on success
108193149Sdougb *\li	#DNS_R_UNKNOWN			type is unknown
109193149Sdougb */
110193149Sdougb
111135446StrhodesISC_LANG_ENDDECLS
112135446Strhodes
113135446Strhodes#endif /* DNS_RCODE_H */
114