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 20 extern lookup_table_type dns_certificate_types[]; 21 extern lookup_table_type dns_algorithms[]; 22 23 int rdata_atom_to_string(buffer_type *output, rdata_zoneformat_type type, 24 rdata_atom_type rdata, rr_type *rr); 25 26 /* 27 * Split the wireformat RDATA into an array of rdata atoms. Domain 28 * names are inserted into the OWNERS table. The number of rdata atoms 29 * is returned and the array itself is allocated in REGION and stored 30 * in RDATAS. 31 * 32 * Returns -1 on failure. 33 */ 34 ssize_t rdata_wireformat_to_rdata_atoms(region_type *region, 35 domain_table_type *owners, 36 uint16_t rrtype, 37 uint16_t rdata_size, 38 buffer_type *packet, 39 rdata_atom_type **rdatas); 40 41 /* 42 * Calculate the maximum size of the rdata assuming domain names are 43 * not compressed. 44 */ 45 size_t rdata_maximum_wireformat_size(rrtype_descriptor_type *descriptor, 46 size_t rdata_count, 47 rdata_atom_type *rdatas); 48 49 int rdata_atoms_to_unknown_string(buffer_type *out, 50 rrtype_descriptor_type *descriptor, 51 size_t rdata_count, 52 rdata_atom_type *rdatas); 53 54 /* print rdata to a text string (as for a zone file) returns 0 55 on a failure (bufpos is reset to original position). 56 returns 1 on success, bufpos is moved. */ 57 int print_rdata(buffer_type *output, rrtype_descriptor_type *descriptor, 58 rr_type *record); 59 60 #endif /* _DNS_H_ */ 61