#include <arpa/nameser.h>
#include <resolv.h>
+#include <algorithm>
+
#include <apt-pkg/error.h>
#include "srvrec.h"
Result.push_back(rec);
}
+ // sort them
+ std::stable_sort(Result.begin(), Result.end());
+
+ // FIXME: implement weight selection as specified in RFC-2782
+
return true;
}
u_int16_t weight;
u_int16_t port;
- // see rfc-2782
- //int random;
+ bool operator<(SrvRec const &other) const {
+ return this->priority < other.priority;
+ }
};
bool GetSrvRecords(std::string name, std::vector<SrvRec> &Result);