1 /* $NetBSD: rcode.h,v 1.4 2014/12/10 04:37:58 christos Exp $ */ 2 3 /* 4 * Copyright (C) 2004-2008 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: rcode.h,v 1.21 2008/09/25 04:02:39 tbox Exp */ 21 22 #ifndef DNS_RCODE_H 23 #define DNS_RCODE_H 1 24 25 /*! \file dns/rcode.h */ 26 27 #include <isc/lang.h> 28 29 #include <dns/types.h> 30 31 ISC_LANG_BEGINDECLS 32 33 isc_result_t dns_rcode_fromtext(dns_rcode_t *rcodep, isc_textregion_t *source); 34 /*%< 35 * Convert the text 'source' refers to into a DNS error value. 36 * 37 * Requires: 38 *\li 'rcodep' is a valid pointer. 39 * 40 *\li 'source' is a valid text region. 41 * 42 * Returns: 43 *\li #ISC_R_SUCCESS on success 44 *\li #DNS_R_UNKNOWN type is unknown 45 */ 46 47 isc_result_t dns_rcode_totext(dns_rcode_t rcode, isc_buffer_t *target); 48 /*%< 49 * Put a textual representation of error 'rcode' into 'target'. 50 * 51 * Requires: 52 *\li 'rcode' is a valid rcode. 53 * 54 *\li 'target' is a valid text buffer. 55 * 56 * Ensures: 57 *\li If the result is success: 58 * The used space in 'target' is updated. 59 * 60 * Returns: 61 *\li #ISC_R_SUCCESS on success 62 *\li #ISC_R_NOSPACE target buffer is too small 63 */ 64 65 isc_result_t dns_tsigrcode_fromtext(dns_rcode_t *rcodep, 66 isc_textregion_t *source); 67 /*%< 68 * Convert the text 'source' refers to into a TSIG/TKEY error value. 69 * 70 * Requires: 71 *\li 'rcodep' is a valid pointer. 72 * 73 *\li 'source' is a valid text region. 74 * 75 * Returns: 76 *\li #ISC_R_SUCCESS on success 77 *\li #DNS_R_UNKNOWN type is unknown 78 */ 79 80 isc_result_t dns_tsigrcode_totext(dns_rcode_t rcode, isc_buffer_t *target); 81 /*%< 82 * Put a textual representation of TSIG/TKEY error 'rcode' into 'target'. 83 * 84 * Requires: 85 *\li 'rcode' is a valid TSIG/TKEY error code. 86 * 87 *\li 'target' is a valid text buffer. 88 * 89 * Ensures: 90 *\li If the result is success: 91 * The used space in 'target' is updated. 92 * 93 * Returns: 94 *\li #ISC_R_SUCCESS on success 95 *\li #ISC_R_NOSPACE target buffer is too small 96 */ 97 98 isc_result_t 99 dns_hashalg_fromtext(unsigned char *hashalg, isc_textregion_t *source); 100 /*%< 101 * Convert the text 'source' refers to into a has algorithm value. 102 * 103 * Requires: 104 *\li 'hashalg' is a valid pointer. 105 * 106 *\li 'source' is a valid text region. 107 * 108 * Returns: 109 *\li #ISC_R_SUCCESS on success 110 *\li #DNS_R_UNKNOWN type is unknown 111 */ 112 113 ISC_LANG_ENDDECLS 114 115 #endif /* DNS_RCODE_H */ 116