1 #ifndef OPENFLOW_COMMON_H
2 #define OPENFLOW_COMMON_H 1
7 #include "fluid/util/util.h"
8 #include "fluid/util/ethaddr.hh"
9 #include "fluid/util/ipaddr.hh"
26 uint32_t state, uint32_t curr, uint32_t advertised, uint32_t supported,
30 bool operator==(
const PortCommon &other)
const;
31 bool operator!=(
const PortCommon &other)
const;
33 return this->hw_addr_;
47 uint32_t advertised() {
48 return this->advertised_;
50 uint32_t supported() {
51 return this->supported_;
57 this->hw_addr_ = hw_addr;
59 void name(std::string name) {
62 void config(uint32_t config) {
63 this->config_ = config;
65 void state(uint32_t state) {
68 void curr(uint32_t curr) {
71 void advertised(uint32_t advertised) {
72 this->advertised_ = advertised;
74 void supported(uint32_t supported) {
75 this->supported_ = supported;
77 void peer(uint32_t peer) {
99 virtual size_t pack(uint8_t* buffer);
100 virtual of_error unpack(uint8_t* buffer);
101 uint16_t property() {
102 return this->property_;
107 void property(uint16_t property) {
108 this->property_ = property;
110 static QueueProperty* make_queue_of10_property(uint16_t property);
111 static QueueProperty* make_queue_of13_property(uint16_t property);
121 std::list<QueueProperty*> property_list_;
133 size_t pack(uint8_t* buffer);
134 of_error unpack10(uint8_t* buffer);
135 of_error unpack13(uint8_t* buffer);
138 return this->length_;
140 std::list<QueueProperty*> property_list() {
141 return this->property_list_;
144 void length(uint16_t length) {
145 this->length_ = length;
166 void rate(uint16_t rate) {
173 std::string mfr_desc_;
174 std::string hw_desc_;
175 std::string sw_desc_;
176 std::string serial_num_;
177 std::string dp_desc_;
182 SwitchDesc(std::string mfr_desc, std::string hw_desc, std::string sw_desc,
183 std::string serial_num, std::string dp_desc);
187 bool operator==(
const SwitchDesc &other)
const;
188 bool operator!=(
const SwitchDesc &other)
const;
189 size_t pack(uint8_t* buffer);
190 of_error unpack(uint8_t* buffer);
191 std::string mfr_desc() {
192 return this->mfr_desc_;
194 std::string hw_desc() {
195 return this->hw_desc_;
197 std::string sw_desc() {
198 return this->sw_desc_;
200 std::string serial_num() {
201 return this->serial_num_;
203 std::string dp_desc() {
204 return this->dp_desc_;
206 void mfr_desc(std::string mfr_desc) {
207 this->mfr_desc_ = mfr_desc;
209 void hw_desc(std::string hw_desc) {
210 this->hw_desc_ = hw_desc;
212 void sw_desc(std::string sw_desc) {
213 this->sw_desc_ = sw_desc;
215 void serial_num(std::string serial_num) {
216 this->serial_num_ = serial_num;
218 void dp_desc(std::string dp_desc) {
219 this->dp_desc_ = dp_desc;
238 uint32_t queue_id() {
239 return this->queue_id_;
244 void queue_id(uint32_t queue_id) {
245 this->queue_id_ = queue_id;
255 uint32_t duration_sec_;
256 uint32_t duration_nsec_;
258 uint16_t idle_timeout_;
259 uint16_t hard_timeout_;
261 uint64_t packet_count_;
262 uint64_t byte_count_;
266 uint32_t duration_nsec, uint16_t priority, uint16_t idle_timeout,
267 uint16_t hard_timeout, uint64_t cookie, uint64_t packet_count,
268 uint64_t byte_count);
275 return this->length_;
278 return this->table_id_;
280 uint32_t duration_sec() {
281 return this->duration_sec_;
283 uint32_t duration_nsec() {
284 return this->duration_nsec_;
286 uint16_t priority() {
287 return this->priority_;
289 uint16_t idle_timeout() {
290 return this->idle_timeout_;
292 uint16_t hard_timeout() {
293 return this->hard_timeout_;
296 return this->cookie_;
298 uint64_t packet_count() {
299 return this->packet_count_;
301 uint64_t byte_count() {
302 return this->byte_count_;
304 void table_id(uint8_t table_id) {
305 this->table_id_ = table_id;
307 void duration_sec(uint32_t duration_sec) {
308 this->duration_sec_ = duration_sec;
310 void duration_nsec(uint32_t duration_nsec) {
311 this->duration_nsec_ = duration_nsec;
313 void priority(uint16_t priority) {
314 this->priority_ = priority;
316 void idle_timeout(uint16_t idle_timeout) {
317 this->idle_timeout_ = idle_timeout;
319 void hard_timeout(uint16_t hard_timeout) {
320 this->hard_timeout_ = hard_timeout;
322 void cookie(uint64_t cookie) {
323 this->cookie_ = cookie;
325 void packet_count(uint16_t packet_count) {
326 this->packet_count_ = packet_count;
328 void byte_count(uint64_t byte_count) {
329 this->byte_count_ = byte_count;
336 uint32_t active_count_;
337 uint64_t lookup_count_;
338 uint64_t matched_count_;
342 uint64_t lookup_count, uint64_t matched_count);
349 return this->table_id_;
351 uint32_t active_count() {
352 return this->active_count_;
354 uint64_t lookup_count() {
355 return this->lookup_count_;
357 uint64_t matched_count() {
358 return this->matched_count_;
360 void table_id(uint8_t table_id) {
361 this->table_id_ = table_id;
363 void active_count(uint32_t active_count) {
364 this->active_count_ = active_count;
366 void lookup_count(uint64_t lookup_count) {
367 this->lookup_count_ = lookup_count;
369 void matched_count(uint64_t matched_count) {
370 this->matched_count_ = matched_count;
383 return ((this->rx_packets == other.rx_packets)
384 && (this->tx_packets == other.tx_packets)
385 && (this->rx_bytes == other.rx_bytes)
386 && (this->tx_bytes == other.tx_bytes)
387 && (this->rx_dropped == other.rx_dropped)
388 && (this->tx_dropped == other.tx_dropped));
401 uint64_t rx_frame_err;
402 uint64_t rx_over_err;
406 return ((this->rx_errors == other.rx_errors)
407 && (this->tx_errors == other.tx_errors)
408 && (this->rx_frame_err == other.rx_frame_err)
409 && (this->rx_over_err == other.rx_over_err)
410 && (this->rx_crc_err == other.rx_crc_err));
418 uint64_t collisions_;
428 size_t pack(uint8_t* buffer);
429 of_error unpack(uint8_t* buffer);
430 uint64_t rx_packets() {
431 return this->rx_tx_stats.rx_packets;
433 uint64_t tx_packets() {
434 return this->rx_tx_stats.tx_packets;
436 uint64_t rx_bytes() {
437 return this->rx_tx_stats.rx_bytes;
439 uint64_t tx_bytes() {
440 return this->rx_tx_stats.tx_bytes;
442 uint64_t rx_dropped() {
443 return this->rx_tx_stats.rx_dropped;
445 uint64_t tx_dropped() {
446 return this->rx_tx_stats.tx_dropped;
448 uint64_t rx_errors() {
449 return this->err_stats.rx_errors;
451 uint64_t tx_errors() {
452 return this->err_stats.tx_errors;
454 uint64_t rx_frame_err() {
455 return this->err_stats.rx_frame_err;
457 uint64_t rx_over_err() {
458 return this->err_stats.rx_over_err;
460 uint64_t rx_crc_err() {
461 return this->err_stats.rx_crc_err;
463 uint64_t collisions() {
464 return this->collisions_;
466 void rx_packets(uint64_t rx_packets) {
467 this->rx_tx_stats.rx_packets = rx_packets;
469 void tx_packets(uint64_t tx_packets) {
470 this->rx_tx_stats.tx_packets = tx_packets;
472 void rx_bytes(uint64_t rx_bytes) {
473 this->rx_tx_stats.rx_bytes = rx_bytes;
475 void tx_bytes(uint64_t tx_bytes) {
476 this->rx_tx_stats.tx_bytes = tx_bytes;
478 void rx_dropped(uint64_t rx_dropped) {
479 this->rx_tx_stats.rx_dropped = rx_dropped;
481 void tx_dropped(uint64_t tx_dropped) {
482 this->rx_tx_stats.tx_dropped = tx_dropped;
484 void rx_errors(uint64_t rx_errors) {
485 this->err_stats.rx_errors = rx_errors;
487 void tx_errors(uint64_t tx_errors) {
488 this->err_stats.tx_errors = tx_errors;
490 void rx_frame_err(uint64_t rx_frame_err) {
491 this->err_stats.rx_frame_err = rx_frame_err;
493 void rx_over_err(uint64_t rx_over_err) {
494 this->err_stats.rx_over_err = rx_over_err;
496 void rx_crc_err(uint64_t rx_crc_err) {
497 this->err_stats.rx_crc_err = rx_crc_err;
499 void collisions(uint64_t collisions) {
500 this->collisions_ = collisions;
508 uint64_t tx_packets_;
519 uint32_t queue_id() {
520 return this->queue_id_;
522 uint64_t tx_bytes() {
523 return this->tx_bytes_;
525 uint64_t tx_packets() {
526 return this->tx_packets_;
528 uint64_t tx_errors() {
529 return this->tx_errors_;
531 void queue_id(uint32_t queue_id) {
532 this->queue_id_ = queue_id;
534 void tx_bytes(uint64_t tx_bytes) {
535 this->tx_bytes_ = tx_bytes;
537 void tx_packets(uint64_t tx_packets) {
538 this->tx_packets_ = tx_packets;
540 void tx_errors(uint64_t tx_errors) {
541 this->tx_errors_ = tx_errors;