summaryrefslogtreecommitdiffstats
path: root/src/rpc-server
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-01-26 09:53:21 -0500
committerimarom <imarom@cisco.com>2016-01-26 09:53:21 -0500
commitdb6254e3c59ef887ff41ff2aff44349010bd6bad (patch)
tree358193ec39ef4c6b1f404795f2dce71799c750c7 /src/rpc-server
parent2828fc9aab33b742c59a499dbf06ea2239ec6220 (diff)
packet is now base64 encoded
Diffstat (limited to 'src/rpc-server')
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_stream.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
index 821479f5..dc8a9ccd 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
@@ -24,7 +24,7 @@ limitations under the License.
#include <trex_stateless.h>
#include <trex_stateless_port.h>
#include <trex_streams_compiler.h>
-
+#include <common/base64.h>
#include <iostream>
using namespace std;
@@ -63,7 +63,7 @@ TrexRpcCmdAddStream::_run(const Json::Value &params, Json::Value &result) {
stream->m_next_stream_id = parse_int(section, "next_stream_id", result);
const Json::Value &pkt = parse_object(section, "packet", result);
- const Json::Value &pkt_binary = parse_array(pkt, "binary", result);
+ std::string pkt_binary = base64_decode(parse_string(pkt, "binary", result));
/* fetch the packet from the message */
@@ -73,9 +73,11 @@ TrexRpcCmdAddStream::_run(const Json::Value &params, Json::Value &result) {
generate_internal_err(result, "unable to allocate memory");
}
- /* parse the packet */
+ /* copy the packet */
+ const char *pkt_buffer = pkt_binary.c_str();
+
for (int i = 0; i < pkt_binary.size(); i++) {
- stream->m_pkt.binary[i] = parse_byte(pkt_binary, i, result);
+ stream->m_pkt.binary[i] = pkt_buffer[i];
}
/* meta data */