4 #include <fluid/util/ethaddr.hh>
6 #include "openflow-common.hh"
24 OFMsg(uint8_t version, uint8_t type);
25 OFMsg(uint8_t version, uint8_t type, uint32_t xid);
26 OFMsg(uint8_t* buffer) {
31 virtual uint8_t* pack();
32 virtual of_error unpack(uint8_t *buffer);
33 bool operator==(
const OFMsg &other)
const;
34 bool operator!=(
const OFMsg &other)
const;
36 return this->version_;
44 virtual uint16_t length() {
50 void version(uint8_t version) {
51 this->version_ = version;
53 void msg_type(uint8_t type) {
56 void length(uint16_t length) {
57 this->length_ = length;
59 void xid(uint32_t xid) {
62 static void free_buffer(uint8_t *buffer) {
76 EchoCommon(uint8_t version, uint8_t type, uint32_t xid)
77 :
OFMsg(version, type, xid),
83 of_error unpack(uint8_t *buffer);
84 bool operator==(
const EchoCommon &other)
const;
85 bool operator!=(
const EchoCommon &other)
const;
90 return this->data_len_;
92 void data(
void* data,
size_t data_len);
106 ErrorCommon(uint8_t version, uint8_t type, uint32_t xid, uint16_t err_type,
108 ErrorCommon(uint8_t version, uint8_t type, uint32_t xid, uint16_t err_type,
109 uint16_t code,
void* data,
size_t data_len);
114 of_error unpack(uint8_t *buffer);
115 uint16_t err_type() {
116 return this->err_type_;
125 return this->data_len_;
127 void err_type(uint16_t err_type) {
128 this->err_type_ = err_type;
130 void code(uint16_t code) {
133 void data(
void* data,
size_t data_len);
141 uint64_t datapath_id_;
144 uint32_t capabilities_;
148 uint64_t datapath_id, uint32_t n_buffers, uint8_t n_tables,
149 uint32_t capabilities);
154 uint64_t datapath_id() {
155 return this->datapath_id_;
157 uint32_t n_buffers() {
158 return this->n_buffers_;
161 return this->n_tables_;
163 uint32_t capabilities() {
164 return this->capabilities_;
166 void datapath_id(uint64_t datapath_id) {
167 this->datapath_id_ = datapath_id;
169 void n_buffers(uint32_t n_buffers) {
170 this->n_buffers_ = n_buffers;
172 void n_tables(uint8_t n_tables) {
173 this->n_tables_ = n_tables;
175 void capabilities(uint32_t capabilities) {
176 this->capabilities_ = capabilities;
186 uint16_t miss_send_len_;
190 uint16_t flags, uint16_t miss_send_len);
196 of_error unpack(uint8_t *buffer);
200 uint16_t miss_send_len() {
201 return this->miss_send_len_;
203 void flags(uint16_t flags) {
204 this->flags_ = flags;
206 void miss_send_len(uint16_t miss_send_len) {
207 this->miss_send_len_ = miss_send_len;
217 uint16_t idle_timeout_;
218 uint16_t hard_timeout_;
225 FlowModCommon(uint8_t version, uint8_t type, uint32_t xid, uint64_t cookie,
226 uint16_t idle_timeout, uint16_t hard_timeout,
227 uint16_t priority, uint32_t buffer_id, uint16_t flags);
234 return this->cookie_;
236 uint16_t idle_timeout() {
237 return this->idle_timeout_;
239 uint16_t hard_timeout() {
240 return this->hard_timeout_;
242 uint16_t priority() {
243 return this->priority_;
245 uint32_t buffer_id() {
246 return this->buffer_id_;
251 void cookie(uint64_t cookie) {
252 this->cookie_ = cookie;
254 void idle_timeout(uint16_t idle_timeout) {
255 this->idle_timeout_ = idle_timeout;
257 void hard_timeout(uint16_t hard_timeout) {
258 this->hard_timeout_ = hard_timeout;
260 void priority(uint16_t priority) {
261 this->priority_ = priority;
263 void buffer_id(uint32_t buffer_id) {
264 this->buffer_id_ = buffer_id;
266 void flags(uint16_t flags) {
267 this->flags_ = flags;
277 uint16_t actions_len_;
288 uint32_t buffer_id() {
289 return this->buffer_id_;
291 uint16_t actions_len() {
292 return this->actions_len_;
295 return this->actions_;
298 return this->data_len_;
303 void buffer_id(uint32_t buffer_id) {
304 this->buffer_id_ = buffer_id;
307 void add_action(
Action &action);
308 void add_action(
Action *action);
309 void data(
void* data,
size_t len);
325 uint32_t buffer_id, uint16_t total_len, uint8_t reason);
329 uint32_t buffer_id() {
330 return this->buffer_id_;
332 uint16_t total_len() {
333 return this->total_len_;
336 return this->reason_;
342 return this->data_len_;
344 void buffer_id(uint32_t buffer_id) {
345 this->buffer_id_ = buffer_id;
347 void total_len(uint16_t total_len) {
348 this->total_len_ = total_len;
350 void reason(uint8_t reason) {
351 this->reason_ = reason;
353 void data(
void* data,
size_t len);
364 uint32_t duration_sec_;
365 uint32_t duration_nsec_;
366 uint16_t idle_timeout_;
367 uint64_t packet_count_;
368 uint64_t byte_count_;
372 uint64_t cookie, uint16_t priority, uint8_t reason,
373 uint32_t duration_sec, uint32_t duration_nsec, uint16_t idle_timeout,
374 uint64_t packet_count, uint64_t byte_count);
380 return this->cookie_;
382 uint16_t priority() {
383 return this->priority_;
386 return this->reason_;
388 uint32_t duration_sec() {
389 return this->duration_sec_;
391 uint32_t duration_nsec() {
392 return this->duration_nsec_;
394 uint64_t packet_count() {
395 return this->packet_count_;
397 uint64_t byte_count() {
398 return this->byte_count_;
400 void cookie(uint64_t cookie) {
401 this->cookie_ = cookie;
403 void priority(uint16_t priority) {
404 this->priority_ = priority;
406 void reason(uint8_t reason) {
407 this->reason_ = reason;
409 void duration_sec(uint32_t duration_sec) {
410 this->duration_sec_ = duration_sec;
412 void duration_nsec(uint32_t duration_nsec) {
413 this->duration_nsec_ = duration_nsec;
415 void idle_timeout(uint16_t idle_timeout) {
416 this->idle_timeout_ = idle_timeout;
418 void packet_count(uint64_t packet_count) {
419 this->packet_count_ = packet_count;
421 void byte_count(uint64_t byte_count) {
422 this->byte_count_ = byte_count;
441 return this->reason_;
443 void reason(uint8_t reason) {
444 this->reason_ = reason;
460 EthAddress hw_addr, uint32_t config, uint32_t mask, uint32_t advertise);
466 return this->hw_addr_;
469 return this->config_;
474 uint32_t advertise() {
475 return this->advertise_;
478 this->hw_addr_ = hw_addr;
480 void config(uint32_t config) {
481 this->config_ = config;
483 void mask(uint32_t mask) {
486 void advertise(uint32_t advertise) {
487 this->advertise_ = advertise;