diff options
Diffstat (limited to 'src/rpc-server/trex_rpc_cmd.cpp')
-rw-r--r-- | src/rpc-server/trex_rpc_cmd.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/rpc-server/trex_rpc_cmd.cpp b/src/rpc-server/trex_rpc_cmd.cpp index 8f0ffbad..b5dd121c 100644 --- a/src/rpc-server/trex_rpc_cmd.cpp +++ b/src/rpc-server/trex_rpc_cmd.cpp @@ -98,6 +98,8 @@ TrexRpcCommand::type_to_str(field_type_e type) { return "uint16"; case FIELD_TYPE_UINT32: return "uint32"; + case FIELD_TYPE_UINT64: + return "uint64"; case FIELD_TYPE_BOOL: return "bool"; case FIELD_TYPE_INT: @@ -179,6 +181,18 @@ TrexRpcCommand::parse_uint32(const Json::Value &parent, int index, Json::Value & return parent[index].asUInt(); } +uint64_t +TrexRpcCommand::parse_uint64(const Json::Value &parent, const std::string &name, Json::Value &result) { + check_field_type(parent, name, FIELD_TYPE_UINT64, result); + return parent[name].asUInt64(); +} + +uint64_t +TrexRpcCommand::parse_uint64(const Json::Value &parent, int index, Json::Value &result) { + check_field_type(parent, index, FIELD_TYPE_UINT64, result); + return parent[index].asUInt64(); +} + int TrexRpcCommand::parse_int(const Json::Value &parent, const std::string &name, Json::Value &result) { check_field_type(parent, name, FIELD_TYPE_INT, result); @@ -286,6 +300,12 @@ TrexRpcCommand::check_field_type_common(const Json::Value &field, const std::str } break; + case FIELD_TYPE_UINT64: + if (!field.isInt64()) { + rc = false; + } + break; + case FIELD_TYPE_BOOL: if (!field.isBool()) { rc = false; |