21 #ifndef INCLUDE_OLA_SLP_URLENTRY_H_
22 #define INCLUDE_OLA_SLP_URLENTRY_H_
24 #include <ola/io/BigEndianStream.h>
46 URLEntry(
const std::string &url, uint16_t lifetime)
48 m_lifetime(lifetime) {
53 std::string url()
const {
return m_url; }
54 uint16_t lifetime()
const {
return m_lifetime; }
55 void set_lifetime(uint16_t lifetime) { m_lifetime = lifetime; }
61 bool AgeLifetime(uint16_t seconds) {
62 if (m_lifetime <= seconds) {
71 unsigned int PackedSize()
const {
return 6 + m_url.size(); }
77 bool operator==(
const URLEntry &other)
const {
78 return m_url == other.m_url;
81 bool operator!=(
const URLEntry &other)
const {
82 return m_url != other.m_url;
85 URLEntry& operator=(
const URLEntry &other) {
88 m_lifetime = other.m_lifetime;
93 void ToStream(std::ostream *out)
const {
94 *out << m_url <<
"(" << m_lifetime <<
")";
97 std::string ToString()
const {
98 std::ostringstream str;
103 friend std::ostream& operator<<(std::ostream &out,
const URLEntry &entry) {
104 entry.ToStream(&out);
115 typedef std::vector<URLEntry> URLEntries;
118 #endif // INCLUDE_OLA_SLP_URLENTRY_H_