diff --git a/.gitmodules b/.gitmodules index 8ac1453..8ae244b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "rpc/rpc_core"] - path = rpc/rpc_core +[submodule "include/asio_net/rpc_core"] + path = include/asio_net/rpc_core url = git@github.com:shuai132/rpc_core.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bc26cf..bd7295e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,15 +17,14 @@ set(CMAKE_CXX_STANDARD 14) add_compile_options(-Wall) add_library(${PROJECT_NAME} INTERFACE) -target_include_directories(${PROJECT_NAME} INTERFACE .) +target_include_directories(${PROJECT_NAME} INTERFACE include) if (ASIO_NET_ENABLE_SSL) target_compile_definitions(${PROJECT_NAME} INTERFACE -DASIO_NET_ENABLE_SSL) endif () if (ASIO_NET_ENABLE_RPC) target_include_directories(${PROJECT_NAME} INTERFACE - rpc/rpc_core - rpc + include/asio_net/rpc_core/include ) endif () diff --git a/include/asio_net.hpp b/include/asio_net.hpp new file mode 100644 index 0000000..cc97071 --- /dev/null +++ b/include/asio_net.hpp @@ -0,0 +1,7 @@ +#pragma once + +#include "asio_net/server_discovery.hpp" +#include "asio_net/tcp_client.hpp" +#include "asio_net/tcp_server.hpp" +#include "asio_net/udp_client.hpp" +#include "asio_net/udp_server.hpp" diff --git a/config.h b/include/asio_net/config.h similarity index 100% rename from config.h rename to include/asio_net/config.h diff --git a/detail/log.h b/include/asio_net/detail/log.h similarity index 100% rename from detail/log.h rename to include/asio_net/detail/log.h diff --git a/detail/message.hpp b/include/asio_net/detail/message.hpp similarity index 100% rename from detail/message.hpp rename to include/asio_net/detail/message.hpp diff --git a/detail/noncopyable.hpp b/include/asio_net/detail/noncopyable.hpp similarity index 100% rename from detail/noncopyable.hpp rename to include/asio_net/detail/noncopyable.hpp diff --git a/rpc/detail/rpc_client_t.hpp b/include/asio_net/detail/rpc_client_t.hpp similarity index 96% rename from rpc/detail/rpc_client_t.hpp rename to include/asio_net/detail/rpc_client_t.hpp index c7397fb..1443259 100644 --- a/rpc/detail/rpc_client_t.hpp +++ b/include/asio_net/detail/rpc_client_t.hpp @@ -2,10 +2,10 @@ #include -#include "detail/noncopyable.hpp" +#include "noncopyable.hpp" #include "rpc_core.hpp" -#include "rpc_session.hpp" -#include "tcp_client.hpp" +#include "rpc_session_t.hpp" +#include "tcp_client_t.hpp" namespace asio_net { namespace detail { diff --git a/rpc/detail/rpc_server_t.hpp b/include/asio_net/detail/rpc_server_t.hpp similarity index 97% rename from rpc/detail/rpc_server_t.hpp rename to include/asio_net/detail/rpc_server_t.hpp index 4824488..79d84fb 100644 --- a/rpc/detail/rpc_server_t.hpp +++ b/include/asio_net/detail/rpc_server_t.hpp @@ -3,8 +3,8 @@ #include #include "asio.hpp" -#include "rpc_session.hpp" -#include "tcp_server.hpp" +#include "rpc_session_t.hpp" +#include "tcp_server_t.hpp" namespace asio_net { namespace detail { diff --git a/rpc/detail/rpc_session_t.hpp b/include/asio_net/detail/rpc_session_t.hpp similarity index 96% rename from rpc/detail/rpc_session_t.hpp rename to include/asio_net/detail/rpc_session_t.hpp index bb4236c..f2cd410 100644 --- a/rpc/detail/rpc_session_t.hpp +++ b/include/asio_net/detail/rpc_session_t.hpp @@ -2,9 +2,9 @@ #include -#include "detail/noncopyable.hpp" -#include "detail/tcp_channel_t.hpp" +#include "noncopyable.hpp" #include "rpc_core.hpp" +#include "tcp_channel_t.hpp" namespace asio_net { namespace detail { diff --git a/detail/socket_type.hpp b/include/asio_net/detail/socket_type.hpp similarity index 100% rename from detail/socket_type.hpp rename to include/asio_net/detail/socket_type.hpp diff --git a/detail/tcp_channel_t.hpp b/include/asio_net/detail/tcp_channel_t.hpp similarity index 99% rename from detail/tcp_channel_t.hpp rename to include/asio_net/detail/tcp_channel_t.hpp index a1843b0..fa6dcf8 100644 --- a/detail/tcp_channel_t.hpp +++ b/include/asio_net/detail/tcp_channel_t.hpp @@ -3,8 +3,8 @@ #include #include +#include "../config.h" #include "asio.hpp" -#include "config.h" #include "log.h" #include "message.hpp" #include "noncopyable.hpp" diff --git a/detail/tcp_client_t.hpp b/include/asio_net/detail/tcp_client_t.hpp similarity index 100% rename from detail/tcp_client_t.hpp rename to include/asio_net/detail/tcp_client_t.hpp diff --git a/detail/tcp_server_t.hpp b/include/asio_net/detail/tcp_server_t.hpp similarity index 99% rename from detail/tcp_server_t.hpp rename to include/asio_net/detail/tcp_server_t.hpp index 277aa93..f7bd78a 100644 --- a/detail/tcp_server_t.hpp +++ b/include/asio_net/detail/tcp_server_t.hpp @@ -2,8 +2,8 @@ #include +#include "../config.h" #include "asio.hpp" -#include "config.h" #include "tcp_channel_t.hpp" namespace asio_net { diff --git a/detail/udp_client_t.hpp b/include/asio_net/detail/udp_client_t.hpp similarity index 100% rename from detail/udp_client_t.hpp rename to include/asio_net/detail/udp_client_t.hpp diff --git a/detail/udp_server_t.hpp b/include/asio_net/detail/udp_server_t.hpp similarity index 100% rename from detail/udp_server_t.hpp rename to include/asio_net/detail/udp_server_t.hpp diff --git a/rpc/rpc_client.hpp b/include/asio_net/rpc_client.hpp similarity index 100% rename from rpc/rpc_client.hpp rename to include/asio_net/rpc_client.hpp diff --git a/include/asio_net/rpc_core b/include/asio_net/rpc_core new file mode 160000 index 0000000..4d51c81 --- /dev/null +++ b/include/asio_net/rpc_core @@ -0,0 +1 @@ +Subproject commit 4d51c8118ac151ac9619c24a4d364addf92d84db diff --git a/rpc/rpc_server.hpp b/include/asio_net/rpc_server.hpp similarity index 92% rename from rpc/rpc_server.hpp rename to include/asio_net/rpc_server.hpp index b1a6668..327b716 100644 --- a/rpc/rpc_server.hpp +++ b/include/asio_net/rpc_server.hpp @@ -1,6 +1,7 @@ #pragma once #include "detail/rpc_server_t.hpp" +#include "rpc_session.hpp" namespace asio_net { diff --git a/rpc/rpc_session.hpp b/include/asio_net/rpc_session.hpp similarity index 100% rename from rpc/rpc_session.hpp rename to include/asio_net/rpc_session.hpp diff --git a/server_discovery.hpp b/include/asio_net/server_discovery.hpp similarity index 100% rename from server_discovery.hpp rename to include/asio_net/server_discovery.hpp diff --git a/tcp_client.hpp b/include/asio_net/tcp_client.hpp similarity index 100% rename from tcp_client.hpp rename to include/asio_net/tcp_client.hpp diff --git a/tcp_server.hpp b/include/asio_net/tcp_server.hpp similarity index 100% rename from tcp_server.hpp rename to include/asio_net/tcp_server.hpp diff --git a/udp_client.hpp b/include/asio_net/udp_client.hpp similarity index 100% rename from udp_client.hpp rename to include/asio_net/udp_client.hpp diff --git a/udp_server.hpp b/include/asio_net/udp_server.hpp similarity index 100% rename from udp_server.hpp rename to include/asio_net/udp_server.hpp diff --git a/library.json b/library.json index 0892924..e5c42b8 100644 --- a/library.json +++ b/library.json @@ -14,9 +14,8 @@ "build": { "srcDir": "_", "flags": [ - "-I .", - "-I rpc", - "-I rpc/rpc_core" + "-I include", + "-I asio_net/rpc_core/include" ] } } diff --git a/rpc/rpc_core b/rpc/rpc_core deleted file mode 160000 index d9b1383..0000000 --- a/rpc/rpc_core +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d9b13833002dc0acc616996222edc01b3d03a543 diff --git a/test/domain_rpc.cpp b/test/domain_rpc.cpp index 9b64433..09e29ab 100644 --- a/test/domain_rpc.cpp +++ b/test/domain_rpc.cpp @@ -3,10 +3,10 @@ #include #include +#include "asio_net/rpc_client.hpp" +#include "asio_net/rpc_server.hpp" #include "assert_def.h" #include "log.h" -#include "rpc_client.hpp" -#include "rpc_server.hpp" using namespace asio_net; diff --git a/test/domain_tcp.cpp b/test/domain_tcp.cpp index 2af0fbf..424eaed 100644 --- a/test/domain_tcp.cpp +++ b/test/domain_tcp.cpp @@ -3,10 +3,10 @@ #include #include +#include "asio_net/tcp_client.hpp" +#include "asio_net/tcp_server.hpp" #include "assert_def.h" #include "log.h" -#include "tcp_client.hpp" -#include "tcp_server.hpp" using namespace asio_net; diff --git a/test/domain_udp.cpp b/test/domain_udp.cpp index d089546..cfc50c3 100644 --- a/test/domain_udp.cpp +++ b/test/domain_udp.cpp @@ -3,10 +3,10 @@ #include #include +#include "asio_net/udp_client.hpp" +#include "asio_net/udp_server.hpp" #include "assert_def.h" #include "log.h" -#include "udp_client.hpp" -#include "udp_server.hpp" using namespace asio_net; diff --git a/test/rpc.cpp b/test/rpc.cpp index 13daddd..31d7ddc 100644 --- a/test/rpc.cpp +++ b/test/rpc.cpp @@ -3,10 +3,10 @@ #include #include +#include "asio_net/rpc_client.hpp" +#include "asio_net/rpc_server.hpp" #include "assert_def.h" #include "log.h" -#include "rpc_client.hpp" -#include "rpc_server.hpp" using namespace asio_net; diff --git a/test/rpc_c.cpp b/test/rpc_c.cpp index e03a103..316493b 100644 --- a/test/rpc_c.cpp +++ b/test/rpc_c.cpp @@ -1,7 +1,7 @@ #include +#include "asio_net/rpc_client.hpp" #include "log.h" -#include "rpc_client.hpp" using namespace asio_net; diff --git a/test/rpc_c_open_close.cpp b/test/rpc_c_open_close.cpp index eb1401e..654ed21 100644 --- a/test/rpc_c_open_close.cpp +++ b/test/rpc_c_open_close.cpp @@ -1,7 +1,7 @@ #include +#include "asio_net/rpc_client.hpp" #include "log.h" -#include "rpc_client.hpp" using namespace asio_net; diff --git a/test/rpc_reconnect.cpp b/test/rpc_reconnect.cpp index 0214823..8d607a4 100644 --- a/test/rpc_reconnect.cpp +++ b/test/rpc_reconnect.cpp @@ -2,9 +2,9 @@ #include #include +#include "asio_net/rpc_client.hpp" +#include "asio_net/rpc_server.hpp" #include "log.h" -#include "rpc_client.hpp" -#include "rpc_server.hpp" using namespace asio_net; diff --git a/test/rpc_s.cpp b/test/rpc_s.cpp index df57411..415cea3 100644 --- a/test/rpc_s.cpp +++ b/test/rpc_s.cpp @@ -1,7 +1,7 @@ #include +#include "asio_net/rpc_server.hpp" #include "log.h" -#include "rpc_server.hpp" using namespace asio_net; diff --git a/test/rpc_ssl.cpp b/test/rpc_ssl.cpp index 021f8b0..b3da2cf 100644 --- a/test/rpc_ssl.cpp +++ b/test/rpc_ssl.cpp @@ -3,10 +3,10 @@ #include #include +#include "asio_net/rpc_client.hpp" +#include "asio_net/rpc_server.hpp" #include "assert_def.h" #include "log.h" -#include "rpc_client.hpp" -#include "rpc_server.hpp" using namespace asio_net; diff --git a/test/server_discovery.cpp b/test/server_discovery.cpp index b3741a4..8e1da33 100644 --- a/test/server_discovery.cpp +++ b/test/server_discovery.cpp @@ -1,4 +1,4 @@ -#include "server_discovery.hpp" +#include "asio_net/server_discovery.hpp" #include diff --git a/test/tcp.cpp b/test/tcp.cpp index 7a1a575..9bd3f56 100644 --- a/test/tcp.cpp +++ b/test/tcp.cpp @@ -3,10 +3,10 @@ #include #include +#include "asio_net/tcp_client.hpp" +#include "asio_net/tcp_server.hpp" #include "assert_def.h" #include "log.h" -#include "tcp_client.hpp" -#include "tcp_server.hpp" using namespace asio_net; diff --git a/test/tcp_bigdata.cpp b/test/tcp_bigdata.cpp index fd65ab4..60fc316 100644 --- a/test/tcp_bigdata.cpp +++ b/test/tcp_bigdata.cpp @@ -2,10 +2,10 @@ #include #include +#include "asio_net/tcp_client.hpp" +#include "asio_net/tcp_server.hpp" #include "assert_def.h" #include "log.h" -#include "tcp_client.hpp" -#include "tcp_server.hpp" using namespace asio_net; diff --git a/test/tcp_c.cpp b/test/tcp_c.cpp index 2b4dc96..c4902f0 100644 --- a/test/tcp_c.cpp +++ b/test/tcp_c.cpp @@ -1,5 +1,5 @@ +#include "asio_net/tcp_client.hpp" #include "log.h" -#include "tcp_client.hpp" using namespace asio_net; diff --git a/test/tcp_reconnect.cpp b/test/tcp_reconnect.cpp index 44238ea..6b160f9 100644 --- a/test/tcp_reconnect.cpp +++ b/test/tcp_reconnect.cpp @@ -2,10 +2,10 @@ #include #include +#include "asio_net/tcp_client.hpp" +#include "asio_net/tcp_server.hpp" #include "assert_def.h" #include "log.h" -#include "tcp_client.hpp" -#include "tcp_server.hpp" using namespace asio_net; diff --git a/test/tcp_s.cpp b/test/tcp_s.cpp index afe3739..15812b4 100644 --- a/test/tcp_s.cpp +++ b/test/tcp_s.cpp @@ -1,6 +1,6 @@ +#include "asio_net/tcp_server.hpp" #include "assert_def.h" #include "log.h" -#include "tcp_server.hpp" using namespace asio_net; diff --git a/test/tcp_ssl_c.cpp b/test/tcp_ssl_c.cpp index 96c440c..7c53dc7 100644 --- a/test/tcp_ssl_c.cpp +++ b/test/tcp_ssl_c.cpp @@ -1,5 +1,5 @@ +#include "asio_net/tcp_client.hpp" #include "log.h" -#include "tcp_client.hpp" using namespace asio_net; diff --git a/test/tcp_ssl_s.cpp b/test/tcp_ssl_s.cpp index 4769830..4bcf98f 100644 --- a/test/tcp_ssl_s.cpp +++ b/test/tcp_ssl_s.cpp @@ -1,6 +1,6 @@ +#include "asio_net/tcp_server.hpp" #include "assert_def.h" #include "log.h" -#include "tcp_server.hpp" using namespace asio_net; diff --git a/test/udp.cpp b/test/udp.cpp index 2c0c970..6d3d6ce 100644 --- a/test/udp.cpp +++ b/test/udp.cpp @@ -3,10 +3,10 @@ #include #include +#include "asio_net/udp_client.hpp" +#include "asio_net/udp_server.hpp" #include "assert_def.h" #include "log.h" -#include "udp_client.hpp" -#include "udp_server.hpp" using namespace asio_net; diff --git a/test/udp_c.cpp b/test/udp_c.cpp index 7e41189..4a0fc36 100644 --- a/test/udp_c.cpp +++ b/test/udp_c.cpp @@ -1,5 +1,5 @@ +#include "asio_net/udp_client.hpp" #include "log.h" -#include "udp_client.hpp" using namespace asio_net; diff --git a/test/udp_s.cpp b/test/udp_s.cpp index a97e3d6..807ccfd 100644 --- a/test/udp_s.cpp +++ b/test/udp_s.cpp @@ -1,5 +1,5 @@ +#include "asio_net/udp_server.hpp" #include "log.h" -#include "udp_server.hpp" using namespace asio_net;