P4C
The P4 Compiler
|
#include <p4info_map.h>
Public Member Functions | |
P4InfoMaps (const p4::config::v1::P4Info &p4Info) | |
std::optional< cstring > | lookUpControlPlaneName (uint64_t id) const |
std::optional< uint64_t > | lookUpP4RuntimeId (cstring controlPlaneName) const |
Protected Member Functions | |
virtual void | buildP4InfoMaps (const p4::config::v1::P4Info &p4Info) |
Iterate over the P4Info object and build a mapping from P4 control plane names to their ids. | |
Protected Attributes | |
P4RuntimeIdToControlPlaneNameMap | idToNameMap |
Maps P4Runtime IDs to control plane names. | |
ControlPlaneNameToP4RuntimeIdMap | nameToIdMap |
Maps control plane names to P4Runtime IDs. | |
This object maps P4 control plane names to their P4Runtime IDs and vice versa. It uses the P4Info object to populate the maps. Since ids for action parameters and table keys are not unique, we use a pairing function to compute a unique identifier. This pairing function uses the id of the parent object (e.g., a table or action) and combines it with the id of the parameter or key element to create a unique identifier.
|
nodiscard |
Looks up the control plane name for the given P4Runtime id in the pre-computed P4Runtime-ID map.
|
nodiscard |
Looks up the P4Runtime id for the given control plane name in the pre-computed P4Runtime-ID map.