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 extern const char *svcparamkey_strs[]; 23 24 int 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 */ 35 ssize_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 */ 46 size_t rdata_maximum_wireformat_size(rrtype_descriptor_type *descriptor, 47 size_t rdata_count, 48 rdata_atom_type *rdatas); 49 50 int 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. */ 58 int print_rdata(buffer_type *output, rrtype_descriptor_type *descriptor, 59 rr_type *record); 60 61 #endif /* _DNS_H_ */ 62