diff options
Diffstat (limited to 'src/rpc-server/trex_rpc_server_api.h')
-rw-r--r-- | src/rpc-server/trex_rpc_server_api.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/rpc-server/trex_rpc_server_api.h b/src/rpc-server/trex_rpc_server_api.h index b4313670..c34ac0f8 100644 --- a/src/rpc-server/trex_rpc_server_api.h +++ b/src/rpc-server/trex_rpc_server_api.h @@ -173,24 +173,50 @@ public: } /** + * owner handler + * for the connection + * + */ + static const std::string &get_owner_handler() { + return s_owner_handler; + } + + static bool is_free_to_aquire() { + return (s_owner == "none"); + } + + /** * take ownership of the server array * this is static * ownership is total * */ - static void set_owner(const std::string &owner) { + static std::string set_owner(const std::string &owner) { s_owner = owner; + s_owner_handler = generate_handler(); + return (s_owner_handler); } static void clear_owner() { s_owner = "none"; + s_owner_handler = ""; + } + + static bool verify_owner_handler(const std::string &handler) { + + return ( (s_owner != "none") && (s_owner_handler == handler) ); + } private: + static std::string generate_handler(); + std::vector<TrexRpcServerInterface *> m_servers; bool m_verbose; static const std::string s_server_uptime; + static std::string s_owner; + static std::string s_owner_handler; }; #endif /* __TREX_RPC_SERVER_API_H__ */ |