]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/srvrec.h
fix "Mismatched free() / delete / delete []" in simple_buffer
[apt.git] / apt-pkg / contrib / srvrec.h
index 79b318b48e23c0657b308fe8edfa179934a086ec..01b810281b0c16ffe091da5be94a9f32d0bbecb3 100644 (file)
@@ -3,7 +3,7 @@
 /* ######################################################################
 
    SRV record support
 /* ######################################################################
 
    SRV record support
-  
+
    ##################################################################### */
                                                                        /*}}}*/
 #ifndef SRVREC_H
    ##################################################################### */
                                                                        /*}}}*/
 #ifndef SRVREC_H
@@ -26,9 +26,16 @@ class SrvRec
    int random_number_range_end;
    int random_number_range_max;
 
    int random_number_range_end;
    int random_number_range_max;
 
-   bool operator<(SrvRec const &other) const { 
-      return this->priority < other.priority; 
+   bool operator<(SrvRec const &other) const {
+      return this->priority < other.priority;
    }
    }
+   bool operator==(SrvRec const &other) const;
+
+   SrvRec(std::string const Target, u_int16_t const Priority,
+        u_int16_t const Weight, u_int16_t const Port) :
+      target(Target), priority(Priority), weight(Weight), port(Port),
+      random_number_range_start(0), random_number_range_end(0),
+      random_number_range_max(0) {}
 };
 
 /** \brief Get SRV records from host/port (builds the query string internally) 
 };
 
 /** \brief Get SRV records from host/port (builds the query string internally) 
@@ -39,4 +46,9 @@ bool GetSrvRecords(std::string name, std::vector<SrvRec> &Result);
  */
 bool GetSrvRecords(std::string host, int port, std::vector<SrvRec> &Result);
 
  */
 bool GetSrvRecords(std::string host, int port, std::vector<SrvRec> &Result);
 
+/** \brief Pop a single SRV record from the vector of SrvRec taking
+ *         priority and weight into account
+ */
+SrvRec PopFromSrvRecs(std::vector<SrvRec> &Recs);
+
 #endif
 #endif