]> git.saurik.com Git - apt.git/blob - apt-pkg/contrib/srvrec.h
when using srv records, use the next server if one fails to connect
[apt.git] / apt-pkg / contrib / srvrec.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 /* ######################################################################
4
5 SRV record support
6
7 ##################################################################### */
8 /*}}}*/
9 #ifndef SRVREC_H
10 #define SRVREC_H
11
12 #include <arpa/nameser.h>
13 #include <vector>
14 #include <string>
15
16 class SrvRec
17 {
18 public:
19 std::string target;
20 u_int16_t priority;
21 u_int16_t weight;
22 u_int16_t port;
23
24 bool operator<(SrvRec const &other) const {
25 return this->priority < other.priority;
26 }
27 };
28
29 /** \brief Get SRV records from host/port (builds the query string internally)
30 */
31 bool GetSrvRecords(std::string name, std::vector<SrvRec> &Result);
32
33 /** \brief Get SRV records for query string like: _http._tcp.example.com
34 */
35 bool GetSrvRecords(std::string host, int port, std::vector<SrvRec> &Result);
36
37 #endif