FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
cmd.hpp
Go to the documentation of this file.
1 /*
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:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15 
16 #ifndef __VOM_CMD_H__
17 #define __VOM_CMD_H__
18 
19 #include <string>
20 
21 #include "vom/types.hpp"
22 
23 namespace VOM {
24 /**
25  * Forward declaration of the connection class
26  */
27 class connection;
28 
29 /**
30  * A representation of a method call to VPP
31  */
32 class cmd
33 {
34 public:
35  /**
36  * Default constructor
37  */
38  cmd() {}
39  /**
40  * Virtual destructor
41  */
42  virtual ~cmd() {}
43 
44  /**
45  * Issue the command to VPP/HW
46  */
47  virtual rc_t issue(connection& con) = 0;
48 
49  /**
50  * Retire/cancel a long running command
51  */
52  virtual void retire(connection& con) = 0;
53 
54  /**
55  * Invoked on a Command when the HW queue is disabled to indicate
56  * that the commnad can be considered successful
57  */
58  virtual void succeeded() = 0;
59 
60  /**
61  * convert to string format for debug purposes
62  */
63  virtual std::string to_string() const = 0;
64 };
65 
66 /**
67  * Free ostream function to print a command
68  */
69 std::ostream& operator<<(std::ostream& os, const cmd& cmd);
70 };
71 
72 /*
73  * fd.io coding-style-patch-verification: OFF
74  *
75  * Local Variables:
76  * eval: (c-set-style "mozilla")
77  * End:
78  */
79 
80 #endif
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::cmd::issue
virtual rc_t issue(connection &con)=0
Issue the command to VPP/HW.
types.hpp
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::cmd::cmd
cmd()
Default constructor.
Definition: cmd.hpp:38
VOM::cmd::succeeded
virtual void succeeded()=0
Invoked on a Command when the HW queue is disabled to indicate that the commnad can be considered suc...
VOM::cmd::to_string
virtual std::string to_string() const =0
convert to string format for debug purposes
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::operator<<
std::ostream & operator<<(std::ostream &os, const std::pair< direction_t, interface::key_t > &key)
Definition: acl_binding.cpp:201
VOM::cmd::~cmd
virtual ~cmd()
Virtual destructor.
Definition: cmd.hpp:42
VOM::cmd::retire
virtual void retire(connection &con)=0
Retire/cancel a long running command.
VOM::rc_t
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
VOM::cmd
A representation of a method call to VPP.
Definition: cmd.hpp:32
string
const char *const string
Definition: cJSON.h:172