rdataclass.h revision 79a55d4f4dcf3d6f617523228503d8584b72a3a3
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff/*
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Copyright (C) 1998-2001 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews *
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Permission to use, copy, modify, and/or distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * purpose with or without fee is hereby granted, provided that the above
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff * copyright notice and this permission notice appear in all copies.
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff *
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
ad3a5c4b7e21af04d1b872f933c2e19e5c0a135bMichael Graff * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
c803787146cadcb2d7e10cbf4491f3be513dfa1aMichael Graff * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
ad3a5c4b7e21af04d1b872f933c2e19e5c0a135bMichael Graff * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
8cdfd17426179ae6f629a9b7475d46a22f535047Bob Halley * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
ad3a5c4b7e21af04d1b872f933c2e19e5c0a135bMichael Graff * PERFORMANCE OF THIS SOFTWARE.
ad3a5c4b7e21af04d1b872f933c2e19e5c0a135bMichael Graff */
ad3a5c4b7e21af04d1b872f933c2e19e5c0a135bMichael Graff
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff/* $Id: rdataclass.h,v 1.24 2007/06/19 23:47:17 tbox Exp $ */
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff
058eeac2105c39e7cb31fb75ee0b473717ec3bbcMark Andrews#ifndef DNS_RDATACLASS_H
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence#define DNS_RDATACLASS_H 1
3024dbecbac365171bc6de0f3fa04951d6558be3Michael Graff
5fca48054b5e791a2fa0c5015bc3b6fef4fcdce1Andreas Gustafsson/*! \file dns/rdataclass.h */
3759f10fc543747668b1ca4b4671f35b0dea8445Francis Dupont
f181f94ec8da8b1dbcc6353e8be965ea4a5ea282Michael Graff#include <isc/lang.h>
d9059b0c38bd630c367d81424d72b1308cd74b04Tatuya JINMEI 神明達哉
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff#include <dns/types.h>
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence
440be4c866f6935ac069db79a414304507a664c2Michael GraffISC_LANG_BEGINDECLS
11fcc67616fac1bc6a28b3d4fed24641137888e7Michael Graff
e45d323a2a0f4ca08d4b139546e60a5fa7bd3f0cMichael Graffisc_result_t
29f28fe573d4b3b318b3b026d567c1eb86738015Michael Graffdns_rdataclass_fromtext(dns_rdataclass_t *classp, isc_textregion_t *source);
86944a4c8002e80ae9b6eb5a5e29b797879be45fMichael Graff/*%<
21e7034ec046105c00a0dab86c83732e2e77ad99Michael Graff * Convert the text 'source' refers to into a DNS class.
e51511aa3281f8dc384eb1283115c7f8d5c402aeMichael Graff *
e51511aa3281f8dc384eb1283115c7f8d5c402aeMichael Graff * Requires:
d1cbf714097e900ed1703529584d3e1a50e8a4a8Brian Wellington *\li 'classp' is a valid pointer.
bcf369e513a1cc2209e2a987f5772afa79813540Mark Andrews *
11efdeb076d65fa9f0c5fc067dc040e7c99dfba6Michael Graff *\li 'source' is a valid text region.
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence *
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * Returns:
ad3a5c4b7e21af04d1b872f933c2e19e5c0a135bMichael Graff *\li #ISC_R_SUCCESS on success
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff *\li #DNS_R_UNKNOWN class is unknown
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff */
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graffisc_result_t
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graffdns_rdataclass_totext(dns_rdataclass_t rdclass, isc_buffer_t *target);
31fab17bcdbe302592a6c0dc5374ef56333ee879Michael Graff/*%<
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff * Put a textual representation of class 'rdclass' into 'target'.
bcf369e513a1cc2209e2a987f5772afa79813540Mark Andrews *
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff * Requires:
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff *\li 'rdclass' is a valid class.
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff *
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff *\li 'target' is a valid text buffer.
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff *
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff * Ensures,
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff * if the result is success:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li The used space in 'target' is updated.
3115cd89bc1e1fd3ecc4705d253e3484a3f5c555Michael Graff *
d947011dc393d9f9988d1349d585b246d19cc3c7Michael Graff * Returns:
49a940dc68b30d9e4f9e1bd3c0503d8b90bb1726Mark Andrews *\li #ISC_R_SUCCESS on success
d947011dc393d9f9988d1349d585b246d19cc3c7Michael Graff *\li #ISC_R_NOSPACE target buffer is too small
3115cd89bc1e1fd3ecc4705d253e3484a3f5c555Michael Graff */
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graffisc_result_t
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graffdns_rdataclass_tounknowntext(dns_rdataclass_t rdclass, isc_buffer_t *target);
ad3a5c4b7e21af04d1b872f933c2e19e5c0a135bMichael Graff/*%<
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff * Put textual RFC3597 CLASSXXXX representation of class 'rdclass' into
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff * 'target'.
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff *
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff * Requires:
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff *\li 'rdclass' is a valid class.
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff *
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff *\li 'target' is a valid text buffer.
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff *
3ac63b472022ff92691d1fe69ac715a729671965Michael Graff * Ensures,
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff * if the result is success:
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff *\li The used space in 'target' is updated.
213973a334f92d4aef4ef62b4538fc2e4d0e8082Michael Graff *
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff * Returns:
64828244e04e86dfa40f0a4f0c05f27923da499dMichael Graff *\li #ISC_R_SUCCESS on success
f3350b671881f175d03e16fa5d0f685a1691bcabMark Andrews *\li #ISC_R_NOSPACE target buffer is too small
081cff0c33514a5dc63ab794fc199c07377ab756Mark Andrews */
213973a334f92d4aef4ef62b4538fc2e4d0e8082Michael Graff
11fcc67616fac1bc6a28b3d4fed24641137888e7Michael Graffvoid
ff9bb3fc5453bbf310b67c560fbf04a5c0fb60daMichael Graffdns_rdataclass_format(dns_rdataclass_t rdclass,
bcf369e513a1cc2209e2a987f5772afa79813540Mark Andrews char *array, unsigned int size);
ad3a5c4b7e21af04d1b872f933c2e19e5c0a135bMichael Graff/*%<
bb143613cf26e0f27dfd9caf1a7336065d064b26Michael Graff * Format a human-readable representation of the class 'rdclass'
fe14eafefa91fada7cea0a55b09196c01477406cBob Halley * into the character array 'array', which is of size 'size'.
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff * The resulting string is guaranteed to be null-terminated.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein */
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff
f172f06ff2e7609dd7d91914a44b4e24cff8bb7aAutomatic Updater#define DNS_RDATACLASS_FORMATSIZE sizeof("CLASS65535")
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff/*%<
f172f06ff2e7609dd7d91914a44b4e24cff8bb7aAutomatic Updater * Minimum size of array to pass to dns_rdataclass_format().
f172f06ff2e7609dd7d91914a44b4e24cff8bb7aAutomatic Updater */
f172f06ff2e7609dd7d91914a44b4e24cff8bb7aAutomatic Updater
f172f06ff2e7609dd7d91914a44b4e24cff8bb7aAutomatic UpdaterISC_LANG_ENDDECLS
f172f06ff2e7609dd7d91914a44b4e24cff8bb7aAutomatic Updater
b239c8294a5653d21876d084e0c5b029f6b9fc5dMichael Graff#endif /* DNS_RDATACLASS_H */
f172f06ff2e7609dd7d91914a44b4e24cff8bb7aAutomatic Updater