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