17#ifndef BACKENDS_UBPF_UBPFPROGRAM_H_
18#define BACKENDS_UBPF_UBPFPROGRAM_H_
20#include "backends/ebpf/ebpfOptions.h"
21#include "backends/ebpf/ebpfProgram.h"
23#include "frontends/p4/evaluator/evaluator.h"
24#include "frontends/p4/typeMap.h"
44 cstring contextVar, outerHdrOffsetVar, outerHdrLengthVar;
47 cstring arrayIndexType =
"uint32_t"_cs;
50 P4::TypeMap *typeMap,
const IR::ToplevelBlock *toplevel)
52 model(UBPFModel::instance) {
53 packetStartVar =
cstring(
"pkt");
54 offsetVar =
cstring(
"packetOffsetInBits");
55 outerHdrOffsetVar =
cstring(
"outHeaderOffset");
56 outerHdrLengthVar =
cstring(
"outHeaderLength");
60 stdMetadataVar =
cstring(
"std_meta");
61 packetTruncatedSizeVar =
cstring(
"packetTruncatedSize");
64 bool build()
override;
65 void emitC(
UbpfCodeBuilder *builder,
const std::filesystem::path &headerFile);
66 void emitH(
EBPF::CodeBuilder *builder,
const std::filesystem::path &headerFile)
override;
78 static std::set<cstring> DEFAULT_METHODS = {
79 "mark_to_drop"_cs,
"mark_to_pass"_cs,
"ubpf_time_get_ns"_cs,
"truncate"_cs,
80 "hash"_cs,
"csum_replace2"_cs,
"csum_replace4"_cs,
82 return DEFAULT_METHODS.find(methodName) != DEFAULT_METHODS.end() ||
83 EBPFProgram::isLibraryMethod(methodName);
Definition ebpf/codeGen.h:33
Definition ebpfProgram.h:39
Definition ebpfOptions.h:26
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
Definition ubpfControl.h:59
Definition ubpfDeparser.h:64
Definition ubpfModel.h:67
Definition ubpfParser.h:33
Definition ubpfProgram.h:37
bool isLibraryMethod(cstring methodName) override
Definition ubpfProgram.h:77
Definition ubpf/codeGen.h:10