*/
void ldns_rr_list_sort(ldns_rr_list *unsorted);
-/**
- * sorts an rr_list (owner - class - type). the sorting is done inband.
- * \param[in] unsorted the rr_list to be sorted
- * \return void
- */
-void ldns_rr_list_sort_oct(ldns_rr_list *unsorted);
-
/**
* compares two rrs.
* \param[in] rr1 the first one
*/
int ldns_rr_compare(const ldns_rr *rr1, const ldns_rr *rr2);
-/**
- * compares two rrs. (owner-class-type order)
- * \param[in] rr1 the first one
- * \param[in] rr2 the second one
- * \return 0 if equal
- * -1 if rr1 comes before rr2
- * +1 if rr2 comes before rr1
- */
-int ldns_rr_compare_oct(const ldns_rr *rr1, const ldns_rr *rr2);
-
/**
* returns true of the given rr's are equal.
* Also returns true if one record is a DS that represents the
/*
* ldns_tcp_server_connect
- *
- * and the normal conetc, for just a socket
*/
int
ldns_udp_server_connect(const struct sockaddr_storage *to, struct timeval timeout)
return ldns_rr_compare(rr1, rr2);
}
-static int
-qsort_rr_compare_oct(const void *a, const void *b)
-{
- const ldns_rr *rr1 = * (const ldns_rr **) a;
- const ldns_rr *rr2 = * (const ldns_rr **) b;
- return ldns_rr_compare_oct(rr1, rr2);
-}
-
void
ldns_rr_list_sort(ldns_rr_list *unsorted)
{
}
}
-void
-ldns_rr_list_sort_oct(ldns_rr_list *unsorted)
-{
- if (unsorted) {
- qsort(unsorted->_rrs,
- ldns_rr_list_rr_count(unsorted),
- sizeof(ldns_rr *),
- qsort_rr_compare_oct);
- }
-}
-
-/* sort by owner - class - type */
-int
-ldns_rr_compare_oct(const ldns_rr *rr1, const ldns_rr *rr2)
-{
- char *n1, *n2;
- ldns_rr_class c1, c2;
- ldns_rr_type t1, t2;
- int result;
-
- n1 = ldns_rdf2str(ldns_rr_owner(rr1));
- n2 = ldns_rdf2str(ldns_rr_owner(rr2));
- c1 = ldns_rr_get_class(rr1);
- c2 = ldns_rr_get_class(rr2);
- t1 = ldns_rr_get_type(rr1);
- t2 = ldns_rr_get_type(rr2);
-
- result = strcmp(n1, n2);
- if (result == 0) {
- if (c1 < c2) {
- result = -1;
- } else if (c1 > c2) {
- result = 1;
- } else {
- if (t1 < t2) {
- result = -1;
- } else if (t1 > t2) {
- result = 1;
- } else {
- result = 0;
- }
- }
- }
-
- LDNS_FREE(n1);
- LDNS_FREE(n2);
- return result;
-
-}
-
int
ldns_rr_compare(const ldns_rr *rr1, const ldns_rr *rr2)
{