1/* 2 * rdata.h -- RDATA conversion functions. 3 * 4 * Copyright (c) 2001-2006, NLnet Labs. All rights reserved. 5 * 6 * See LICENSE for the license. 7 * 8 */ 9 10#ifndef RDATA_H 11#define RDATA_H 12 13#include "dns.h" 14#include "namedb.h" 15 16/* High bit of the APL length field is the negation bit. */ 17#define APL_NEGATION_MASK 0x80U 18#define APL_LENGTH_MASK (~APL_NEGATION_MASK) 19 20extern lookup_table_type dns_certificate_types[]; 21extern lookup_table_type dns_algorithms[]; 22extern const char *svcparamkey_strs[]; 23 24int rdata_atom_to_string(buffer_type *output, rdata_zoneformat_type type, 25 rdata_atom_type rdata, rr_type *rr); 26 27/* 28 * Split the wireformat RDATA into an array of rdata atoms. Domain 29 * names are inserted into the OWNERS table. The number of rdata atoms 30 * is returned and the array itself is allocated in REGION and stored 31 * in RDATAS. 32 * 33 * Returns -1 on failure. 34 */ 35ssize_t rdata_wireformat_to_rdata_atoms(region_type *region, 36 domain_table_type *owners, 37 uint16_t rrtype, 38 uint16_t rdata_size, 39 buffer_type *packet, 40 rdata_atom_type **rdatas); 41 42/* 43 * Calculate the maximum size of the rdata assuming domain names are 44 * not compressed. 45 */ 46size_t rdata_maximum_wireformat_size(rrtype_descriptor_type *descriptor, 47 size_t rdata_count, 48 rdata_atom_type *rdatas); 49 50int rdata_atoms_to_unknown_string(buffer_type *out, 51 rrtype_descriptor_type *descriptor, 52 size_t rdata_count, 53 rdata_atom_type *rdatas); 54 55/* print rdata to a text string (as for a zone file) returns 0 56 on a failure (bufpos is reset to original position). 57 returns 1 on success, bufpos is moved. */ 58int print_rdata(buffer_type *output, rrtype_descriptor_type *descriptor, 59 rr_type *record); 60 61#endif /* RDATA_H */ 62