summaryrefslogtreecommitdiffstats
path: root/src/rpc-server
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-02-16 10:27:32 +0200
committerHanoh Haim <hhaim@cisco.com>2016-02-16 10:27:32 +0200
commitecbb10f1ce8303c5803fa9331198ce6d98b3e3fa (patch)
tree4e9d8437b9bdda1961852c7fa2db611cd398d8cf /src/rpc-server
parentaebe518a0f109f25928cf82eb998e7b7602a2c03 (diff)
add action counter
Diffstat (limited to 'src/rpc-server')
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_stream.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
index 87e205b0..918ff99b 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
@@ -57,7 +57,15 @@ TrexRpcCmdAddStream::_run(const Json::Value &params, Json::Value &result) {
stream->m_enabled = parse_bool(section, "enabled", result);
stream->m_self_start = parse_bool(section, "self_start", result);
stream->m_flags = parse_int(section, "flags", result);
- stream->m_action_count = (uint16_t)parse_int(section, "action_count", result);
+ int cnt = parse_int(section, "action_count", result);
+ if (cnt<0 || cnt >= UINT16_MAX) {
+ std::stringstream ss;
+ ss << "bad action_count provided: should be between " << 0 << " and " << UINT16_MAX;
+ printf(" %s \n",ss.str().c_str());
+ delete stream;
+ generate_execute_err(result, ss.str());
+ }
+ stream->m_action_count = (uint16_t)cnt;
/* inter stream gap */
stream->m_isg_usec = parse_double(section, "isg", result);