summaryrefslogtreecommitdiffstats
path: root/src/rpc-server/trex_rpc_server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc-server/trex_rpc_server.cpp')
-rw-r--r--src/rpc-server/trex_rpc_server.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/rpc-server/trex_rpc_server.cpp b/src/rpc-server/trex_rpc_server.cpp
index 149bb668..a5988cab 100644
--- a/src/rpc-server/trex_rpc_server.cpp
+++ b/src/rpc-server/trex_rpc_server.cpp
@@ -112,6 +112,7 @@ get_current_date_time() {
const std::string TrexRpcServer::s_server_uptime = get_current_date_time();
std::string TrexRpcServer::s_owner = "none";
+std::string TrexRpcServer::s_owner_handler = "";
TrexRpcServer::TrexRpcServer(const TrexRpcServerConfig &req_resp_cfg) {
@@ -157,3 +158,22 @@ void TrexRpcServer::set_verbose(bool verbose) {
}
}
+/**
+ * generate a random connection handler
+ *
+ */
+std::string TrexRpcServer::generate_handler() {
+ std::stringstream ss;
+
+ static const char alphanum[] =
+ "0123456789"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz";
+
+ /* generate 8 bytes of random handler */
+ for (int i = 0; i < 8; ++i) {
+ ss << alphanum[rand() % (sizeof(alphanum) - 1)];
+ }
+
+ return (ss.str());
+}