Initial vendor import of ldns-1.6.4 into contrib.
[dragonfly.git] / contrib / ldns / ldns / update.h
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 /**
24  * create an update packet from zone name, class and the rr lists
25  * \param[in] zone_rdf name of the zone
26  * \param[in] clas zone class
27  * \param[in] pr_rrlist list of Prerequisite Section RRs
28  * \param[in] up_rrlist list of Updates Section RRs
29  * \param[in] ad_rrlist list of Additional Data Section RRs (currently unused)
30  * \return the new packet
31  */
32 ldns_pkt *ldns_update_pkt_new(ldns_rdf *zone_rdf, ldns_rr_class clas, ldns_rr_list *pr_rrlist, ldns_rr_list *up_rrlist, ldns_rr_list *ad_rrlist);
33
34 /**
35  * add tsig credentials to
36  * a packet from a resolver
37  * \param[in] p packet to copy to
38  * \param[in] r resolver to copy from
39  *
40  * \return status wether successfull or not
41  */
42 ldns_status ldns_update_pkt_tsig_add(ldns_pkt *p, ldns_resolver *r);
43
44 /* access functions */
45
46 /**
47  * Get the zo count
48  * \param[in] p the packet
49  * \return the zo count
50  */
51 uint16_t ldns_update_zocount(const ldns_pkt *p);
52 /**
53  * Get the zo count
54  * \param[in] p the packet
55  * \return the pr count
56  */
57 uint16_t ldns_update_prcount(const ldns_pkt *p);
58 /**
59  * Get the zo count
60  * \param[in] p the packet
61  * \return the up count
62  */
63 uint16_t ldns_update_upcount(const ldns_pkt *p);
64 /**
65  * Get the zo count
66  * \param[in] p the packet
67  * \return the ad count
68  */
69 uint16_t ldns_update_ad(const ldns_pkt *p);
70 /**
71  * Set the zo count
72  * \param[in] p the packet
73  * \param[in] c the zo count to set
74  */
75 void ldns_update_set_zo(ldns_pkt *p, uint16_t c);
76 /**
77  * Set the pr count
78  * \param[in] p the packet
79  * \param[in] c the pr count to set
80  */
81 void ldns_update_set_prcount(ldns_pkt *p, uint16_t c);
82 /**
83  * Set the up count
84  * \param[in] p the packet
85  * \param[in] c the up count to set
86  */
87 void ldns_update_set_upcount(ldns_pkt *p, uint16_t c);
88 /**
89  * Set the ad count
90  * \param[in] p the packet
91  * \param[in] c the ad count to set
92  */
93 void ldns_update_set_adcount(ldns_pkt *p, uint16_t c);
94
95 /* soa functions that need to be configured */
96 /*
97  * Not sure if we want to keep these like this, therefore
98  * not documented
99  */
100 ldns_status ldns_update_soa_mname(ldns_rdf *zone, ldns_resolver *r, ldns_rr_class c, ldns_rdf **mname);
101 /* 
102  * Not sure if we want to keep these like this, therefore
103  * not documented
104  */
105 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);
106
107 #endif  /* LDNS_UPDATE_H */