libfluid
The ONF OpenFlow driver
of13action.hh
1 #ifndef OF13ACTION_H
2 #define OF13ACTION_H
3 
4 #include "fluid/ofcommon/action.hh"
5 #include "of13match.hh"
6 
7 namespace fluid_msg {
8 
9 namespace of13 {
10 
11 class OutputAction: public Action {
12 private:
13  uint32_t port_;
14  uint16_t max_len_;
15  const uint16_t set_order_;
16 public:
17  OutputAction();
18  OutputAction(uint32_t port, uint16_t max_len);
19  ~OutputAction() {
20  }
21  virtual bool equals(const Action & other);
22  uint16_t set_order() const {
23  return this->set_order_;
24  }
25  size_t pack(uint8_t *buffer);
26  of_error unpack(uint8_t *buffer);
27  virtual OutputAction* clone() {
28  return new OutputAction(*this);
29  }
30  uint32_t port() {
31  return this->port_;
32  }
33  void port(uint32_t port) {
34  this->port_ = port;
35  }
36  uint16_t max_len() {
37  return this->max_len_;
38  }
39  void max_len(uint16_t max_len) {
40  this->max_len_ = max_len;
41  }
42 };
43 
44 class CopyTTLOutAction: public Action {
45 private:
46  const uint16_t set_order_;
47 public:
49  ~CopyTTLOutAction() {
50  }
51  uint16_t set_order() const {
52  return this->set_order_;
53  }
54  size_t pack(uint8_t *buffer);
55  of_error unpack(uint8_t *buffer);
56  virtual CopyTTLOutAction* clone() {
57  return new CopyTTLOutAction(*this);
58  }
59 };
60 
61 class CopyTTLInAction: public Action {
62 private:
63  const uint16_t set_order_;
64 public:
66  ~CopyTTLInAction() {
67  }
68  uint16_t set_order() const {
69  return this->set_order_;
70  }
71  size_t pack(uint8_t *buffer);
72  of_error unpack(uint8_t *buffer);
73  virtual CopyTTLInAction* clone() {
74  return new CopyTTLInAction(*this);
75  }
76 };
77 
78 class SetMPLSTTLAction: public Action {
79 private:
80  uint8_t mpls_ttl_;
81  const uint16_t set_order_;
82 public:
84  SetMPLSTTLAction(uint8_t mpls_ttl);
85  ~SetMPLSTTLAction() {
86  }
87  virtual bool equals(const Action & other);
88  uint16_t set_order() const {
89  return this->set_order_;
90  }
91  size_t pack(uint8_t *buffer);
92  of_error unpack(uint8_t *buffer);
93  uint8_t mpls_ttl() {
94  return this->mpls_ttl_;
95  }
96  void mpls_ttl(uint8_t mpls_ttl) {
97  this->mpls_ttl_ = mpls_ttl;
98  }
99  virtual SetMPLSTTLAction* clone() {
100  return new SetMPLSTTLAction(*this);
101  }
102 };
103 
104 class DecMPLSTTLAction: public Action {
105 private:
106  const uint16_t set_order_;
107 public:
109  ~DecMPLSTTLAction() {
110  }
111  uint16_t set_order() const {
112  return this->set_order_;
113  }
114  size_t pack(uint8_t *buffer);
115  of_error unpack(uint8_t *buffer);
116  virtual DecMPLSTTLAction* clone() {
117  return new DecMPLSTTLAction(*this);
118  }
119 };
120 
121 class PushVLANAction: public Action {
122 private:
123  uint16_t ethertype_;
124  const uint16_t set_order_;
125 public:
126  PushVLANAction();
127  PushVLANAction(uint16_t ethertype);
128  ~PushVLANAction() {
129  }
130  virtual bool equals(const Action & other);
131  uint16_t set_order() const {
132  return this->set_order_;
133  }
134  size_t pack(uint8_t *buffer);
135  of_error unpack(uint8_t *buffer);
136  virtual PushVLANAction* clone() {
137  return new PushVLANAction(*this);
138  }
139  uint16_t ethertype() {
140  return this->ethertype_;
141  }
142  void ethertype(uint16_t ethertype) {
143  this->ethertype_ = ethertype;
144  }
145 };
146 
147 class PopVLANAction: public Action {
148 private:
149  const uint16_t set_order_;
150 public:
151  PopVLANAction();
152  ~PopVLANAction() {
153  }
154  uint16_t set_order() const {
155  return this->set_order_;
156  }
157  size_t pack(uint8_t *buffer);
158  of_error unpack(uint8_t *buffer);
159  virtual PopVLANAction* clone() {
160  return new PopVLANAction(*this);
161  }
162 };
163 
164 class PushMPLSAction: public Action {
165 private:
166  uint16_t ethertype_;
167  const uint16_t set_order_;
168 public:
169  PushMPLSAction();
170  PushMPLSAction(uint16_t ethertype);
171  ~PushMPLSAction() {
172  }
173  virtual bool equals(const Action & other);
174  uint16_t set_order() const {
175  return this->set_order_;
176  }
177  size_t pack(uint8_t *buffer);
178  of_error unpack(uint8_t *buffer);
179  virtual PushMPLSAction* clone() {
180  return new PushMPLSAction(*this);
181  }
182  uint16_t ethertype() {
183  return this->ethertype_;
184  }
185  void ethertype(uint16_t ethertype) {
186  this->ethertype_ = ethertype;
187  }
188 };
189 
190 class PopMPLSAction: public Action {
191 private:
192  uint16_t ethertype_;
193  const uint16_t set_order_;
194 public:
195  PopMPLSAction();
196  PopMPLSAction(uint16_t ethertype);
197  ~PopMPLSAction() {
198  }
199  virtual bool equals(const Action & other);
200  uint16_t set_order() const {
201  return this->set_order_;
202  }
203  size_t pack(uint8_t *buffer);
204  of_error unpack(uint8_t *buffer);
205  virtual PopMPLSAction* clone() {
206  return new PopMPLSAction(*this);
207  }
208  uint16_t ethertype() {
209  return this->ethertype_;
210  }
211  void ethertype(uint16_t ethertype) {
212  this->ethertype_ = ethertype;
213  }
214 };
215 
216 class SetQueueAction: public Action {
217 private:
218  uint32_t queue_id_;
219  const uint16_t set_order_;
220 public:
221  SetQueueAction();
222  SetQueueAction(uint32_t queue_id);
223  ~SetQueueAction() {
224  }
225  virtual bool equals(const Action & other);
226  uint16_t set_order() const {
227  return this->set_order_;
228  }
229  size_t pack(uint8_t *buffer);
230  of_error unpack(uint8_t *buffer);
231  virtual SetQueueAction* clone() {
232  return new SetQueueAction(*this);
233  }
234  uint32_t queue_id() {
235  return this->queue_id_;
236  }
237  void queue_id(uint32_t queue_id) {
238  this->queue_id_ = queue_id;
239  }
240 };
241 
242 class GroupAction: public Action {
243 private:
244  uint32_t group_id_;
245  const uint16_t set_order_;
246 public:
247  GroupAction();
248  GroupAction(uint32_t group_id);
249  ~GroupAction() {
250  }
251  virtual bool equals(const Action & other);
252  uint16_t set_order() const {
253  return this->set_order_;
254  }
255  size_t pack(uint8_t *buffer);
256  of_error unpack(uint8_t *buffer);
257  virtual GroupAction* clone() {
258  return new GroupAction(*this);
259  }
260  uint32_t group_id() {
261  return this->group_id_;
262  }
263  void group_id(uint32_t group_id) {
264  this->group_id_ = group_id;
265  }
266 };
267 
268 class SetNWTTLAction: public Action {
269 private:
270  uint8_t nw_ttl_;
271  const uint16_t set_order_;
272 public:
273  SetNWTTLAction();
274  SetNWTTLAction(uint8_t nw_ttl);
275  ~SetNWTTLAction() {
276  }
277  ;
278  virtual bool equals(const Action & other);
279  uint16_t set_order() const {
280  return this->set_order_;
281  }
282  size_t pack(uint8_t *buffer);
283  of_error unpack(uint8_t *buffer);
284  virtual SetNWTTLAction* clone() {
285  return new SetNWTTLAction(*this);
286  }
287  uint8_t nw_ttl() {
288  return this->nw_ttl_;
289  }
290  void nw_ttl(uint8_t nw_ttl) {
291  this->nw_ttl_ = nw_ttl;
292  }
293 };
294 
295 class DecNWTTLAction: public Action {
296 private:
297  const uint16_t set_order_;
298 public:
299  DecNWTTLAction();
300  ~DecNWTTLAction() {
301  }
302  uint16_t set_order() const {
303  return this->set_order_;
304  }
305  size_t pack(uint8_t *buffer);
306  of_error unpack(uint8_t *buffer);
307  virtual DecNWTTLAction* clone() {
308  return new DecNWTTLAction(*this);
309  }
310 };
311 
312 class SetFieldAction: public Action {
313 private:
314  OXMTLV* field_;
315  const uint16_t set_order_;
316 public:
317  SetFieldAction();
318  SetFieldAction(OXMTLV* field);
319  SetFieldAction(const SetFieldAction &other);
320  ~SetFieldAction();
321  virtual bool equals(const Action & other);
322  SetFieldAction& operator=(SetFieldAction other);
323  uint16_t set_order() const {
324  return this->set_order_;
325  }
326  size_t pack(uint8_t *buffer);
327  of_error unpack(uint8_t *buffer);
328  virtual SetFieldAction* clone() {
329  return new SetFieldAction(*this);
330  }
331  OXMTLV* field();
332  void field(OXMTLV* field);
333  friend void swap(SetFieldAction& first, SetFieldAction& second);
334 };
335 
336 class PushPBBAction: public Action {
337 private:
338  uint16_t ethertype_;
339  const uint16_t set_order_;
340 public:
341  PushPBBAction();
342  PushPBBAction(uint16_t ethertype);
343  ~PushPBBAction() {
344  }
345  virtual bool equals(const Action & other);
346  uint16_t set_order() const {
347  return this->set_order_;
348  }
349  size_t pack(uint8_t *buffer);
350  of_error unpack(uint8_t *buffer);
351  virtual PushPBBAction* clone() {
352  return new PushPBBAction(*this);
353  }
354  uint16_t ethertype() {
355  return this->ethertype_;
356  }
357  void ethertype(uint16_t ethertype) {
358  this->ethertype_ = ethertype;
359  }
360 };
361 
362 class PopPBBAction: public Action {
363 private:
364  const uint16_t set_order_;
365 public:
366  PopPBBAction();
367  ~PopPBBAction() {
368  }
369  uint16_t set_order() const {
370  return this->set_order_;
371  }
372  size_t pack(uint8_t *buffer);
373  of_error unpack(uint8_t *buffer);
374  virtual PopPBBAction* clone() {
375  return new PopPBBAction(*this);
376  }
377 };
378 
379 class ExperimenterAction: public Action {
380 protected:
381  uint32_t experimenter_;
382 public:
384  ExperimenterAction(uint32_t experimenter);
385  ~ExperimenterAction() {
386  }
387  virtual bool equals(const Action & other);
388  size_t pack(uint8_t *buffer);
389  of_error unpack(uint8_t *buffer);
390  virtual ExperimenterAction* clone() {
391  return new ExperimenterAction(*this);
392  }
393  uint32_t experimenter() {
394  return this->experimenter_;
395  }
396  void experimenter(uint32_t experimenter) {
397  this->experimenter_ = experimenter;
398  }
399 };
400 
401 } //End of namespace of13
402 
403 } //End of namespace fluid_msg
404 #endif