Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofactionset.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 /*
6  * cofactionset.h
7  *
8  * Created on: Feb 6, 2012
9  * Author: tobi
10  */
11 
12 #ifndef COFACTIONSET_H_
13 #define COFACTIONSET_H_
14 
15 #include <inttypes.h>
16 #include <map>
17 #include <string>
18 
19 #include "rofl/common/openflow/cofaction.h"
20 #include "rofl/common/openflow/cofinstruction.h"
21 
22 namespace rofl {
23 namespace openflow {
24 
26 {
27 public:
28 
29  std::map<int, cofaction> acset;
30  std::map<uint16_t, std::map<uint8_t, cofaction> > acfields;
31  uint64_t metadata;
32  uint64_t metadata_mask;
33 
34 public:
35 
39  cofactionset();
40 
44  ~cofactionset();
45 
46 
50  std::vector<cofaction>&
52 
56  void
58 
62  void
64 
68  void
70 
74  void
76 
77 
81  static int
82  get_action_index(uint16_t acdtion_type);
83 
84 protected:
85 
86  static void
87  init_action_indices();
88 
89  static std::map<uint16_t, int>
91 
92 public:
93 
94  friend std::ostream&
95  operator<< (std::ostream& os, cofactionset const& actionset) {
96  os << "<cofactionset ";
97  os << "metadata:" << (unsigned long long)actionset.metadata << " ";
98  os << "metadata-mask:" << (unsigned long long)actionset.metadata_mask << " ";
99  os << "actions:" << std::endl;
100  for (std::map<int,cofaction>::const_iterator
101  it = actionset.acset.begin(); it != actionset.acset.end(); ++it) {
102  os << it->first << ":" << it->second << std::endl;
103  }
104  os << "set-fields:" << std::endl;
105  for (std::map<uint16_t, std::map<uint8_t, cofaction> >::const_iterator
106  it = actionset.acfields.begin(); it != actionset.acfields.end(); ++it) {
107 
108  uint16_t oxm_class = it->first;
109  std::map<uint8_t, cofaction> const& acfields_per_class = it->second;
110 
111  os << "oxm-class:" << (int)oxm_class << std::endl;
112  for (std::map<uint8_t, cofaction>::const_iterator
113  jt = acfields_per_class.begin(); jt != acfields_per_class.end(); ++jt) {
114 
115  os << (int)jt->first << ": " << jt->second << std::endl;
116  }
117  }
118  os << ">";
119  return os;
120  };
121 };
122 
123 }; // end of namespace openflow
124 }; // end of namespace rofl
125 
126 #endif /* COFACTIONSET_H_ */
void actionset_write_metadata(const cofinstruction_write_metadata &inst)
Definition: cofactionset.cc:128
std::vector< cofaction > & ordered_action_set()
static std::map< uint16_t, int > action_indices
indexes for priority ordering of actions
Definition: cofactionset.h:90
std::map< uint16_t, std::map< uint8_t, cofaction > > acfields
OF1.2 list of set fields per instruction.
Definition: cofactionset.h:30
Definition: cofactionset.h:25
static int get_action_index(uint16_t acdtion_type)
Definition: cofactionset.cc:56
cofactionset()
Definition: cofactionset.cc:19
~cofactionset()
Definition: cofactionset.cc:28
void actionset_write_actions(const cofinstruction_actions &inst)
Definition: cofactionset.cc:96
Definition: cofinstruction.h:198
std::map< int, cofaction > acset
OF1.1 ActionSet, except OFPAT_SET_FIELD (OF1.2)
Definition: cofactionset.h:29
void actionset_clear()
Definition: cofactionset.cc:88
Definition: cofinstruction.h:548