summaryrefslogtreecommitdiffstats
path: root/src/rpc-server
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-02-18 16:51:54 +0200
committerHanoh Haim <hhaim@cisco.com>2016-02-18 16:51:54 +0200
commit77531f879979de5c261802c88b41a361a18095ab (patch)
tree511845d62f2e6c9839dcfa98e2db95f1bab3b279 /src/rpc-server
parent8b12867a012f56b92bd3a3797aa2e554c0b71bef (diff)
parent38defe118db360190121c44a9b65c1477f54afa3 (diff)
Merge new mask instruction
Diffstat (limited to 'src/rpc-server')
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_stream.cpp23
-rw-r--r--src/rpc-server/commands/trex_rpc_cmds.h2
2 files changed, 24 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 508967b9..920991e2 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
@@ -292,6 +292,25 @@ TrexRpcCmdAddStream::parse_vm_instr_flow_var(const Json::Value &inst, TrexStream
);
}
+
+void
+TrexRpcCmdAddStream::parse_vm_instr_write_mask_flow_var(const Json::Value &inst, TrexStream *stream, Json::Value &result) {
+ std::string flow_var_name = parse_string(inst, "name", result);
+ uint16_t pkt_offset = parse_uint16(inst, "pkt_offset", result);
+ uint16_t pkt_cast_size = parse_uint16(inst, "pkt_cast_size", result);
+ uint32_t mask = parse_uint32(inst, "mask", result);
+ int shift = parse_int(inst, "shift", result);
+ bool is_big_endian = parse_bool(inst, "is_big_endian", result);
+
+ stream->m_vm.add_instruction(new StreamVmInstructionWriteMaskToPkt(flow_var_name,
+ pkt_offset,
+ (uint8_t)pkt_cast_size,
+ mask,
+ shift,
+ is_big_endian));
+}
+
+
void
TrexRpcCmdAddStream::parse_vm_instr_write_flow_var(const Json::Value &inst, TrexStream *stream, Json::Value &result) {
std::string flow_var_name = parse_string(inst, "name", result);
@@ -314,7 +333,7 @@ TrexRpcCmdAddStream::parse_vm(const Json::Value &vm, TrexStream *stream, Json::V
for (int i = 0; i < instructions.size(); i++) {
const Json::Value & inst = parse_object(instructions, i, result);
- auto vm_types = {"fix_checksum_ipv4", "flow_var", "write_flow_var","tuple_flow_var","trim_pkt_size"};
+ auto vm_types = {"fix_checksum_ipv4", "flow_var", "write_flow_var","tuple_flow_var","trim_pkt_size","write_mask_flow_var"};
std::string vm_type = parse_choice(inst, "type", vm_types, result);
// checksum instruction
@@ -332,6 +351,8 @@ TrexRpcCmdAddStream::parse_vm(const Json::Value &vm, TrexStream *stream, Json::V
} else if (vm_type == "trim_pkt_size") {
parse_vm_instr_trim_pkt_size(inst, stream, result);
+ }else if (vm_type == "write_mask_flow_var") {
+ parse_vm_instr_write_mask_flow_var(inst, stream, result);
} else {
/* internal error */
throw TrexRpcException("internal error");
diff --git a/src/rpc-server/commands/trex_rpc_cmds.h b/src/rpc-server/commands/trex_rpc_cmds.h
index 48a38780..3dc2ce0a 100644
--- a/src/rpc-server/commands/trex_rpc_cmds.h
+++ b/src/rpc-server/commands/trex_rpc_cmds.h
@@ -100,6 +100,8 @@ void parse_vm_instr_tuple_flow_var(const Json::Value &inst, TrexStream *stream,
void parse_vm_instr_trim_pkt_size(const Json::Value &inst, TrexStream *stream, Json::Value &result);
void parse_vm_instr_write_flow_var(const Json::Value &inst, TrexStream *stream, Json::Value &result);
+void parse_vm_instr_write_mask_flow_var(const Json::Value &inst, TrexStream *stream, Json::Value &result);
+
);