zone.h
Go to the documentation of this file.
1 
23 #ifndef LDNS_ZONE_H
24 #define LDNS_ZONE_H
25 
26 #include <ldns/common.h>
27 #include <ldns/rdata.h>
28 #include <ldns/rr.h>
29 #include <ldns/error.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
43 {
46  /* basically a zone is a list of rr's */
48  /* we could change this to be a b-tree etc etc todo */
49 };
50 typedef struct ldns_struct_zone ldns_zone;
51 
56 ldns_zone * ldns_zone_new(void);
57 
63 ldns_rr * ldns_zone_soa(const ldns_zone *z);
64 
70 size_t ldns_zone_rr_count(const ldns_zone *z);
71 
77 void ldns_zone_set_soa(ldns_zone *z, ldns_rr *soa);
78 
87 
93 void ldns_zone_set_rrs(ldns_zone *z, ldns_rr_list *rrlist);
94 
102 bool ldns_zone_push_rr_list(ldns_zone *z, const ldns_rr_list *list);
103 
111 bool ldns_zone_push_rr(ldns_zone *z, ldns_rr *rr);
112 
127 
138 ldns_status ldns_zone_new_frm_fp(ldns_zone **z, FILE *fp, const ldns_rdf *origin, uint32_t ttl, ldns_rr_class c);
139 
151 ldns_status ldns_zone_new_frm_fp_l(ldns_zone **z, FILE *fp, const ldns_rdf *origin, uint32_t ttl, ldns_rr_class c, int *line_nr);
152 
157 void ldns_zone_free(ldns_zone *zone);
158 
164 void ldns_zone_deep_free(ldns_zone *zone);
165 
170 void ldns_zone_sort(ldns_zone *zone);
171 
172 #ifdef __cplusplus
173 }
174 #endif
175 
176 #endif /* LDNS_ZONE_H */
Common definitions for LDNS.
Defines error numbers and functions to translate those to a readable string.
enum ldns_enum_status ldns_status
Definition: error.h:146
Defines ldns_rdf and functions to manipulate those.
Contains the definition of ldns_rr and functions to manipulate those.
enum ldns_enum_rr_class ldns_rr_class
Definition: rr.h:61
Resource record data field.
Definition: rdata.h:197
List or Set of Resource Records.
Definition: rr.h:338
Resource Record.
Definition: rr.h:310
DNS Zone.
Definition: zone.h:43
ldns_rr_list * _rrs
Definition: zone.h:47
ldns_rr * _soa
the soa defines a zone
Definition: zone.h:45
void ldns_zone_set_soa(ldns_zone *z, ldns_rr *soa)
Set the zone's soa record.
Definition: zone.c:29
ldns_zone * ldns_zone_new(void)
create a new ldns_zone structure
Definition: zone.c:165
size_t ldns_zone_rr_count(const ldns_zone *z)
Returns the number of resource records in the zone, NOT counting the SOA record.
Definition: zone.c:23
void ldns_zone_set_rrs(ldns_zone *z, ldns_rr_list *rrlist)
Set the zone's contents.
Definition: zone.c:41
ldns_rr_list * ldns_zone_rrs(const ldns_zone *z)
Get a list of a zone's content.
Definition: zone.c:35
bool ldns_zone_push_rr_list(ldns_zone *z, const ldns_rr_list *list)
push an rrlist to a zone structure.
Definition: zone.c:47
void ldns_zone_deep_free(ldns_zone *zone)
Frees the allocated memory for the zone, the soa rr in it, and the rr_list structure in it,...
Definition: zone.c:376
bool ldns_zone_push_rr(ldns_zone *z, ldns_rr *rr)
push an single rr to a zone structure.
Definition: zone.c:53
ldns_status ldns_zone_new_frm_fp(ldns_zone **z, FILE *fp, const ldns_rdf *origin, uint32_t ttl, ldns_rr_class c)
Create a new zone from a file.
Definition: zone.c:187
ldns_rr * ldns_zone_soa(const ldns_zone *z)
Return the soa record of a zone.
Definition: zone.c:17
void ldns_zone_free(ldns_zone *zone)
Frees the allocated memory for the zone, and the rr_list structure in it.
Definition: zone.c:369
void ldns_zone_sort(ldns_zone *zone)
Sort the rrs in a zone, with the current impl.
Definition: zone.c:359
ldns_status ldns_zone_new_frm_fp_l(ldns_zone **z, FILE *fp, const ldns_rdf *origin, uint32_t ttl, ldns_rr_class c, int *line_nr)
Create a new zone from a file, keep track of the line numbering.
ldns_rr_list * ldns_zone_glue_rr_list(const ldns_zone *z)
Retrieve all resource records from the zone that are glue records.
Definition: zone.c:65