17#ifndef BACKENDS_EBPF_EBPFPROGRAM_H_
18#define BACKENDS_EBPF_EBPFPROGRAM_H_
22#include "ebpfObject.h"
23#include "ebpfOptions.h"
24#include "frontends/common/options.h"
25#include "frontends/p4/evaluator/evaluator.h"
26#include "frontends/p4/typeMap.h"
46 const IR::P4Program *program;
47 const IR::ToplevelBlock *toplevel;
56 cstring endLabel, offsetVar, lengthVar, headerStartVar;
57 cstring zeroKey, functionName, errorVar;
58 cstring packetStartVar, packetEndVar, byteVar;
66 P4::TypeMap *typeMap,
const IR::ToplevelBlock *toplevel)
67 : progTarget(nullptr),
78 offsetVar = EBPFModel::reserved(
"packetOffsetInBits"_cs);
79 zeroKey = EBPFModel::reserved(
"zero"_cs);
80 functionName = EBPFModel::reserved(
"filter"_cs);
81 errorVar = EBPFModel::reserved(
"errorCode"_cs);
82 packetStartVar = EBPFModel::reserved(
"packetStart"_cs);
83 packetEndVar = EBPFModel::reserved(
"packetEnd"_cs);
84 headerStartVar = EBPFModel::reserved(
"headerStart"_cs);
85 lengthVar = EBPFModel::reserved(
"pkt_len"_cs);
86 byteVar = EBPFModel::reserved(
"byte"_cs);
87 endLabel = EBPFModel::reserved(
"end"_cs);
88 errorEnum = EBPFModel::reserved(
"errorCodes"_cs);
94 virtual void emitHeaderInstances(
CodeBuilder *builder);
95 virtual void emitLocalVariables(
CodeBuilder *builder);
104 virtual void emitCommonPreamble(
CodeBuilder *builder);
105 virtual void emitGeneratedComment(
CodeBuilder *builder);
107 const std::filesystem::path &headerFile);
109 const std::filesystem::path &headerFile);
Definition ebpf/codeGen.h:33
Definition ebpfControl.h:57
Definition ebpfDeparser.h:63
Keep this in sync with ebpf_model.p4 and xdp_model.p4.
Definition ebpfModel.h:66
Base class for EBPF objects.
Definition ebpfObject.h:31
Definition ebpfParser.h:79
Definition ebpfProgram.h:39
EBPFProgram(const EbpfOptions &options, const IR::P4Program *program, P4::ReferenceMap *refMap, P4::TypeMap *typeMap, const IR::ToplevelBlock *toplevel)
return 'true' on success
Definition ebpfProgram.h:65
cstring arrayIndexType
TODO: this should be a compiler option probably.
Definition ebpfProgram.h:61
virtual bool isLibraryMethod(cstring methodName)
Definition ebpfProgram.cpp:348
EBPFDeparser * deparser
Deparser may be NULL if not supported (e.g. ebpfFilter package).
Definition ebpfProgram.h:54
Definition ebpf/target.h:44
Definition ebpfOptions.h:26
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
Definition codeGen.cpp:25