rdata.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004-2009, 2011-2013  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 1998-2003  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: rdata.h,v 1.80 2011/03/20 02:31:53 marka Exp $ */
00019 
00020 #ifndef DNS_RDATA_H
00021 #define DNS_RDATA_H 1
00022 
00023 /*****
00024  ***** Module Info
00025  *****/
00026 
00027 /*! \file dns/rdata.h
00028  * \brief
00029  * Provides facilities for manipulating DNS rdata, including conversions to
00030  * and from wire format and text format.
00031  *
00032  * Given the large amount of rdata possible in a nameserver, it was important
00033  * to come up with a very efficient way of storing rdata, but at the same
00034  * time allow it to be manipulated.
00035  *
00036  * The decision was to store rdata in uncompressed wire format,
00037  * and not to make it a fully abstracted object; i.e. certain parts of the
00038  * server know rdata is stored that way.  This saves a lot of memory, and
00039  * makes adding rdata to messages easy.  Having much of the server know
00040  * the representation would be perilous, and we certainly don't want each
00041  * user of rdata to be manipulating such a low-level structure.  This is
00042  * where the rdata module comes in.  The module allows rdata handles to be
00043  * created and attached to uncompressed wire format regions.  All rdata
00044  * operations and conversions are done through these handles.
00045  *
00046  * Implementation Notes:
00047  *
00048  *\li   The routines in this module are expected to be synthesized by the
00049  *      build process from a set of source files, one per rdata type.  For
00050  *      portability, it's probably best that the building be done by a C
00051  *      program.  Adding a new rdata type will be a simple matter of adding
00052  *      a file to a directory and rebuilding the server.  *All* knowledge of
00053  *      the format of a particular rdata type is in this file.
00054  *
00055  * MP:
00056  *\li   Clients of this module must impose any required synchronization.
00057  *
00058  * Reliability:
00059  *\li   This module deals with low-level byte streams.  Errors in any of
00060  *      the functions are likely to crash the server or corrupt memory.
00061  *
00062  *\li   Rdata is typed, and the caller must know what type of rdata it has.
00063  *      A caller that gets this wrong could crash the server.
00064  *
00065  *\li   The fromstruct() and tostruct() routines use a void * pointer to
00066  *      represent the structure.  The caller must ensure that it passes a
00067  *      pointer to the appropriate type, or the server could crash or memory
00068  *      could be corrupted.
00069  *
00070  * Resources:
00071  *\li   None.
00072  *
00073  * Security:
00074  *
00075  *\li   *** WARNING ***
00076  *      dns_rdata_fromwire() deals with raw network data.  An error in
00077  *      this routine could result in the failure or hijacking of the server.
00078  *
00079  * Standards:
00080  *\li   RFC1035
00081  *\li   Draft EDNS0 (0)
00082  *\li   Draft EDNS1 (0)
00083  *\li   Draft Binary Labels (2)
00084  *\li   Draft Local Compression (1)
00085  *\li   Various RFCs for particular types; these will be documented in the
00086  *       sources files of the types.
00087  *
00088  */
00089 
00090 /***
00091  *** Imports
00092  ***/
00093 
00094 #include <isc/lang.h>
00095 
00096 #include <dns/types.h>
00097 #include <dns/name.h>
00098 #include <dns/message.h>
00099 
00100 ISC_LANG_BEGINDECLS
00101 
00102 
00103 /***
00104  *** Types
00105  ***/
00106 
00107 /*%
00108  ***** An 'rdata' is a handle to a binary region.  The handle has an RR
00109  ***** class and type, and the data in the binary region is in the format
00110  ***** of the given class and type.
00111  *****/
00112 /*%
00113  * Clients are strongly discouraged from using this type directly, with
00114  * the exception of the 'link' field which may be used directly for whatever
00115  * purpose the client desires.
00116  */
00117 struct dns_rdata {
00118         unsigned char *                 data;
00119         unsigned int                    length;
00120         dns_rdataclass_t                rdclass;
00121         dns_rdatatype_t                 type;
00122         unsigned int                    flags;
00123         ISC_LINK(dns_rdata_t)           link;
00124 };
00125 
00126 #define DNS_RDATA_INIT { NULL, 0, 0, 0, 0, {(void*)(-1), (void *)(-1)}}
00127 
00128 #define DNS_RDATA_CHECKINITIALIZED
00129 #ifdef DNS_RDATA_CHECKINITIALIZED
00130 #define DNS_RDATA_INITIALIZED(rdata) \
00131         ((rdata)->data == NULL && (rdata)->length == 0 && \
00132          (rdata)->rdclass == 0 && (rdata)->type == 0 && (rdata)->flags == 0 && \
00133          !ISC_LINK_LINKED((rdata), link))
00134 #else
00135 #ifdef ISC_LIST_CHECKINIT
00136 #define DNS_RDATA_INITIALIZED(rdata) \
00137         (!ISC_LINK_LINKED((rdata), link))
00138 #else
00139 #define DNS_RDATA_INITIALIZED(rdata) ISC_TRUE
00140 #endif
00141 #endif
00142 
00143 #define DNS_RDATA_UPDATE        0x0001          /*%< update pseudo record. */
00144 #define DNS_RDATA_OFFLINE       0x0002          /*%< RRSIG has a offline key. */
00145 
00146 #define DNS_RDATA_VALIDFLAGS(rdata) \
00147         (((rdata)->flags & ~(DNS_RDATA_UPDATE|DNS_RDATA_OFFLINE)) == 0)
00148 
00149 /*
00150  * The maximum length of a RDATA that can be sent on the wire.
00151  * Max packet size (65535) less header (12), less name (1), type (2),
00152  * class (2), ttl(4), length (2).
00153  *
00154  * None of the defined types that support name compression can exceed
00155  * this and all new types are to be sent uncompressed.
00156  */
00157 
00158 #define DNS_RDATA_MAXLENGTH     65512U
00159 
00160 /*
00161  * Flags affecting rdata formatting style.  Flags 0xFFFF0000
00162  * are used by masterfile-level formatting and defined elsewhere.
00163  * See additional comments at dns_rdata_tofmttext().
00164  */
00165 
00166 /*% Split the rdata into multiple lines to try to keep it
00167  within the "width". */
00168 #define DNS_STYLEFLAG_MULTILINE         0x00000001U
00169 
00170 /*% Output explanatory comments. */
00171 #define DNS_STYLEFLAG_COMMENT           0x00000002U
00172 #define DNS_STYLEFLAG_RRCOMMENT         0x00000004U
00173 
00174 /*% Output KEYDATA in human readable format. */
00175 #define DNS_STYLEFLAG_KEYDATA           0x00000008U
00176 
00177 #define DNS_RDATA_DOWNCASE              DNS_NAME_DOWNCASE
00178 #define DNS_RDATA_CHECKNAMES            DNS_NAME_CHECKNAMES
00179 #define DNS_RDATA_CHECKNAMESFAIL        DNS_NAME_CHECKNAMESFAIL
00180 #define DNS_RDATA_CHECKREVERSE          DNS_NAME_CHECKREVERSE
00181 #define DNS_RDATA_CHECKMX               DNS_NAME_CHECKMX
00182 #define DNS_RDATA_CHECKMXFAIL           DNS_NAME_CHECKMXFAIL
00183 #define DNS_RDATA_UNKNOWNESCAPE         0x80000000
00184 
00185 /***
00186  *** Initialization
00187  ***/
00188 
00189 void
00190 dns_rdata_init(dns_rdata_t *rdata);
00191 /*%<
00192  * Make 'rdata' empty.
00193  *
00194  * Requires:
00195  *      'rdata' is a valid rdata (i.e. not NULL, points to a struct dns_rdata)
00196  */
00197 
00198 void
00199 dns_rdata_reset(dns_rdata_t *rdata);
00200 /*%<
00201  * Make 'rdata' empty.
00202  *
00203  * Requires:
00204  *\li   'rdata' is a previously initialized rdata and is not linked.
00205  */
00206 
00207 void
00208 dns_rdata_clone(const dns_rdata_t *src, dns_rdata_t *target);
00209 /*%<
00210  * Clone 'target' from 'src'.
00211  *
00212  * Requires:
00213  *\li   'src' to be initialized.
00214  *\li   'target' to be initialized.
00215  */
00216 
00217 /***
00218  *** Comparisons
00219  ***/
00220 
00221 int
00222 dns_rdata_compare(const dns_rdata_t *rdata1, const dns_rdata_t *rdata2);
00223 /*%<
00224  * Determine the relative ordering under the DNSSEC order relation of
00225  * 'rdata1' and 'rdata2'.
00226  *
00227  * Requires:
00228  *
00229  *\li   'rdata1' is a valid, non-empty rdata
00230  *
00231  *\li   'rdata2' is a valid, non-empty rdata
00232  *
00233  * Returns:
00234  *\li   < 0             'rdata1' is less than 'rdata2'
00235  *\li   0               'rdata1' is equal to 'rdata2'
00236  *\li   > 0             'rdata1' is greater than 'rdata2'
00237  */
00238 
00239 int
00240 dns_rdata_casecompare(const dns_rdata_t *rdata1, const dns_rdata_t *rdata2);
00241 /*%<
00242  * dns_rdata_casecompare() is similar to dns_rdata_compare() but also
00243  * compares domain names case insensitively in known rdata types that
00244  * are treated as opaque data by dns_rdata_compare().
00245  *
00246  * Requires:
00247  *
00248  *\li   'rdata1' is a valid, non-empty rdata
00249  *
00250  *\li   'rdata2' is a valid, non-empty rdata
00251  *
00252  * Returns:
00253  *\li   < 0             'rdata1' is less than 'rdata2'
00254  *\li   0               'rdata1' is equal to 'rdata2'
00255  *\li   > 0             'rdata1' is greater than 'rdata2'
00256  */
00257 
00258 /***
00259  *** Conversions
00260  ***/
00261 
00262 void
00263 dns_rdata_fromregion(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
00264                      dns_rdatatype_t type, isc_region_t *r);
00265 /*%<
00266  * Make 'rdata' refer to region 'r'.
00267  *
00268  * Requires:
00269  *
00270  *\li   The data in 'r' is properly formatted for whatever type it is.
00271  */
00272 
00273 void
00274 dns_rdata_toregion(const dns_rdata_t *rdata, isc_region_t *r);
00275 /*%<
00276  * Make 'r' refer to 'rdata'.
00277  */
00278 
00279 isc_result_t
00280 dns_rdata_fromwire(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
00281                    dns_rdatatype_t type, isc_buffer_t *source,
00282                    dns_decompress_t *dctx, unsigned int options,
00283                    isc_buffer_t *target);
00284 /*%<
00285  * Copy the possibly-compressed rdata at source into the target region.
00286  *
00287  * Notes:
00288  *\li   Name decompression policy is controlled by 'dctx'.
00289  *
00290  *      'options'
00291  *\li   DNS_RDATA_DOWNCASE      downcase domain names when they are copied
00292  *                              into target.
00293  *
00294  * Requires:
00295  *
00296  *\li   'rdclass' and 'type' are valid.
00297  *
00298  *\li   'source' is a valid buffer, and the active region of 'source'
00299  *      references the rdata to be processed.
00300  *
00301  *\li   'target' is a valid buffer.
00302  *
00303  *\li   'dctx' is a valid decompression context.
00304  *
00305  * Ensures,
00306  *      if result is success:
00307  *      \li     If 'rdata' is not NULL, it is attached to the target.
00308  *      \li     The conditions dns_name_fromwire() ensures for names hold
00309  *              for all names in the rdata.
00310  *      \li     The current location in source is advanced, and the used space
00311  *              in target is updated.
00312  *
00313  * Result:
00314  *\li   Success
00315  *\li   Any non-success status from dns_name_fromwire()
00316  *\li   Various 'Bad Form' class failures depending on class and type
00317  *\li   Bad Form: Input too short
00318  *\li   Resource Limit: Not enough space
00319  */
00320 
00321 isc_result_t
00322 dns_rdata_towire(dns_rdata_t *rdata, dns_compress_t *cctx,
00323                  isc_buffer_t *target);
00324 /*%<
00325  * Convert 'rdata' into wire format, compressing it as specified by the
00326  * compression context 'cctx', and storing the result in 'target'.
00327  *
00328  * Notes:
00329  *\li   If the compression context allows global compression, then the
00330  *      global compression table may be updated.
00331  *
00332  * Requires:
00333  *\li   'rdata' is a valid, non-empty rdata
00334  *
00335  *\li   target is a valid buffer
00336  *
00337  *\li   Any offsets specified in a global compression table are valid
00338  *      for target.
00339  *
00340  * Ensures,
00341  *      if the result is success:
00342  *      \li     The used space in target is updated.
00343  *
00344  * Returns:
00345  *\li   Success
00346  *\li   Any non-success status from dns_name_towire()
00347  *\li   Resource Limit: Not enough space
00348  */
00349 
00350 isc_result_t
00351 dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
00352                    dns_rdatatype_t type, isc_lex_t *lexer, dns_name_t *origin,
00353                    unsigned int options, isc_mem_t *mctx,
00354                    isc_buffer_t *target, dns_rdatacallbacks_t *callbacks);
00355 /*%<
00356  * Convert the textual representation of a DNS rdata into uncompressed wire
00357  * form stored in the target region.  Tokens constituting the text of the rdata
00358  * are taken from 'lexer'.
00359  *
00360  * Notes:
00361  *\li   Relative domain names in the rdata will have 'origin' appended to them.
00362  *      A NULL origin implies "origin == dns_rootname".
00363  *
00364  *
00365  *      'options'
00366  *\li   DNS_RDATA_DOWNCASE      downcase domain names when they are copied
00367  *                              into target.
00368  *\li   DNS_RDATA_CHECKNAMES    perform checknames checks.
00369  *\li   DNS_RDATA_CHECKNAMESFAIL fail if the checknames check fail.  If
00370  *                              not set a warning will be issued.
00371  *\li   DNS_RDATA_CHECKREVERSE  this should set if the owner name ends
00372  *                              in IP6.ARPA, IP6.INT or IN-ADDR.ARPA.
00373  *
00374  * Requires:
00375  *
00376  *\li   'rdclass' and 'type' are valid.
00377  *
00378  *\li   'lexer' is a valid isc_lex_t.
00379  *
00380  *\li   'mctx' is a valid isc_mem_t.
00381  *
00382  *\li   'target' is a valid region.
00383  *
00384  *\li   'origin' if non NULL it must be absolute.
00385  *
00386  *\li   'callbacks' to be NULL or callbacks->warn and callbacks->error be
00387  *      initialized.
00388  *
00389  * Ensures,
00390  *      if result is success:
00391  *\li           If 'rdata' is not NULL, it is attached to the target.
00392 
00393  *\li           The conditions dns_name_fromtext() ensures for names hold
00394  *              for all names in the rdata.
00395 
00396  *\li           The used space in target is updated.
00397  *
00398  * Result:
00399  *\li   Success
00400  *\li   Translated result codes from isc_lex_gettoken
00401  *\li   Various 'Bad Form' class failures depending on class and type
00402  *\li   Bad Form: Input too short
00403  *\li   Resource Limit: Not enough space
00404  *\li   Resource Limit: Not enough memory
00405  */
00406 
00407 isc_result_t
00408 dns_rdata_totext(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target);
00409 /*%<
00410  * Convert 'rdata' into text format, storing the result in 'target'.
00411  * The text will consist of a single line, with fields separated by
00412  * single spaces.
00413  *
00414  * Notes:
00415  *\li   If 'origin' is not NULL, then any names in the rdata that are
00416  *      subdomains of 'origin' will be made relative it.
00417  *
00418  *\li   XXX Do we *really* want to support 'origin'?  I'm inclined towards "no"
00419  *      at the moment.
00420  *
00421  * Requires:
00422  *
00423  *\li   'rdata' is a valid, non-empty rdata
00424  *
00425  *\li   'origin' is NULL, or is a valid name
00426  *
00427  *\li   'target' is a valid text buffer
00428  *
00429  * Ensures,
00430  *      if the result is success:
00431  *
00432  *      \li     The used space in target is updated.
00433  *
00434  * Returns:
00435  *\li   Success
00436  *\li   Any non-success status from dns_name_totext()
00437  *\li   Resource Limit: Not enough space
00438  */
00439 
00440 isc_result_t
00441 dns_rdata_tofmttext(dns_rdata_t *rdata, dns_name_t *origin, unsigned int flags,
00442                     unsigned int width, unsigned int split_width,
00443                     const char *linebreak, isc_buffer_t *target);
00444 /*%<
00445  * Like dns_rdata_totext, but do formatted output suitable for
00446  * database dumps.  This is intended for use by dns_db_dump();
00447  * library users are discouraged from calling it directly.
00448  *
00449  * If (flags & #DNS_STYLEFLAG_MULTILINE) != 0, attempt to stay
00450  * within 'width' by breaking the text into multiple lines.
00451  * The string 'linebreak' is inserted between lines, and parentheses
00452  * are added when necessary.  Because RRs contain unbreakable elements
00453  * such as domain names whose length is variable, unpredictable, and
00454  * potentially large, there is no guarantee that the lines will
00455  * not exceed 'width' anyway.
00456  *
00457  * If (flags & #DNS_STYLEFLAG_MULTILINE) == 0, the rdata is always
00458  * printed as a single line, and no parentheses are used.
00459  * The 'width' and 'linebreak' arguments are ignored.
00460  *
00461  * If (flags & #DNS_STYLEFLAG_COMMENT) != 0, output explanatory
00462  * comments next to things like the SOA timer fields.  Some
00463  * comments (e.g., the SOA ones) are only printed when multiline
00464  * output is selected.
00465  *
00466  * base64 rdata text (e.g., DNSKEY records) will be split into chunks
00467  * of 'split_width' characters.  If split_width == 0, the text will
00468  * not be split at all.  If split_width == UINT_MAX (0xffffffff), then
00469  * it is undefined and falls back to the default value of 'width'
00470  */
00471 
00472 isc_result_t
00473 dns_rdata_fromstruct(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
00474                      dns_rdatatype_t type, void *source, isc_buffer_t *target);
00475 /*%<
00476  * Convert the C structure representation of an rdata into uncompressed wire
00477  * format in 'target'.
00478  *
00479  * XXX  Should we have a 'size' parameter as a sanity check on target?
00480  *
00481  * Requires:
00482  *
00483  *\li   'rdclass' and 'type' are valid.
00484  *
00485  *\li   'source' points to a valid C struct for the class and type.
00486  *
00487  *\li   'target' is a valid buffer.
00488  *
00489  *\li   All structure pointers to memory blocks should be NULL if their
00490  *      corresponding length values are zero.
00491  *
00492  * Ensures,
00493  *      if result is success:
00494  *      \li     If 'rdata' is not NULL, it is attached to the target.
00495  *
00496  *      \li     The used space in 'target' is updated.
00497  *
00498  * Result:
00499  *\li   Success
00500  *\li   Various 'Bad Form' class failures depending on class and type
00501  *\li   Resource Limit: Not enough space
00502  */
00503 
00504 isc_result_t
00505 dns_rdata_tostruct(dns_rdata_t *rdata, void *target, isc_mem_t *mctx);
00506 /*%<
00507  * Convert an rdata into its C structure representation.
00508  *
00509  * If 'mctx' is NULL then 'rdata' must persist while 'target' is being used.
00510  *
00511  * If 'mctx' is non NULL then memory will be allocated if required.
00512  *
00513  * Requires:
00514  *
00515  *\li   'rdata' is a valid, non-empty rdata.
00516  *
00517  *\li   'target' to point to a valid pointer for the type and class.
00518  *
00519  * Result:
00520  *\li   Success
00521  *\li   Resource Limit: Not enough memory
00522  */
00523 
00524 void
00525 dns_rdata_freestruct(void *source);
00526 /*%<
00527  * Free dynamic memory attached to 'source' (if any).
00528  *
00529  * Requires:
00530  *
00531  *\li   'source' to point to the structure previously filled in by
00532  *      dns_rdata_tostruct().
00533  */
00534 
00535 isc_boolean_t
00536 dns_rdatatype_ismeta(dns_rdatatype_t type);
00537 /*%<
00538  * Return true iff the rdata type 'type' is a meta-type
00539  * like ANY or AXFR.
00540  */
00541 
00542 isc_boolean_t
00543 dns_rdatatype_issingleton(dns_rdatatype_t type);
00544 /*%<
00545  * Return true iff the rdata type 'type' is a singleton type,
00546  * like CNAME or SOA.
00547  *
00548  * Requires:
00549  * \li  'type' is a valid rdata type.
00550  *
00551  */
00552 
00553 isc_boolean_t
00554 dns_rdataclass_ismeta(dns_rdataclass_t rdclass);
00555 /*%<
00556  * Return true iff the rdata class 'rdclass' is a meta-class
00557  * like ANY or NONE.
00558  */
00559 
00560 isc_boolean_t
00561 dns_rdatatype_isdnssec(dns_rdatatype_t type);
00562 /*%<
00563  * Return true iff 'type' is one of the DNSSEC
00564  * rdata types that may exist alongside a CNAME record.
00565  *
00566  * Requires:
00567  * \li  'type' is a valid rdata type.
00568  */
00569 
00570 isc_boolean_t
00571 dns_rdatatype_iszonecutauth(dns_rdatatype_t type);
00572 /*%<
00573  * Return true iff rdata of type 'type' is considered authoritative
00574  * data (not glue) in the NSEC chain when it occurs in the parent zone
00575  * at a zone cut.
00576  *
00577  * Requires:
00578  * \li  'type' is a valid rdata type.
00579  *
00580  */
00581 
00582 isc_boolean_t
00583 dns_rdatatype_isknown(dns_rdatatype_t type);
00584 /*%<
00585  * Return true iff the rdata type 'type' is known.
00586  *
00587  * Requires:
00588  * \li  'type' is a valid rdata type.
00589  *
00590  */
00591 
00592 
00593 isc_result_t
00594 dns_rdata_additionaldata(dns_rdata_t *rdata, dns_additionaldatafunc_t add,
00595                          void *arg);
00596 /*%<
00597  * Call 'add' for each name and type from 'rdata' which is subject to
00598  * additional section processing.
00599  *
00600  * Requires:
00601  *
00602  *\li   'rdata' is a valid, non-empty rdata.
00603  *
00604  *\li   'add' is a valid dns_additionalfunc_t.
00605  *
00606  * Ensures:
00607  *
00608  *\li   If successful, then add() will have been called for each name
00609  *      and type subject to additional section processing.
00610  *
00611  *\li   If add() returns something other than #ISC_R_SUCCESS, that result
00612  *      will be returned as the result of dns_rdata_additionaldata().
00613  *
00614  * Returns:
00615  *
00616  *\li   ISC_R_SUCCESS
00617  *
00618  *\li   Many other results are possible if not successful.
00619  */
00620 
00621 isc_result_t
00622 dns_rdata_digest(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg);
00623 /*%<
00624  * Send 'rdata' in DNSSEC canonical form to 'digest'.
00625  *
00626  * Note:
00627  *\li   'digest' may be called more than once by dns_rdata_digest().  The
00628  *      concatenation of all the regions, in the order they were given
00629  *      to 'digest', will be the DNSSEC canonical form of 'rdata'.
00630  *
00631  * Requires:
00632  *
00633  *\li   'rdata' is a valid, non-empty rdata.
00634  *
00635  *\li   'digest' is a valid dns_digestfunc_t.
00636  *
00637  * Ensures:
00638  *
00639  *\li   If successful, then all of the rdata's data has been sent, in
00640  *      DNSSEC canonical form, to 'digest'.
00641  *
00642  *\li   If digest() returns something other than ISC_R_SUCCESS, that result
00643  *      will be returned as the result of dns_rdata_digest().
00644  *
00645  * Returns:
00646  *
00647  *\li   ISC_R_SUCCESS
00648  *
00649  *\li   Many other results are possible if not successful.
00650  */
00651 
00652 isc_boolean_t
00653 dns_rdatatype_questiononly(dns_rdatatype_t type);
00654 /*%<
00655  * Return true iff rdata of type 'type' can only appear in the question
00656  * section of a properly formatted message.
00657  *
00658  * Requires:
00659  * \li  'type' is a valid rdata type.
00660  *
00661  */
00662 
00663 isc_boolean_t
00664 dns_rdatatype_notquestion(dns_rdatatype_t type);
00665 /*%<
00666  * Return true iff rdata of type 'type' can not appear in the question
00667  * section of a properly formatted message.
00668  *
00669  * Requires:
00670  * \li  'type' is a valid rdata type.
00671  *
00672  */
00673 
00674 isc_boolean_t
00675 dns_rdatatype_atparent(dns_rdatatype_t type);
00676 /*%<
00677  * Return true iff rdata of type 'type' should appear at the parent of
00678  * a zone cut.
00679  *
00680  * Requires:
00681  * \li  'type' is a valid rdata type.
00682  *
00683  */
00684 
00685 unsigned int
00686 dns_rdatatype_attributes(dns_rdatatype_t rdtype);
00687 /*%<
00688  * Return attributes for the given type.
00689  *
00690  * Requires:
00691  *\li   'rdtype' are known.
00692  *
00693  * Returns:
00694  *\li   a bitmask consisting of the following flags.
00695  */
00696 
00697 /*% only one may exist for a name */
00698 #define DNS_RDATATYPEATTR_SINGLETON             0x00000001U
00699 /*% requires no other data be present */
00700 #define DNS_RDATATYPEATTR_EXCLUSIVE             0x00000002U
00701 /*% Is a meta type */
00702 #define DNS_RDATATYPEATTR_META                  0x00000004U
00703 /*% Is a DNSSEC type, like RRSIG or NSEC */
00704 #define DNS_RDATATYPEATTR_DNSSEC                0x00000008U
00705 /*% Is a zone cut authority type */
00706 #define DNS_RDATATYPEATTR_ZONECUTAUTH           0x00000010U
00707 /*% Is reserved (unusable) */
00708 #define DNS_RDATATYPEATTR_RESERVED              0x00000020U
00709 /*% Is an unknown type */
00710 #define DNS_RDATATYPEATTR_UNKNOWN               0x00000040U
00711 /*% Is META, and can only be in a question section */
00712 #define DNS_RDATATYPEATTR_QUESTIONONLY          0x00000080U
00713 /*% is META, and can NOT be in a question section */
00714 #define DNS_RDATATYPEATTR_NOTQUESTION           0x00000100U
00715 /*% Is present at zone cuts in the parent, not the child */
00716 #define DNS_RDATATYPEATTR_ATPARENT              0x00000200U
00717 
00718 dns_rdatatype_t
00719 dns_rdata_covers(dns_rdata_t *rdata);
00720 /*%<
00721  * Return the rdatatype that this type covers.
00722  *
00723  * Requires:
00724  *\li   'rdata' is a valid, non-empty rdata.
00725  *
00726  *\li   'rdata' is a type that covers other rdata types.
00727  *
00728  * Returns:
00729  *\li   The type covered.
00730  */
00731 
00732 isc_boolean_t
00733 dns_rdata_checkowner(dns_name_t* name, dns_rdataclass_t rdclass,
00734                      dns_rdatatype_t type, isc_boolean_t wildcard);
00735 /*
00736  * Returns whether this is a valid ownername for this <type,class>.
00737  * If wildcard is true allow the first label to be a wildcard if
00738  * appropriate.
00739  *
00740  * Requires:
00741  *      'name' is a valid name.
00742  */
00743 
00744 isc_boolean_t
00745 dns_rdata_checknames(dns_rdata_t *rdata, dns_name_t *owner, dns_name_t *bad);
00746 /*
00747  * Returns whether 'rdata' contains valid domain names.  The checks are
00748  * sensitive to the owner name.
00749  *
00750  * If 'bad' is non-NULL and a domain name fails the check the
00751  * the offending name will be return in 'bad' by cloning from
00752  * the 'rdata' contents.
00753  *
00754  * Requires:
00755  *      'rdata' to be valid.
00756  *      'owner' to be valid.
00757  *      'bad'   to be NULL or valid.
00758  */
00759 
00760 void
00761 dns_rdata_exists(dns_rdata_t *rdata, dns_rdatatype_t type);
00762 
00763 void
00764 dns_rdata_notexist(dns_rdata_t *rdata, dns_rdatatype_t type);
00765 
00766 void
00767 dns_rdata_deleterrset(dns_rdata_t *rdata, dns_rdatatype_t type);
00768 
00769 void
00770 dns_rdata_makedelete(dns_rdata_t *rdata);
00771 
00772 const char *
00773 dns_rdata_updateop(dns_rdata_t *rdata, dns_section_t section);
00774 
00775 ISC_LANG_ENDDECLS
00776 
00777 #endif /* DNS_RDATA_H */

Generated on Tue Apr 28 17:40:57 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha