Skip to content

Commit

Permalink
Merge pull request #22 from marioskogias/ssl-support
Browse files Browse the repository at this point in the history
Add TLS support for symmetric agent
  • Loading branch information
marioskogias authored Jun 5, 2022
2 parents bad33c5 + 4235e22 commit 0b8eafb
Show file tree
Hide file tree
Showing 8 changed files with 446 additions and 41 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
tags

# just this for emacs by default
*~
Expand Down Expand Up @@ -40,6 +41,7 @@ agents/redis_loader
agents/t_rpclib_agent
agents/t_tcp_agent
build/
.eggs/

# CLion default cmake build directories
cmake-build-*/
6 changes: 4 additions & 2 deletions agents/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_library(LIBRT rt REQUIRED)
find_library(LIBM m REQUIRED)
find_library(LIB_SSL ssl REQUIRED)
find_library(LIB_CRYPTO crypto REQUIRED)

find_library(LIBCONFIG config)
if(NOT LIBM)
Expand Down Expand Up @@ -83,7 +85,7 @@ target_sources( agent PRIVATE
${RAND_SRCS}
"agent.c" "args.c"
"app_proto.c"
"tp_tcp.c" "tp_udp.c" "key_gen.c"
"tp_tcp.c" "tp_udp.c" "tp_ssl.c" "key_gen.c"
"stats.c" "timestamping.c" "redis.c" "memcache.c"
${HTTP_SOURCES}
${R2P2_TP_SOURCE}
Expand All @@ -94,7 +96,7 @@ target_include_directories( agent PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" )
target_link_libraries( agent PRIVATE lancet )
target_compile_options(agent PRIVATE ${COMMON_CFLAGS} ${ENABLE_R2P2} ${ENABLE_R2P2_NIC_TS})
target_link_libraries( agent PRIVATE
Threads::Threads ${LIBM} ${LIBRT} )
Threads::Threads ${LIBM} ${LIBRT} ${LIB_SSL} ${LIB_CRYPTO})
if(BUILD_R2P2)
target_link_libraries( agent PRIVATE r2p2 ${LIBCONFIG})
endif()
5 changes: 5 additions & 0 deletions agents/args.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ init_transport_protocol(enum transport_protocol_type tp_type)
case UDP:
res = init_udp();
break;
case TLS:
res = init_tls();
break;
#ifdef ENABLE_R2P2
case R2P2:
res = init_r2p2();
Expand Down Expand Up @@ -123,6 +126,8 @@ struct agent_config *parse_arguments(int argc, char **argv)
#endif
else if (strcmp(optarg, "UDP") == 0)
cfg->tp_type = UDP;
else if (strcmp(optarg, "TLS") == 0)
cfg->tp_type = TLS;
else {
lancet_fprintf(stderr, "Unknown transport protocol\n");
return NULL;
Expand Down
Loading

0 comments on commit 0b8eafb

Please sign in to comment.