bmv2
Designing your own switch target with bmv2
Public Types | Public Member Functions | List of all members
bm::ErrorCodeMap Class Reference

A bi-directional map between error codes and their P4 names. More...

Public Types

enum  Core {
  Core::NoError, Core::PacketTooShort, Core::NoMatch, Core::StackOutOfBounds,
  Core::HeaderTooShort, Core::ParserTimeout, Core::ParserInvalidArgument
}
 The core erros, as per core.p4. More...
 

Public Member Functions

ErrorCode from_name (const std::string &name) const
 
ErrorCode from_core (const Core &core) const
 Retrieve an error code for one of the core errors. More...
 
const std::string & to_name (const ErrorCode &code) const
 

Detailed Description

A bi-directional map between error codes and their P4 names.

Member Enumeration Documentation

◆ Core

The core erros, as per core.p4.

Enumerator
NoError 

No error raised in parser.

PacketTooShort 

Not enough bits in packet for extract or lookahead.

NoMatch 

Match statement has no matches (unused for now)

StackOutOfBounds 

Reference to invalid element of a header stack (partial support)

HeaderTooShort 

Extracting too many bits into a varbit field (unused for now)

ParserTimeout 

Parser execution time limit exceeded (unused for now)

ParserInvalidArgument 

Parser operation was called with a value not supported by the implementation.

Member Function Documentation

◆ from_core()

ErrorCode bm::ErrorCodeMap::from_core ( const Core core) const

Retrieve an error code for one of the core errors.

◆ from_name()

ErrorCode bm::ErrorCodeMap::from_name ( const std::string &  name) const

Retrieve an error code from a P4 error name. Will throw std::out_of_range exception if name does not exist.

◆ to_name()

const std::string& bm::ErrorCodeMap::to_name ( const ErrorCode code) const

Retrieve an error code's name. Will throw std::out_of_range exception if the error code is not valid.


The documentation for this class was generated from the following file: