add endpoint print functions

This commit is contained in:
Chunting Gu
2020-03-02 09:41:06 +08:00
parent 57f069135b
commit 2cf48aed35
3 changed files with 30 additions and 0 deletions
+11
View File
@@ -1,8 +1,11 @@
#ifndef WEBCC_UTILITY_H_
#define WEBCC_UTILITY_H_
#include <iosfwd>
#include <string>
#include "asio/ip/tcp.hpp"
#include "webcc/globals.h"
// Avoid include <filesystem> in the header.
@@ -35,6 +38,14 @@ bool ReadFile(const std::filesystem::path& path, std::string* output);
void DumpByLine(const std::string& data, std::ostream& os,
const std::string& prefix);
// Print TCP endpoint.
// Usage: PrintEndpoint(std::cout, endpoint)
void PrintEndpoint(std::ostream& ostream,
const asio::ip::tcp::endpoint& endpoint);
// TCP endpoint to string.
std::string EndpointToString(const asio::ip::tcp::endpoint& endpoint);
} // namespace utility
} // namespace webcc