/usr/include/ldns/zone.h is in libldns-dev 1.6.11-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | /**
* zone.h
*
* zone definitions
* - what is it
* - get_glue function
* - search etc
*
* a Net::DNS like library for C
*
* (c) NLnet Labs, 2005-2006
*
* See the file LICENSE for the license
*/
/**
* \file
*
* Defines the ldns_zone structure and functions to manipulate it.
*/
#ifndef LDNS_ZONE_H
#define LDNS_ZONE_H
#include <ldns/common.h>
#include <ldns/rdata.h>
#include <ldns/rr.h>
#include <ldns/error.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* DNS Zone
*
* A list of RR's with some
* extra information which comes from the SOA RR
* Note: nothing has been done to make this efficient (yet).
*/
struct ldns_struct_zone
{
/** the soa defines a zone */
ldns_rr *_soa;
/* basicly a zone is a list of rr's */
ldns_rr_list *_rrs;
/* we could change this to be a b-tree etc etc todo */
};
typedef struct ldns_struct_zone ldns_zone;
/**
* create a new ldns_zone structure
* \return a pointer to a ldns_zone structure
*/
ldns_zone * ldns_zone_new(void);
/**
* Return the soa record of a zone
* \param[in] z the zone to read from
* \return the soa record in the zone
*/
ldns_rr * ldns_zone_soa(const ldns_zone *z);
/**
* Returns the number of resource records in the zone, NOT counting the SOA record
* \param[in] z the zone to read from
* \return the number of rr's in the zone
*/
size_t ldns_zone_rr_count(const ldns_zone *z);
/**
* Set the zone's soa record
* \param[in] z the zone to put the new soa in
* \param[in] soa the soa to set
*/
void ldns_zone_set_soa(ldns_zone *z, ldns_rr *soa);
/**
* Get a list of a zone's content. Note that the SOA
* isn't included in this list. You need to get the
* with ldns_zone_soa.
* \param[in] z the zone to read from
* \return the rrs from this zone
*/
ldns_rr_list * ldns_zone_rrs(const ldns_zone *z);
/**
* Set the zone's contents
* \param[in] z the zone to put the new soa in
* \param[in] rrlist the rrlist to use
*/
void ldns_zone_set_rrs(ldns_zone *z, ldns_rr_list *rrlist);
/**
* push an rrlist to a zone structure. This function use pointer
* copying, so the rr_list structure inside z is modified!
* \param[in] z the zone to add to
* \param[in] list the list to add
* \return a true on succes otherwise falsed
*/
bool ldns_zone_push_rr_list(ldns_zone *z, ldns_rr_list *list);
/**
* push an single rr to a zone structure. This function use pointer
* copying, so the rr_list structure inside z is modified!
* \param[in] z the zone to add to
* \param[in] rr the rr to add
* \return a true on succes otherwise falsed
*/
bool ldns_zone_push_rr(ldns_zone *z, ldns_rr *rr);
/**
* Retrieve all resource records from the zone that are glue
* records. The resulting list does are pointer references
* to the zone's data.
*
* Due to the current zone implementation (as a list of rr's), this
* function is extremely slow. Another (probably better) way to do this
* is to use an ldns_dnssec_zone structure and the
* ldns_dnssec_mark_and_get_glue() function.
*
* \param[in] z the zone to look for glue
* \return the rr_list with the glue
*/
ldns_rr_list *ldns_zone_glue_rr_list(const ldns_zone *z);
/**
* Create a new zone from a file
* \param[out] z the new zone
* \param[in] *fp the filepointer to use
* \param[in] *origin the zones' origin
* \param[in] ttl default ttl to use
* \param[in] c default class to use (IN)
*
* \return ldns_status mesg with an error or LDNS_STATUS_OK
*/
ldns_status ldns_zone_new_frm_fp(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c);
/**
* Create a new zone from a file, keep track of the line numbering
* \param[out] z the new zone
* \param[in] *fp the filepointer to use
* \param[in] *origin the zones' origin
* \param[in] ttl default ttl to use
* \param[in] c default class to use (IN)
* \param[out] line_nr used for error msg, to get to the line number
*
* \return ldns_status mesg with an error or LDNS_STATUS_OK
*/
ldns_status ldns_zone_new_frm_fp_l(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c, int *line_nr);
/**
* Frees the allocated memory for the zone, and the rr_list structure in it
* \param[in] zone the zone to free
*/
void ldns_zone_free(ldns_zone *zone);
/**
* Frees the allocated memory for the zone, the soa rr in it,
* and the rr_list structure in it, including the rr's in that. etc.
* \param[in] zone the zone to free
*/
void ldns_zone_deep_free(ldns_zone *zone);
/**
* Sort the rrs in a zone, with the current impl. this is slow
* \param[in] zone the zone to sort
*/
void ldns_zone_sort(ldns_zone *zone);
#ifdef __cplusplus
}
#endif
#endif /* LDNS_ZONE_H */
|