00001 /* 00002 * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") 00003 * Copyright (C) 1998-2001 Internet Software Consortium. 00004 * 00005 * Permission to use, copy, modify, and/or distribute this software for any 00006 * purpose with or without fee is hereby granted, provided that the above 00007 * copyright notice and this permission notice appear in all copies. 00008 * 00009 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 00010 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00011 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 00012 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 00013 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00014 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00015 * PERFORMANCE OF THIS SOFTWARE. 00016 */ 00017 00018 /* $Id: rdataclass.h,v 1.24 2007/06/19 23:47:17 tbox Exp $ */ 00019 00020 #ifndef DNS_RDATACLASS_H 00021 #define DNS_RDATACLASS_H 1 00022 00023 /*! \file dns/rdataclass.h */ 00024 00025 #include <isc/lang.h> 00026 00027 #include <dns/types.h> 00028 00029 ISC_LANG_BEGINDECLS 00030 00031 isc_result_t 00032 dns_rdataclass_fromtext(dns_rdataclass_t *classp, isc_textregion_t *source); 00033 /*%< 00034 * Convert the text 'source' refers to into a DNS class. 00035 * 00036 * Requires: 00037 *\li 'classp' is a valid pointer. 00038 * 00039 *\li 'source' is a valid text region. 00040 * 00041 * Returns: 00042 *\li #ISC_R_SUCCESS on success 00043 *\li #DNS_R_UNKNOWN class is unknown 00044 */ 00045 00046 isc_result_t 00047 dns_rdataclass_totext(dns_rdataclass_t rdclass, isc_buffer_t *target); 00048 /*%< 00049 * Put a textual representation of class 'rdclass' into 'target'. 00050 * 00051 * Requires: 00052 *\li 'rdclass' is a valid class. 00053 * 00054 *\li 'target' is a valid text buffer. 00055 * 00056 * Ensures, 00057 * if the result is success: 00058 *\li The used space in 'target' is updated. 00059 * 00060 * Returns: 00061 *\li #ISC_R_SUCCESS on success 00062 *\li #ISC_R_NOSPACE target buffer is too small 00063 */ 00064 00065 void 00066 dns_rdataclass_format(dns_rdataclass_t rdclass, 00067 char *array, unsigned int size); 00068 /*%< 00069 * Format a human-readable representation of the class 'rdclass' 00070 * into the character array 'array', which is of size 'size'. 00071 * The resulting string is guaranteed to be null-terminated. 00072 */ 00073 00074 #define DNS_RDATACLASS_FORMATSIZE sizeof("CLASS65535") 00075 /*%< 00076 * Minimum size of array to pass to dns_rdataclass_format(). 00077 */ 00078 00079 ISC_LANG_ENDDECLS 00080 00081 #endif /* DNS_RDATACLASS_H */