1135446Strhodes/*
2193149Sdougb * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
3135446Strhodes * Copyright (C) 1998-2001  Internet Software Consortium.
4135446Strhodes *
5193149Sdougb * Permission to use, copy, modify, and/or distribute this software for any
6135446Strhodes * purpose with or without fee is hereby granted, provided that the above
7135446Strhodes * copyright notice and this permission notice appear in all copies.
8135446Strhodes *
9135446Strhodes * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10135446Strhodes * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11135446Strhodes * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12135446Strhodes * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13135446Strhodes * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14135446Strhodes * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15135446Strhodes * PERFORMANCE OF THIS SOFTWARE.
16135446Strhodes */
17135446Strhodes
18234010Sdougb/* $Id: rdataclass.h,v 1.24 2007/06/19 23:47:17 tbox Exp $ */
19135446Strhodes
20135446Strhodes#ifndef DNS_RDATACLASS_H
21135446Strhodes#define DNS_RDATACLASS_H 1
22135446Strhodes
23193149Sdougb/*! \file dns/rdataclass.h */
24170222Sdougb
25135446Strhodes#include <isc/lang.h>
26135446Strhodes
27135446Strhodes#include <dns/types.h>
28135446Strhodes
29135446StrhodesISC_LANG_BEGINDECLS
30135446Strhodes
31135446Strhodesisc_result_t
32135446Strhodesdns_rdataclass_fromtext(dns_rdataclass_t *classp, isc_textregion_t *source);
33170222Sdougb/*%<
34135446Strhodes * Convert the text 'source' refers to into a DNS class.
35135446Strhodes *
36135446Strhodes * Requires:
37170222Sdougb *\li	'classp' is a valid pointer.
38135446Strhodes *
39170222Sdougb *\li	'source' is a valid text region.
40135446Strhodes *
41135446Strhodes * Returns:
42170222Sdougb *\li	#ISC_R_SUCCESS			on success
43170222Sdougb *\li	#DNS_R_UNKNOWN			class is unknown
44135446Strhodes */
45135446Strhodes
46135446Strhodesisc_result_t
47135446Strhodesdns_rdataclass_totext(dns_rdataclass_t rdclass, isc_buffer_t *target);
48170222Sdougb/*%<
49135446Strhodes * Put a textual representation of class 'rdclass' into 'target'.
50135446Strhodes *
51135446Strhodes * Requires:
52170222Sdougb *\li	'rdclass' is a valid class.
53135446Strhodes *
54170222Sdougb *\li	'target' is a valid text buffer.
55135446Strhodes *
56170222Sdougb * Ensures,
57170222Sdougb *	if the result is success:
58170222Sdougb *\li		The used space in 'target' is updated.
59135446Strhodes *
60135446Strhodes * Returns:
61170222Sdougb *\li	#ISC_R_SUCCESS			on success
62170222Sdougb *\li	#ISC_R_NOSPACE			target buffer is too small
63135446Strhodes */
64135446Strhodes
65135446Strhodesvoid
66135446Strhodesdns_rdataclass_format(dns_rdataclass_t rdclass,
67135446Strhodes		      char *array, unsigned int size);
68170222Sdougb/*%<
69135446Strhodes * Format a human-readable representation of the class 'rdclass'
70135446Strhodes * into the character array 'array', which is of size 'size'.
71135446Strhodes * The resulting string is guaranteed to be null-terminated.
72135446Strhodes */
73135446Strhodes
74135446Strhodes#define DNS_RDATACLASS_FORMATSIZE sizeof("CLASS65535")
75170222Sdougb/*%<
76135446Strhodes * Minimum size of array to pass to dns_rdataclass_format().
77135446Strhodes */
78135446Strhodes
79135446StrhodesISC_LANG_ENDDECLS
80135446Strhodes
81135446Strhodes#endif /* DNS_RDATACLASS_H */
82