2 * Copyright (c) 2017 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef __VOM_SRPC_CMD_H__
17 #define __VOM_SRPC_CMD_H__
20 #include "vom/rpc_cmd.hpp"
23 template <typename MSG>
24 class srpc_cmd : public rpc_cmd<HW::item<handle_t>, MSG>
33 * Constructor taking the HW item that will be updated by the command
35 srpc_cmd(HW::item<handle_t>& item)
36 : rpc_cmd<HW::item<handle_t>, MSG>(item)
43 virtual ~srpc_cmd() {}
45 virtual vapi_error_e operator()(MSG& reply)
47 int stats_index = reply.get_response().get_payload().stats_index;
48 int retval = reply.get_response().get_payload().retval;
50 VOM_LOG(log_level_t::DEBUG) << this->to_string() << " " << retval;
52 rc_t rc = rc_t::from_vpp_retval(retval);
53 handle_t handle = handle_t::INVALID;
59 this->fulfill(HW::item<handle_t>(handle, rc));
67 * fd.io coding-style-patch-verification: ON
70 * eval: (c-set-style "mozilla")