17#ifndef FRONTENDS_P4_CORELIBRARY_H_
18#define FRONTENDS_P4_CORELIBRARY_H_
20#include "frontends/common/model.h"
22#include "lib/cstring.h"
25enum class StandardExceptions {
35inline std::ostream &operator<<(std::ostream &out, P4::StandardExceptions e) {
37 case P4::StandardExceptions::NoError:
40 case P4::StandardExceptions::PacketTooShort:
41 out <<
"PacketTooShort";
43 case P4::StandardExceptions::NoMatch:
46 case P4::StandardExceptions::StackOutOfBounds:
47 out <<
"StackOutOfBounds";
49 case P4::StandardExceptions::HeaderTooShort:
50 out <<
"HeaderTooShort";
52 case P4::StandardExceptions::ParserTimeout:
53 out <<
"ParserTimeout";
56 BUG(
"Unhandled case");
63using namespace literals;
68 : Extern_Model(
"packet_in"_cs),
69 extract(
"extract"_cs),
70 lookahead(
"lookahead"_cs),
71 advance(
"advance"_cs),
72 length(
"length"_cs) {}
77 int extractSecondArgSize = 32;
82 PacketOut() : Extern_Model(
"packet_out"_cs), emit(
"emit"_cs) {}
88 const StandardExceptions exc;
90 std::stringstream str;
102 : noAction(
"NoAction"_cs),
103 exactMatch(
"exact"_cs),
104 ternaryMatch(
"ternary"_cs),
106 noError(StandardExceptions::NoError),
107 packetTooShort(StandardExceptions::PacketTooShort),
108 noMatch(StandardExceptions::NoMatch),
109 stackOutOfBounds(StandardExceptions::StackOutOfBounds),
110 headerTooShort(StandardExceptions::HeaderTooShort) {}
Definition frontends/common/model.h:64
Definition coreLibrary.h:98
Definition coreLibrary.h:86
Definition coreLibrary.h:65
Definition coreLibrary.h:80
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
Definition frontends/common/model.h:28
Extern_Model : Type_Model.
Definition frontends/common/model.h:52