bmv2
Designing your own switch target with bmv2
Classes
counters.h File Reference

Go to the source code of this file.

Classes

class  bm::Counter
 
class  bm::CounterArray
 

Detailed Description

Includes both the Counter and CounterArray classes. CounterArray is exposed in P4 v1.0.2 as the counter object. Action primitives can take a CounterArray reference as a parameter (but not a Counter though). Here is a possible implementation of the count() P4 primitive:

class count : public ActionPrimitive<CounterArray &, const Data &> {
void operator ()(CounterArray &counter_array, const Data &idx) {
counter_array.get_counter(idx.get_uint()).increment_counter(
get_packet());
}
};