need them before...
o init function? random - load_ssl_errors()
- SSL_load_error_str()?
o SERVER stuff; open connection and such - NOT DONE AT ALL - will happen in .90
+o const args for all functions
To ponder and discuss:
----------------------
*
* dname specific rdata implementations
* A dname is a rdf structure with type LDNS_RDF_TYPE_DNAME
+ * It is not a /real/ type! All function must therefor check
+ * for LDNS_RDF_TYPE_DNAME.
*
* a Net::DNS like library for C
*
#include <netdb.h>
#include <arpa/inet.h>
-
ldns_rdf *
ldns_dname_cat_clone(ldns_rdf *rd1, ldns_rdf *rd2)
{
}
uint8_t
-ldns_dname_label_count(ldns_rdf *r)
+ldns_dname_label_count(const ldns_rdf *r)
{
uint8_t src_pos;
uint8_t len;
*rdd = (uint8_t)LDNS_DNAME_NORMALIZE((int)*rdd);
}
}
+
+bool
+ldns_dname_is_subdomain(const ldns_rdf *sub, const ldns_rdf *parent)
+{
+ uint8_t sub_lab;
+ uint8_t par_lab;
+ int8_t i;
+
+ if (ldns_rdf_get_type(sub) != LDNS_RDF_TYPE_DNAME ||
+ ldns_rdf_get_type(parent) != LDNS_RDF_TYPE_DNAME) {
+ return false;
+ }
+
+ sub_lab = ldns_dname_label_count(sub);
+ par_lab = ldns_dname_label_count(parent);
+
+ /* if sub sits above parent, it cannot be a child/sub domain */
+ if (sub_lab < par_lab) {
+ return false;
+ }
+
+ /* check all labels the from the parent labels, from right to left.
+ * When they /all/ match we have found a subdomain
+ */
+ for (i = par_lab; i > 0; i--) {
+ /* */
+ }
+ return false;
+}
+
+uint8_t *
+ldns_dname_label(ldns_rdf *rdf, uint8_t labelpos)
+{
+ rdf = rdf;
+ labelpos = labelpos;
+
+ return NULL;
+}
* \param[in] *r the rdf
* \return the number of labels
*/
-uint8_t ldns_dname_label_count(ldns_rdf *r);
+uint8_t ldns_dname_label_count(const ldns_rdf *r);
/**
* Create a new dname rdf from a string
* \return ldns_rdf*
*/
ldns_rdf *ldns_dname_new_frm_data(uint16_t size, const void *data);
+
/**
* Put a dname into canonical fmt - ie. lowercase it
* \param[in] rdf the dname to lowercase
* \return void
*/
-void ldns_dname2canonical(const ldns_rdf *rdf);
+void ldns_dname2canonical(const ldns_rdf *rdf);
+
+/**
+ * test wether the name sub falls under parent (i.e. is a subdomain
+ * of parent.
+ * \param[in] sub the name to test
+ * \param[in] parent the parent's name
+ * \return true if sub falls under parent, otherwise false
+ */
+bool ldns_dname_is_subdomain(const ldns_rdf *sub, const ldns_rdf *parent);
+
+/**
+ * look inside the rdf and if it is an LDNS_RDF_TYPE_DNAME
+ * try and retrieve a specific label. The labels are numbered
+ * starting from 0 (left most).
+ * \param[in] rdf the rdf to look in
+ * \param[in] labelpos return the label with this number
+ * \return a pointer to a newly allocated buffer with the
+ * label which is NULL terminated
+ */
+uint8_t * ldns_dname_label(ldns_rdf *rdf, uint8_t labelpos);
#endif /* !_LDNS_DNAME_H */
*/
bool ldns_zone_push_rr(ldns_zone *z, ldns_rr *rr);
+/**
+ * find out if the rr is glue inside zone z
+ * \param[in] z the zone to look for glue
+ * \param[in] rr the rr to test
+ * \return true if rr is glue, otherwise false
+ */
+bool ldns_zone_rr_is_glue(ldns_zone *z, ldns_rr *rr);
+
#endif /* LDNS_ZONE_H */
ldns_zone_rrs(z), rr);
}
+bool
+ldns_zone_rr_is_glue(ldns_zone *z, ldns_rr *rr)
+{
+ z = z;
+ rr = rr;
+
+ return false;
+}
+
#if 0
/**
* ixfr function. Work on a ldns_zone and remove and add