/* * Validates an ipv4ipv6 address and return the result. * Thanks, beej! */ bool util::valid_ipv46_addr(const std::experimental::string_view &addr) { assert(!addr.empty()); /* Unused, but required by inet_pton(). */ unsigned char buf[sizeof(struct in6_addr)]; if (ip_version(addr) == ipv4) return inet_pton(AF_INET, addr.data(), buf); else return inet_pton(AF_INET6, addr.data(), buf); }
void client::raw_cmd(const std::experimental::string_view &content) { if (content.empty()) throw std::invalid_argument("content is empty."); con_.write(content.data()); }