Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofmsg_group_mod.h
1 /*
2  * cofmsg_group_mod.h
3  *
4  * Created on: 18.03.2013
5  * Author: andi
6  */
7 
8 #ifndef COFMSG_GROUP_MOD_H_
9 #define COFMSG_GROUP_MOD_H_ 1
10 
11 #include "rofl/common/openflow/messages/cofmsg.h"
12 #include "rofl/common/openflow/cofbuckets.h"
13 #include "rofl/common/openflow/cofgroupmod.h"
14 
15 namespace rofl {
16 namespace openflow {
17 
22  public cofmsg
23 {
24 private:
25 
27 
28  union {
29  uint8_t* ofhu_group_mod;
30  struct openflow12::ofp_group_mod* ofhu12_group_mod;
31  struct openflow13::ofp_group_mod* ofhu13_group_mod;
32  } ofhu;
33 
34 #define ofh_group_mod ofhu.ofhu_group_mod
35 #define ofh12_group_mod ofhu.ofhu12_group_mod
36 #define ofh13_group_mod ofhu.ofhu13_group_mod
37 
38 public:
39 
40 
45  uint8_t of_version,
46  uint32_t xid,
47  rofl::openflow::cofgroupmod const& ge);
48 
49 
54  uint8_t of_version = 0,
55  uint32_t xid = 0,
56  uint16_t command = 0,
57  uint8_t group_type = 0,
58  uint32_t group_id = 0,
60 
61 
66  cofmsg_group_mod const& group_mod);
67 
68 
73  operator= (
74  cofmsg_group_mod const& group_mod);
75 
76 
80  virtual
82 
83 
87  cofmsg_group_mod(cmemory *memarea);
88 
89 
93  virtual void
94  reset();
95 
96 
100  virtual uint8_t*
101  resize(size_t len);
102 
103 
107  virtual size_t
108  length() const;
109 
110 
114  virtual void
115  pack(uint8_t *buf = (uint8_t*)0, size_t buflen = 0);
116 
117 
121  virtual void
122  unpack(uint8_t *buf, size_t buflen);
123 
124 
127  virtual void
128  validate();
129 
130 
134  void
135  check_prerequisites() const;
136 
137 
138 public:
139 
140 
144  uint16_t
145  get_command() const;
146 
150  void
151  set_command(uint16_t command);
152 
156  uint8_t
157  get_group_type() const;
158 
162  void
163  set_group_type(uint8_t group_type);
164 
168  uint32_t
169  get_group_id() const;
170 
174  void
175  set_group_id(uint32_t group_id);
176 
181  get_buckets() { return buckets; };
182 
183 public:
184 
185  friend std::ostream&
186  operator<< (std::ostream& os, cofmsg_group_mod const& msg) {
187  os << rofl::indent(0) << "<cofmsg_group_mod >" << std::endl;
188  { rofl::indent i(2); os << dynamic_cast<const cofmsg&>( msg ); };
189  switch (msg.get_command()) {
190  case rofl::openflow12::OFPGC_ADD: {
191  os << indent(4) << "<command: -ADD- >" << std::endl;
192  } break;
193  case rofl::openflow12::OFPGC_MODIFY: {
194  os << indent(4) << "<command: -MODIFY- >" << std::endl;
195  } break;
196  case rofl::openflow12::OFPGC_DELETE: {
197  os << indent(4) << "<command: -DELETE- >" << std::endl;
198  } break;
199  default: {
200  os << indent(4) << "<command: -UNKNOWN- >" << std::endl;
201  };
202  }
203  os << indent(4) << "<group-type:" << (int)msg.get_group_type() << " >" << std::endl;
204  os << indent(4) << "<group-id:" << (int)msg.get_group_id() << " >" << std::endl;
205  rofl::indent i(4);
206  os << msg.buckets;
207  return os;
208  };
209 };
210 
211 } // end of namespace openflow
212 } // end of namespace rofl
213 
214 #endif /* COFMSG_GROUP_MOD_H_ */
virtual void unpack(uint8_t *buf, size_t buflen)
Definition: cofmsg_group_mod.cc:186
Definition: cofmsg_group_mod.h:21
Definition: cofgroupmod.h:24
virtual void validate()
Definition: cofmsg_group_mod.cc:196
virtual size_t length() const
Definition: cofmsg_group_mod.cc:137
virtual void pack(uint8_t *buf=(uint8_t *) 0, size_t buflen=0)
Definition: cofmsg_group_mod.cc:155
Definition: openflow13.h:859
virtual void reset()
Definition: cofmsg_group_mod.cc:121
Definition: cofbuckets.h:28
C++ abstraction for malloc'ed memory areas.
Definition: cmemory.h:44
Definition: logging.h:76
virtual ~cofmsg_group_mod()
Definition: cofmsg_group_mod.cc:113
Definition: openflow12.h:1000
Definition: cofmsg.h:62