#include <string.h>
#include <netdb.h>
+#include <sstream>
+
#include <fmt/format.h>
#include "common/Formatter.h"
+#include "include/types.h"
bool entity_name_t::parse(std::string_view s)
{
return ls;
}
+std::ostream& operator<<(std::ostream& out, const entity_addrvec_t& av) {
+ if (av.v.empty()) {
+ return out;
+ } else if (av.v.size() == 1) {
+ return out << av.v[0];
+ } else {
+ return out << av.v;
+ }
+}
+
std::string entity_addr_t::ip_only_to_str() const
{
const char *host_ip = NULL;
return fmt::format("{}:{}", ip_only_to_str(), get_port());
}
}
+
+std::string entity_addr_t::get_legacy_str() const {
+ std::ostringstream ss;
+ ss << get_sockaddr() << "/" << get_nonce();
+ return ss.str();
+}
#include <algorithm> // for std::min()
#include <set>
-#include <sstream>
#include <string>
#include <netinet/in.h>
#endif
#include "include/ceph_features.h"
-#include "include/types.h"
#include "include/blobhash.h"
#include "include/encoding.h"
#include "include/msgr.h" // for CEPH_ENTITY_TYPE_*
std::string ip_only_to_str() const;
std::string ip_n_port_to_str() const;
- std::string get_legacy_str() const {
- std::ostringstream ss;
- ss << get_sockaddr() << "/" << get_nonce();
- return ss.str();
- }
+ std::string get_legacy_str() const;
bool parse(const std::string_view s, int default_type=TYPE_DEFAULT);
bool parse(const char *s, const char **end = 0, int default_type=TYPE_DEFAULT);
return false;
}
- friend std::ostream& operator<<(std::ostream& out, const entity_addrvec_t& av) {
- if (av.v.empty()) {
- return out;
- } else if (av.v.size() == 1) {
- return out << av.v[0];
- } else {
- return out << av.v;
- }
- }
+ friend std::ostream& operator<<(std::ostream& out, const entity_addrvec_t& av);
friend bool operator==(const entity_addrvec_t& l, const entity_addrvec_t& r) {
return l.v == r.v;