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