Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofbucketcounter.h
1 /*
2  * cofbucketcounter.h
3  *
4  * Created on: 16.03.2014
5  * Author: andreas
6  */
7 
8 #ifndef COFBUCKETCOUNTER_H_
9 #define COFBUCKETCOUNTER_H_
10 
11 #include <inttypes.h>
12 
13 #include <iostream>
14 
15 #include "rofl/common/openflow/openflow.h"
16 #include "rofl/common/openflow/openflow_rofl_exceptions.h"
17 #include "rofl/common/croflexception.h"
18 #include "rofl/common/logging.h"
19 
20 namespace rofl {
21 namespace openflow {
22 
26 
28 {
29  uint8_t ofp_version;
30  uint64_t packet_count;
31  uint64_t byte_count;
32 
33 public:
34 
39  uint8_t ofp_version = rofl::openflow::OFP_VERSION_UNKNOWN);
40 
44  virtual
46 
51  cofbucket_counter const& bc);
52 
57  operator= (
58  cofbucket_counter const& bc);
59 
63  bool
64  operator== (
65  cofbucket_counter const& bc);
66 
67 public:
68 
72  uint8_t
73  get_version() const { return ofp_version; };
74 
78  void
79  set_version(uint8_t ofp_version) { this->ofp_version = ofp_version; };
80 
84  uint64_t
85  get_packet_count() const { return packet_count; };
86 
90  void
91  set_packet_count(uint64_t packet_count) { this->packet_count = packet_count; };
92 
96  uint64_t
97  get_byte_count() const { return byte_count; };
98 
102  void
103  set_byte_count(uint64_t byte_count) { this->byte_count = byte_count; };
104 
105 public:
106 
110  virtual size_t
111  length() const;
112 
116  virtual void
117  pack(uint8_t* buf, size_t buflen);
118 
122  virtual void
123  unpack(uint8_t* buf, size_t buflen);
124 
125 public:
126 
127  friend std::ostream&
128  operator<< (std::ostream& os, cofbucket_counter const& bc) {
129  os << rofl::indent(0) << "<cofbucket_counter ";
130  os << "ofp-version: " << (int)bc.ofp_version << " ";
131  os << std::hex;
132  os << "packet-count: 0x" << (unsigned long long)bc.packet_count << " ";
133  os << "byte-count: 0x" << (unsigned long long)bc.byte_count << " ";
134  os << std::dec;
135  os << ">" << std::endl;
136  return os;
137  };
138 };
139 
140 }; // end of namespace openflow
141 }; // end of namespace rofl
142 
143 #endif /* COFBUCKETCOUNTER_H_ */
Definition: cofbucketcounter.h:25
Definition: cofbucketcounter.h:24
Definition: logging.h:76
Definition: cofbucketcounter.h:27
Definition: cofbucketcounter.h:23
Definition: croflexception.h:27