summaryrefslogtreecommitdiffstats
path: root/src/rpc-server/trex_rpc_cmd_api.h
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2015-09-09 18:06:12 +0300
committerimarom <imarom@cisco.com>2015-09-09 18:56:11 +0300
commit54f8323b3938bf4ab672cde01a06711bfc522a2e (patch)
tree3454351e53499c2051715641e1b87b3e32f9a333 /src/rpc-server/trex_rpc_cmd_api.h
parente33befcf222fd2108d589dede11069d4256bb21a (diff)
added ownership to RPC server
Diffstat (limited to 'src/rpc-server/trex_rpc_cmd_api.h')
-rw-r--r--src/rpc-server/trex_rpc_cmd_api.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/rpc-server/trex_rpc_cmd_api.h b/src/rpc-server/trex_rpc_cmd_api.h
index def52fca..c72b3e3b 100644
--- a/src/rpc-server/trex_rpc_cmd_api.h
+++ b/src/rpc-server/trex_rpc_cmd_api.h
@@ -68,8 +68,15 @@ public:
/**
* method name and params
*/
- TrexRpcCommand(const std::string &method_name, int param_count) : m_name(method_name), m_param_count(param_count) {
-
+ TrexRpcCommand(const std::string &method_name, int param_count, bool needs_ownership) :
+ m_name(method_name),
+ m_param_count(param_count),
+ m_needs_ownership(needs_ownership) {
+
+ /* if needs ownership - another field is needed (handler) */
+ if (m_needs_ownership) {
+ m_param_count++;
+ }
}
/**
@@ -112,6 +119,12 @@ protected:
void check_param_count(const Json::Value &params, int expected, Json::Value &result);
/**
+ * verify ownership
+ *
+ */
+ void verify_ownership(const Json::Value &params, Json::Value &result);
+
+ /**
* parse functions
*
*/
@@ -209,6 +222,7 @@ protected:
/* RPC command name */
std::string m_name;
int m_param_count;
+ bool m_needs_ownership;
};
#endif /* __TREX_RPC_CMD_API_H__ */