diff options
author | imarom <imarom@cisco.com> | 2015-09-09 18:06:12 +0300 |
---|---|---|
committer | imarom <imarom@cisco.com> | 2015-09-09 18:56:11 +0300 |
commit | 54f8323b3938bf4ab672cde01a06711bfc522a2e (patch) | |
tree | 3454351e53499c2051715641e1b87b3e32f9a333 /src/rpc-server/commands/trex_rpc_cmds.h | |
parent | e33befcf222fd2108d589dede11069d4256bb21a (diff) |
added ownership to RPC server
Diffstat (limited to 'src/rpc-server/commands/trex_rpc_cmds.h')
-rw-r--r-- | src/rpc-server/commands/trex_rpc_cmds.h | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/src/rpc-server/commands/trex_rpc_cmds.h b/src/rpc-server/commands/trex_rpc_cmds.h index f88631bc..32138195 100644 --- a/src/rpc-server/commands/trex_rpc_cmds.h +++ b/src/rpc-server/commands/trex_rpc_cmds.h @@ -35,37 +35,45 @@ class TrexStream; * syntactic sugar for creating a simple command */ -#define TREX_RPC_CMD_DEFINE_EXTENED(class_name, cmd_name, param_count, ext) \ +#define TREX_RPC_CMD_DEFINE_EXTENED(class_name, cmd_name, param_count, needs_ownership, ext) \ class class_name : public TrexRpcCommand { \ public: \ - class_name () : TrexRpcCommand(cmd_name, param_count) {} \ + class_name () : TrexRpcCommand(cmd_name, param_count, needs_ownership) {} \ protected: \ virtual trex_rpc_cmd_rc_e _run(const Json::Value ¶ms, Json::Value &result); \ ext \ } -#define TREX_RPC_CMD_DEFINE(class_name, cmd_name, param_count) TREX_RPC_CMD_DEFINE_EXTENED(class_name, cmd_name, param_count, ;) +#define TREX_RPC_CMD_DEFINE(class_name, cmd_name, param_count, needs_ownership) TREX_RPC_CMD_DEFINE_EXTENED(class_name, cmd_name, param_count, needs_ownership, ;) /** * test cmds */ -TREX_RPC_CMD_DEFINE(TrexRpcCmdTestAdd, "test_add", 2); -TREX_RPC_CMD_DEFINE(TrexRpcCmdTestSub, "test_sub", 2); +TREX_RPC_CMD_DEFINE(TrexRpcCmdTestAdd, "test_add", 2, false); +TREX_RPC_CMD_DEFINE(TrexRpcCmdTestSub, "test_sub", 2, false); /** * general cmds */ -TREX_RPC_CMD_DEFINE(TrexRpcCmdPing, "ping", 0); -TREX_RPC_CMD_DEFINE(TrexRpcCmdGetReg, "get_reg_cmds", 0); -TREX_RPC_CMD_DEFINE(TrexRpcCmdGetStatus, "get_status", 0); +TREX_RPC_CMD_DEFINE(TrexRpcCmdPing, "ping", 0, false); +TREX_RPC_CMD_DEFINE(TrexRpcCmdGetReg, "get_reg_cmds", 0, false); +TREX_RPC_CMD_DEFINE(TrexRpcCmdGetStatus, "get_status", 0, false); + +/** + * ownership + */ +TREX_RPC_CMD_DEFINE(TrexRpcCmdGetOwner, "get_owner", 0, false); +TREX_RPC_CMD_DEFINE(TrexRpcCmdAcquire, "acquire", 2, false); +TREX_RPC_CMD_DEFINE(TrexRpcCmdRelease, "release", 0, true); + /** * stream cmds */ -TREX_RPC_CMD_DEFINE(TrexRpcCmdRemoveAllStreams, "remove_all_streams", 1); -TREX_RPC_CMD_DEFINE(TrexRpcCmdRemoveStream, "remove_stream", 2); +TREX_RPC_CMD_DEFINE(TrexRpcCmdRemoveAllStreams, "remove_all_streams", 1, true); +TREX_RPC_CMD_DEFINE(TrexRpcCmdRemoveStream, "remove_stream", 2, true); -TREX_RPC_CMD_DEFINE_EXTENED(TrexRpcCmdAddStream, "add_stream", 3, +TREX_RPC_CMD_DEFINE_EXTENED(TrexRpcCmdAddStream, "add_stream", 3, true, /* extended part */ TrexStream * allocate_new_stream(const Json::Value §ion, uint8_t port_id, uint32_t stream_id, Json::Value &result); @@ -77,11 +85,11 @@ void parse_vm_instr_write_flow_var(const Json::Value &inst, TrexStream *stream, ); -TREX_RPC_CMD_DEFINE(TrexRpcCmdGetStreamList, "get_stream_list", 1); +TREX_RPC_CMD_DEFINE(TrexRpcCmdGetStreamList, "get_stream_list", 1, true); -TREX_RPC_CMD_DEFINE(TrexRpcCmdGetStream, "get_stream", 2); +TREX_RPC_CMD_DEFINE(TrexRpcCmdGetStream, "get_stream", 2, true); -TREX_RPC_CMD_DEFINE(TrexRpcCmdStartTraffic, "start_traffic", 1); -TREX_RPC_CMD_DEFINE(TrexRpcCmdStopTraffic, "stop_traffic", 1); +TREX_RPC_CMD_DEFINE(TrexRpcCmdStartTraffic, "start_traffic", 1, true); +TREX_RPC_CMD_DEFINE(TrexRpcCmdStopTraffic, "stop_traffic", 1, true); #endif /* __TREX_RPC_CMD_H__ */ |