+ m_custom_session = s;
+}
+
+std::string mp::Origin::get_forward_address() const
+{
+ // return first component of address
+ // That's either first part of X-Forwarded component
+ size_t pos = m_address.find(' ');
+ if (pos != std::string::npos)
+ return m_address.substr(0, pos);
+ else
+ return m_address;
+}
+
+std::string mp::Origin::get_address()
+{
+ // return last component of address
+ size_t pos = m_address.rfind(' ');
+ if (pos != std::string::npos)
+ return m_address.substr(pos + 1);
+ else
+ return m_address;
+}
+
+std::ostream& std::operator<<(std::ostream& os, const mp::Origin& o)
+{
+ // print first component of address
+ std::string a = o.get_forward_address();
+ if (a.length())
+ os << a;