diff --git a/include/client.hpp b/include/client.hpp index b9d2e89..776a672 100644 --- a/include/client.hpp +++ b/include/client.hpp @@ -8,6 +8,8 @@ #include "boost/bind.hpp" +namespace commons { + class client { public: client(boost::asio::io_service& io_service, @@ -26,3 +28,5 @@ class client { std::string message_; unsigned short port_; }; + +} // namespace commons diff --git a/include/server.hpp b/include/server.hpp index d4096ff..e53f937 100644 --- a/include/server.hpp +++ b/include/server.hpp @@ -7,7 +7,10 @@ #include "protocol.hpp" #include "spdlog/spdlog.h" +namespace commons { + using boost::asio::ip::udp; +using namespace protocol; class server { public: @@ -55,3 +58,5 @@ class server { enum { max_length = 1024 }; char data_[max_length]; }; + +} // namespace commons diff --git a/src/client.cpp b/src/client.cpp index ee31a2a..d001b95 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -5,6 +5,8 @@ #include "protocol.hpp" #include "spdlog/spdlog.h" +namespace commons { + client::client(boost::asio::io_service& io_service, const boost::asio::ip::address& multicast_address, short multicast_port, unsigned short tcp_port) @@ -54,3 +56,5 @@ void client::handle_timeout(const boost::system::error_code& error) { // std::placeholders::_1)); } } + +} // namespace commons diff --git a/src/main.cpp b/src/main.cpp index c0e8dc7..28a93bb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,15 +14,16 @@ void init_spdlog() { void run_client() { boost::asio::io_context io_context; spdlog::info("Running client..."); - client s(io_context, boost::asio::ip::make_address("0.0.0.0"), 9000, 0); + commons::client s(io_context, boost::asio::ip::make_address("0.0.0.0"), 9000, + 0); s.init(); io_context.run(); } void run_server() { boost::asio::io_context io_context; - spdlog::info("Running client..."); - server s(io_context, 9000); + spdlog::info("Running server..."); + commons::server s(io_context, 9000); io_context.run(); } diff --git a/src/protocol.cpp b/src/protocol.cpp index c2a0fc0..24fc11b 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -1 +1,3 @@ #include "protocol.hpp" + +namespace commons::protocol {} // namespace commons::protocol