Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow json output format to be modified #4407

Merged
merged 3 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
move P4RuntimeFormat to new header file
Move P4RuntimeFormat definition to a new header file to allow options.h
to include only that header file, and not everything in
p4RuntimeSerializer.h. This prevents needing to pull in the protobuf
includes for any file that uses options.h
  • Loading branch information
grg committed Feb 16, 2024
commit 441b61423b67d3ca7613b0b0ca9c0505e89c3d22
1 change: 1 addition & 0 deletions backends/p4tools/modules/testgen/targets/bmv2/bmv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "backends/p4tools/common/compiler/compiler_target.h"
#include "backends/p4tools/common/compiler/midend.h"
#include "backends/p4tools/common/lib/variables.h"
#include "control-plane/p4RuntimeSerializer.h"
#include "frontends/common/options.h"

#include "backends/p4tools/modules/testgen/core/compiler_target.h"
Expand Down
1 change: 1 addition & 0 deletions control-plane/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ set (CONTROLPLANE_HDRS
p4RuntimeArchStandard.h
p4RuntimeSerializer.h
p4RuntimeSymbolTable.h
p4RuntimeTypes.h
typeSpecConverter.h
bfruntime.h
)
Expand Down
4 changes: 1 addition & 3 deletions control-plane/p4RuntimeSerializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ limitations under the License.
#include <unordered_map>

#include "lib/cstring.h"
#include "p4RuntimeTypes.h"

namespace p4 {
namespace config {
Expand All @@ -47,9 +48,6 @@ class CompilerOptions;

namespace P4 {

/// P4Runtime serialization formats.
enum class P4RuntimeFormat { BINARY, JSON, TEXT, TEXT_PROTOBUF };

/// A P4 program's control-plane API, represented in terms of P4Runtime's data
/// structures. Can be inspected or serialized.
struct P4RuntimeAPI {
Expand Down
27 changes: 27 additions & 0 deletions control-plane/p4RuntimeTypes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
Copyright 2024-present Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#ifndef CONTROL_PLANE_P4RUNTIMETYPES_H_
#define CONTROL_PLANE_P4RUNTIMETYPES_H_

namespace P4 {

/// P4Runtime serialization formats.
enum class P4RuntimeFormat { BINARY, JSON, TEXT, TEXT_PROTOBUF };

} // namespace P4

#endif /* CONTROL_PLANE_P4RUNTIMETYPES_H_ */
2 changes: 1 addition & 1 deletion frontends/common/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.

#include "parser_options.h"
// for p4::P4RuntimeFormat definition
#include "control-plane/p4RuntimeSerializer.h"
#include "control-plane/p4RuntimeTypes.h"

class CompilerOptions : public ParserOptions {
protected:
Expand Down
Loading