1 #ifndef OPENFLOW_INSTRUCTION_H
2 #define OPENFLOW_INSTRUCTION_H
4 #include "of13action.hh"
5 #include "openflow-13.h"
23 virtual bool operator==(
const Instruction &other)
const;
24 virtual bool operator!=(
const Instruction &other)
const;
25 virtual uint16_t set_order()
const {
31 virtual size_t pack(uint8_t* buffer);
32 virtual of_error unpack(uint8_t* buffer);
39 void type(uint16_t type) {
42 void length(uint16_t length) {
43 this->length_ = length;
45 static Instruction* make_instruction(uint16_t type);
50 return lhs->set_order() < rhs->set_order();
57 std::set<Instruction*, comp_inst_set_order> instruction_set_;
68 size_t pack(uint8_t* buffer);
69 of_error unpack(uint8_t* buffer);
76 void length(uint16_t length) {
77 this->length_ = length;
84 const uint16_t set_order_;
88 sizeof(
struct of13::ofp_instruction_goto_table)),
94 uint16_t set_order()
const {
95 return this->set_order_;
101 size_t pack(uint8_t* buffer);
102 of_error unpack(uint8_t* buffer);
104 return this->table_id_;
106 void table_id(uint8_t table_id) {
107 this->table_id_ = table_id;
114 uint64_t metadata_mask_;
115 const uint16_t set_order_;
119 sizeof(
struct of13::ofp_instruction_write_metadata)),
125 uint16_t set_order()
const {
126 return this->set_order_;
132 size_t pack(uint8_t* buffer);
133 of_error unpack(uint8_t* buffer);
134 uint64_t metadata() {
135 return this->metadata_;
137 uint64_t metadata_mask() {
138 return this->metadata_mask_;
140 void metadata(uint64_t metadata) {
141 this->metadata_ = metadata;
143 void metadata_mask(uint64_t metadata_mask) {
144 this->metadata_mask_ = metadata_mask;
151 const uint16_t set_order_;
155 sizeof(
struct of13::ofp_instruction_actions)),
161 uint16_t set_order()
const {
162 return this->set_order_;
165 size_t pack(uint8_t* buffer);
169 of_error unpack(uint8_t* buffer);
171 return this->actions_;
174 void add_action(
Action &action);
175 void add_action(
Action* action);
181 const uint16_t set_order_;
185 sizeof(
struct of13::ofp_instruction_actions)),
191 uint16_t set_order()
const {
192 return this->set_order_;
198 size_t pack(uint8_t* buffer);
199 of_error unpack(uint8_t* buffer);
201 return this->actions_;
204 void add_action(
Action &action);
205 void add_action(
Action* action);
210 const uint16_t set_order_;
214 sizeof(
struct of13::ofp_instruction) + 4),
219 uint16_t set_order()
const {
220 return this->set_order_;
225 size_t pack(uint8_t* buffer);
226 of_error unpack(uint8_t* buffer);
232 const uint16_t set_order_;
236 sizeof(
struct of13::ofp_instruction_meter)),
239 Meter(uint32_t meter_id);
242 uint16_t set_order()
const {
243 return this->set_order_;
246 virtual Meter* clone() {
247 return new Meter(*
this);
249 size_t pack(uint8_t* buffer);
250 of_error unpack(uint8_t* buffer);
251 uint32_t meter_id() {
252 return this->meter_id_;
254 void meter_id(uint32_t meter_id) {
255 this->meter_id_ = meter_id;
261 uint32_t experimenter_;
272 size_t pack(uint8_t* buffer);
273 of_error unpack(uint8_t* buffer);
274 uint32_t experimenter() {
275 return this->experimenter_;
277 void experimenter(uint32_t experimenter) {
278 this->experimenter_ = experimenter;