1 /* 2 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 9 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 11 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 13 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14 * PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 /* $Id: rdataclass.h,v 1.2 2020/02/13 13:53:01 jsg Exp $ */ 18 19 #ifndef DNS_RDATACLASS_H 20 #define DNS_RDATACLASS_H 1 21 22 /*! \file dns/rdataclass.h */ 23 24 #include <dns/types.h> 25 26 isc_result_t 27 dns_rdataclass_fromtext(dns_rdataclass_t *classp, isc_textregion_t *source); 28 /*%< 29 * Convert the text 'source' refers to into a DNS class. 30 * 31 * Requires: 32 *\li 'classp' is a valid pointer. 33 * 34 *\li 'source' is a valid text region. 35 * 36 * Returns: 37 *\li #ISC_R_SUCCESS on success 38 *\li #DNS_R_UNKNOWN class is unknown 39 */ 40 41 isc_result_t 42 dns_rdataclass_totext(dns_rdataclass_t rdclass, isc_buffer_t *target); 43 /*%< 44 * Put a textual representation of class 'rdclass' into 'target'. 45 * 46 * Requires: 47 *\li 'rdclass' is a valid class. 48 * 49 *\li 'target' is a valid text buffer. 50 * 51 * Ensures, 52 * if the result is success: 53 *\li The used space in 'target' is updated. 54 * 55 * Returns: 56 *\li #ISC_R_SUCCESS on success 57 *\li #ISC_R_NOSPACE target buffer is too small 58 */ 59 60 void 61 dns_rdataclass_format(dns_rdataclass_t rdclass, 62 char *array, unsigned int size); 63 /*%< 64 * Format a human-readable representation of the class 'rdclass' 65 * into the character array 'array', which is of size 'size'. 66 * The resulting string is guaranteed to be null-terminated. 67 */ 68 69 #define DNS_RDATACLASS_FORMATSIZE sizeof("CLASS65535") 70 /*%< 71 * Minimum size of array to pass to dns_rdataclass_format(). 72 */ 73 74 #endif /* DNS_RDATACLASS_H */ 75