1 #ifndef OPENFLOW_METER_H
2 #define OPENFLOW_METER_H
5 #include "openflow-13.h"
21 MeterBand(uint16_t type, uint32_t rate, uint32_t burst_size);
24 virtual bool equals(
const MeterBand & other);
28 virtual size_t pack(uint8_t* buffer);
29 virtual of_error unpack(uint8_t* buffer);
39 uint32_t burst_size() {
40 return this->burst_size_;
42 void type(uint16_t type) {
45 void rate(uint32_t rate) {
48 void burst_size(uint32_t burst_size) {
49 this->burst_size_ = burst_size;
51 static bool delete_all(
MeterBand * band) {
55 static MeterBand * make_meter_band(uint16_t type);
61 std::list<MeterBand*> band_list_;
72 size_t pack(uint8_t* buffer);
73 of_error unpack(uint8_t* buffer);
79 void length(uint16_t length) {
80 this->length_ = length;
93 size_t pack(uint8_t* buffer);
94 of_error unpack(uint8_t* buffer);
105 virtual bool equals(
const MeterBand & other);
106 size_t pack(uint8_t* buffer);
107 of_error unpack(uint8_t* buffer);
111 uint8_t prec_level() {
112 return this->prec_level_;
114 void prec_level(uint8_t prec_level) {
115 this->prec_level_ = prec_level;
121 uint32_t experimenter_;
125 uint32_t experimenter);
128 virtual bool equals(
const MeterBand & other);
132 size_t pack(uint8_t* buffer);
133 of_error unpack(uint8_t* buffer);
134 uint32_t experimenter() {
135 return this->experimenter_;
137 void experimenter(uint32_t experimenter) {
138 this->experimenter_ = experimenter;
156 size_t pack(uint8_t* buffer);
157 of_error unpack(uint8_t* buffer);
159 return this->length_;
164 uint32_t meter_id() {
165 return this->meter_id_;
177 uint32_t band_types_;
178 uint32_t capabilities_;
184 uint32_t capabilities, uint8_t max_bands, uint8_t max_color);
189 size_t pack(uint8_t* buffer);
190 of_error unpack(uint8_t* buffer);
191 uint32_t max_meter() {
192 return this->max_meter_;
194 uint32_t band_types() {
195 return this->band_types_;
197 uint32_t capabilities() {
198 return this->capabilities_;
200 uint8_t max_bands() {
201 return this->max_bands_;
203 uint8_t max_color() {
204 return this->max_color_;
206 void max_meter(uint32_t max_meter) {
207 this->max_meter_ = max_meter;
209 void banc_types(uint32_t band_types) {
210 this->band_types_ = band_types;
212 void capabilities(uint32_t capabilities) {
213 this->capabilities_ = capabilities;
215 void max_bands(uint8_t max_bands) {
216 this->max_bands_ = max_bands;
218 void max_color(uint8_t max_color) {
219 this->max_color_ = max_color;
225 uint64_t packet_band_count_;
226 uint64_t byte_band_count_;
229 BandStats(uint64_t packet_band_count, uint64_t byte_band_count);
232 bool operator==(
const BandStats &other)
const;
233 bool operator!=(
const BandStats &other)
const;
234 size_t pack(uint8_t* buffer);
235 of_error unpack(uint8_t* buffer);
236 uint64_t packet_band_count() {
237 return this->packet_band_count_;
239 uint64_t byte_band_count() {
240 return this->byte_band_count_;
248 uint32_t flow_count_;
249 uint64_t packet_in_count_;
250 uint64_t byte_in_count_;
251 uint32_t duration_sec_;
252 uint32_t duration_nsec_;
253 std::vector<BandStats> band_stats_;
257 MeterStats(uint32_t meter_id, uint32_t flow_count, uint64_t packet_in_count,
258 uint64_t byte_in_count, uint32_t duration_sec, uint32_t duration_nsec);
259 MeterStats(uint32_t meter_id, uint32_t flow_count, uint64_t packet_in_count,
260 uint64_t byte_in_count, uint32_t duration_sec, uint32_t duration_nsec,
261 std::vector<BandStats> band_stats);
264 bool operator==(
const MeterStats &other)
const;
265 bool operator!=(
const MeterStats &other)
const;
266 size_t pack(uint8_t* buffer);
267 of_error unpack(uint8_t* buffer);
268 uint32_t meter_id() {
269 return this->meter_id_;
274 uint64_t packet_in_count() {
275 return this->packet_in_count_;
277 uint64_t byte_in_count() {
278 return this->byte_in_count_;
280 uint32_t duration_sec() {
281 return this->duration_sec_;
283 uint32_t duration_nsec() {
284 return this->duration_nsec_;
286 std::vector<BandStats> band_stats() {
287 return this->band_stats_;
289 void meter_id(uint32_t meter_id) {
290 this->meter_id_ = meter_id;
292 void packet_in_count(uint64_t packet_in_count) {
293 this->packet_in_count_ = packet_in_count;
295 void byte_in_count(uint64_t byte_in_count) {
296 this->byte_in_count_ = byte_in_count;
298 void duration_sec(uint32_t duration_sec) {
299 this->duration_sec_ = duration_sec;
301 void duration_nsec(uint64_t duration_nsec) {
302 this->duration_nsec_ = duration_nsec;
304 void band_stats(std::vector<BandStats> band_stats);