c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley/*
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 1998-2001, 2004-2007, 2016 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews *
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley */
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley
70e5a7403f0e0a3bd292b8287c5fed5772c15270Automatic Updater/* $Id: rdataclass.h,v 1.24 2007/06/19 23:47:17 tbox Exp $ */
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley#ifndef DNS_RDATACLASS_H
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley#define DNS_RDATACLASS_H 1
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley
29747dfe5e073a299b3681e01f5c55540f8bfed7Mark Andrews/*! \file dns/rdataclass.h */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
904a5734375869ffb504ed8cde6b68cafadb6d64Bob Halley#include <isc/lang.h>
904a5734375869ffb504ed8cde6b68cafadb6d64Bob Halley
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley#include <dns/types.h>
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley
904a5734375869ffb504ed8cde6b68cafadb6d64Bob HalleyISC_LANG_BEGINDECLS
904a5734375869ffb504ed8cde6b68cafadb6d64Bob Halley
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrenceisc_result_t
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrencedns_rdataclass_fromtext(dns_rdataclass_t *classp, isc_textregion_t *source);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley * Convert the text 'source' refers to into a DNS class.
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley *
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley * Requires:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'classp' is a valid pointer.
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'source' is a valid text region.
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley *
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley * Returns:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_SUCCESS on success
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #DNS_R_UNKNOWN class is unknown
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley */
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrenceisc_result_t
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrencedns_rdataclass_totext(dns_rdataclass_t rdclass, isc_buffer_t *target);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
0e919917cce54d09407393499ea5c019b93750e2Bob Halley * Put a textual representation of class 'rdclass' into 'target'.
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley *
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley * Requires:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'rdclass' is a valid class.
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'target' is a valid text buffer.
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * Ensures,
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * if the result is success:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li The used space in 'target' is updated.
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley *
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley * Returns:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_SUCCESS on success
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_NOSPACE target buffer is too small
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley */
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaramanisc_result_t
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaramandns_rdataclass_tounknowntext(dns_rdataclass_t rdclass, isc_buffer_t *target);
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman/*%<
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman * Put textual RFC3597 CLASSXXXX representation of class 'rdclass' into
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman * 'target'.
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman *
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman * Requires:
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman *\li 'rdclass' is a valid class.
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman *
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman *\li 'target' is a valid text buffer.
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman *
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman * Ensures,
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman * if the result is success:
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman *\li The used space in 'target' is updated.
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman *
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman * Returns:
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman *\li #ISC_R_SUCCESS on success
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman *\li #ISC_R_NOSPACE target buffer is too small
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman */
79a55d4f4dcf3d6f617523228503d8584b72a3a3Mukund Sivaraman
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafssonvoid
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafssondns_rdataclass_format(dns_rdataclass_t rdclass,
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafsson char *array, unsigned int size);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafsson * Format a human-readable representation of the class 'rdclass'
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafsson * into the character array 'array', which is of size 'size'.
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafsson * The resulting string is guaranteed to be null-terminated.
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafsson */
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafsson
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafsson#define DNS_RDATACLASS_FORMATSIZE sizeof("CLASS65535")
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafsson * Minimum size of array to pass to dns_rdataclass_format().
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafsson */
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafsson
904a5734375869ffb504ed8cde6b68cafadb6d64Bob HalleyISC_LANG_ENDDECLS
904a5734375869ffb504ed8cde6b68cafadb6d64Bob Halley
c6dcc4cc989a7aae39ce7263c1d3e1d5758fb91bBob Halley#endif /* DNS_RDATACLASS_H */