libfluid
The ONF OpenFlow driver
of10action.hh
1 #ifndef OF10ACTION_H
2 #define OF10ACTION_H
3 
4 #include "fluid/util/ethaddr.hh"
5 #include "fluid/util/ipaddr.hh"
6 #include "fluid/ofcommon/action.hh"
7 
8 namespace fluid_msg {
9 
10 namespace of10 {
11 
12 class OutputAction: public Action {
13 private:
14  uint16_t port_;
15  uint16_t max_len_;
16 public:
17  OutputAction();
18  OutputAction(uint16_t port, uint16_t max_len);
19  ~OutputAction() {
20  }
21  OutputAction* clone() {
22  return new OutputAction(*this);
23  }
24  virtual bool equals(const Action & other);
25  size_t pack(uint8_t *buffer);
26  of_error unpack(uint8_t *buffer);
27  uint16_t port() {
28  return this->port_;
29  }
30  void port(uint32_t port) {
31  this->port_ = port;
32  }
33  uint16_t max_len() {
34  return this->max_len_;
35  }
36  void max_len(uint16_t max_len) {
37  this->max_len_ = max_len;
38  }
39 };
40 
41 class SetVLANVIDAction: public Action {
42 private:
43  uint16_t vlan_vid_;
44 public:
46  SetVLANVIDAction(uint16_t vlan_vid);
47  ~SetVLANVIDAction() {
48  }
49  virtual SetVLANVIDAction* clone() {
50  return new SetVLANVIDAction(*this);
51  }
52  virtual bool equals(const Action & other);
53  size_t pack(uint8_t *buffer);
54  of_error unpack(uint8_t *buffer);
55  uint16_t vlan_vid() {
56  return this->vlan_vid_;
57  }
58  void vlan_vid(uint16_t vlan_vid) {
59  this->vlan_vid_ = vlan_vid;
60  }
61 };
62 
63 class SetVLANPCPAction: public Action {
64 private:
65  uint8_t vlan_pcp_;
66 public:
68  SetVLANPCPAction(uint8_t vlan_pcp);
69  ~SetVLANPCPAction() {
70  }
71  virtual SetVLANPCPAction* clone() {
72  return new SetVLANPCPAction(*this);
73  }
74  virtual bool equals(const Action & other);
75  size_t pack(uint8_t *buffer);
76  of_error unpack(uint8_t *buffer);
77  uint16_t vlan_pcp() {
78  return this->vlan_pcp_;
79  }
80  void vlan_pcp(uint8_t vlan_pcp) {
81  this->vlan_pcp_ = vlan_pcp;
82  }
83 };
84 
85 class StripVLANAction: public Action {
86 public:
88  ~StripVLANAction() {
89  }
90  size_t pack(uint8_t *buffer);
91  of_error unpack(uint8_t *buffer);
92  virtual StripVLANAction* clone() {
93  return new StripVLANAction(*this);
94  }
95 };
96 
97 class SetDLSrcAction: public Action {
98 private:
99  EthAddress dl_addr_;
100 public:
101  SetDLSrcAction();
102  SetDLSrcAction(EthAddress dl_addr);
103  ~SetDLSrcAction() {
104  }
105  virtual bool equals(const Action & other);
106  size_t pack(uint8_t *buffer);
107  of_error unpack(uint8_t *buffer);
108  virtual SetDLSrcAction* clone() {
109  return new SetDLSrcAction(*this);
110  }
111  EthAddress dl_addr() {
112  return this->dl_addr_;
113  }
114  void dl_addr(const EthAddress &dl_addr) {
115  this->dl_addr_ = dl_addr;
116  }
117 };
118 
119 class SetDLDstAction: public Action {
120 private:
121  EthAddress dl_addr_;
122 public:
123  SetDLDstAction();
124  SetDLDstAction(EthAddress dl_addr);
125  ~SetDLDstAction() {
126  }
127  virtual bool equals(const Action & other);
128  size_t pack(uint8_t *buffer);
129  of_error unpack(uint8_t *buffer);
130  virtual SetDLDstAction* clone() {
131  return new SetDLDstAction(*this);
132  }
133  EthAddress dl_addr() {
134  return this->dl_addr_;
135  }
136  void dl_addr(const EthAddress &dl_addr) {
137  this->dl_addr_ = dl_addr;
138  }
139 
140 };
141 
142 class SetNWSrcAction: public Action {
143 private:
144  IPAddress nw_addr_;
145 public:
146  SetNWSrcAction();
147  SetNWSrcAction(IPAddress nw_addr);
148  ~SetNWSrcAction() {
149  }
150  virtual bool equals(const Action & other);
151  size_t pack(uint8_t *buffer);
152  of_error unpack(uint8_t *buffer);
153  virtual SetNWSrcAction* clone() {
154  return new SetNWSrcAction(*this);
155  }
156  IPAddress nw_addr() {
157  return this->nw_addr_;
158  }
159  void nw_addr(const IPAddress &nw_addr) {
160  this->nw_addr_ = nw_addr;
161  }
162 };
163 
164 class SetNWDstAction: public Action {
165 private:
166  IPAddress nw_addr_;
167 public:
168  SetNWDstAction();
169  SetNWDstAction(IPAddress nw_addr);
170  ~SetNWDstAction() {
171  }
172  virtual bool equals(const Action & other);
173  size_t pack(uint8_t *buffer);
174  of_error unpack(uint8_t *buffer);
175  virtual SetNWDstAction* clone() {
176  return new SetNWDstAction(*this);
177  }
178  IPAddress nw_addr() {
179  return this->nw_addr_;
180  }
181  void nw_addr(const IPAddress &nw_addr) {
182  this->nw_addr_ = nw_addr;
183  }
184 };
185 
186 class SetNWTOSAction: public Action {
187 private:
188  uint8_t nw_tos_;
189 public:
190  SetNWTOSAction();
191  SetNWTOSAction(uint8_t nw_tos);
192  ~SetNWTOSAction() {
193  }
194  virtual bool equals(const Action & other);
195  size_t pack(uint8_t *buffer);
196  of_error unpack(uint8_t *buffer);
197  virtual SetNWTOSAction* clone() {
198  return new SetNWTOSAction(*this);
199  }
200  uint8_t nw_tos() {
201  return this->nw_tos_;
202  }
203  void nw_tos(uint8_t nw_tos) {
204  this->nw_tos_ = nw_tos;
205  }
206 };
207 
208 class SetTPSrcAction: public Action {
209 private:
210  uint16_t tp_port_;
211 public:
212  SetTPSrcAction();
213  SetTPSrcAction(uint16_t tp_port);
214  ~SetTPSrcAction() {
215  }
216  virtual bool equals(const Action & other);
217  size_t pack(uint8_t *buffer);
218  of_error unpack(uint8_t *buffer);
219  virtual SetTPSrcAction* clone() {
220  return new SetTPSrcAction(*this);
221  }
222  IPAddress tp_port() {
223  return this->tp_port_;
224  }
225  void tp_port(uint16_t tp_port) {
226  this->tp_port_ = tp_port;
227  }
228 };
229 
230 class SetTPDstAction: public Action {
231 private:
232  uint16_t tp_port_;
233 public:
234  SetTPDstAction();
235  SetTPDstAction(uint16_t tp_port);
236  ~SetTPDstAction() {
237  }
238  virtual bool equals(const Action & other);
239  size_t pack(uint8_t *buffer);
240  of_error unpack(uint8_t *buffer);
241  virtual SetTPDstAction* clone() {
242  return new SetTPDstAction(*this);
243  }
244  IPAddress tp_port() {
245  return this->tp_port_;
246  }
247  void tp_port(uint16_t tp_port) {
248  this->tp_port_ = tp_port;
249  }
250 };
251 
252 class EnqueueAction: public Action {
253 private:
254  uint16_t port_;
255  uint32_t queue_id_;
256 public:
257  EnqueueAction();
258  EnqueueAction(uint16_t port, uint32_t queue_id);
259  ~EnqueueAction() {
260  }
261  virtual bool equals(const Action & other);
262  size_t pack(uint8_t *buffer);
263  of_error unpack(uint8_t *buffer);
264  virtual EnqueueAction* clone() {
265  return new EnqueueAction(*this);
266  }
267  uint16_t port() {
268  return this->port_;
269  }
270  uint32_t queue_id() {
271  return this->queue_id_;
272  }
273  void port(uint16_t port) {
274  this->port_ = port;
275  }
276  void queue_id(uint32_t queue_id) {
277  this->queue_id_ = queue_id;
278  }
279 };
280 
281 class VendorAction: public Action {
282 private:
283  uint32_t vendor_;
284 public:
285  VendorAction();
286  VendorAction(uint32_t vendor);
287  ~VendorAction() {
288  }
289  virtual bool equals(const Action & other);
290  virtual VendorAction* clone() {
291  return new VendorAction(*this);
292  }
293  size_t pack(uint8_t *buffer);
294  of_error unpack(uint8_t *buffer);
295  IPAddress vendor() {
296  return this->vendor_;
297  }
298  void vendor(uint32_t vendor) {
299  this->vendor_ = vendor;
300  }
301 };
302 
303 } //End of namespace of10
304 
305 } //End of namespace fluid_msg
306 #endif