1 /* $NetBSD: dsdigest.h,v 1.1.1.3 2014/12/10 03:34:42 christos Exp $ */ 2 3 /* 4 * Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC") 5 * 6 * Permission to use, copy, modify, and/or distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 11 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 12 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 13 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 14 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 15 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /* Id */ 20 21 #ifndef DNS_DSDIGEST_H 22 #define DNS_DSDIGEST_H 1 23 24 /*! \file dns/dsdigest.h */ 25 26 #include <isc/lang.h> 27 28 #include <dns/types.h> 29 30 ISC_LANG_BEGINDECLS 31 32 isc_result_t 33 dns_dsdigest_fromtext(dns_dsdigest_t *dsdigestp, isc_textregion_t *source); 34 /*%< 35 * Convert the text 'source' refers to into a DS/DLV digest type value. 36 * The text may contain either a mnemonic digest name or a decimal 37 * digest number. 38 * 39 * Requires: 40 *\li 'dsdigestp' 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 50 isc_result_t 51 dns_dsdigest_totext(dns_dsdigest_t dsdigest, isc_buffer_t *target); 52 /*%< 53 * Put a textual representation of the DS/DLV digest type 'dsdigest' 54 * into 'target'. 55 * 56 * Requires: 57 *\li 'dsdigest' is a valid dsdigest. 58 * 59 *\li 'target' is a valid text buffer. 60 * 61 * Ensures, 62 * if the result is success: 63 *\li The used space in 'target' is updated. 64 * 65 * Returns: 66 *\li ISC_R_SUCCESS on success 67 *\li ISC_R_NOSPACE target buffer is too small 68 */ 69 70 #define DNS_DSDIGEST_FORMATSIZE 20 71 void 72 dns_dsdigest_format(dns_dsdigest_t typ, char *cp, unsigned int size); 73 /*%< 74 * Wrapper for dns_dsdigest_totext(), writing text into 'cp' 75 */ 76 77 ISC_LANG_ENDDECLS 78 79 #endif /* DNS_DSDIGEST_H */ 80