libfluid
The ONF OpenFlow driver
of13msg.hh
1 #ifndef OF13MSG_H
2 #define OF13MSG_H 1
3 
4 #include "fluid/ofcommon/msg.hh"
5 #include "of13/of13common.hh"
6 #include "of13/of13action.hh"
7 #include "of13/of13meter.hh"
8 
9 namespace fluid_msg {
10 
14 class RoleCommon: public OFMsg {
15 private:
16  uint32_t role_;
17  uint64_t generation_id_;
18 public:
19  RoleCommon(uint8_t version, uint8_t type);
20  RoleCommon(uint8_t version, uint8_t type, uint32_t xid, uint32_t role,
21  uint64_t generation_id);
22  virtual ~RoleCommon() {
23  }
24  bool operator==(const RoleCommon &other) const;
25  bool operator!=(const RoleCommon &other) const;
26  uint8_t* pack();
27  of_error unpack(uint8_t *buffer);
28  uint32_t role() {
29  return this->role_;
30  }
31  uint64_t generation_id() {
32  return this->generation_id_;
33  }
34  void role(uint32_t role) {
35  this->role_ = role;
36  }
37  void generation_id(uint64_t generation_id) {
38  this->generation_id_ = generation_id;
39  }
40 };
41 
45 class AsyncConfigCommon: public OFMsg {
46 protected:
47  std::vector<uint32_t> packet_in_mask_;
48  std::vector<uint32_t> port_status_mask_;
49  std::vector<uint32_t> flow_removed_mask_;
50 public:
51  AsyncConfigCommon(uint8_t version, uint8_t type);
52  AsyncConfigCommon(uint8_t version, uint8_t type, uint32_t xid);
53  AsyncConfigCommon(uint8_t version, uint8_t type, uint32_t xid,
54  std::vector<uint32_t> packet_in_mask,
55  std::vector<uint32_t> port_status_mask,
56  std::vector<uint32_t> flow_removed_mask);
57  virtual ~AsyncConfigCommon() {
58  }
59  bool operator==(const AsyncConfigCommon &other) const;
60  bool operator!=(const AsyncConfigCommon &other) const;
61  uint8_t* pack();
62  of_error unpack(uint8_t *buffer);
63  /*TODO check for specific message type */
64  uint32_t master_equal_packet_in_mask() {
65  return this->packet_in_mask_[0];
66  }
67  uint32_t master_equal_port_status_mask() {
68  return this->port_status_mask_[0];
69  }
70  uint32_t master_equal_flow_removed_mask() {
71  return this->port_status_mask_[0];
72  }
73  uint32_t slave_packet_in_mask() {
74  return this->packet_in_mask_[1];
75  }
76  uint32_t slave_port_status_mask() {
77  return this->port_status_mask_[1];
78  }
79  uint32_t slave_flow_removed_mask() {
80  return this->port_status_mask_[1];
81  }
82  void master_equal_packet_in_mask(uint32_t mask) {
83  this->packet_in_mask_[0] = mask;
84  }
85  void master_equal_port_status_mask(uint32_t mask) {
86  this->port_status_mask_[0] = mask;
87  }
88  void master_equal_flow_removed_mask(uint32_t mask) {
89  this->port_status_mask_[0] = mask;
90  }
91  void slave_packet_in_mask(uint32_t mask) {
92  this->packet_in_mask_[1] = mask;
93  }
94  void slave_port_status_mask(uint32_t mask) {
95  this->port_status_mask_[1] = mask;
96  }
97  void slave_flow_removed_mask(uint32_t mask) {
98  this->port_status_mask_[1] = mask;
99  }
100 };
101 
105 namespace of13 {
106 
110 class Hello: public OFMsg {
111 private:
112  std::list<HelloElemVersionBitmap> elements_;
113 public:
114  Hello();
115  Hello(uint32_t xid);
116  Hello(uint32_t xid, std::list<HelloElemVersionBitmap> elements);
117  ~Hello() {
118  }
119  bool operator==(const Hello &other) const;
120  bool operator!=(const Hello &other) const;
121  uint8_t* pack();
122  of_error unpack(uint8_t* buffer);
123  std::list<HelloElemVersionBitmap> elements() {
124  return this->elements_;
125  }
126  void elements(std::list<HelloElemVersionBitmap> elements);
127  void add_element(HelloElemVersionBitmap element);
128  uint32_t elements_len();
129 };
130 
134 class Error: public ErrorCommon {
135 public:
136  Error();
137  Error(uint32_t xid, uint16_t err_type, uint16_t code);
138  Error(uint32_t xid, uint16_t err_type, uint16_t code, uint8_t *data,
139  size_t data_len);
140  ~Error() {
141  }
142 };
143 
147 class EchoRequest: public EchoCommon {
148 public:
149  EchoRequest();
150  EchoRequest(uint32_t xid);
151  ~EchoRequest() {
152  }
153 };
154 
158 class EchoReply: public EchoCommon {
159 public:
160  EchoReply();
161  EchoReply(uint32_t xid);
162  ~EchoReply() {
163  }
164 };
165 
170 class Experimenter: public OFMsg {
171 protected:
172  uint32_t experimenter_;
173  uint32_t exp_type_;
174 public:
175  Experimenter();
176  Experimenter(uint32_t xid, uint32_t experimenter, uint32_t exp_type);
177  virtual ~Experimenter() {
178  }
179  bool operator==(const Experimenter &other) const;
180  bool operator!=(const Experimenter &other) const;
181  uint8_t* pack();
182  of_error unpack(uint8_t *buffer);
183  uint32_t experimenter() {
184  return this->experimenter_;
185  }
186  uint32_t exp_type() {
187  return this->exp_type_;
188  }
189 };
190 
194 class FeaturesRequest: public OFMsg {
195 public:
196  FeaturesRequest();
197  FeaturesRequest(uint32_t xid);
198  ~FeaturesRequest() {
199  }
200  uint8_t* pack();
201  of_error unpack(uint8_t* buffer);
202 };
203 
208  uint8_t auxiliary_id_;
209 public:
210  FeaturesReply();
211  FeaturesReply(uint32_t xid, uint64_t datapath_id, uint32_t n_buffers,
212  uint8_t n_tables, uint8_t auxiliary_id, uint32_t capabilities);
213  ~FeaturesReply() {
214  }
215  bool operator==(const FeaturesReply &other) const;
216  bool operator!=(const FeaturesReply &other) const;
217  uint8_t* pack();
218  of_error unpack(uint8_t *buffer);
219  uint8_t auxiliary_id() {
220  return this->auxiliary_id_;
221  }
222  void auxiliary_id(uint8_t auxiliary_id) {
223  this->auxiliary_id_ = auxiliary_id;
224  }
225 };
226 
230 class GetConfigRequest: public OFMsg {
231 public:
233  GetConfigRequest(uint32_t xid);
234  ~GetConfigRequest() {
235  }
236  ;
237  uint8_t* pack();
238  of_error unpack(uint8_t* buffer);
239 };
240 
245 public:
246  GetConfigReply();
247  GetConfigReply(uint32_t xid, uint16_t flags, uint16_t miss_send_len);
248  ~GetConfigReply() {
249  }
250  ;
251 };
252 
257 public:
258  SetConfig();
259  SetConfig(uint32_t xid, uint16_t flags, uint16_t miss_send_len);
260  ~SetConfig() {
261  }
262  ;
263 };
264 
268 class PacketOut: public PacketOutCommon {
269 private:
270  uint32_t in_port_;
271 public:
272  PacketOut();
273  PacketOut(uint32_t xid, uint32_t buffer_id, uint32_t in_port);
274  bool operator==(const PacketOut &other) const;
275  bool operator!=(const PacketOut &other) const;
276  uint8_t* pack();
277  of_error unpack(uint8_t *buffer);
278  uint16_t in_port() {
279  return this->in_port_;
280  }
281  void in_port(uint32_t in_port) {
282  this->in_port_ = in_port;
283  }
284 };
285 
289 class PacketIn: public PacketInCommon {
290 private:
291  uint8_t table_id_;
292  uint64_t cookie_;
293  of13::Match match_;
294 public:
295  PacketIn();
296  PacketIn(uint32_t xid, uint32_t buffer_id, uint16_t total_len,
297  uint8_t reason, uint8_t table_id, uint64_t cookie);
298  ~PacketIn() {
299  }
300  ;
301  virtual uint16_t length();
302  bool operator==(const PacketIn &other) const;
303  bool operator!=(const PacketIn &other) const;
304  uint8_t* pack();
305  of_error unpack(uint8_t *buffer);
306  uint8_t table_id() {
307  return this->table_id_;
308  }
309  uint64_t cookie() {
310  return this->cookie_;
311  }
312  of13::Match match() {
313  return this->match_;
314  }
315  ;
316  OXMTLV * get_oxm_field(uint8_t field);
317  void table_id(uint8_t table_id) {
318  this->table_id_ = table_id;
319  }
320  void cookie(uint64_t cookie) {
321  this->cookie_ = cookie;
322  }
323  void add_oxm_field(OXMTLV &field);
324  void add_oxm_field(OXMTLV *field);
325 };
326 
330 class FlowMod: public FlowModCommon {
331 private:
332  uint8_t command_;
333  uint64_t cookie_mask_;
334  uint8_t table_id_;
335  uint32_t out_port_;
336  uint32_t out_group_;
337  of13::Match match_;
338  InstructionSet instructions_;
339 public:
340  FlowMod();
341  FlowMod(uint32_t xid, uint64_t cookie, uint64_t cookie_mask,
342  uint8_t table_id, uint8_t command, uint16_t idle_timeout,
343  uint16_t hard_timeout, uint16_t priority, uint32_t buffer_id,
344  uint32_t out_port, uint32_t out_group, uint16_t flags);
345  ~FlowMod() {
346  }
347  bool operator==(const FlowMod &other) const;
348  bool operator!=(const FlowMod &other) const;
349  uint8_t* pack();
350  of_error unpack(uint8_t *buffer);
351  virtual uint16_t length();
352  uint8_t command(){
353  return this->command_;
354  }
355  uint64_t cookie_mask() {
356  return this->cookie_mask_;
357  }
358  uint8_t table_id() {
359  return this->table_id_;
360  }
361  uint32_t out_port() {
362  return this->out_port_;
363  }
364  uint32_t out_group() {
365  return this->out_group_;
366  }
367  of13::Match match() {
368  return this->match_;
369  }
370  OXMTLV * get_oxm_field(uint8_t field);
371  void command(uint8_t command){
372  this->command_ = command;
373  }
374  void cookie_mask(uint64_t cookie_mask) {
375  this->cookie_mask_ = cookie_mask;
376  }
377  void table_id(uint8_t table_id) {
378  this->table_id_ = table_id;
379  }
380  void out_port(uint32_t out_port) {
381  this->out_port_ = out_port;
382  }
383  void out_group(uint32_t out_group) {
384  this->out_group_ = out_group;
385  }
386  void match(of13::Match match);
387  void add_oxm_field(OXMTLV &field);
388  void add_oxm_field(OXMTLV *field);
389  void instructions(InstructionSet instructions);
390  void add_instruction(Instruction &inst);
391  void add_instruction(Instruction* inst);
392 };
393 
398 private:
399  uint8_t table_id_;
400  uint16_t hard_timeout_;
401  of13::Match match_;
402 public:
403  FlowRemoved();
404  FlowRemoved(uint32_t xid, uint64_t cookie, uint16_t priority,
405  uint8_t reason, uint8_t table_id, uint32_t duration_sec,
406  uint32_t duration_nsec, uint16_t idle_timeout, uint16_t hard_timeout,
407  uint64_t packet_count, uint64_t byte_count);
408  FlowRemoved(uint32_t xid, uint64_t cookie, uint16_t priority,
409  uint8_t reason, uint8_t table_id, uint32_t duration_sec,
410  uint32_t duration_nsec, uint16_t idle_timeout, uint16_t hard_timeout,
411  uint64_t packet_count, uint64_t byte_count, of13::Match);
412  ~FlowRemoved() {
413  }
414  virtual uint16_t length();
415  bool operator==(const FlowRemoved &other) const;
416  bool operator!=(const FlowRemoved &other) const;
417  uint8_t* pack();
418  of_error unpack(uint8_t *buffer);
419  uint8_t table_id() {
420  return this->table_id_;
421  }
422  uint16_t hard_timeout() {
423  return this->hard_timeout_;
424  }
425  void table_id(uint8_t table_id) {
426  this->table_id_ = table_id;
427  }
428  void hard_timeout(uint16_t hard_timeout) {
429  this->hard_timeout_ = hard_timeout;
430  }
431  of13::Match match() {
432  return this->match_;
433  }
434  void match(of13::Match match) {
435  this->match_ = match;
436  }
437 };
438 
443 private:
444  of13::Port desc_;
445 public:
446  PortStatus();
447  PortStatus(uint32_t xid, uint8_t reason, of13::Port desc);
448  ~PortStatus() {
449  }
450  bool operator==(const PortStatus &other) const;
451  bool operator!=(const PortStatus &other) const;
452  uint8_t* pack();
453  of_error unpack(uint8_t *buffer);
454  of13::Port desc() {
455  return this->desc_;
456  }
457  void desc(of13::Port desc) {
458  this->desc_ = desc;
459  }
460 };
461 
465 class PortMod: public PortModCommon {
466 private:
467  uint32_t port_no_;
468 public:
469  PortMod();
470  PortMod(uint32_t xid, uint32_t port_no, EthAddress hw_addr, uint32_t config,
471  uint32_t mask, uint32_t advertise);
472  ~PortMod() {
473  }
474  bool operator==(const PortMod &other) const;
475  bool operator!=(const PortMod &other) const;
476  uint8_t* pack();
477  of_error unpack(uint8_t *buffer);
478  uint32_t port_no() {
479  return this->port_no_;
480  }
481  void port_no(uint32_t port_no) {
482  this->port_no_ = port_no;
483  }
484 };
485 
489 class GroupMod: public OFMsg {
490 private:
491  uint16_t command_;
492  uint8_t group_type_;
493  uint32_t group_id_;
494  std::vector<Bucket> buckets_;
495 public:
496  GroupMod();
497  GroupMod(uint32_t xid, uint16_t command, uint8_t type, uint32_t group_id);
498  GroupMod(uint32_t xid, uint16_t command, uint8_t type, uint32_t group_id,
499  std::vector<Bucket> buckets);
500  ~GroupMod() {
501  }
502  bool operator==(const GroupMod &other) const;
503  bool operator!=(const GroupMod &other) const;
504  uint8_t* pack();
505  of_error unpack(uint8_t *buffer);
506  uint16_t command() {
507  return this->command_;
508  }
509  uint8_t type() {
510  return this->type_;
511  }
512  uint32_t group_id() {
513  return this->group_id_;
514  }
515  std::vector<Bucket> buckets() {
516  return this->buckets_;
517  }
518  void commmand(uint16_t command) {
519  this->command_ = command;
520  }
521  void group_type(uint8_t type) {
522  this->group_type_ = type;
523  }
524  void group_id(uint32_t group_id) {
525  this->group_id_ = group_id;
526  }
527  void buckets(std::vector<Bucket> buckets);
528  void add_bucket(Bucket bucket);
529  size_t buckets_len();
530 };
531 
535 class TableMod: public OFMsg {
536 private:
537  uint8_t table_id_;
538  uint32_t config_;
539 public:
540  TableMod();
541  TableMod(uint32_t xid, uint8_t table_id, uint32_t config);
542  ~TableMod() {
543  }
544  bool operator==(const TableMod &other) const;
545  bool operator!=(const TableMod &other) const;
546  uint8_t* pack();
547  of_error unpack(uint8_t *buffer);
548  uint8_t table_id() {
549  return this->table_id_;
550  }
551  uint32_t config() {
552  return this->config_;
553  }
554  void table_id(uint8_t table_id) {
555  this->table_id_ = table_id;
556  }
557  void config(uint32_t config) {
558  this->config_ = config;
559  }
560 };
561 
566 class MultipartRequest: public OFMsg {
567 protected:
568  uint16_t mpart_type_;
569  uint16_t flags_;
570 public:
572  MultipartRequest(uint16_t type);
573  MultipartRequest(uint32_t xid, uint16_t type, uint16_t flags);
574  virtual ~MultipartRequest() {
575  }
576  bool operator==(const MultipartRequest &other) const;
577  bool operator!=(const MultipartRequest &other) const;
578  uint8_t* pack();
579  of_error unpack(uint8_t *buffer);
580  uint16_t mpart_type() {
581  return this->mpart_type_;
582  }
583  uint16_t flags() {
584  return this->flags_;
585  }
586  void type(uint16_t type) {
587  this->mpart_type_ = type;
588  }
589  void flags(uint16_t flags) {
590  this->flags_ = flags;
591  }
592 };
593 
598 class MultipartReply: public OFMsg {
599 protected:
600  uint16_t mpart_type_;
601  uint16_t flags_;
602 public:
603  MultipartReply();
604  MultipartReply(uint16_t type);
605  MultipartReply(uint32_t xid, uint16_t type, uint16_t flags);
606  virtual ~MultipartReply() {
607  }
608  bool operator==(const MultipartReply &other) const;
609  bool operator!=(const MultipartReply &other) const;
610  uint8_t* pack();
611  of_error unpack(uint8_t *buffer);
612  uint16_t mpart_type() {
613  return this->mpart_type_;
614  }
615  uint16_t flags() {
616  return this->flags_;
617  }
618  void type(uint16_t type) {
619  this->mpart_type_ = type;
620  }
621  void flags(uint16_t flags) {
622  this->flags_ = flags;
623  }
624 };
625 
630 public:
632  MultipartRequestDesc(uint32_t xid, uint16_t flags);
634  }
635  uint8_t* pack();
636  of_error unpack(uint8_t *buffer);
637 };
638 
643 private:
644  SwitchDesc desc_;
645 public:
647  MultipartReplyDesc(uint32_t xid, uint16_t flags, SwitchDesc desc);
648  MultipartReplyDesc(uint32_t xid, uint16_t flags, std::string mfr_desc,
649  std::string hw_desc, std::string sw_desc, std::string serial_num,
650  std::string dp_desc);
651  ~MultipartReplyDesc() {
652  }
653  bool operator==(const MultipartReplyDesc &other) const;
654  bool operator!=(const MultipartReplyDesc &other) const;
655  uint8_t* pack();
656  of_error unpack(uint8_t *buffer);
657  SwitchDesc desc() {
658  return this->desc_;
659  }
660  void set_desc(SwitchDesc desc) {
661  this->desc_ = desc;
662  }
663 };
664 
669 private:
670  uint8_t table_id_;
671  uint32_t out_port_;
672  uint32_t out_group_;
673  uint64_t cookie_;
674  uint64_t cookie_mask_;
675  of13::Match match_;
676 public:
678  MultipartRequestFlow(uint32_t xid, uint16_t flags, uint8_t table_id,
679  uint32_t out_port, uint32_t out_group, uint64_t cookie,
680  uint64_t cookie_mask);
681  MultipartRequestFlow(uint32_t xid, uint16_t flags, uint8_t table_id,
682  uint32_t out_port, uint32_t out_group, uint64_t cookie,
683  uint64_t cookie_mask, of13::Match match);
685  }
686  bool operator==(const MultipartRequestFlow &other) const;
687  bool operator!=(const MultipartRequestFlow &other) const;
688  uint8_t* pack();
689  of_error unpack(uint8_t *buffer);
690  of13::Match match() {
691  return this->match_;
692  }
693  uint8_t table_id() {
694  return this->table_id_;
695  }
696  uint32_t out_port() {
697  return this->out_port_;
698  }
699  uint32_t out_group() {
700  return this->out_group_;
701  }
702  uint64_t cookie() {
703  return this->cookie_;
704  }
705  uint64_t cookie_mask() {
706  return this->cookie_mask_;
707  }
708  void match(of13::Match match);
709  void add_oxm_field(OXMTLV &field);
710  void add_oxm_field(OXMTLV* field);
711  void table_id(uint8_t table_id) {
712  this->table_id_ = table_id;
713  }
714  void out_port(uint16_t out_port) {
715  this->out_port_ = out_port;
716  }
717  void out_group(uint32_t out_group) {
718  this->out_group_ = out_group;
719  }
720  void cookie(uint64_t cookie) {
721  this->cookie_ = cookie;
722  }
723  void cookie_mask(uint64_t cookie_mask) {
724  this->cookie_mask_ = cookie_mask;
725  }
726 };
727 
732 private:
733  std::vector<of13::FlowStats> flow_stats_;
734 public:
736  MultipartReplyFlow(uint32_t xid, uint16_t flags);
737  MultipartReplyFlow(uint32_t xid, uint16_t flags,
738  std::vector<of13::FlowStats> flow_stats);
739  ~MultipartReplyFlow() {
740  }
741  bool operator==(const MultipartReplyFlow &other) const;
742  bool operator!=(const MultipartReplyFlow &other) const;
743  uint8_t* pack();
744  of_error unpack(uint8_t *buffer);
745  std::vector<of13::FlowStats> flow_stats() {
746  return this->flow_stats_;
747  }
748  void flow_stats(std::vector<of13::FlowStats> flow_stats);
749  void add_flow_stats(of13::FlowStats);
750 };
751 
756 private:
757  uint8_t table_id_;
758  uint32_t out_port_;
759  uint32_t out_group_;
760  uint64_t cookie_;
761  uint64_t cookie_mask_;
762  of13::Match match_;
763 public:
765  MultipartRequestAggregate(uint32_t xid, uint16_t flags, uint8_t table_id,
766  uint32_t out_port, uint32_t out_group, uint64_t cookie,
767  uint64_t cookie_mask);
768  MultipartRequestAggregate(uint32_t xid, uint16_t flags, uint8_t table_id,
769  uint32_t out_port, uint32_t out_group, uint64_t cookie,
770  uint64_t cookie_mask, of13::Match match);
772  }
773  virtual uint16_t length();
774  bool operator==(const MultipartRequestAggregate &other) const;
775  bool operator!=(const MultipartRequestAggregate &other) const;
776  uint8_t* pack();
777  of_error unpack(uint8_t *buffer);
778  of13::Match match() {
779  return this->match_;
780  }
781  uint8_t table_id() {
782  return this->table_id_;
783  }
784  uint32_t out_port() {
785  return this->out_port_;
786  }
787  uint32_t out_group() {
788  return this->out_group_;
789  }
790  uint64_t cookie() {
791  return this->cookie_;
792  }
793  uint64_t cookie_mask() {
794  return this->cookie_mask_;
795  }
796  void match(of13::Match match);
797  void add_oxm_field(OXMTLV &field);
798  void add_oxm_field(OXMTLV *field);
799  void table_id(uint8_t table_id) {
800  this->table_id_ = table_id;
801  }
802  void out_port(uint16_t out_port) {
803  this->out_port_ = out_port;
804  }
805  void out_group(uint32_t out_group) {
806  this->out_group_ = out_group;
807  }
808  void cookie(uint64_t cookie) {
809  this->cookie_ = cookie;
810  }
811  void cookie_mask(uint64_t cookie_mask) {
812  this->cookie_mask_ = cookie_mask;
813  }
814 };
815 
820 private:
821  uint64_t packet_count_;
822  uint64_t byte_count_;
823  uint32_t flow_count_;
824 public:
826  MultipartReplyAggregate(uint32_t xid, uint16_t flags, uint64_t packet_count,
827  uint64_t byte_count, uint32_t flow_count);
829  }
830  bool operator==(const MultipartReplyAggregate &other) const;
831  bool operator!=(const MultipartReplyAggregate &other) const;
832  uint8_t* pack();
833  of_error unpack(uint8_t *buffer);
834  uint64_t packet_count() {
835  return this->packet_count_;
836  }
837  uint64_t byte_count() {
838  return this->byte_count_;
839  }
840  uint32_t flow_count() {
841  return this->flow_count_;
842  }
843  void packet_count(uint64_t packet_count) {
844  this->packet_count_ = packet_count;
845  }
846  void byte_count(uint64_t byte_count) {
847  this->byte_count_ = byte_count;
848  }
849  void flow_count(uint32_t flow_count) {
850  this->flow_count_ = flow_count;
851  }
852 };
853 
858 public:
860  MultipartRequestTable(uint32_t xid, uint16_t flags);
862  }
863  ;
864  uint8_t* pack();
865  of_error unpack(uint8_t *buffer);
866 };
867 
872 private:
873  std::vector<of13::TableStats> table_stats_;
874 public:
876  MultipartReplyTable(uint32_t xid, uint16_t flags);
877  MultipartReplyTable(uint32_t xid, uint16_t flags,
878  std::vector<of13::TableStats> table_stats);
880  }
881  bool operator==(const MultipartReplyTable &other) const;
882  bool operator!=(const MultipartReplyTable &other) const;
883  uint8_t* pack();
884  of_error unpack(uint8_t *buffer);
885  std::vector<of13::TableStats> table_stats() {
886  return this->table_stats_;
887  }
888  void table_stats(std::vector<of13::TableStats> table_stats);
889  void add_table_stat(of13::TableStats stat);
890 };
891 
896 private:
897  uint32_t port_no_;
898 public:
900  MultipartRequestPortStats(uint32_t xid, uint16_t flags, uint32_t port_no);
902  }
903  bool operator==(const MultipartRequestPortStats &other) const;
904  bool operator!=(const MultipartRequestPortStats &other) const;
905  uint8_t* pack();
906  of_error unpack(uint8_t *buffer);
907  uint32_t port_no() {
908  return this->port_no_;
909  }
910  void port_no(uint32_t port_no) {
911  this->port_no_ = port_no;
912  }
913 };
914 
919 private:
920  std::vector<of13::PortStats> port_stats_;
921 public:
923  MultipartReplyPortStats(uint32_t xid, uint16_t flags);
924  MultipartReplyPortStats(uint32_t xid, uint16_t flags,
925  std::vector<of13::PortStats> port_stats);
927  }
928  bool operator==(const MultipartReplyPortStats &other) const;
929  bool operator!=(const MultipartReplyPortStats &other) const;
930  uint8_t* pack();
931  of_error unpack(uint8_t *buffer);
932  std::vector<of13::PortStats> port_stats() {
933  return this->port_stats_;
934  }
935  void port_stats(std::vector<of13::PortStats> port_stats);
936  void add_port_stat(of13::PortStats stat);
937 };
938 
943 private:
944  uint32_t port_no_;
945  uint32_t queue_id_;
946 public:
948  MultipartRequestQueue(uint32_t xid, uint16_t flags, uint32_t port_no,
949  uint32_t queue_id);
951  }
952  bool operator==(const MultipartRequestQueue &other) const;
953  bool operator!=(const MultipartRequestQueue &other) const;
954  uint8_t* pack();
955  of_error unpack(uint8_t *buffer);
956  uint16_t port_no() {
957  return this->port_no_;
958  }
959  uint32_t queue_id() {
960  return this->queue_id_;
961  }
962  void port_no(uint32_t port_no) {
963  this->port_no_ = port_no;
964  }
965  void queue_id(uint32_t queue_id) {
966  this->queue_id_ = queue_id;
967  }
968 };
969 
974 private:
975  std::vector<of13::QueueStats> queue_stats_;
976 public:
978  MultipartReplyQueue(uint32_t xid, uint16_t flags);
979  MultipartReplyQueue(uint32_t xid, uint16_t flags,
980  std::vector<of13::QueueStats> queue_stats);
982  }
983  bool operator==(const MultipartReplyQueue &other) const;
984  bool operator!=(const MultipartReplyQueue &other) const;
985  uint8_t* pack();
986  of_error unpack(uint8_t *buffer);
987  std::vector<of13::QueueStats> queue_stats() {
988  return this->queue_stats_;
989  }
990  void queue_stats(std::vector<of13::QueueStats> queue_stats_);
991  void add_queue_stat(of13::QueueStats stat);
992 };
993 
998 private:
999  uint32_t group_id_;
1000 public:
1002  MultipartRequestGroup(uint32_t xid, uint16_t flags, uint32_t group_id);
1004  }
1005  bool operator==(const MultipartRequestGroup &other) const;
1006  bool operator!=(const MultipartRequestGroup &other) const;
1007  uint8_t* pack();
1008  of_error unpack(uint8_t *buffer);
1009  uint32_t group_id() {
1010  return this->group_id_;
1011  }
1012  void group_id(uint32_t group_id) {
1013  this->group_id_ = group_id;
1014  }
1015 };
1016 
1021 private:
1022  std::vector<of13::GroupStats> group_stats_;
1023 public:
1025  MultipartReplyGroup(uint32_t xid, uint16_t flags);
1026  MultipartReplyGroup(uint32_t xid, uint16_t flags,
1027  std::vector<of13::GroupStats> group_stats);
1028  ~MultipartReplyGroup() {
1029  }
1030  bool operator==(const MultipartReplyGroup &other) const;
1031  bool operator!=(const MultipartReplyGroup &other) const;
1032  uint8_t* pack();
1033  of_error unpack(uint8_t *buffer);
1034  std::vector<of13::GroupStats> queue_stats() {
1035  return this->group_stats_;
1036  }
1037  void group_stats(std::vector<of13::GroupStats> group_stats);
1038  void add_group_stats(of13::GroupStats stat);
1039  size_t group_stats_len();
1040 };
1041 
1046 public:
1048  MultipartRequestGroupDesc(uint32_t xid, uint16_t flags);
1050  }
1051  uint8_t* pack();
1052  of_error unpack(uint8_t *buffer);
1053 };
1054 
1059 private:
1060  std::vector<of13::GroupDesc> group_desc_;
1061 public:
1063  MultipartReplyGroupDesc(uint32_t xid, uint16_t flags);
1064  MultipartReplyGroupDesc(uint32_t xid, uint16_t flags,
1065  std::vector<of13::GroupDesc> group_desc);
1067  }
1068  bool operator==(const MultipartReplyGroupDesc &other) const;
1069  bool operator!=(const MultipartReplyGroupDesc &other) const;
1070  uint8_t* pack();
1071  of_error unpack(uint8_t *buffer);
1072  std::vector<of13::GroupDesc> queue_stats() {
1073  return this->group_desc_;
1074  }
1075  void group_desc(std::vector<of13::GroupDesc> group_desc);
1076  void add_group_desc(of13::GroupDesc stat);
1077  size_t desc_len();
1078 };
1079 
1084 public:
1086  MultipartRequestGroupFeatures(uint32_t xid, uint16_t flags);
1088  }
1089  uint8_t* pack();
1090  of_error unpack(uint8_t *buffer);
1091 };
1092 
1097 private:
1098  of13::GroupFeatures features_;
1099 public:
1101  MultipartReplyGroupFeatures(uint32_t xid, uint16_t flags,
1102  of13::GroupFeatures features);
1104  }
1105  bool operator==(const MultipartReplyGroupFeatures &other) const;
1106  bool operator!=(const MultipartReplyGroupFeatures &other) const;
1107  uint8_t* pack();
1108  of_error unpack(uint8_t *buffer);
1109  of13::GroupFeatures features() {
1110  return this->features_;
1111  }
1112  void features(of13::GroupFeatures features) {
1113  this->features_ = features;
1114  }
1115 };
1116 
1121 private:
1122  uint32_t meter_id_;
1123 public:
1125  MultipartRequestMeter(uint32_t xid, uint16_t flags, uint32_t meter_id);
1126  bool operator==(const MultipartRequestMeter &other) const;
1127  bool operator!=(const MultipartRequestMeter &other) const;
1129  }
1130  uint8_t* pack();
1131  of_error unpack(uint8_t *buffer);
1132  uint32_t meter_id() {
1133  return this->meter_id_;
1134  }
1135  void meter_id(uint32_t meter_id) {
1136  this->meter_id_ = meter_id;
1137  }
1138 };
1139 
1144 private:
1145  std::vector<of13::MeterStats> meter_stats_;
1146 public:
1148  MultipartReplyMeter(uint32_t xid, uint16_t flags);
1149  MultipartReplyMeter(uint32_t xid, uint16_t flags,
1150  std::vector<of13::MeterStats> meter_stats);
1151  ~MultipartReplyMeter() {
1152  }
1153  bool operator==(const MultipartReplyMeter &other) const;
1154  bool operator!=(const MultipartReplyMeter &other) const;
1155  uint8_t* pack();
1156  of_error unpack(uint8_t *buffer);
1157  std::vector<of13::MeterStats> meter_stats() {
1158  return this->meter_stats_;
1159  }
1160  void meter_stats(std::vector<of13::MeterStats> meter_stats);
1161  void add_meter_stats(MeterStats stats);
1162  size_t meter_stats_len();
1163 };
1164 
1169 public:
1171  MultipartRequestMeterConfig(uint32_t xid, uint16_t flags);
1173  }
1174  uint8_t* pack();
1175  of_error unpack(uint8_t *buffer);
1176 };
1177 
1182  std::vector<MeterConfig> meter_config_;
1183 public:
1185  MultipartReplyMeterConfig(uint32_t xid, uint16_t flags);
1186  MultipartReplyMeterConfig(uint32_t xid, uint16_t flags,
1187  std::vector<MeterConfig> meter_config);
1189  }
1190  bool operator==(const MultipartReplyMeterConfig &other) const;
1191  bool operator!=(const MultipartReplyMeterConfig &other) const;
1192  uint8_t* pack();
1193  of_error unpack(uint8_t *buffer);
1194  std::vector<MeterConfig> meter_config() {
1195  return this->meter_config_;
1196  }
1197  void meter_config(std::vector<MeterConfig> meter_config);
1198  void add_meter_config(MeterConfig config);
1199  size_t meter_config_len();
1200 };
1201 
1206 public:
1208  MultipartRequestMeterFeatures(uint32_t xid, uint16_t flags);
1210  }
1211  uint8_t* pack();
1212  of_error unpack(uint8_t *buffer);
1213 };
1214 
1219 private:
1220  MeterFeatures meter_features_;
1221 public:
1223  MultipartReplyMeterFeatures(uint32_t xid, uint16_t flags,
1224  MeterFeatures features);
1226  }
1227  bool operator==(const MultipartReplyMeterFeatures &other) const;
1228  bool operator!=(const MultipartReplyMeterFeatures &other) const;
1229  uint8_t* pack();
1230  of_error unpack(uint8_t *buffer);
1231  MeterFeatures meter_features() {
1232  return this->meter_features_;
1233  }
1234  void meter_features(MeterFeatures meter_features) {
1235  this->meter_features_ = meter_features;
1236  }
1237 };
1238 
1243 private:
1244  std::vector<TableFeatures> tables_features_;
1245 public:
1247  MultipartRequestTableFeatures(uint32_t xid, uint16_t flags);
1248  MultipartRequestTableFeatures(uint32_t xid, uint16_t flags,
1249  std::vector<TableFeatures> table_features);
1251  }
1252  bool operator==(const MultipartRequestTableFeatures &other) const;
1253  bool operator!=(const MultipartRequestTableFeatures &other) const;
1254  uint8_t* pack();
1255  of_error unpack(uint8_t *buffer);
1256  std::vector<TableFeatures> tables_features() {
1257  return this->tables_features_;
1258  }
1259  void tables_features(std::vector<TableFeatures> tables_features);
1260  void add_table_features(TableFeatures table_feature);
1261 };
1262 
1267 private:
1268  std::vector<TableFeatures> tables_features_;
1269 public:
1271  MultipartReplyTableFeatures(uint32_t xid, uint16_t flags);
1272  MultipartReplyTableFeatures(uint32_t xid, uint16_t flags,
1273  std::vector<TableFeatures> table_features);
1275  }
1276  bool operator==(const MultipartReplyTableFeatures &other) const;
1277  bool operator!=(const MultipartReplyTableFeatures &other) const;
1278  uint8_t* pack();
1279  of_error unpack(uint8_t *buffer);
1280  std::vector<TableFeatures> table_features() {
1281  return this->tables_features_;
1282  }
1283  void tables_features(std::vector<TableFeatures> tables_features);
1284  void add_table_features(TableFeatures table_feature);
1285 };
1286 
1291 public:
1293  MultipartRequestPortDescription(uint32_t xid, uint16_t flags);
1295  }
1296  uint8_t* pack();
1297  of_error unpack(uint8_t *buffer);
1298 };
1299 
1304 private:
1305  std::vector<of13::Port> ports_;
1306 public:
1308  MultipartReplyPortDescription(uint32_t xid, uint16_t flags);
1309  MultipartReplyPortDescription(uint32_t xid, uint16_t flags,
1310  std::vector<of13::Port> ports);
1312  }
1313  bool operator==(const MultipartReplyPortDescription &other) const;
1314  bool operator!=(const MultipartReplyPortDescription &other) const;
1315  uint8_t* pack();
1316  of_error unpack(uint8_t *buffer);
1317  std::vector<of13::Port> ports() {
1318  return this->ports_;
1319  }
1320  void ports(std::vector<of13::Port> ports);
1321  void add_port(of13::Port);
1322 };
1323 
1329 protected:
1330  uint32_t experimenter_;
1331  uint32_t exp_type_;
1332 public:
1334  MultipartRequestExperimenter(uint32_t xid, uint16_t flags,
1335  uint32_t experimenter, uint32_t exp_type);
1336  virtual ~MultipartRequestExperimenter() {
1337  }
1338  bool operator==(const MultipartRequestExperimenter &other) const;
1339  bool operator!=(const MultipartRequestExperimenter &other) const;
1340  uint8_t* pack();
1341  of_error unpack(uint8_t *buffer);
1342  uint32_t experimenter() {
1343  return this->experimenter_;
1344  }
1345  uint32_t exp_type() {
1346  return this->exp_type_;
1347  }
1348 };
1349 
1355 protected:
1356  uint32_t experimenter_;
1357  uint32_t exp_type_;
1358 public:
1360  MultipartReplyExperimenter(uint32_t xid, uint16_t flags,
1361  uint32_t experimenter, uint32_t exp_type);
1362  virtual ~MultipartReplyExperimenter() {
1363  }
1364  bool operator==(const MultipartReplyExperimenter &other) const;
1365  bool operator!=(const MultipartReplyExperimenter &other) const;
1366  uint8_t* pack();
1367  of_error unpack(uint8_t *buffer);
1368  uint32_t experimenter() {
1369  return this->experimenter_;
1370  }
1371  uint32_t exp_type() {
1372  return this->exp_type_;
1373  }
1374 };
1375 
1379 class BarrierRequest: public OFMsg {
1380 public:
1381  BarrierRequest();
1382  BarrierRequest(uint32_t xid);
1383  ~BarrierRequest() {
1384  }
1385  uint8_t* pack();
1386  of_error unpack(uint8_t* buffer);
1387 };
1388 
1391 class BarrierReply: public OFMsg {
1392 public:
1393  BarrierReply();
1394  BarrierReply(uint32_t xid);
1395  ~BarrierReply() {
1396  }
1397  uint8_t* pack();
1398  of_error unpack(uint8_t* buffer);
1399 };
1400 
1405 private:
1406  uint32_t port_;
1407 public:
1409  QueueGetConfigRequest(uint32_t xid, uint32_t port);
1411  }
1412  bool operator==(const QueueGetConfigRequest &other) const;
1413  bool operator!=(const QueueGetConfigRequest &other) const;
1414  uint8_t* pack();
1415  of_error unpack(uint8_t *buffer);
1416  uint32_t port() {
1417  return this->port_;
1418  }
1419  void port(uint32_t port) {
1420  this->port_ = port;
1421  }
1422 };
1423 
1428 private:
1429  uint32_t port_;
1430  std::list<of13::PacketQueue> queues_;
1431 public:
1433  QueueGetConfigReply(uint32_t xid, uint32_t port);
1434  QueueGetConfigReply(uint32_t xid, uint16_t port,
1435  std::list<of13::PacketQueue> queues);
1436  ~QueueGetConfigReply() {
1437  }
1438  bool operator==(const QueueGetConfigReply &other) const;
1439  bool operator!=(const QueueGetConfigReply &other) const;
1440  uint8_t* pack();
1441  of_error unpack(uint8_t *buffer);
1442  uint32_t port() {
1443  return this->port_;
1444  }
1445  std::list<of13::PacketQueue> queues() {
1446  return this->queues_;
1447  }
1448  void port(uint32_t port) {
1449  this->port_ = port;
1450  }
1451  void queues(std::list<of13::PacketQueue> queues);
1452  void add_queue(PacketQueue queue);
1453  size_t queues_len();
1454 };
1455 
1459 class RoleRequest: public RoleCommon {
1460 public:
1461  RoleRequest();
1462  RoleRequest(uint32_t xid, uint32_t role, uint64_t generation_id);
1463  ~RoleRequest() {
1464  }
1465 };
1466 
1470 class RoleReply: public RoleCommon {
1471 public:
1472  RoleReply();
1473  RoleReply(uint32_t xid, uint32_t role, uint64_t generation_id);
1474  ~RoleReply() {
1475  }
1476 };
1477 
1481 class GetAsyncRequest: public OFMsg {
1482 public:
1483  GetAsyncRequest();
1484  GetAsyncRequest(uint32_t xid);
1485  ~GetAsyncRequest() {
1486  }
1487  uint8_t* pack();
1488  of_error unpack(uint8_t* buffer);
1489 };
1490 
1495 public:
1496  GetAsyncReply();
1497  GetAsyncReply(uint32_t xid);
1498  GetAsyncReply(uint32_t xid, std::vector<uint32_t> packet_in_mask,
1499  std::vector<uint32_t> port_status_mask,
1500  std::vector<uint32_t> flow_removed_mask);
1501  ~GetAsyncReply() {
1502  }
1503 };
1504 
1509 public:
1510  SetAsync();
1511  SetAsync(uint32_t xid);
1512  SetAsync(uint32_t xid, std::vector<uint32_t> packet_in_mask,
1513  std::vector<uint32_t> port_status_mask,
1514  std::vector<uint32_t> flow_removed_mask);
1515  ~SetAsync() {
1516  }
1517 };
1518 
1519 class MeterMod: public OFMsg {
1520 private:
1521  uint16_t command_;
1522  uint16_t flags_;
1523  uint32_t meter_id_;
1524  MeterBandList bands_;
1525 
1526 public:
1527  MeterMod();
1528  MeterMod(uint32_t xid, uint16_t command, uint16_t flags, uint32_t meter_id);
1529  MeterMod(uint32_t xid, uint16_t command, uint16_t flags, uint32_t meter_id,
1530  MeterBandList bands);
1531  ~MeterMod() {
1532  }
1533  bool operator==(const MeterMod &other) const;
1534  bool operator!=(const MeterMod &other) const;
1535  uint8_t* pack();
1536  of_error unpack(uint8_t *buffer);
1537  uint16_t command() {
1538  return this->command_;
1539  }
1540  uint16_t flags() {
1541  return this->flags_;
1542  }
1543  uint32_t meter_id() {
1544  return this->meter_id_;
1545  }
1546  MeterBandList bands() {
1547  return this->bands_;
1548  }
1549  void command(uint16_t command) {
1550  this->command_ = command;
1551  }
1552  void flags(uint16_t flags) {
1553  this->flags_ = flags;
1554  }
1555  void meter_id(uint32_t meter_id) {
1556  this->meter_id_ = meter_id;
1557  }
1558  void bands(MeterBandList bands);
1559  void add_band(MeterBand * band);
1560 };
1561 
1562 } // end of namespace of13
1563 } //End of namespace fluid_msg
1564 #endif
1565