Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
coftables.h
1 /*
2  * coftables.h
3  *
4  * Created on: 16.02.2014
5  * Author: andreas
6  */
7 
8 #ifndef COFTABLES_H_
9 #define COFTABLES_H_
10 
11 #include <inttypes.h>
12 
13 #include <map>
14 
15 #include "rofl/common/openflow/coftablefeatures.h"
16 #include "rofl/common/croflexception.h"
17 
18 #include "rofl/common/openflow/coftablestatsarray.h"
19 
20 namespace rofl {
21 namespace openflow {
22 
23 class eOFTablesBase : public RoflException {};
24 class eOFTablesInval : public eOFTablesBase {};
25 class eOFTablesNotFound : public eOFTablesBase {};
26 
27 class coftables
28 {
29  uint8_t ofp_version;
30  std::map<uint8_t, coftable_features> tables;
31 
32 public:
33 
37  coftables(
38  uint8_t ofp_version = rofl::openflow::OFP_VERSION_UNKNOWN);
39 
43  virtual
44  ~coftables();
45 
49  coftables(
50  coftables const& tables);
51 
55  coftables&
56  operator= (
57  coftables const& tables);
58 
62  coftables&
63  operator+= (
64  coftables const& tables);
65 
66 
67 public:
68 
72  virtual void
73  clear();
74 
75 
79  virtual size_t
80  length() const;
81 
82 
86  virtual void
87  pack(
88  uint8_t *buf, size_t buflen);
89 
90 
94  virtual void
95  unpack(
96  uint8_t *buf, size_t buflen);
97 
98 
99 public:
100 
104  uint8_t
105  get_version() const { return ofp_version; };
106 
110  void
111  set_version(uint8_t ofp_version) { this->ofp_version = ofp_version; };
112 
116  std::map<uint8_t, coftable_features> const&
117  get_tables() const { return tables; };
118 
122  std::map<uint8_t, coftable_features>&
123  set_tables() { return tables; };
124 
129  add_table(uint8_t table_id);
130 
134  void
135  drop_table(uint8_t table_id);
136 
140  const coftable_features&
141  get_table(uint8_t table_id) const;
142 
147  set_table(uint8_t table_id);
148 
152  bool
153  has_table(uint8_t table_id) const;
154 
155 public:
156 
160  static void
161  map_tablestatsarray_to_tables(
163 
167  static void
168  map_tables_to_tablestatsarray(
170 
174  static void
175  map_match_to_prop_oxm(
176  uint64_t match, rofl::openflow::coftable_feature_prop_oxm& prop_oxm);
177 
181  static void
182  map_prop_oxm_to_match(
183  const rofl::openflow::coftable_feature_prop_oxm& prop_oxm, uint64_t& match);
184 
188  static void
189  map_actions_to_prop_actions(
190  uint32_t actions, rofl::openflow::coftable_feature_prop_actions& prop_actions);
191 
195  static void
196  map_prop_actions_to_actions(
197  const rofl::openflow::coftable_feature_prop_actions& prop_actions, uint32_t& actions);
198 
202  static void
203  map_instructions_to_prop_instructions(
204  uint32_t instructions, rofl::openflow::coftable_feature_prop_instructions& prop_instructions);
205 
209  static void
210  map_prop_instructions_to_instructions(
211  const rofl::openflow::coftable_feature_prop_instructions& prop_instructions, uint32_t& instructions);
212 
213 public:
214 
215  friend std::ostream&
216  operator<< (std::ostream& os, coftables const& tables) {
217  os << indent(0) << "<coftables #tables:" << tables.tables.size() << " >" << std::endl;
218  indent i(2);
219  for (std::map<uint8_t, coftable_features>::const_iterator
220  it = tables.tables.begin(); it != tables.tables.end(); ++it) {
221  os << it->second;
222  }
223  return os;
224  };
225 };
226 
227 }; // end of namespace openflow
228 }; // end of namespace rofl
229 
230 
231 
232 
233 #endif /* COFTABLES_H_ */
Definition: coftablefeatureprop.h:149
Definition: coftables.h:25
Definition: coftablefeatures.h:26
virtual void clear()
Definition: coftables.cc:74
Definition: coftablefeatureprop.h:608
virtual size_t length() const
Definition: coftables.cc:82
Definition: coftables.h:23
Definition: coftablestatsarray.h:19
Definition: coftablefeatureprop.h:418
Definition: coftables.h:27
Definition: logging.h:76
Definition: coftables.h:24
Definition: croflexception.h:27