1 /* 2 * update.h 3 * 4 * Functions for RFC 2136 Dynamic Update 5 * 6 * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. 7 * 8 * See LICENSE for the license. 9 */ 10 11 /** 12 * \file 13 * 14 * Defines functions to perform UPDATE queries 15 */ 16 17 18 #ifndef LDNS_UPDATE_H 19 #define LDNS_UPDATE_H 20 21 #include <ldns/resolver.h> 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /** 28 * create an update packet from zone name, class and the rr lists 29 * \param[in] zone_rdf name of the zone 30 * The returned packet will take ownership of zone_rdf, so the caller should not free it 31 * \param[in] clas zone class 32 * \param[in] pr_rrlist list of Prerequisite Section RRs 33 * \param[in] up_rrlist list of Updates Section RRs 34 * \param[in] ad_rrlist list of Additional Data Section RRs (currently unused) 35 * \return the new packet 36 */ 37 ldns_pkt *ldns_update_pkt_new(ldns_rdf *zone_rdf, ldns_rr_class clas, const ldns_rr_list *pr_rrlist, const ldns_rr_list *up_rrlist, const ldns_rr_list *ad_rrlist); 38 39 /** 40 * add tsig credentials to 41 * a packet from a resolver 42 * \param[in] p packet to copy to 43 * \param[in] r resolver to copy from 44 * 45 * \return status whether successful or not 46 */ 47 ldns_status ldns_update_pkt_tsig_add(ldns_pkt *p, const ldns_resolver *r); 48 49 /* access functions */ 50 51 /** 52 * Get the zo count 53 * \param[in] p the packet 54 * \return the zo count 55 */ 56 uint16_t ldns_update_zocount(const ldns_pkt *p); 57 /** 58 * Get the zo count 59 * \param[in] p the packet 60 * \return the pr count 61 */ 62 uint16_t ldns_update_prcount(const ldns_pkt *p); 63 /** 64 * Get the zo count 65 * \param[in] p the packet 66 * \return the up count 67 */ 68 uint16_t ldns_update_upcount(const ldns_pkt *p); 69 /** 70 * Get the zo count 71 * \param[in] p the packet 72 * \return the ad count 73 */ 74 uint16_t ldns_update_ad(const ldns_pkt *p); 75 /** 76 * Set the zo count 77 * \param[in] p the packet 78 * \param[in] c the zo count to set 79 */ 80 void ldns_update_set_zo(ldns_pkt *p, uint16_t c); 81 /** 82 * Set the pr count 83 * \param[in] p the packet 84 * \param[in] c the pr count to set 85 */ 86 void ldns_update_set_prcount(ldns_pkt *p, uint16_t c); 87 /** 88 * Set the up count 89 * \param[in] p the packet 90 * \param[in] c the up count to set 91 */ 92 void ldns_update_set_upcount(ldns_pkt *p, uint16_t c); 93 /** 94 * Set the ad count 95 * \param[in] p the packet 96 * \param[in] c the ad count to set 97 */ 98 void ldns_update_set_adcount(ldns_pkt *p, uint16_t c); 99 100 /* soa functions that need to be configured */ 101 /* 102 * Not sure if we want to keep these like this, therefore 103 * not documented 104 */ 105 ldns_status ldns_update_soa_mname(ldns_rdf *zone, ldns_resolver *r, ldns_rr_class c, ldns_rdf **mname); 106 /* 107 * Not sure if we want to keep these like this, therefore 108 * not documented 109 */ 110 ldns_status ldns_update_soa_zone_mname(const char *fqdn, ldns_resolver *r, ldns_rr_class c, ldns_rdf **zone_rdf, ldns_rdf **mname_rdf); 111 112 #ifdef __cplusplus 113 } 114 #endif 115 116 #endif /* LDNS_UPDATE_H */ 117