diff --git a/.github/workflows/ci-build-proto.yml b/.github/workflows/bazel-build.yml similarity index 99% rename from .github/workflows/ci-build-proto.yml rename to .github/workflows/bazel-build.yml index 3cdcaf75..504107a7 100644 --- a/.github/workflows/ci-build-proto.yml +++ b/.github/workflows/bazel-build.yml @@ -1,4 +1,4 @@ -name: "build protobufs" +name: "Bazel build of protobufs" on: push: diff --git a/.github/workflows/google-rpc-status-synced.yml b/.github/workflows/google-rpc-status-synced.yml new file mode 100644 index 00000000..6471fe8c --- /dev/null +++ b/.github/workflows/google-rpc-status-synced.yml @@ -0,0 +1,21 @@ +name: Ensure google/rpc/status.proto is synced with upstream. + +on: + pull_request: + +jobs: + check-google-rpc-status-synced: + runs-on: [ubuntu-latest] + steps: + - uses: actions/checkout@v5 + - run: ./proto/update_google_rpc_status.sh + - run: | + DIFF=$(git diff proto/google/rpc/status.proto) + if [ -n "$DIFF" ]; then + echo "$DIFF" + echo "" + echo "ERROR: proto/google/rpc/status.proto is not synced with upstream." + echo "Please run ./proto/update_google_rpc_status.sh to fix it." + exit 1 + fi + echo "SUCCESS: proto/google/rpc/status.proto is synced with upstream." diff --git a/.github/workflows/rust-build.yml b/.github/workflows/rust-build.yml new file mode 100644 index 00000000..5c1921b7 --- /dev/null +++ b/.github/workflows/rust-build.yml @@ -0,0 +1,14 @@ +name: "Rust build" + +on: + push: + branches: [ main ] + pull_request: + +jobs: + build: + runs-on: [ubuntu-latest] + steps: + - uses: actions/checkout@v5 + - run: cd rust && cargo build + - run: cd rust && cargo test diff --git a/CI/check_codegen.sh b/CI/check_codegen.sh index 918e303b..bf820056 100755 --- a/CI/check_codegen.sh +++ b/CI/check_codegen.sh @@ -8,7 +8,6 @@ pushd "$THIS_DIR/.." >/dev/null rm -rf go/* rm -rf py/p4 -rm -rf rust/src ./codegen/update.sh diff="$(git status --porcelain go go.mod go.sum)" @@ -27,14 +26,4 @@ if [ ! -z "$diff" ]; then exit 1 fi -diff="$(git status --porcelain rust)" - -if [ ! -z "$diff" ]; then - echo "The generated Rust files are not up-to-date" - echo "DIFF:" - echo "$diff" - echo "You can regenerate them with './codegen/update.sh' and commit the changes" - exit 1 -fi - popd >/dev/null diff --git a/README.md b/README.md index d92b6688..2fc84fdd 100644 --- a/README.md +++ b/README.md @@ -179,13 +179,7 @@ pip3 install p4runtime==1.3.0 ### Rust -To include the P4Runtime Rust crate to your project, add this repository url to -your `Cargo.toml` file: - -```toml -[dependencies] -p4runtime = { git = "https://github.com/p4lang/p4runtime.git" } -``` +See the [rust/README.md](rust/README.md). ## Guidelines for using Protocol Buffers (protobuf) in backwards-compatible ways diff --git a/codegen/Dockerfile b/codegen/Dockerfile index 6aab1a1f..46e940d2 100644 --- a/codegen/Dockerfile +++ b/codegen/Dockerfile @@ -6,7 +6,7 @@ LABEL description="Dockerfile used for CI testing of p4lang/p4runtime" ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ - apt-get install -y --no-install-recommends software-properties-common git curl build-essential + apt-get install -y --no-install-recommends software-properties-common git curl ARG GO_VERSION=1.20.5 @@ -26,11 +26,5 @@ ENV PATH="${PATH}:/usr/local/go/bin:/root/go/bin" RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31 RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3 -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.81.0 --profile minimal; \ - . $HOME/.cargo/env; \ - cargo install --locked protoc-gen-prost@0.4.0 protoc-gen-prost-crate@0.4.1 protoc-gen-tonic@0.4.1 - -ENV PATH="${PATH}:/root/.cargo/bin" - COPY . /p4runtime/ WORKDIR /p4runtime/ diff --git a/codegen/compile_protos.sh b/codegen/compile_protos.sh index 486e21f9..a3fefa97 100755 --- a/codegen/compile_protos.sh +++ b/codegen/compile_protos.sh @@ -33,27 +33,18 @@ set -e THIS_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)" PROTO_DIR="$THIS_DIR/../proto" -tmpdir="$(mktemp -d)" -pushd "$tmpdir" > /dev/null -git clone --depth 1 https://github.com/googleapis/googleapis.git -popd > /dev/null -GOOGLE_PROTO_DIR="$tmpdir/googleapis" - PROTOS="\ $PROTO_DIR/p4/v1/p4data.proto \ $PROTO_DIR/p4/v1/p4runtime.proto \ $PROTO_DIR/p4/config/v1/p4info.proto \ -$PROTO_DIR/p4/config/v1/p4types.proto \ -$GOOGLE_PROTO_DIR/google/rpc/status.proto \ -$GOOGLE_PROTO_DIR/google/rpc/code.proto" +$PROTO_DIR/p4/config/v1/p4types.proto" -PROTOFLAGS="-I$GOOGLE_PROTO_DIR -I$PROTO_DIR" +PROTOFLAGS="-I$PROTO_DIR" mkdir -p "$BUILD_DIR/cpp_out" mkdir -p "$BUILD_DIR/grpc_out" mkdir -p "$BUILD_DIR/py_out" mkdir -p "$BUILD_DIR/go_out" -mkdir -p "$BUILD_DIR/rust_out" set -o xtrace $PROTOC $PROTOS --cpp_out "$BUILD_DIR/cpp_out" $PROTOFLAGS @@ -66,18 +57,4 @@ $PROTOC $PROTOS --python_out "$BUILD_DIR/py_out" $PROTOFLAGS --grpc_out "$BUILD_ $PROTOC $PROTOS --go_out="$BUILD_DIR/go_out" --go-grpc_out="$BUILD_DIR/go_out" $PROTOFLAGS -$PROTOC $PROTOS $PROTOFLAGS \ - --prost_out="$BUILD_DIR/rust_out/src" \ - --prost_opt=compile_well_known_types \ - --prost_opt=extern_path=.google.protobuf=::pbjson_types \ - --tonic_out="$BUILD_DIR/rust_out/src" \ - --tonic_opt=compile_well_known_types \ - --tonic_opt=extern_path=.google.protobuf=::pbjson_types \ - --prost-crate_out="$BUILD_DIR/rust_out" \ - --prost-crate_opt="gen_crate=rust/Cargo.toml" - -set +o xtrace - -rm -rf "$tmpdir" - echo "SUCCESS" diff --git a/codegen/update.sh b/codegen/update.sh index 084bc07c..aa8b1772 100755 --- a/codegen/update.sh +++ b/codegen/update.sh @@ -21,9 +21,6 @@ cp -r "$tmpdir"/go_out/github.com/p4lang/p4runtime/go/* go/ cp -r "$tmpdir"/py_out/p4 py/ find py/p4 -type d -exec touch {}/__init__.py \; -# Rust -cp -r "$tmpdir"/rust_out/* rust/ - # Cleanup files owned by root user docker run --rm \ -v "$tmpdir:/tmp/gen" \ diff --git a/proto/google/rpc/status.proto b/proto/google/rpc/status.proto new file mode 100644 index 00000000..dc14c943 --- /dev/null +++ b/proto/google/rpc/status.proto @@ -0,0 +1,49 @@ +// Copyright 2025 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.rpc; + +import "google/protobuf/any.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; +option java_multiple_files = true; +option java_outer_classname = "StatusProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + +// The `Status` type defines a logical error model that is suitable for +// different programming environments, including REST APIs and RPC APIs. It is +// used by [gRPC](https://github.com/grpc). Each `Status` message contains +// three pieces of data: error code, error message, and error details. +// +// You can find out more about this error model and how to work with it in the +// [API Design Guide](https://cloud.google.com/apis/design/errors). +message Status { + // The status code, which should be an enum value of + // [google.rpc.Code][google.rpc.Code]. + int32 code = 1; + + // A developer-facing error message, which should be in English. Any + // user-facing error message should be localized and sent in the + // [google.rpc.Status.details][google.rpc.Status.details] field, or localized + // by the client. + string message = 2; + + // A list of messages that carry the error details. There is a common set of + // message types for APIs to use. + repeated google.protobuf.Any details = 3; +} diff --git a/proto/update_google_rpc_status.sh b/proto/update_google_rpc_status.sh new file mode 100755 index 00000000..112526c1 --- /dev/null +++ b/proto/update_google_rpc_status.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# +# Updates proto/google/rpc/status.proto with the latest version from the +# official upstream repository. +# +# The file is very stable and hasn't changed in many years, but we enforce +# freshness of this copy using a GitHub Actions workflow just in case. + +set -e + +STATUS_PROTO_URL="https://raw.githubusercontent.com/googleapis/googleapis/refs/heads/master/google/rpc/status.proto" +THIS_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)" + +wget "$STATUS_PROTO_URL" -O "$THIS_DIR/google/rpc/status.proto" diff --git a/rust/Cargo.lock b/rust/Cargo.lock index d069cd03..a2db6fcc 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1,64 +1,33 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] -name = "addr2line" -version = "0.22.0" +name = "adler2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" - -[[package]] -name = "async-stream" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", @@ -71,19 +40,12 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - [[package]] name = "axum" -version = "0.7.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +checksum = "8a18ed336352031311f4e0b4dd2ff392d4fbb370777c9d18d7fc9d7359f73871" dependencies = [ - "async-trait", "axum-core", "bytes", "futures-util", @@ -96,9 +58,8 @@ dependencies = [ "mime", "percent-encoding", "pin-project-lite", - "rustversion", - "serde", - "sync_wrapper 1.0.1", + "serde_core", + "sync_wrapper", "tower", "tower-layer", "tower-service", @@ -106,45 +67,22 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.4.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +checksum = "59446ce19cd142f8833f856eb31f3eb097812d1479ab224f54d72428ca21ea22" dependencies = [ - "async-trait", "bytes", - "futures-util", + "futures-core", "http", "http-body", "http-body-util", "mime", "pin-project-lite", - "rustversion", - "sync_wrapper 0.1.2", + "sync_wrapper", "tower-layer", "tower-service", ] -[[package]] -name = "backtrace" -version = "0.3.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -153,70 +91,113 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "byteorder" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" -version = "1.1.0" +version = "1.2.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8" +checksum = "739eb0f94557554b3ca9a86d2d37bebd49c5e6d0c1d2bda35ba5bdac830befc2" +dependencies = [ + "find-msvc-tools", + "shlex", +] [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] -name = "chrono" -version = "0.4.38" +name = "crc32fast" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ - "num-traits", + "cfg-if", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] name = "either" -version = "1.13.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] name = "fastrand" -version = "2.1.0" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "find-msvc-tools" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" [[package]] name = "fixedbitset" -version = "0.4.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" + +[[package]] +name = "flate2" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" +dependencies = [ + "crc32fast", + "miniz_oxide", +] [[package]] name = "fnv" @@ -224,38 +205,47 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-core", "futures-task", @@ -265,9 +255,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "libc", @@ -275,16 +265,22 @@ dependencies = [ ] [[package]] -name = "gimli" -version = "0.29.0" +name = "getrandom" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", +] [[package]] name = "h2" -version = "0.4.5" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" dependencies = [ "atomic-waker", "bytes", @@ -292,7 +288,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.2.6", + "indexmap", "slab", "tokio", "tokio-util", @@ -301,15 +297,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.14.5" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" [[package]] name = "heck" @@ -319,9 +309,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "http" -version = "1.1.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" dependencies = [ "bytes", "fnv", @@ -330,9 +320,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http", @@ -340,12 +330,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", - "futures-util", + "futures-core", "http", "http-body", "pin-project-lite", @@ -353,9 +343,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "httpdate" @@ -365,13 +355,14 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "1.4.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "eb3aa54a13a0dfe7fbe3a59e0c76093041720fdc77b110cc0fc260fafb4dc51e" dependencies = [ + "atomic-waker", "bytes", "futures-channel", - "futures-util", + "futures-core", "h2", "http", "http-body", @@ -379,6 +370,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", + "pin-utils", "smallvec", "tokio", "want", @@ -386,9 +378,9 @@ dependencies = [ [[package]] name = "hyper-timeout" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" dependencies = [ "hyper", "hyper-util", @@ -399,88 +391,187 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.6" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" +checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8" dependencies = [ "bytes", "futures-channel", + "futures-core", "futures-util", "http", "http-body", "hyper", + "libc", "pin-project-lite", "socket2", "tokio", - "tower", "tower-service", "tracing", ] [[package]] -name = "indexmap" -version = "1.9.3" +name = "icu_collections" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" dependencies = [ - "autocfg", - "hashbrown 0.12.3", + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] name = "indexmap" -version = "2.2.6" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown", ] [[package]] name = "itertools" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "litemap" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" [[package]] name = "log" -version = "0.4.22" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" [[package]] name = "matchit" -version = "0.7.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "mime" @@ -490,131 +581,92 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ - "adler", + "adler2", + "simd-adler32", ] [[package]] name = "mio" -version = "0.8.11" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" dependencies = [ "libc", "wasi", - "windows-sys 0.48.0", + "windows-sys 0.61.2", ] [[package]] name = "multimap" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" - -[[package]] -name = "num-traits" -version = "0.2.19" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "object" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" -dependencies = [ - "memchr", -] +checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084" [[package]] name = "once_cell" -version = "1.19.0" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] -name = "p4runtime" +name = "p4runtime-prost" version = "1.4.0" dependencies = [ - "pbjson", - "pbjson-types", - "prost", - "tonic", -] - -[[package]] -name = "pbjson" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7e6349fa080353f4a597daffd05cb81572a9c031a6d4fff7e504947496fcc68" -dependencies = [ - "base64 0.21.7", - "serde", -] - -[[package]] -name = "pbjson-build" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eea3058763d6e656105d1403cb04e0a41b7bbac6362d413e7c33be0c32279c9" -dependencies = [ - "heck", - "itertools", "prost", + "prost-build", "prost-types", + "protoc-prebuilt", + "walkdir", ] [[package]] -name = "pbjson-types" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e54e5e7bfb1652f95bc361d76f3c780d8e526b134b85417e774166ee941f0887" +name = "p4runtime-tonic" +version = "1.4.0" dependencies = [ - "bytes", - "chrono", - "pbjson", - "pbjson-build", + "p4runtime-prost", "prost", - "prost-build", - "serde", + "prost-types", + "protoc-prebuilt", + "tonic", + "tonic-prost", + "tonic-prost-build", + "walkdir", ] [[package]] name = "percent-encoding" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "petgraph" -version = "0.6.5" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" dependencies = [ "fixedbitset", - "indexmap 2.2.6", + "indexmap", ] [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", @@ -623,9 +675,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -634,16 +686,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "ppv-lite86" -version = "0.2.17" +name = "potential_utf" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] [[package]] name = "prettyplease" -version = "0.2.20" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", "syn", @@ -651,18 +706,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] [[package]] name = "prost" -version = "0.13.2" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2ecbe40f08db5c006b5764a2645f7f3f141ce756412ac9e1dd6087e6d32995" +checksum = "7231bd9b3d3d33c86b58adbac74b5ec0ad9f496b19d22801d773636feaa95f3d" dependencies = [ "bytes", "prost-derive", @@ -670,11 +725,10 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.13.1" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb182580f71dd070f88d01ce3de9f4da5021db7115d2e1c3605a754153b77c1" +checksum = "ac6c3320f9abac597dcbc668774ef006702672474aad53c6d596b62e487b40b1" dependencies = [ - "bytes", "heck", "itertools", "log", @@ -684,6 +738,8 @@ dependencies = [ "prettyplease", "prost", "prost-types", + "pulldown-cmark", + "pulldown-cmark-to-cmark", "regex", "syn", "tempfile", @@ -691,9 +747,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.13.2" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf0c195eebb4af52c752bec4f52f645da98b6e92077a04110c7f349477ae5ac" +checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425" dependencies = [ "anyhow", "itertools", @@ -704,57 +760,63 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.13.1" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2" +checksum = "b9b4db3d6da204ed77bb26ba83b6122a73aeb2e87e25fbf7ad2e84c4ccbf8f72" dependencies = [ "prost", ] [[package]] -name = "quote" -version = "1.0.36" +name = "protoc-prebuilt" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "4d85d4641fe3b8c6e853dfd09fe35379bc6b6e66bd692ac29ed4f7087de69ed5" dependencies = [ - "proc-macro2", + "ureq", + "zip", ] [[package]] -name = "rand" -version = "0.8.5" +name = "pulldown-cmark" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "1e8bbe1a966bd2f362681a44f6edce3c2310ac21e4d5067a6e7ec396297a6ea0" dependencies = [ - "libc", - "rand_chacha", - "rand_core", + "bitflags", + "memchr", + "unicase", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "pulldown-cmark-to-cmark" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "e5b6a0769a491a08b31ea5c62494a8f144ee0987d86d670a8af4df1e1b7cde75" dependencies = [ - "ppv-lite86", - "rand_core", + "pulldown-cmark", ] [[package]] -name = "rand_core" -version = "0.6.4" +name = "quote" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" dependencies = [ - "getrandom", + "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + [[package]] name = "regex" -version = "1.10.5" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", @@ -764,9 +826,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -775,85 +837,162 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] -name = "rustc-demangle" -version = "0.1.24" +name = "ring" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.16", + "libc", + "untrusted", + "windows-sys 0.52.0", +] [[package]] name = "rustix" -version = "0.38.34" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a9586e9ee2b4f8fab52a0048ca7334d7024eef48e2cb9407e3497bb7cab7fa7" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", ] [[package]] -name = "rustversion" -version = "1.0.17" +name = "rustls-pki-types" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] [[package]] name = "serde" -version = "1.0.204" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + [[package]] name = "slab" -version = "0.4.9" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" [[package]] name = "smallvec" -version = "1.13.2" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "socket2" -version = "0.5.7" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.60.2", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" -version = "2.0.70" +version = "2.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" +checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" dependencies = [ "proc-macro2", "quote", @@ -862,49 +1001,64 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" [[package]] -name = "sync_wrapper" -version = "1.0.1" +name = "synstructure" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "tempfile" -version = "3.10.1" +version = "3.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" dependencies = [ - "cfg-if", "fastrand", + "getrandom 0.3.4", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.61.2", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", ] [[package]] name = "tokio" -version = "1.38.0" +version = "1.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ - "backtrace", "bytes", "libc", "mio", "pin-project-lite", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" -version = "2.3.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", @@ -913,9 +1067,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -924,9 +1078,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" dependencies = [ "bytes", "futures-core", @@ -937,14 +1091,13 @@ dependencies = [ [[package]] name = "tonic" -version = "0.12.3" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" +checksum = "eb7613188ce9f7df5bfe185db26c5814347d110db17920415cf2fbcad85e7203" dependencies = [ - "async-stream", "async-trait", "axum", - "base64 0.22.1", + "base64", "bytes", "h2", "http", @@ -955,8 +1108,8 @@ dependencies = [ "hyper-util", "percent-encoding", "pin-project", - "prost", "socket2", + "sync_wrapper", "tokio", "tokio-stream", "tower", @@ -965,19 +1118,57 @@ dependencies = [ "tracing", ] +[[package]] +name = "tonic-build" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c40aaccc9f9eccf2cd82ebc111adc13030d23e887244bc9cfa5d1d636049de3" +dependencies = [ + "prettyplease", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tonic-prost" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66bd50ad6ce1252d87ef024b3d64fe4c3cf54a86fb9ef4c631fdd0ded7aeaa67" +dependencies = [ + "bytes", + "prost", + "tonic", +] + +[[package]] +name = "tonic-prost-build" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4a16cba4043dc3ff43fcb3f96b4c5c154c64cbd18ca8dce2ab2c6a451d058a2" +dependencies = [ + "prettyplease", + "proc-macro2", + "prost-build", + "prost-types", + "quote", + "syn", + "tempfile", + "tonic-build", +] + [[package]] name = "tower" -version = "0.4.13" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", - "indexmap 1.9.3", - "pin-project", + "indexmap", "pin-project-lite", - "rand", "slab", + "sync_wrapper", "tokio", "tokio-util", "tower-layer", @@ -987,21 +1178,21 @@ dependencies = [ [[package]] name = "tower-layer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -1010,9 +1201,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", @@ -1021,9 +1212,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" dependencies = [ "once_cell", ] @@ -1034,11 +1225,66 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "unicase" +version = "2.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" + [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "ureq" +version = "2.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d1a66277ed75f640d608235660df48c8e3c19f3b4edb6a263315626cc3c01d" +dependencies = [ + "base64", + "log", + "once_cell", + "rustls", + "rustls-pki-types", + "url", + "webpki-roots 0.26.11", +] + +[[package]] +name = "url" +version = "2.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] [[package]] name = "want" @@ -1051,19 +1297,52 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] -name = "windows-sys" -version = "0.48.0" +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.3", +] + +[[package]] +name = "webpki-roots" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b130c0d2d49f8b6889abc456e795e82525204f27c42cf767cf0d7734e089b8" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-targets 0.48.5", + "windows-sys 0.61.2", ] +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-sys" version = "0.52.0" @@ -1074,18 +1353,21 @@ dependencies = [ ] [[package]] -name = "windows-targets" -version = "0.48.5" +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows-link", ] [[package]] @@ -1097,7 +1379,7 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", @@ -1105,10 +1387,21 @@ dependencies = [ ] [[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" +name = "windows-targets" +version = "0.53.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] [[package]] name = "windows_aarch64_gnullvm" @@ -1117,10 +1410,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" +name = "windows_aarch64_gnullvm" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" [[package]] name = "windows_aarch64_msvc" @@ -1129,10 +1422,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] -name = "windows_i686_gnu" -version = "0.48.5" +name = "windows_aarch64_msvc" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" [[package]] name = "windows_i686_gnu" @@ -1140,6 +1433,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" @@ -1147,10 +1446,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] -name = "windows_i686_msvc" -version = "0.48.5" +name = "windows_i686_gnullvm" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" [[package]] name = "windows_i686_msvc" @@ -1159,10 +1458,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" +name = "windows_i686_msvc" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" [[package]] name = "windows_x86_64_gnu" @@ -1171,10 +1470,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" +name = "windows_x86_64_gnu" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" [[package]] name = "windows_x86_64_gnullvm" @@ -1183,13 +1482,126 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" +name = "windows_x86_64_gnullvm" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "byteorder", + "crc32fast", + "crossbeam-utils", + "flate2", +] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 8afef638..b9d070ea 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,27 +1,6 @@ -[package] -name = "p4runtime" -version = "1.4.0" -edition = "2021" -authors = ["P4 API Working Group "] -description = "P4Runtime Specification" -categories = ["network-programming"] -keywords = ["p4runtime", "grpc"] -license = "Apache-2.0" -repository = "https://github.com/p4lang/p4runtime" - -[dependencies] -pbjson = "0.7.0" -pbjson-types = "0.7.0" -prost = "0.13.2" -tonic = "0.12.3" - -[features] -default = ["proto_full"] -# @@protoc_deletion_point(features) -# This section is automatically generated by protoc-gen-prost-crate. -# Changes in this area may be lost on regeneration. -proto_full = ["google-rpc","p4-config-v1","p4-v1"] -"google-rpc" = [] -"p4-config-v1" = [] -"p4-v1" = ["google-rpc","p4-config-v1"] -## @@protoc_insertion_point(features) +[workspace] +members = [ + "p4runtime-prost", + "p4runtime-tonic", +] +resolver = "2" diff --git a/rust/README.md b/rust/README.md deleted file mode 120000 index 32d46ee8..00000000 --- a/rust/README.md +++ /dev/null @@ -1 +0,0 @@ -../README.md \ No newline at end of file diff --git a/rust/README.md b/rust/README.md new file mode 100644 index 00000000..b3432796 --- /dev/null +++ b/rust/README.md @@ -0,0 +1,95 @@ +# P4Runtime Rust Crates + +This directory contains Rust crates for the P4Runtime API specification. + +## Usage in Your Project + +Add the following to your `Cargo.toml`: + +**For message types only:** +```toml +[dependencies] +p4runtime-prost = { git = "https://github.com/p4lang/p4runtime.git" } +``` + +**For gRPC services:** +```toml +[dependencies] +p4runtime-prost = { git = "https://github.com/p4lang/p4runtime.git" } +p4runtime-tonic = { git = "https://github.com/p4lang/p4runtime.git" } +``` + +## Crates + +### `p4runtime-prost` + +Provides Protocol Buffer message types using [prost](https://docs.rs/prost/). +This crate contains only the message definitions and no gRPC service +implementations. + +**Use this crate when:** +- You need to construct/serialize/deserialize P4Runtime messages +- You don't need gRPC client/server functionality +- You want to minimize dependencies (only depends on `prost`) + +**Example:** +```rust +use p4runtime_prost::p4::v1::WriteRequest; + +let request = WriteRequest { + device_id: 1, + // ... other fields +}; +``` + +### `p4runtime-tonic` + +Provides gRPC service definitions using [tonic](https://docs.rs/tonic/). +This crate depends on `p4runtime-prost` for message types and adds gRPC client +and server implementations. + +**Use this crate when:** +- You need to implement a P4Runtime server +- You need to create a P4Runtime client + +**Example:** +```rust +use p4runtime_tonic::p4::v1::p4_runtime_client::P4RuntimeClient; + +let mut client = P4RuntimeClient::connect("http://[::1]:50051").await?; +``` + +## Design + +1. **Automatic Code Generation**: Code is generated during `cargo build` via +`build.rs` scripts, eliminating the need to run `codegen/` scripts manually. + +2. **Separate Crates**: Message types and gRPC services are in separate crates, +so users who only need the proto messages don't need to depend on `tonic`. + +3. **gRPC Reflection**: File descriptors are exported as part of +`p4runtime-prost`, enabling gRPC reflection support. + +## How can I see the generated code? + +### Via the documentation + +Simply run +``` +cargo doc --open +``` +to build documentation for the crates and bring it up in your default web +browser. Then, navgiate to the desired object and click "Source". + +### Using cargo outdir + +First install `cargo-outdir`: +``` +cargo install cargo-outdir +``` +Then navigate to the crate you're interested in, e.g. `cd p4runtime-prost`, +and run +``` +cd $(cargo outdir --no-names) +``` +to navigate to the build directory containing all generated files. diff --git a/rust/p4runtime-prost/Cargo.toml b/rust/p4runtime-prost/Cargo.toml new file mode 100644 index 00000000..fb8acb45 --- /dev/null +++ b/rust/p4runtime-prost/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "p4runtime-prost" +version = "1.4.0" +edition = "2021" +authors = ["P4 API Working Group "] +description = "P4Runtime Specification - Protobuf message API (Prost)" +categories = ["network-programming"] +keywords = ["p4runtime", "protobuf"] +license = "Apache-2.0" +repository = "https://github.com/p4lang/p4runtime" + +[dependencies] +prost = "0.14" +prost-types = "0.14" + +[build-dependencies] +protoc-prebuilt = "0.3" # To obtain `protoc` binary (the Protobuf compiler). +prost-build = "0.14" # To generate API for Protobuf messages. +walkdir = "2" # To find proto files. diff --git a/rust/p4runtime-prost/build.rs b/rust/p4runtime-prost/build.rs new file mode 100644 index 00000000..3e2634f6 --- /dev/null +++ b/rust/p4runtime-prost/build.rs @@ -0,0 +1,37 @@ +use std::env; +use std::path::PathBuf; + +fn main() -> Result<(), Box> { + // Define constants. + let protoc_version = "33.0"; // Version of the Protobuf compiler to use. + let proto_root = "../../proto"; + let out_dir = PathBuf::from(env::var("OUT_DIR").expect("environment variable OUT_DIR not set")); + let descriptor_path = PathBuf::from(out_dir).join("file_descriptor_set.bin"); + + // Set `protoc` binary (the Protobuf compiler). + let (protoc_bin, protoc_include) = protoc_prebuilt::init(protoc_version).unwrap(); + std::env::set_var("PROTOC", protoc_bin); + std::env::set_var("PROTOC_INCLUDE", protoc_include); + + // Find all .proto files. + let mut proto_files: Vec = Vec::new(); + for entry in walkdir::WalkDir::new(proto_root) + .into_iter() + .filter_map(|e| e.ok()) + { + let path = entry.path(); + if path.is_file() && path.extension().map_or(false, |ext| ext == "proto") { + println!("cargo:rerun-if-changed={}", path.display()); + proto_files.push(path.to_path_buf()); + } + } + println!("cargo:rerun-if-changed={}", proto_root); + + // Compile the `.proto` files into Rust code. + prost_build::Config::new() + // Tell prost to generate a file descriptor set (for gRPC reflection). + .file_descriptor_set_path(&descriptor_path) + .compile_protos(&proto_files, &[proto_root])?; + + Ok(()) +} diff --git a/rust/p4runtime-prost/src/lib.rs b/rust/p4runtime-prost/src/lib.rs new file mode 100644 index 00000000..364cbb2b --- /dev/null +++ b/rust/p4runtime-prost/src/lib.rs @@ -0,0 +1,46 @@ +use prost::Message; +use prost_types::FileDescriptorSet; + +/// The official Prost API for all +/// [P4Runtime Protobuf messages](https://github.com/p4lang/p4runtime/blob/main/proto). +pub mod p4 { + pub mod v1 { + include!(concat!(env!("OUT_DIR"), "/p4.v1.rs")); + } + pub mod config { + pub mod v1 { + include!(concat!(env!("OUT_DIR"), "/p4.config.v1.rs")); + } + } +} + +/// Unofficial Prost API for [`google/rpc/status.proto`](https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto). +/// +/// Included as a workaround here since there is currently no official crate providing this API. +pub mod google { + pub mod rpc { + include!(concat!(env!("OUT_DIR"), "/google.rpc.rs")); + } +} + +/// Returns a `FileDescriptorSet` defining all Protobuf messages used by P4Runtime. +/// +/// Enables [gRPC reflection](https://grpc.io/docs/guides/reflection/). +pub fn file_descriptor_set() -> FileDescriptorSet { + let raw_proto: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/file_descriptor_set.bin")); + return FileDescriptorSet::decode(raw_proto).unwrap(); +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn file_descriptor_set_is_not_empty() { + let descriptor_set = file_descriptor_set(); + assert!( + !descriptor_set.file.is_empty(), + "FileDescriptorSet is empty" + ); + } +} diff --git a/rust/p4runtime-tonic/Cargo.toml b/rust/p4runtime-tonic/Cargo.toml new file mode 100644 index 00000000..97565ef0 --- /dev/null +++ b/rust/p4runtime-tonic/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "p4runtime-tonic" +version = "1.4.0" +edition = "2021" +authors = ["P4 API Working Group "] +description = "P4Runtime Specification - gRPC service definitions" +categories = ["network-programming"] +keywords = ["p4runtime", "grpc", "tonic"] +license = "Apache-2.0" +repository = "https://github.com/p4lang/p4runtime" + +[dependencies] +p4runtime-prost = { path = "../p4runtime-prost" } +prost = "0.14" +prost-types = "0.14" +tonic = "0.14" +tonic-prost = "0.14" + +[build-dependencies] +# To obtain `protoc` binary (the Protobuf compiler). +protoc-prebuilt = "0.3" +# To generate client/server code for grpc services. +tonic-prost-build = "0.14" +# To find proto files. +walkdir = "2" diff --git a/rust/p4runtime-tonic/build.rs b/rust/p4runtime-tonic/build.rs new file mode 100644 index 00000000..97a4a9d6 --- /dev/null +++ b/rust/p4runtime-tonic/build.rs @@ -0,0 +1,37 @@ +use std::path::PathBuf; + +fn main() -> Result<(), Box> { + // Define constants. + let protoc_version = "33.0"; // Version of the Protobuf compiler to use. + let proto_root = "../../proto"; + + // Set `protoc` binary (the Protobuf compiler). + let (protoc_bin, protoc_include) = protoc_prebuilt::init(protoc_version).unwrap(); + std::env::set_var("PROTOC", protoc_bin); + std::env::set_var("PROTOC_INCLUDE", protoc_include); + + // Find all .proto files. + let mut proto_files: Vec = Vec::new(); + for entry in walkdir::WalkDir::new(proto_root) + .into_iter() + .filter_map(|e| e.ok()) + { + let path = entry.path(); + if path.is_file() && path.extension().map_or(false, |ext| ext == "proto") { + println!("cargo:rerun-if-changed={}", path.display()); + proto_files.push(path.to_path_buf()); + } + } + println!("cargo:rerun-if-changed={}", proto_root); + + // Compile the `.proto` files into Rust code. + tonic_prost_build::configure() + // Tell tonic to use the prost-generated types for the Protobuf messages. + .extern_path(".p4", "::p4runtime_prost::p4") + // Build server and client code for the gRPC service. + .build_server(true) + .build_client(true) + .compile_protos(&proto_files, &[PathBuf::from(proto_root)])?; + + Ok(()) +} diff --git a/rust/p4runtime-tonic/src/lib.rs b/rust/p4runtime-tonic/src/lib.rs new file mode 100644 index 00000000..4d8e017c --- /dev/null +++ b/rust/p4runtime-tonic/src/lib.rs @@ -0,0 +1,6 @@ +/// The official Tonic API for all P4Runtime gRPC services, including clients and server code. +pub mod p4 { + pub mod v1 { + tonic::include_proto!("p4.v1"); + } +} diff --git a/rust/src/google.rpc.rs b/rust/src/google.rpc.rs deleted file mode 100644 index cfb26b3f..00000000 --- a/rust/src/google.rpc.rs +++ /dev/null @@ -1,226 +0,0 @@ -// @generated -// This file is @generated by prost-build. -/// The `Status` type defines a logical error model that is suitable for -/// different programming environments, including REST APIs and RPC APIs. It is -/// used by [gRPC](). Each `Status` message contains -/// three pieces of data: error code, error message, and error details. -/// -/// You can find out more about this error model and how to work with it in the -/// [API Design Guide](). -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Status { - /// The status code, which should be an enum value of - /// [google.rpc.Code][google.rpc.Code]. - #[prost(int32, tag="1")] - pub code: i32, - /// A developer-facing error message, which should be in English. Any - /// user-facing error message should be localized and sent in the - /// [google.rpc.Status.details][google.rpc.Status.details] field, or localized - /// by the client. - #[prost(string, tag="2")] - pub message: ::prost::alloc::string::String, - /// A list of messages that carry the error details. There is a common set of - /// message types for APIs to use. - #[prost(message, repeated, tag="3")] - pub details: ::prost::alloc::vec::Vec<::pbjson_types::Any>, -} -/// The canonical error codes for gRPC APIs. -/// -/// -/// Sometimes multiple error codes may apply. Services should return -/// the most specific error code that applies. For example, prefer -/// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply. -/// Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum Code { - /// Not an error; returned on success. - /// - /// HTTP Mapping: 200 OK - Ok = 0, - /// The operation was cancelled, typically by the caller. - /// - /// HTTP Mapping: 499 Client Closed Request - Cancelled = 1, - /// Unknown error. For example, this error may be returned when - /// a `Status` value received from another address space belongs to - /// an error space that is not known in this address space. Also - /// errors raised by APIs that do not return enough error information - /// may be converted to this error. - /// - /// HTTP Mapping: 500 Internal Server Error - Unknown = 2, - /// The client specified an invalid argument. Note that this differs - /// from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments - /// that are problematic regardless of the state of the system - /// (e.g., a malformed file name). - /// - /// HTTP Mapping: 400 Bad Request - InvalidArgument = 3, - /// The deadline expired before the operation could complete. For operations - /// that change the state of the system, this error may be returned - /// even if the operation has completed successfully. For example, a - /// successful response from a server could have been delayed long - /// enough for the deadline to expire. - /// - /// HTTP Mapping: 504 Gateway Timeout - DeadlineExceeded = 4, - /// Some requested entity (e.g., file or directory) was not found. - /// - /// Note to server developers: if a request is denied for an entire class - /// of users, such as gradual feature rollout or undocumented allowlist, - /// `NOT_FOUND` may be used. If a request is denied for some users within - /// a class of users, such as user-based access control, `PERMISSION_DENIED` - /// must be used. - /// - /// HTTP Mapping: 404 Not Found - NotFound = 5, - /// The entity that a client attempted to create (e.g., file or directory) - /// already exists. - /// - /// HTTP Mapping: 409 Conflict - AlreadyExists = 6, - /// The caller does not have permission to execute the specified - /// operation. `PERMISSION_DENIED` must not be used for rejections - /// caused by exhausting some resource (use `RESOURCE_EXHAUSTED` - /// instead for those errors). `PERMISSION_DENIED` must not be - /// used if the caller can not be identified (use `UNAUTHENTICATED` - /// instead for those errors). This error code does not imply the - /// request is valid or the requested entity exists or satisfies - /// other pre-conditions. - /// - /// HTTP Mapping: 403 Forbidden - PermissionDenied = 7, - /// The request does not have valid authentication credentials for the - /// operation. - /// - /// HTTP Mapping: 401 Unauthorized - Unauthenticated = 16, - /// Some resource has been exhausted, perhaps a per-user quota, or - /// perhaps the entire file system is out of space. - /// - /// HTTP Mapping: 429 Too Many Requests - ResourceExhausted = 8, - /// The operation was rejected because the system is not in a state - /// required for the operation's execution. For example, the directory - /// to be deleted is non-empty, an rmdir operation is applied to - /// a non-directory, etc. - /// - /// Service implementors can use the following guidelines to decide - /// between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: - /// (a) Use `UNAVAILABLE` if the client can retry just the failing call. - /// (b) Use `ABORTED` if the client should retry at a higher level. For - /// example, when a client-specified test-and-set fails, indicating the - /// client should restart a read-modify-write sequence. - /// (c) Use `FAILED_PRECONDITION` if the client should not retry until - /// the system state has been explicitly fixed. For example, if an "rmdir" - /// fails because the directory is non-empty, `FAILED_PRECONDITION` - /// should be returned since the client should not retry unless - /// the files are deleted from the directory. - /// - /// HTTP Mapping: 400 Bad Request - FailedPrecondition = 9, - /// The operation was aborted, typically due to a concurrency issue such as - /// a sequencer check failure or transaction abort. - /// - /// See the guidelines above for deciding between `FAILED_PRECONDITION`, - /// `ABORTED`, and `UNAVAILABLE`. - /// - /// HTTP Mapping: 409 Conflict - Aborted = 10, - /// The operation was attempted past the valid range. E.g., seeking or - /// reading past end-of-file. - /// - /// Unlike `INVALID_ARGUMENT`, this error indicates a problem that may - /// be fixed if the system state changes. For example, a 32-bit file - /// system will generate `INVALID_ARGUMENT` if asked to read at an - /// offset that is not in the range \[0,2^32-1\], but it will generate - /// `OUT_OF_RANGE` if asked to read from an offset past the current - /// file size. - /// - /// There is a fair bit of overlap between `FAILED_PRECONDITION` and - /// `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific - /// error) when it applies so that callers who are iterating through - /// a space can easily look for an `OUT_OF_RANGE` error to detect when - /// they are done. - /// - /// HTTP Mapping: 400 Bad Request - OutOfRange = 11, - /// The operation is not implemented or is not supported/enabled in this - /// service. - /// - /// HTTP Mapping: 501 Not Implemented - Unimplemented = 12, - /// Internal errors. This means that some invariants expected by the - /// underlying system have been broken. This error code is reserved - /// for serious errors. - /// - /// HTTP Mapping: 500 Internal Server Error - Internal = 13, - /// The service is currently unavailable. This is most likely a - /// transient condition, which can be corrected by retrying with - /// a backoff. Note that it is not always safe to retry - /// non-idempotent operations. - /// - /// See the guidelines above for deciding between `FAILED_PRECONDITION`, - /// `ABORTED`, and `UNAVAILABLE`. - /// - /// HTTP Mapping: 503 Service Unavailable - Unavailable = 14, - /// Unrecoverable data loss or corruption. - /// - /// HTTP Mapping: 500 Internal Server Error - DataLoss = 15, -} -impl Code { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Code::Ok => "OK", - Code::Cancelled => "CANCELLED", - Code::Unknown => "UNKNOWN", - Code::InvalidArgument => "INVALID_ARGUMENT", - Code::DeadlineExceeded => "DEADLINE_EXCEEDED", - Code::NotFound => "NOT_FOUND", - Code::AlreadyExists => "ALREADY_EXISTS", - Code::PermissionDenied => "PERMISSION_DENIED", - Code::Unauthenticated => "UNAUTHENTICATED", - Code::ResourceExhausted => "RESOURCE_EXHAUSTED", - Code::FailedPrecondition => "FAILED_PRECONDITION", - Code::Aborted => "ABORTED", - Code::OutOfRange => "OUT_OF_RANGE", - Code::Unimplemented => "UNIMPLEMENTED", - Code::Internal => "INTERNAL", - Code::Unavailable => "UNAVAILABLE", - Code::DataLoss => "DATA_LOSS", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "OK" => Some(Self::Ok), - "CANCELLED" => Some(Self::Cancelled), - "UNKNOWN" => Some(Self::Unknown), - "INVALID_ARGUMENT" => Some(Self::InvalidArgument), - "DEADLINE_EXCEEDED" => Some(Self::DeadlineExceeded), - "NOT_FOUND" => Some(Self::NotFound), - "ALREADY_EXISTS" => Some(Self::AlreadyExists), - "PERMISSION_DENIED" => Some(Self::PermissionDenied), - "UNAUTHENTICATED" => Some(Self::Unauthenticated), - "RESOURCE_EXHAUSTED" => Some(Self::ResourceExhausted), - "FAILED_PRECONDITION" => Some(Self::FailedPrecondition), - "ABORTED" => Some(Self::Aborted), - "OUT_OF_RANGE" => Some(Self::OutOfRange), - "UNIMPLEMENTED" => Some(Self::Unimplemented), - "INTERNAL" => Some(Self::Internal), - "UNAVAILABLE" => Some(Self::Unavailable), - "DATA_LOSS" => Some(Self::DataLoss), - _ => None, - } - } -} -// @@protoc_insertion_point(module) diff --git a/rust/src/lib.rs b/rust/src/lib.rs deleted file mode 100644 index d4eeb294..00000000 --- a/rust/src/lib.rs +++ /dev/null @@ -1,25 +0,0 @@ -// @generated -pub mod google { - #[cfg(feature = "google-rpc")] - // @@protoc_insertion_point(attribute:google.rpc) - pub mod rpc { - include!("google.rpc.rs"); - // @@protoc_insertion_point(google.rpc) - } -} -pub mod p4 { - pub mod config { - #[cfg(feature = "p4-config-v1")] - // @@protoc_insertion_point(attribute:p4.config.v1) - pub mod v1 { - include!("p4.config.v1.rs"); - // @@protoc_insertion_point(p4.config.v1) - } - } - #[cfg(feature = "p4-v1")] - // @@protoc_insertion_point(attribute:p4.v1) - pub mod v1 { - include!("p4.v1.rs"); - // @@protoc_insertion_point(p4.v1) - } -} diff --git a/rust/src/p4.config.v1.rs b/rust/src/p4.config.v1.rs deleted file mode 100644 index ce22a714..00000000 --- a/rust/src/p4.config.v1.rs +++ /dev/null @@ -1,1319 +0,0 @@ -// @generated -// This file is @generated by prost-build. -// P4 type specs --------------------------------------------------------------- - -// From the P4_16 spec: - -// |--------------------|--------------------------------------------| -// | | Container type | -// | Element type |-----------|--------------|-----------------| -// | | header | header_union | struct or tuple | -// |--------------------|-----------|--------------|-----------------| -// | bit | allowed | error | allowed | -// | int | allowed | error | allowed | -// | varbit | allowed | error | allowed | -// | int | error | error | error | -// | void | error | error | error | -// | error | error | error | allowed | -// | match_kind | error | error | error | -// | bool | error | error | allowed | -// | enum | allowed* | error | allowed | -// | header | error | allowed | allowed | -// | header stack | error | error | allowed | -// | header_union | error | error | allowed | -// | struct | error | error | allowed | -// | tuple | error | error | allowed | -// |--------------------|-----------|--------------|-----------------| -// -// *if serializable - -/// These P4 types (struct, header_type, header_union and enum) are guaranteed to -/// have a fully-qualified name (e.g. you cannot use an anonymous struct to -/// declare a variable like in C). Instead of duplicating the type spec for these -/// every time the type is used, we include the type spec once in this P4TypeInfo -/// message and refer to the types by name in the P4DataTypeSpec message. We also -/// support annotations for these type specs which can be useful, e.g. to -/// identify well-known headers (such as ipv4). -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4TypeInfo { - #[prost(map="string, message", tag="1")] - pub structs: ::std::collections::HashMap<::prost::alloc::string::String, P4StructTypeSpec>, - #[prost(map="string, message", tag="2")] - pub headers: ::std::collections::HashMap<::prost::alloc::string::String, P4HeaderTypeSpec>, - #[prost(map="string, message", tag="3")] - pub header_unions: ::std::collections::HashMap<::prost::alloc::string::String, P4HeaderUnionTypeSpec>, - #[prost(map="string, message", tag="4")] - pub enums: ::std::collections::HashMap<::prost::alloc::string::String, P4EnumTypeSpec>, - #[prost(message, optional, tag="5")] - pub error: ::core::option::Option, - #[prost(map="string, message", tag="6")] - pub serializable_enums: ::std::collections::HashMap<::prost::alloc::string::String, P4SerializableEnumTypeSpec>, - #[prost(map="string, message", tag="7")] - pub new_types: ::std::collections::HashMap<::prost::alloc::string::String, P4NewTypeSpec>, -} -/// Describes a P4_16 type. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4DataTypeSpec { - #[prost(oneof="p4_data_type_spec::TypeSpec", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12")] - pub type_spec: ::core::option::Option, -} -/// Nested message and enum types in `P4DataTypeSpec`. -pub mod p4_data_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum TypeSpec { - #[prost(message, tag="1")] - Bitstring(super::P4BitstringLikeTypeSpec), - #[prost(message, tag="2")] - Bool(super::P4BoolType), - #[prost(message, tag="3")] - Tuple(super::P4TupleTypeSpec), - #[prost(message, tag="4")] - Struct(super::P4NamedType), - #[prost(message, tag="5")] - Header(super::P4NamedType), - #[prost(message, tag="6")] - HeaderUnion(super::P4NamedType), - #[prost(message, tag="7")] - HeaderStack(super::P4HeaderStackTypeSpec), - #[prost(message, tag="8")] - HeaderUnionStack(super::P4HeaderUnionStackTypeSpec), - #[prost(message, tag="9")] - Enum(super::P4NamedType), - #[prost(message, tag="10")] - Error(super::P4ErrorType), - #[prost(message, tag="11")] - SerializableEnum(super::P4NamedType), - #[prost(message, tag="12")] - NewType(super::P4NamedType), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4NamedType { - #[prost(string, tag="1")] - pub name: ::prost::alloc::string::String, -} -/// Empty message as no type information needed, just used as a placeholder in -/// the oneof to identify boolean types. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct P4BoolType { -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct P4ErrorType { -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4BitstringLikeTypeSpec { - /// Useful to identify well-known types, such as IP address or Ethernet MAC - /// address. - #[prost(string, repeated, tag="4")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="5")] - pub annotation_locations: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="6")] - pub structured_annotations: ::prost::alloc::vec::Vec, - #[prost(oneof="p4_bitstring_like_type_spec::TypeSpec", tags="1, 2, 3")] - pub type_spec: ::core::option::Option, -} -/// Nested message and enum types in `P4BitstringLikeTypeSpec`. -pub mod p4_bitstring_like_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Oneof)] - pub enum TypeSpec { - /// bit - #[prost(message, tag="1")] - Bit(super::P4BitTypeSpec), - /// int - #[prost(message, tag="2")] - Int(super::P4IntTypeSpec), - /// varbit - #[prost(message, tag="3")] - Varbit(super::P4VarbitTypeSpec), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct P4BitTypeSpec { - #[prost(int32, tag="1")] - pub bitwidth: i32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct P4IntTypeSpec { - #[prost(int32, tag="1")] - pub bitwidth: i32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct P4VarbitTypeSpec { - #[prost(int32, tag="1")] - pub max_bitwidth: i32, -} -/// From the P4_16 spec: "A tuple is similar to a struct, in that it holds -/// multiple values. Unlike a struct type, tuples have no named fields." -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4TupleTypeSpec { - #[prost(message, repeated, tag="1")] - pub members: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4StructTypeSpec { - #[prost(message, repeated, tag="1")] - pub members: ::prost::alloc::vec::Vec, - #[prost(string, repeated, tag="2")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="3")] - pub annotation_locations: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="4")] - pub structured_annotations: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `P4StructTypeSpec`. -pub mod p4_struct_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Member { - #[prost(string, tag="1")] - pub name: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] - pub type_spec: ::core::option::Option, - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4HeaderTypeSpec { - #[prost(message, repeated, tag="1")] - pub members: ::prost::alloc::vec::Vec, - #[prost(string, repeated, tag="2")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="3")] - pub annotation_locations: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="4")] - pub structured_annotations: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `P4HeaderTypeSpec`. -pub mod p4_header_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Member { - #[prost(string, tag="1")] - pub name: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] - pub type_spec: ::core::option::Option, - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4HeaderUnionTypeSpec { - #[prost(message, repeated, tag="1")] - pub members: ::prost::alloc::vec::Vec, - #[prost(string, repeated, tag="2")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="3")] - pub annotation_locations: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="4")] - pub structured_annotations: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `P4HeaderUnionTypeSpec`. -pub mod p4_header_union_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Member { - #[prost(string, tag="1")] - pub name: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] - pub header: ::core::option::Option, - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4HeaderStackTypeSpec { - #[prost(message, optional, tag="1")] - pub header: ::core::option::Option, - #[prost(int32, tag="2")] - pub size: i32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4HeaderUnionStackTypeSpec { - #[prost(message, optional, tag="1")] - pub header_union: ::core::option::Option, - #[prost(int32, tag="2")] - pub size: i32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct KeyValuePair { - #[prost(string, tag="1")] - pub key: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] - pub value: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct KeyValuePairList { - #[prost(message, repeated, tag="1")] - pub kv_pairs: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Expression { - #[prost(oneof="expression::Value", tags="1, 2, 3")] - pub value: ::core::option::Option, -} -/// Nested message and enum types in `Expression`. -pub mod expression { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Value { - #[prost(string, tag="1")] - StringValue(::prost::alloc::string::String), - #[prost(int64, tag="2")] - Int64Value(i64), - #[prost(bool, tag="3")] - BoolValue(bool), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ExpressionList { - #[prost(message, repeated, tag="1")] - pub expressions: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct StructuredAnnotation { - #[prost(string, tag="1")] - pub name: ::prost::alloc::string::String, - /// Optional. Location of the '@' symbol of this annotation in the source code. - #[prost(message, optional, tag="4")] - pub source_location: ::core::option::Option, - #[prost(oneof="structured_annotation::Body", tags="2, 3")] - pub body: ::core::option::Option, -} -/// Nested message and enum types in `StructuredAnnotation`. -pub mod structured_annotation { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Body { - #[prost(message, tag="2")] - ExpressionList(super::ExpressionList), - #[prost(message, tag="3")] - KvPairList(super::KeyValuePairList), - } -} -/// Location of code relative to a given source file. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SourceLocation { - /// Path to the source file (absolute or relative to the working directory). - #[prost(string, tag="1")] - pub file: ::prost::alloc::string::String, - /// Line and column numbers within the source file, 1-based. - #[prost(int32, tag="2")] - pub line: i32, - #[prost(int32, tag="3")] - pub column: i32, -} -/// For "safe" enums with no underlying representation and no member integer -/// values. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4EnumTypeSpec { - #[prost(message, repeated, tag="1")] - pub members: ::prost::alloc::vec::Vec, - #[prost(string, repeated, tag="2")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="4")] - pub annotation_locations: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="3")] - pub structured_annotations: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `P4EnumTypeSpec`. -pub mod p4_enum_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Member { - #[prost(string, tag="1")] - pub name: ::prost::alloc::string::String, - #[prost(string, repeated, tag="2")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="4")] - pub annotation_locations: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="3")] - pub structured_annotations: ::prost::alloc::vec::Vec, - } -} -/// For serializable (or "unsafe") enums, which have an underlying type. Note -/// that as per the P4_16 specification, the underlying representation can only -/// be a bit type. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4SerializableEnumTypeSpec { - #[prost(message, optional, tag="1")] - pub underlying_type: ::core::option::Option, - #[prost(message, repeated, tag="2")] - pub members: ::prost::alloc::vec::Vec, - #[prost(string, repeated, tag="3")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="5")] - pub annotation_locations: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="4")] - pub structured_annotations: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `P4SerializableEnumTypeSpec`. -pub mod p4_serializable_enum_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Member { - #[prost(string, tag="1")] - pub name: ::prost::alloc::string::String, - #[prost(bytes="vec", tag="2")] - pub value: ::prost::alloc::vec::Vec, - #[prost(string, repeated, tag="3")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="5")] - pub annotation_locations: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="4")] - pub structured_annotations: ::prost::alloc::vec::Vec, - } -} -/// Similar to an enum, but there is always one and only one instance per P4 -/// program. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4ErrorTypeSpec { - #[prost(string, repeated, tag="1")] - pub members: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4NewTypeTranslation { - /// the URI uniquely identifies the translation in order to enable the - /// P4Runtime agent to perform value-mapping appropriately when required. It is - /// recommended that the URI includes at least the P4 architecture name and the - /// type name. - #[prost(string, tag="1")] - pub uri: ::prost::alloc::string::String, - /// The object is either represented as an unsigned integer with a bitwidth of - /// `sdn_bitwidth`, or as a string. - #[prost(oneof="p4_new_type_translation::SdnType", tags="2, 3")] - pub sdn_type: ::core::option::Option, -} -/// Nested message and enum types in `P4NewTypeTranslation`. -pub mod p4_new_type_translation { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] - pub struct SdnString { - } - /// The object is either represented as an unsigned integer with a bitwidth of - /// `sdn_bitwidth`, or as a string. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Oneof)] - pub enum SdnType { - #[prost(int32, tag="2")] - SdnBitwidth(i32), - #[prost(message, tag="3")] - SdnString(SdnString), - } -} -/// New types introduced with the "type" keyword -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4NewTypeSpec { - /// for other annotations (not @p4runtime_translation) - #[prost(string, repeated, tag="3")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="5")] - pub annotation_locations: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="4")] - pub structured_annotations: ::prost::alloc::vec::Vec, - #[prost(oneof="p4_new_type_spec::Representation", tags="1, 2")] - pub representation: ::core::option::Option, -} -/// Nested message and enum types in `P4NewTypeSpec`. -pub mod p4_new_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Representation { - /// if no @p4runtime_translation annotation present - #[prost(message, tag="1")] - OriginalType(super::P4DataTypeSpec), - /// if @p4runtime_translation annotation present - #[prost(message, tag="2")] - TranslatedType(super::P4NewTypeTranslation), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4Info { - #[prost(message, optional, tag="1")] - pub pkg_info: ::core::option::Option, - #[prost(message, repeated, tag="2")] - pub tables: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="3")] - pub actions: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="4")] - pub action_profiles: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="5")] - pub counters: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="6")] - pub direct_counters: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="7")] - pub meters: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="8")] - pub direct_meters: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="9")] - pub controller_packet_metadata: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="10")] - pub value_sets: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="11")] - pub registers: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="12")] - pub digests: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="100")] - pub externs: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="200")] - pub type_info: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Documentation { - /// A brief description of something, e.g. one sentence - #[prost(string, tag="1")] - pub brief: ::prost::alloc::string::String, - /// A more verbose description of something. Multiline is accepted. Markup - /// format (if any) is TBD. - #[prost(string, tag="2")] - pub description: ::prost::alloc::string::String, -} -/// Used to describe the required properties of the underlying platform. -/// Added in v1.4.0 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct PlatformProperties { - /// The minimum number of multicast entries (i.e. multicast groups) that the - /// platform is required to support. If 0, there are no requirements. - #[prost(int32, tag="1")] - pub multicast_group_table_size: i32, - /// The minimum number of replicas that the platform is required to support - /// across all groups. If 0, there are no requirements. - #[prost(int32, tag="2")] - pub multicast_group_table_total_replicas: i32, - /// The number of replicas that the platform is required to support per - /// group/entry. If 0, `multicast_group_table_total_replicas` should be used. - /// Must be no larger than `multicast_group_table_total_replicas`. - #[prost(int32, tag="3")] - pub multicast_group_table_max_replicas_per_entry: i32, -} -/// Top-level package documentation describing the forwarding pipeline config -/// Can be used to manage multiple P4 packages. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct PkgInfo { - /// a definitive name for this configuration, e.g. switch.p4_v1.0 - #[prost(string, tag="1")] - pub name: ::prost::alloc::string::String, - /// configuration version, free-format string - #[prost(string, tag="2")] - pub version: ::prost::alloc::string::String, - /// brief and detailed descriptions - #[prost(message, optional, tag="3")] - pub doc: ::core::option::Option, - /// Miscellaneous metadata, free-form; a way to extend PkgInfo - #[prost(string, repeated, tag="4")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="10")] - pub annotation_locations: ::prost::alloc::vec::Vec, - /// the target architecture, e.g. "psa" - #[prost(string, tag="5")] - pub arch: ::prost::alloc::string::String, - /// organization which produced the configuration, e.g. "p4.org" - #[prost(string, tag="6")] - pub organization: ::prost::alloc::string::String, - /// contact info for support,e.g. "tech-support@acme.org" - #[prost(string, tag="7")] - pub contact: ::prost::alloc::string::String, - /// url for more information, e.g. - /// " - #[prost(string, tag="8")] - pub url: ::prost::alloc::string::String, - /// Miscellaneous metadata, structured; a way to extend PkgInfo - #[prost(message, repeated, tag="9")] - pub structured_annotations: ::prost::alloc::vec::Vec, - /// If set, specifies the properties that the underlying platform should have. - /// If the platform does not conform to these properties, the server should - /// reject the P4Info when used with a SetForwardingPipelineConfigRequest. - /// Added in 1.4.0 - #[prost(message, optional, tag="11")] - pub platform_properties: ::core::option::Option, -} -/// wrapping the enum in a message to avoid name collisions in C++, where "enum -/// values are siblings of their type, not children of it" -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct P4Ids { -} -/// Nested message and enum types in `P4Ids`. -pub mod p4_ids { - /// ids are allocated in such a way that it is possible based on an id to - /// deduce the resource type (e.g. table, action, counter, ...). The - /// most-significant byte of the 32-bit id encodes the resource type. The - /// purpose of this enum is to define which value is used as the - /// most-significant byte for each resource type. The P4 compiler must use - /// these values when allocating ids for P4 objects. Other users of P4Info can - /// refer to this enum to identify a resource type based on its id. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - pub enum Prefix { - Unspecified = 0, - /// P4 language built-ins - Action = 1, - Table = 2, - ValueSet = 3, - ControllerHeader = 4, - /// PSA externs - PsaExternsStart = 16, - ActionProfile = 17, - Counter = 18, - DirectCounter = 19, - Meter = 20, - DirectMeter = 21, - Register = 22, - Digest = 23, - /// externs for other architectures (vendor extensions) - OtherExternsStart = 128, - /// max value for an unsigned 8-bit byte - /// - /// requires protoc >= 3.5.0 - /// reserved 0x100 to max; - Max = 255, - } - impl Prefix { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Prefix::Unspecified => "UNSPECIFIED", - Prefix::Action => "ACTION", - Prefix::Table => "TABLE", - Prefix::ValueSet => "VALUE_SET", - Prefix::ControllerHeader => "CONTROLLER_HEADER", - Prefix::PsaExternsStart => "PSA_EXTERNS_START", - Prefix::ActionProfile => "ACTION_PROFILE", - Prefix::Counter => "COUNTER", - Prefix::DirectCounter => "DIRECT_COUNTER", - Prefix::Meter => "METER", - Prefix::DirectMeter => "DIRECT_METER", - Prefix::Register => "REGISTER", - Prefix::Digest => "DIGEST", - Prefix::OtherExternsStart => "OTHER_EXTERNS_START", - Prefix::Max => "MAX", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNSPECIFIED" => Some(Self::Unspecified), - "ACTION" => Some(Self::Action), - "TABLE" => Some(Self::Table), - "VALUE_SET" => Some(Self::ValueSet), - "CONTROLLER_HEADER" => Some(Self::ControllerHeader), - "PSA_EXTERNS_START" => Some(Self::PsaExternsStart), - "ACTION_PROFILE" => Some(Self::ActionProfile), - "COUNTER" => Some(Self::Counter), - "DIRECT_COUNTER" => Some(Self::DirectCounter), - "METER" => Some(Self::Meter), - "DIRECT_METER" => Some(Self::DirectMeter), - "REGISTER" => Some(Self::Register), - "DIGEST" => Some(Self::Digest), - "OTHER_EXTERNS_START" => Some(Self::OtherExternsStart), - "MAX" => Some(Self::Max), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Preamble { - /// ids share the same number-space; e.g. table ids cannot overlap with counter - /// ids. Even though this is irrelevant to this proto definition, the ids are - /// allocated in such a way that it is possible based on an id to deduce the - /// resource type (e.g. table, action, counter, ...). This means that code - /// using these ids can detect if the wrong resource type is used - /// somewhere. This also means that ids of different types can be mixed - /// (e.g. direct resource list for a table) without ambiguity. Note that id 0 - /// is reserved and means "invalid id". - #[prost(uint32, tag="1")] - pub id: u32, - /// fully qualified name of the P4 object, e.g. c1.c2.ipv4_lpm - #[prost(string, tag="2")] - pub name: ::prost::alloc::string::String, - /// an alias (alternative name) for the P4 object, probably shorter than its - /// fully qualified name. The only constraint is for it to be unique with - /// respect to other P4 objects of the same type. By default, the compiler uses - /// the shortest suffix of the name that uniquely identifies the object. For - /// example if the P4 program contains two tables with names s.c1.t and s.c2.t, - /// the default aliases will respectively be c1.t and c2.t. In the future, the - /// P4 programmer may also be able to override the default alias for any P4 - /// object (TBD). - #[prost(string, tag="3")] - pub alias: ::prost::alloc::string::String, - #[prost(string, repeated, tag="4")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="7")] - pub annotation_locations: ::prost::alloc::vec::Vec, - /// Documentation of the entity - #[prost(message, optional, tag="5")] - pub doc: ::core::option::Option, - #[prost(message, repeated, tag="6")] - pub structured_annotations: ::prost::alloc::vec::Vec, -} -/// used to group all extern instances of the same type in one message -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Extern { - /// the extern_type_id is unique for a given architecture and must be in the - /// range \[0x81, 0xfe\]. - #[prost(uint32, tag="1")] - pub extern_type_id: u32, - #[prost(string, tag="2")] - pub extern_type_name: ::prost::alloc::string::String, - #[prost(message, repeated, tag="3")] - pub instances: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ExternInstance { - #[prost(message, optional, tag="1")] - pub preamble: ::core::option::Option, - /// specific to the extern type, declared in a separate vendor-specific proto - /// file - #[prost(message, optional, tag="2")] - pub info: ::core::option::Option<::pbjson_types::Any>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MatchField { - #[prost(uint32, tag="1")] - pub id: u32, - #[prost(string, tag="2")] - pub name: ::prost::alloc::string::String, - #[prost(string, repeated, tag="3")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="10")] - pub annotation_locations: ::prost::alloc::vec::Vec, - #[prost(int32, tag="4")] - pub bitwidth: i32, - /// Documentation of the match field - #[prost(message, optional, tag="6")] - pub doc: ::core::option::Option, - /// unset if not user-defined type - #[prost(message, optional, tag="8")] - pub type_name: ::core::option::Option, - #[prost(message, repeated, tag="9")] - pub structured_annotations: ::prost::alloc::vec::Vec, - #[prost(oneof="match_field::Match", tags="5, 7")] - pub r#match: ::core::option::Option, -} -/// Nested message and enum types in `MatchField`. -pub mod match_field { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - pub enum MatchType { - Unspecified = 0, - Exact = 2, - Lpm = 3, - Ternary = 4, - Range = 5, - Optional = 6, - } - impl MatchType { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - MatchType::Unspecified => "UNSPECIFIED", - MatchType::Exact => "EXACT", - MatchType::Lpm => "LPM", - MatchType::Ternary => "TERNARY", - MatchType::Range => "RANGE", - MatchType::Optional => "OPTIONAL", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNSPECIFIED" => Some(Self::Unspecified), - "EXACT" => Some(Self::Exact), - "LPM" => Some(Self::Lpm), - "TERNARY" => Some(Self::Ternary), - "RANGE" => Some(Self::Range), - "OPTIONAL" => Some(Self::Optional), - _ => None, - } - } - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Match { - #[prost(enumeration="MatchType", tag="5")] - MatchType(i32), - /// used for architecture-specific match types which are not part of the core - /// P4 language or of the PSA architecture. - #[prost(string, tag="7")] - OtherMatchType(::prost::alloc::string::String), - } -} -/// A TableActionCall references a particular action id and executes the -/// action with the supplied list of arguments. -/// Arguments are matched to the id of the respective action parameter. -/// TableActionCalls may be used as the default action call of a table implementation. -/// Added in 1.4.0. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TableActionCall { - #[prost(uint32, tag="1")] - pub action_id: u32, - #[prost(message, repeated, tag="4")] - pub arguments: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `TableActionCall`. -pub mod table_action_call { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Argument { - #[prost(uint32, tag="2")] - pub param_id: u32, - #[prost(bytes="vec", tag="3")] - pub value: ::prost::alloc::vec::Vec, - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Table { - #[prost(message, optional, tag="1")] - pub preamble: ::core::option::Option, - #[prost(message, repeated, tag="2")] - pub match_fields: ::prost::alloc::vec::Vec, - /// even when the table is indirect (see implementation_id) below, this field - /// includes all possible actions for the table; by using ActionRef instead of - /// a repeated field of action ids, each action reference in a P4 table is able - /// to have its own annotations - #[prost(message, repeated, tag="3")] - pub action_refs: ::prost::alloc::vec::Vec, - /// 0 (default value) means that the table does not have a const default action - #[prost(uint32, tag="4")] - pub const_default_action_id: u32, - /// The initial default action of the table. This can be overridden at runtime. - /// Added in 1.4.0. - #[prost(message, optional, tag="5")] - pub initial_default_action: ::core::option::Option, - /// P4 id of the "implementation" for this table (e.g. action profile id); 0 - /// (default value) means that the table is a regular (direct) match table. As - /// of today, only action profiles are supported but other table - /// implementations may be added in the future - #[prost(uint32, tag="6")] - pub implementation_id: u32, - /// ids of the direct resources (if any) attached to this table; for now this - /// includes only direct counters and direct meters, but other resources may be - /// added in the future - #[prost(uint32, repeated, tag="7")] - pub direct_resource_ids: ::prost::alloc::vec::Vec, - /// max number of entries in table - #[prost(int64, tag="8")] - pub size: i64, - /// is idle timeout supported for this table? - #[prost(enumeration="table::IdleTimeoutBehavior", tag="9")] - pub idle_timeout_behavior: i32, - /// True if and only if the table's entries are immutable, - /// i.e. defined using the 'const entries' table property in the P4 - /// source code, and thus entries cannot be deleted, modified, or - /// inserted at run time. - #[prost(bool, tag="10")] - pub is_const_table: bool, - /// True if and only if the table has initial entries defined using - /// the 'entries' table property in the P4 source code, either with - /// or without the 'const' qualifier on 'entries', and there is at - /// least one entry in that list. This field is false if the list of - /// entries is empty in the P4 source code. - /// Added in 1.4.0. - #[prost(bool, tag="11")] - pub has_initial_entries: bool, - /// architecture-specific table properties which are not part of the core P4 - /// language or of the PSA architecture. - #[prost(message, optional, tag="100")] - pub other_properties: ::core::option::Option<::pbjson_types::Any>, -} -/// Nested message and enum types in `Table`. -pub mod table { - /// this enum can be extended in the future with other behaviors, such as - /// "HARD_EVICTION" - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - pub enum IdleTimeoutBehavior { - NoTimeout = 0, - NotifyControl = 1, - } - impl IdleTimeoutBehavior { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - IdleTimeoutBehavior::NoTimeout => "NO_TIMEOUT", - IdleTimeoutBehavior::NotifyControl => "NOTIFY_CONTROL", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "NO_TIMEOUT" => Some(Self::NoTimeout), - "NOTIFY_CONTROL" => Some(Self::NotifyControl), - _ => None, - } - } - } -} -/// used to list all possible actions in a Table -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ActionRef { - #[prost(uint32, tag="1")] - pub id: u32, - #[prost(enumeration="action_ref::Scope", tag="3")] - pub scope: i32, - #[prost(string, repeated, tag="2")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="5")] - pub annotation_locations: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="4")] - pub structured_annotations: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `ActionRef`. -pub mod action_ref { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - pub enum Scope { - TableAndDefault = 0, - TableOnly = 1, - DefaultOnly = 2, - } - impl Scope { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Scope::TableAndDefault => "TABLE_AND_DEFAULT", - Scope::TableOnly => "TABLE_ONLY", - Scope::DefaultOnly => "DEFAULT_ONLY", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "TABLE_AND_DEFAULT" => Some(Self::TableAndDefault), - "TABLE_ONLY" => Some(Self::TableOnly), - "DEFAULT_ONLY" => Some(Self::DefaultOnly), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Action { - #[prost(message, optional, tag="1")] - pub preamble: ::core::option::Option, - #[prost(message, repeated, tag="2")] - pub params: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `Action`. -pub mod action { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Param { - #[prost(uint32, tag="1")] - pub id: u32, - #[prost(string, tag="2")] - pub name: ::prost::alloc::string::String, - #[prost(string, repeated, tag="3")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="8")] - pub annotation_locations: ::prost::alloc::vec::Vec, - #[prost(int32, tag="4")] - pub bitwidth: i32, - /// Documentation of the Param. - #[prost(message, optional, tag="5")] - pub doc: ::core::option::Option, - /// unset if not user-defined type. - #[prost(message, optional, tag="6")] - pub type_name: ::core::option::Option, - #[prost(message, repeated, tag="7")] - pub structured_annotations: ::prost::alloc::vec::Vec, - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ActionProfile { - #[prost(message, optional, tag="1")] - pub preamble: ::core::option::Option, - /// the ids of the tables sharing this action profile - #[prost(uint32, repeated, tag="2")] - pub table_ids: ::prost::alloc::vec::Vec, - /// true iff the action profile used dynamic selection - #[prost(bool, tag="3")] - pub with_selector: bool, - /// max number of member entries across all groups if the action profile does - /// not have a selector. Otherwise, semantics as specified by - /// `selector_size_semantics` below. - #[prost(int64, tag="4")] - pub size: i64, - /// 0 if the action profile does not have a selector. Otherwise, semantics as - /// specified by `selector_size_semantics` below. - #[prost(int32, tag="5")] - pub max_group_size: i32, - /// Dictates whether the controller can specify weights for groups programmed - /// in this ActionProfile. If `weights_disallowed` is true, then all weights - /// must be absent. Unset (false) in action profiles without selectors. - /// Added in v1.5.0. - #[prost(bool, tag="8")] - pub weights_disallowed: bool, - /// specifies the semantics of `size` and `max_group_size` above. - #[prost(oneof="action_profile::SelectorSizeSemantics", tags="6, 7")] - pub selector_size_semantics: ::core::option::Option, -} -/// Nested message and enum types in `ActionProfile`. -pub mod action_profile { - /// indicates that `size` and `max_group_size` represent the maximum sum of - /// weights that can be present across all selector groups and within a - /// single selector group respectively. - /// Added in v1.4.0. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] - pub struct SumOfWeights { - } - /// indicates that `size` and `max_group_size` represent the maximum number - /// of members that can be present across all selector groups and within a - /// single selector group respectively. - /// Added in v1.4.0. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] - pub struct SumOfMembers { - /// the maximum weight of each individual member in a group. - #[prost(int32, tag="1")] - pub max_member_weight: i32, - } - /// specifies the semantics of `size` and `max_group_size` above. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Oneof)] - pub enum SelectorSizeSemantics { - /// group size is the sum of the group's weights. - /// Added in v1.4.0. - #[prost(message, tag="6")] - SumOfWeights(SumOfWeights), - /// group size is the sum of the group's members. - /// Added in v1.4.0. - #[prost(message, tag="7")] - SumOfMembers(SumOfMembers), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct CounterSpec { - #[prost(enumeration="counter_spec::Unit", tag="1")] - pub unit: i32, -} -/// Nested message and enum types in `CounterSpec`. -pub mod counter_spec { - /// Corresponds to 'type' constructor parameter for Counter / DirectCounter in - /// PSA - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - pub enum Unit { - Unspecified = 0, - Bytes = 1, - Packets = 2, - Both = 3, - } - impl Unit { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Unit::Unspecified => "UNSPECIFIED", - Unit::Bytes => "BYTES", - Unit::Packets => "PACKETS", - Unit::Both => "BOTH", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNSPECIFIED" => Some(Self::Unspecified), - "BYTES" => Some(Self::Bytes), - "PACKETS" => Some(Self::Packets), - "BOTH" => Some(Self::Both), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Counter { - #[prost(message, optional, tag="1")] - pub preamble: ::core::option::Option, - #[prost(message, optional, tag="2")] - pub spec: ::core::option::Option, - /// number of entries in the counter array - #[prost(int64, tag="3")] - pub size: i64, - /// unset if index is not user-defined type - #[prost(message, optional, tag="4")] - pub index_type_name: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct DirectCounter { - #[prost(message, optional, tag="1")] - pub preamble: ::core::option::Option, - #[prost(message, optional, tag="2")] - pub spec: ::core::option::Option, - /// the id of the table to which the counter is attached - #[prost(uint32, tag="3")] - pub direct_table_id: u32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct MeterSpec { - #[prost(enumeration="meter_spec::Unit", tag="1")] - pub unit: i32, - /// Added in 1.4.0. - #[prost(enumeration="meter_spec::Type", tag="2")] - pub r#type: i32, -} -/// Nested message and enum types in `MeterSpec`. -pub mod meter_spec { - /// Corresponds to 'type' constructor parameter for Meter / DirectMeter in PSA - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - pub enum Unit { - Unspecified = 0, - Bytes = 1, - Packets = 2, - } - impl Unit { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Unit::Unspecified => "UNSPECIFIED", - Unit::Bytes => "BYTES", - Unit::Packets => "PACKETS", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNSPECIFIED" => Some(Self::Unspecified), - "BYTES" => Some(Self::Bytes), - "PACKETS" => Some(Self::Packets), - _ => None, - } - } - } - /// Used to restrict the MeterConfigs that can be used to instantiate the - /// meter. - /// Added in 1.4.0. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - pub enum Type { - /// As described in RFC 2698, allows meters to use two rates to split packets - /// into three potential colors. - /// MeterConfigs on table entries using this meter type MUST have `eburst == - /// 0` (i.e. unset). - TwoRateThreeColor = 0, - /// As described in RFC 2697, allows meters to use one rate with an Excess - /// Burst Size (EBS) to split packets into three potential colors. - /// MeterConfigs on table entries using this meter type MUST have - /// `cir == pir && cburst == pburst`. - SingleRateThreeColor = 1, - /// A simplified version of RFC 2697, restricting meters to using a single - /// rate to split packets into only RED or GREEN, by not providing an Excess - /// Burst Size (EBS). - /// MeterConfigs on table entries using this meter type MUST have - /// `cir == pir && cburst == pburst && eburst == 0` (i.e. unset). - SingleRateTwoColor = 2, - } - impl Type { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Type::TwoRateThreeColor => "TWO_RATE_THREE_COLOR", - Type::SingleRateThreeColor => "SINGLE_RATE_THREE_COLOR", - Type::SingleRateTwoColor => "SINGLE_RATE_TWO_COLOR", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "TWO_RATE_THREE_COLOR" => Some(Self::TwoRateThreeColor), - "SINGLE_RATE_THREE_COLOR" => Some(Self::SingleRateThreeColor), - "SINGLE_RATE_TWO_COLOR" => Some(Self::SingleRateTwoColor), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Meter { - #[prost(message, optional, tag="1")] - pub preamble: ::core::option::Option, - #[prost(message, optional, tag="2")] - pub spec: ::core::option::Option, - /// number of entries in the meter array - #[prost(int64, tag="3")] - pub size: i64, - /// unset if index is not user-defined type - #[prost(message, optional, tag="4")] - pub index_type_name: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct DirectMeter { - #[prost(message, optional, tag="1")] - pub preamble: ::core::option::Option, - #[prost(message, optional, tag="2")] - pub spec: ::core::option::Option, - /// the id of the table to which the meter is attached - #[prost(uint32, tag="3")] - pub direct_table_id: u32, -} -/// Any metadata associated with controller Packet-IO (Packet-In or Packet-Out) -/// is modeled as P4 headers carrying special annotations -/// @controller_header("packet_out") and @controller_header("packet_in") -/// respectively. There can be at most one header each with these annotations. -/// This message captures the info contained within these special headers, -/// and used in p4runtime.proto to supply the metadata. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ControllerPacketMetadata { - /// preamble.name and preamble.id will specify header type ("packet_out" or - /// "packet_in" for now). - #[prost(message, optional, tag="1")] - pub preamble: ::core::option::Option, - /// Ordered based on header layout. - /// This is a constraint on the generator of this P4Info. - #[prost(message, repeated, tag="2")] - pub metadata: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `ControllerPacketMetadata`. -pub mod controller_packet_metadata { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Metadata { - #[prost(uint32, tag="1")] - pub id: u32, - /// This is the name of the header field (not fully-qualified), similar - /// to e.g. Action.Param.name. - #[prost(string, tag="2")] - pub name: ::prost::alloc::string::String, - #[prost(string, repeated, tag="3")] - pub annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Optional. If present, the location of `annotations\[i\]` is given by - /// `annotation_locations\[i\]`. - #[prost(message, repeated, tag="7")] - pub annotation_locations: ::prost::alloc::vec::Vec, - #[prost(int32, tag="4")] - pub bitwidth: i32, - /// unset if not user-defined type - #[prost(message, optional, tag="5")] - pub type_name: ::core::option::Option, - #[prost(message, repeated, tag="6")] - pub structured_annotations: ::prost::alloc::vec::Vec, - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ValueSet { - #[prost(message, optional, tag="1")] - pub preamble: ::core::option::Option, - #[prost(message, repeated, tag="2")] - pub r#match: ::prost::alloc::vec::Vec, - /// number of entries in the value_set, as per the P4 constructor call. - #[prost(int32, tag="3")] - pub size: i32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Register { - #[prost(message, optional, tag="1")] - pub preamble: ::core::option::Option, - #[prost(message, optional, tag="2")] - pub type_spec: ::core::option::Option, - #[prost(int32, tag="3")] - pub size: i32, - /// unset if index is not user-defined type - #[prost(message, optional, tag="4")] - pub index_type_name: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Digest { - #[prost(message, optional, tag="1")] - pub preamble: ::core::option::Option, - #[prost(message, optional, tag="2")] - pub type_spec: ::core::option::Option, -} -// @@protoc_insertion_point(module) diff --git a/rust/src/p4.v1.rs b/rust/src/p4.v1.rs deleted file mode 100644 index 320bc863..00000000 --- a/rust/src/p4.v1.rs +++ /dev/null @@ -1,1480 +0,0 @@ -// @generated -// This file is @generated by prost-build. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4Data { - #[prost(oneof="p4_data::Data", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12")] - pub data: ::core::option::Option, -} -/// Nested message and enum types in `P4Data`. -pub mod p4_data { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Data { - /// for bit, int - #[prost(bytes, tag="1")] - Bitstring(::prost::alloc::vec::Vec), - /// for varbit - #[prost(message, tag="2")] - Varbit(super::P4Varbit), - #[prost(bool, tag="3")] - Bool(bool), - #[prost(message, tag="4")] - Tuple(super::P4StructLike), - #[prost(message, tag="5")] - Struct(super::P4StructLike), - #[prost(message, tag="6")] - Header(super::P4Header), - #[prost(message, tag="7")] - HeaderUnion(super::P4HeaderUnion), - #[prost(message, tag="8")] - HeaderStack(super::P4HeaderStack), - #[prost(message, tag="9")] - HeaderUnionStack(super::P4HeaderUnionStack), - /// safe (non-serializable) enums only - #[prost(string, tag="10")] - Enum(::prost::alloc::string::String), - #[prost(string, tag="11")] - Error(::prost::alloc::string::String), - /// serializable enums only - #[prost(bytes, tag="12")] - EnumValue(::prost::alloc::vec::Vec), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4Varbit { - #[prost(bytes="vec", tag="1")] - pub bitstring: ::prost::alloc::vec::Vec, - /// dynamic bitwidth of the field - #[prost(int32, tag="2")] - pub bitwidth: i32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4StructLike { - #[prost(message, repeated, tag="1")] - pub members: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4Header { - /// If the header is invalid (is_valid is "false"), then the bitstrings - /// repeated field must be empty. - #[prost(bool, tag="1")] - pub is_valid: bool, - #[prost(bytes="vec", repeated, tag="2")] - pub bitstrings: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4HeaderUnion { - /// An empty string indicates that none of the union members are valid and - /// valid_header must therefore be unset. - #[prost(string, tag="1")] - pub valid_header_name: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] - pub valid_header: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4HeaderStack { - /// The length of this repeated field must always be equal to the compile-time - /// size of the header stack, which is specified in P4Info. - #[prost(message, repeated, tag="1")] - pub entries: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct P4HeaderUnionStack { - /// The length of this repeated field must always be equal to the compile-time - /// size of the header union stack, which is specified in P4Info. - #[prost(message, repeated, tag="1")] - pub entries: ::prost::alloc::vec::Vec, -} -/// ------------------------------------------------------------------------------ -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct WriteRequest { - #[prost(uint64, tag="1")] - pub device_id: u64, - /// Deprecated in v1.4.0 - #[deprecated] - #[prost(uint64, tag="2")] - pub role_id: u64, - /// Added in v1.4.0 - #[prost(string, tag="6")] - pub role: ::prost::alloc::string::String, - #[prost(message, optional, tag="3")] - pub election_id: ::core::option::Option, - /// The write batch, comprising a list of Update operations. The P4Runtime - /// server may arbitrarily reorder messages within a batch to maximize - /// performance. - #[prost(message, repeated, tag="4")] - pub updates: ::prost::alloc::vec::Vec, - #[prost(enumeration="write_request::Atomicity", tag="5")] - pub atomicity: i32, -} -/// Nested message and enum types in `WriteRequest`. -pub mod write_request { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - pub enum Atomicity { - /// Required. This is the default behavior. The batch is processed in a - /// non-atomic manner from a data plane point of view. Each operation within - /// the batch must be attempted even if one or more encounter errors. - /// Every data plane packet is guaranteed to be processed according to - /// table contents as they are between two individual operations of the - /// batch, but there could be several packets processed that see each of - /// these intermediate stages. - ContinueOnError = 0, - /// Optional. Operations within the batch are committed to data plane until - /// an error is encountered. At this point, the operations must be rolled - /// back such that both software and data plane state is consistent with the - /// state before the batch was attempted. The resulting behavior is - /// all-or-none, except the batch is not atomic from a data plane point of - /// view. Every data plane packet is guaranteed to be processed according to - /// table contents as they are between two individual operations of the - /// batch, but there could be several packets processed that see each of - /// these intermediate stages. - RollbackOnError = 1, - /// Optional. Every data plane packet is guaranteed to be processed according - /// to table contents before the batch began, or after the batch completed - /// and the operations were programmed to the hardware. - /// The batch is therefore treated as a transaction. - DataplaneAtomic = 2, - } - impl Atomicity { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Atomicity::ContinueOnError => "CONTINUE_ON_ERROR", - Atomicity::RollbackOnError => "ROLLBACK_ON_ERROR", - Atomicity::DataplaneAtomic => "DATAPLANE_ATOMIC", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "CONTINUE_ON_ERROR" => Some(Self::ContinueOnError), - "ROLLBACK_ON_ERROR" => Some(Self::RollbackOnError), - "DATAPLANE_ATOMIC" => Some(Self::DataplaneAtomic), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct WriteResponse { -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ReadRequest { - #[prost(uint64, tag="1")] - pub device_id: u64, - /// When specified, only return table entries for the given role. - /// Added in 1.4.0. - #[prost(string, tag="3")] - pub role: ::prost::alloc::string::String, - #[prost(message, repeated, tag="2")] - pub entities: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ReadResponse { - #[prost(message, repeated, tag="1")] - pub entities: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Update { - #[prost(enumeration="update::Type", tag="1")] - pub r#type: i32, - #[prost(message, optional, tag="2")] - pub entity: ::core::option::Option, -} -/// Nested message and enum types in `Update`. -pub mod update { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - pub enum Type { - Unspecified = 0, - Insert = 1, - Modify = 2, - Delete = 3, - } - impl Type { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Type::Unspecified => "UNSPECIFIED", - Type::Insert => "INSERT", - Type::Modify => "MODIFY", - Type::Delete => "DELETE", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNSPECIFIED" => Some(Self::Unspecified), - "INSERT" => Some(Self::Insert), - "MODIFY" => Some(Self::Modify), - "DELETE" => Some(Self::Delete), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Entity { - #[prost(oneof="entity::Entity", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12")] - pub entity: ::core::option::Option, -} -/// Nested message and enum types in `Entity`. -pub mod entity { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Entity { - #[prost(message, tag="1")] - ExternEntry(super::ExternEntry), - #[prost(message, tag="2")] - TableEntry(super::TableEntry), - #[prost(message, tag="3")] - ActionProfileMember(super::ActionProfileMember), - #[prost(message, tag="4")] - ActionProfileGroup(super::ActionProfileGroup), - #[prost(message, tag="5")] - MeterEntry(super::MeterEntry), - #[prost(message, tag="6")] - DirectMeterEntry(super::DirectMeterEntry), - #[prost(message, tag="7")] - CounterEntry(super::CounterEntry), - #[prost(message, tag="8")] - DirectCounterEntry(super::DirectCounterEntry), - #[prost(message, tag="9")] - PacketReplicationEngineEntry(super::PacketReplicationEngineEntry), - #[prost(message, tag="10")] - ValueSetEntry(super::ValueSetEntry), - #[prost(message, tag="11")] - RegisterEntry(super::RegisterEntry), - #[prost(message, tag="12")] - DigestEntry(super::DigestEntry), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ExternEntry { - /// the extern_type_id is unique for a given architecture and must be in the - /// range \[0x81, 0xfe\]. - #[prost(uint32, tag="1")] - pub extern_type_id: u32, - /// id of the instance - #[prost(uint32, tag="2")] - pub extern_id: u32, - #[prost(message, optional, tag="3")] - pub entry: ::core::option::Option<::pbjson_types::Any>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TableEntry { - #[prost(uint32, tag="1")] - pub table_id: u32, - #[prost(message, repeated, tag="2")] - pub r#match: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="3")] - pub action: ::core::option::Option, - /// Should only be set if the match implies a TCAM lookup, i.e. at least one of - /// the match fields is Optional, Ternary or Range. A higher number indicates - /// higher priority. Only a highest priority entry that matches the packet - /// must be selected. Multiple entries in the same table with the same - /// priority value are permitted. See Section "TableEntry" in the - /// specification for details of the behavior. - #[prost(int32, tag="4")] - pub priority: i32, - /// Metadata (cookie) opaque to the target. There is no requirement of where - /// this is stored, as long as it is returned with the rest of the entry in - /// a Read RPC. This is deprecated in favor of the more flexible metadata - /// field. - #[deprecated] - #[prost(uint64, tag="5")] - pub controller_metadata: u64, - /// meter_config, counter_data and meter_counter_data are convenience fields - /// that enable the controller to configure the direct resources associated - /// with the table at the same time as a match-action entry is inserted or - /// modified. - /// Table write: - /// - If the table does not contain a direct resource, then setting the - /// corresponding direct resource field in any table write operation will - /// return an error. - /// - When inserting a new table entry, leaving these fields unset means that - /// the direct resources of this table (if any) will assume default values. - /// For counters, the default value is 0, and for meters, the default value - /// is always green. - /// - When updating a table entry, leaving meter_config unset will reset the - /// meter (if any) to its default configuration, while leaving counter_data - /// or meter_counter_data unset means that the counter (if any) will not be - /// updated. - /// Table read: - /// - If the table does not contain a direct resource, then the corresponding - /// field will not be set in the read table entry. - /// - If meter_config is unset in the request, or if the meter has a default - /// configuration, meter_config will not be set in the response. - /// - If counter_data or meter_counter_data is unset in the request, it will - /// be unset in the response as well. - #[prost(message, optional, tag="6")] - pub meter_config: ::core::option::Option, - #[prost(message, optional, tag="7")] - pub counter_data: ::core::option::Option, - /// Per color counters for tables with a direct meter. - /// Added in v1.4.0 - #[prost(message, optional, tag="12")] - pub meter_counter_data: ::core::option::Option, - /// Set to true if the table entry is being used to update the non-const - /// default action of the table. If true, the "match" field must be empty and - /// the "action" field must be populated with a valid direct action. - #[prost(bool, tag="8")] - pub is_default_action: bool, - /// The TTL for the entry, in nanoseconds. A value of 0 means that the table - /// entry never "expires". - #[prost(int64, tag="9")] - pub idle_timeout_ns: i64, - /// Table write: this field should be left unset. - /// Table read: if the table supports idle timeout and time_since_last_hit is - /// set in the request, this field will be set in the response. - #[prost(message, optional, tag="10")] - pub time_since_last_hit: ::core::option::Option, - /// Arbitrary metadata from the controller that is opaque to the target. - #[prost(bytes="vec", tag="11")] - pub metadata: ::prost::alloc::vec::Vec, - /// True if and only if the entry cannot be deleted or modified, - /// i.e. any of the following: - /// + Any entry read from a table declared with `const entries` - /// + The default entry read from a table declared with `const - /// default_action` - /// + Any entry declared with `entries` without the `const` qualifier - /// before `entries`, where the individual entry has the `const` - /// qualifier on it in the P4 source code. - /// Note: Older P4Runtime API servers before the `is_const` field was - /// added to this message will not return a value for `is_const` in - /// the first two cases above, but newer P4Runtime API servers will. - /// Added in 1.4.0. - #[prost(bool, tag="13")] - pub is_const: bool, -} -/// Nested message and enum types in `TableEntry`. -pub mod table_entry { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] - pub struct IdleTimeout { - /// Time elapsed - in nanoseconds - since the table entry was last "hit" as - /// part of a data plane table lookup. - #[prost(int64, tag="1")] - pub elapsed_ns: i64, - } -} -/// field_match_type ::= exact | ternary | lpm | range | optional -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct FieldMatch { - #[prost(uint32, tag="1")] - pub field_id: u32, - #[prost(oneof="field_match::FieldMatchType", tags="2, 3, 4, 6, 7, 100")] - pub field_match_type: ::core::option::Option, -} -/// Nested message and enum types in `FieldMatch`. -pub mod field_match { - /// Matches can be performed on arbitrarily-large inputs; the protobuf type - /// 'bytes' is used to model arbitrarily-large values. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Exact { - #[prost(bytes="vec", tag="1")] - pub value: ::prost::alloc::vec::Vec, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Ternary { - #[prost(bytes="vec", tag="1")] - pub value: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="2")] - pub mask: ::prost::alloc::vec::Vec, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Lpm { - #[prost(bytes="vec", tag="1")] - pub value: ::prost::alloc::vec::Vec, - /// in bits - #[prost(int32, tag="2")] - pub prefix_len: i32, - } - /// A Range is logically a set that contains all values numerically between - /// 'low' and 'high' inclusively. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Range { - #[prost(bytes="vec", tag="1")] - pub low: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="2")] - pub high: ::prost::alloc::vec::Vec, - } - /// If the Optional match should be a wildcard, the FieldMatch must be omitted. - /// Otherwise, this behaves like an exact match. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Optional { - #[prost(bytes="vec", tag="1")] - pub value: ::prost::alloc::vec::Vec, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum FieldMatchType { - #[prost(message, tag="2")] - Exact(Exact), - #[prost(message, tag="3")] - Ternary(Ternary), - #[prost(message, tag="4")] - Lpm(Lpm), - #[prost(message, tag="6")] - Range(Range), - #[prost(message, tag="7")] - Optional(Optional), - /// Architecture-specific match value; it corresponds to the other_match_type - /// in the P4Info MatchField message. - #[prost(message, tag="100")] - Other(::pbjson_types::Any), - } -} -/// table_actions ::= action_specification | action_profile_specification -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TableAction { - #[prost(oneof="table_action::Type", tags="1, 2, 3, 4")] - pub r#type: ::core::option::Option, -} -/// Nested message and enum types in `TableAction`. -pub mod table_action { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Type { - #[prost(message, tag="1")] - Action(super::Action), - #[prost(uint32, tag="2")] - ActionProfileMemberId(u32), - #[prost(uint32, tag="3")] - ActionProfileGroupId(u32), - #[prost(message, tag="4")] - ActionProfileActionSet(super::ActionProfileActionSet), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Action { - #[prost(uint32, tag="1")] - pub action_id: u32, - #[prost(message, repeated, tag="4")] - pub params: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `Action`. -pub mod action { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Param { - #[prost(uint32, tag="2")] - pub param_id: u32, - #[prost(bytes="vec", tag="3")] - pub value: ::prost::alloc::vec::Vec, - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ActionProfileActionSet { - #[prost(message, repeated, tag="1")] - pub action_profile_actions: ::prost::alloc::vec::Vec, - /// Determines how the group selects a per-packet action. - #[prost(enumeration="action_profile_action_set::ActionSelectionMode", tag="2")] - pub action_selection_mode: i32, - /// Determines the resources used by the group. - #[prost(enumeration="action_profile_action_set::SizeSemantics", tag="3")] - pub size_semantics: i32, -} -/// Nested message and enum types in `ActionProfileActionSet`. -pub mod action_profile_action_set { - /// Added in v1.5.0. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - pub enum ActionSelectionMode { - /// Uses the mode specified by the action selector. - DefaultModeDeterminedByActionSelector = 0, - /// Uses the hash mode specified by the action selector or a target-defined - /// hash mode if there is none. - Hash = 1, - /// Picks the action randomly. - Random = 2, - } - impl ActionSelectionMode { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - ActionSelectionMode::DefaultModeDeterminedByActionSelector => "DEFAULT_MODE_DETERMINED_BY_ACTION_SELECTOR", - ActionSelectionMode::Hash => "HASH", - ActionSelectionMode::Random => "RANDOM", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "DEFAULT_MODE_DETERMINED_BY_ACTION_SELECTOR" => Some(Self::DefaultModeDeterminedByActionSelector), - "HASH" => Some(Self::Hash), - "RANDOM" => Some(Self::Random), - _ => None, - } - } - } - /// Added in v1.5.0. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - pub enum SizeSemantics { - /// Uses the `selector_size_semantics` specified by the action selector. - DefaultSizeDeterminedByActionSelector = 0, - /// Uses the `sum_of_weights` `selector_size_semantics` for this group. - SumOfWeights = 1, - /// Uses the `sum_of_members` `selector_size_semantics` for this group. - SumOfMembers = 2, - } - impl SizeSemantics { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - SizeSemantics::DefaultSizeDeterminedByActionSelector => "DEFAULT_SIZE_DETERMINED_BY_ACTION_SELECTOR", - SizeSemantics::SumOfWeights => "SUM_OF_WEIGHTS", - SizeSemantics::SumOfMembers => "SUM_OF_MEMBERS", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "DEFAULT_SIZE_DETERMINED_BY_ACTION_SELECTOR" => Some(Self::DefaultSizeDeterminedByActionSelector), - "SUM_OF_WEIGHTS" => Some(Self::SumOfWeights), - "SUM_OF_MEMBERS" => Some(Self::SumOfMembers), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ActionProfileAction { - #[prost(message, optional, tag="1")] - pub action: ::core::option::Option, - #[prost(int32, tag="2")] - pub weight: i32, - #[prost(oneof="action_profile_action::WatchKind", tags="3, 4")] - pub watch_kind: ::core::option::Option, -} -/// Nested message and enum types in `ActionProfileAction`. -pub mod action_profile_action { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum WatchKind { - /// Using int32 as ports is deprecated, use watch_port instead. - #[prost(int32, tag="3")] - Watch(i32), - #[prost(bytes, tag="4")] - WatchPort(::prost::alloc::vec::Vec), - } -} -/// ------------------------------------------------------------------------------ -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ActionProfileMember { - #[prost(uint32, tag="1")] - pub action_profile_id: u32, - #[prost(uint32, tag="2")] - pub member_id: u32, - #[prost(message, optional, tag="3")] - pub action: ::core::option::Option, -} -/// ------------------------------------------------------------------------------ -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ActionProfileGroup { - #[prost(uint32, tag="1")] - pub action_profile_id: u32, - #[prost(uint32, tag="2")] - pub group_id: u32, - #[prost(message, repeated, tag="3")] - pub members: ::prost::alloc::vec::Vec, - /// Max number of weighted member entries in this group. It cannot be modified - /// after a group has been created. It must not exceed the static - /// max_group_size included in P4Info. If the max size is not known at group - /// creation-time, the client may leave this field unset (default value 0), in - /// which case the static max_group_size value will be used and the group will - /// be able to include up to max_group_size weighted member entries. - #[prost(int32, tag="4")] - pub max_size: i32, -} -/// Nested message and enum types in `ActionProfileGroup`. -pub mod action_profile_group { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Member { - #[prost(uint32, tag="1")] - pub member_id: u32, - #[prost(int32, tag="2")] - pub weight: i32, - #[prost(oneof="member::WatchKind", tags="3, 4")] - pub watch_kind: ::core::option::Option, - } - /// Nested message and enum types in `Member`. - pub mod member { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum WatchKind { - /// Using int32 as ports is deprecated, use watch_port instead. - #[prost(int32, tag="3")] - Watch(i32), - #[prost(bytes, tag="4")] - WatchPort(::prost::alloc::vec::Vec), - } - } -} -/// An index as a protobuf message. In proto3, fields cannot be optional and -/// there is no difference between an unset integer field and an integer field -/// set to 0. This is inconvenient for reading from P4 array-like structures, -/// such as indirect counters and meters. We need a way to do a wildcard read on -/// these but we cannot use a default zero index value to do so, as zero is a -/// valid index (first entry in the array). We therefore wrap the index in a -/// message. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct Index { - #[prost(int64, tag="1")] - pub index: i64, -} -/// ------------------------------------------------------------------------------ -/// For WriteRequest, Update.Type must be MODIFY. -/// For ReadRequest, the scope is defined as follows: -/// - All meter cells for all meters if meter_id = 0 (default). -/// - All meter cells for given meter_id if index is unset (default). -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct MeterEntry { - #[prost(uint32, tag="1")] - pub meter_id: u32, - #[prost(message, optional, tag="2")] - pub index: ::core::option::Option, - #[prost(message, optional, tag="3")] - pub config: ::core::option::Option, - /// Added in v1.4.0 - #[prost(message, optional, tag="4")] - pub counter_data: ::core::option::Option, -} -/// ------------------------------------------------------------------------------ -/// For WriteRequest, Update.Type must be MODIFY. INSERT and DELETE on direct -/// meters is not allowed and will return an error. The insertion/deletion -/// should happen as part of INSERT/DELETE on the associated table-entry. -/// For ReadRequest, the scope is defined as follows: -/// - All meter cells for all tables if table_entry.table_id = 0. -/// - All meter cells of a table if table_entry.table_id is present and -/// table_entry.match is empty. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct DirectMeterEntry { - /// The associated table entry. This field is required. - /// table_entry.action is ignored. Other fields specify the match. - #[prost(message, optional, tag="1")] - pub table_entry: ::core::option::Option, - #[prost(message, optional, tag="2")] - pub config: ::core::option::Option, - /// Added in v1.4.0 - #[prost(message, optional, tag="3")] - pub counter_data: ::core::option::Option, -} -/// Modeled to support both RFC 2698: A Two Rate Three Color Marker (trTCM) and -/// RFC 2697: A Single Rate Three Color Marker (srTCM) based on the `type` of the -/// corresponding MeterSpec. -/// -/// The trTCM meters a packet stream and marks its packets based on two rates, -/// Peak Information Rate (PIR) and Committed Information Rate (CIR), and their -/// associated burst sizes to be either green, yellow, or red. A packet is -/// marked red if it exceeds the PIR. Otherwise it is marked either yellow or -/// green depending on whether it exceeds or doesn't exceed the CIR. For this -/// meter type, `eburst` must be unset. -/// -/// The srTCM meters a packet stream and marks its packets based on one rate, -/// Committed Information Rate (CIR), and its associated burst size as well as an -/// Excess Burst Size (EBS) to be either green, yellow, or red. Roughly, a packet -/// is marked green if it doesn't exceed the CIR. Otherwise it is marked either -/// yellow or green depending on whether it exceeds or doesn't exceed the EBS. -/// For this meter type, it must be the case that `cir == pir && cburst == -/// pburst`. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct MeterConfig { - /// Committed information rate (units per sec) - #[prost(int64, tag="1")] - pub cir: i64, - /// Committed burst size - #[prost(int64, tag="2")] - pub cburst: i64, - /// Peak information rate (units per sec) - #[prost(int64, tag="3")] - pub pir: i64, - /// Peak burst size - #[prost(int64, tag="4")] - pub pburst: i64, - /// Excess burst size (only used by srTCM). - /// Added in 1.4.0. - #[prost(int64, tag="5")] - pub eburst: i64, -} -/// ------------------------------------------------------------------------------ -/// For WriteRequest, Update.Type must be MODIFY. -/// For ReadRequest, the scope is defined as follows: -/// - All counter cells for all counters if counter_id = 0 (default). -/// - All counter cells for given counter_id if index is unset (default). -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct CounterEntry { - #[prost(uint32, tag="1")] - pub counter_id: u32, - #[prost(message, optional, tag="2")] - pub index: ::core::option::Option, - #[prost(message, optional, tag="3")] - pub data: ::core::option::Option, -} -/// ------------------------------------------------------------------------------ -/// For WriteRequest, Update.Type must be MODIFY. INSERT and DELETE on direct -/// counters is not allowed and will return an error. The insertion/deletion -/// should happen as part of INSERT/DELETE on the associated table-entry. -/// For ReadRequest, the scope is defined as follows: -/// - All counter cells for all tables if table_entry.table_id = 0. -/// - All counter cells of a table if table_entry.table_id is present and -/// table_entry.match is empty. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct DirectCounterEntry { - /// The associated table entry. This field is required. - /// table_entry.action is ignored. Other fields specify the match. - #[prost(message, optional, tag="1")] - pub table_entry: ::core::option::Option, - #[prost(message, optional, tag="2")] - pub data: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct CounterData { - #[prost(int64, tag="1")] - pub byte_count: i64, - #[prost(int64, tag="2")] - pub packet_count: i64, -} -/// Added in v1.4.0 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct MeterCounterData { - #[prost(message, optional, tag="1")] - pub green: ::core::option::Option, - #[prost(message, optional, tag="2")] - pub yellow: ::core::option::Option, - #[prost(message, optional, tag="3")] - pub red: ::core::option::Option, -} -/// ------------------------------------------------------------------------------ -/// Only one instance of a Packet Replication Engine (PRE) is expected in the -/// P4 pipeline. Hence, no instance id is needed to access the PRE. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct PacketReplicationEngineEntry { - #[prost(oneof="packet_replication_engine_entry::Type", tags="1, 2")] - pub r#type: ::core::option::Option, -} -/// Nested message and enum types in `PacketReplicationEngineEntry`. -pub mod packet_replication_engine_entry { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Type { - #[prost(message, tag="1")] - MulticastGroupEntry(super::MulticastGroupEntry), - #[prost(message, tag="2")] - CloneSessionEntry(super::CloneSessionEntry), - } -} -/// A backup replica used as a fallback when the primary replica port goes down. -/// Added in v1.5.0. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BackupReplica { - #[prost(bytes="vec", tag="1")] - pub port: ::prost::alloc::vec::Vec, - #[prost(uint32, tag="2")] - pub instance: u32, -} -/// Used for replicas created for cloning and multicasting actions. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Replica { - #[prost(uint32, tag="2")] - pub instance: u32, - /// List of backup replicas used as a fallback when the primary replica port - /// (and all higher-preference backup replica ports) are down. - /// Added in v1.5.0. - #[prost(message, repeated, tag="4")] - pub backup_replicas: ::prost::alloc::vec::Vec, - #[prost(oneof="replica::PortKind", tags="1, 3")] - pub port_kind: ::core::option::Option, -} -/// Nested message and enum types in `Replica`. -pub mod replica { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum PortKind { - /// Using uint32 as ports is deprecated, use port field instead. - /// Deprecated in v1.4.0 - #[prost(uint32, tag="1")] - EgressPort(u32), - /// Added in v1.4.0 - #[prost(bytes, tag="3")] - Port(::prost::alloc::vec::Vec), - } -} -/// The (port, instance) pair must be unique for each replica in a given -/// multicast group entry. A packet may be multicast by setting the -/// multicast_group field of PSA ingress output metadata to multicast_group_id -/// of a programmed multicast group entry. The port and instance fields of each -/// replica's egress input metadata will be set to the respective values -/// programmed in the multicast group entry. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MulticastGroupEntry { - #[prost(uint32, tag="1")] - pub multicast_group_id: u32, - #[prost(message, repeated, tag="2")] - pub replicas: ::prost::alloc::vec::Vec, - /// Arbitrary metadata from the controller that is opaque to the target. - /// Added in 1.4.0. - #[prost(bytes="vec", tag="3")] - pub metadata: ::prost::alloc::vec::Vec, -} -/// A packet may be cloned by setting the clone_session_id field of PSA -/// ingress/egress output metadata to session_id of a programmed clone session -/// entry. Multiple clones may be created via a single clone session entry by -/// using the replicas message. The clones may be distinguished in the egress -/// using the instance field. The class_of_service field of the clone's egress -/// input metadata will be set to the respective value programmed in the clone -/// session entry. Note that in case of multiple clones, all clones, defined -/// for a clone session, will get the same class of service. The -/// packet_length_bytes field must be set to a non-zero value if the clone -/// packet(s) should be truncated to the given value (in bytes). The packet -/// length is also common to all clones in the clone session. If the -/// packet_length_bytes field is 0, no truncation on the clone(s) will be -/// performed. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct CloneSessionEntry { - #[prost(uint32, tag="1")] - pub session_id: u32, - #[prost(message, repeated, tag="2")] - pub replicas: ::prost::alloc::vec::Vec, - #[prost(uint32, tag="3")] - pub class_of_service: u32, - #[prost(int32, tag="4")] - pub packet_length_bytes: i32, -} -/// A member in a P4 value set. Each member defines a list of matches, which can -/// have different match types. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ValueSetMember { - #[prost(message, repeated, tag="1")] - pub r#match: ::prost::alloc::vec::Vec, -} -/// ------------------------------------------------------------------------------ -/// For writing and reading matches in a parser value set. A state transition -/// on an empty value set will never be taken. The number of matches must be at -/// most the size of the value set as specified by the size argument of the -/// value_set constructor in the P4 program. -/// -/// For Write Requests: -/// - MODIFY will write the given matches in the repeated field to the value -/// set. -/// - INSERT and DELETE are not allowed. -/// -/// For Read Requests: -/// - All matches for all value-set entries if value_set_id = 0 -/// - All matches of the value-set if a valid value_set_id is specified -/// - The 'match' field must never be set in the ReadRequest -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ValueSetEntry { - #[prost(uint32, tag="1")] - pub value_set_id: u32, - #[prost(message, repeated, tag="2")] - pub members: ::prost::alloc::vec::Vec, -} -/// ------------------------------------------------------------------------------ -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct RegisterEntry { - #[prost(uint32, tag="1")] - pub register_id: u32, - #[prost(message, optional, tag="2")] - pub index: ::core::option::Option, - #[prost(message, optional, tag="3")] - pub data: ::core::option::Option, -} -/// ------------------------------------------------------------------------------ -/// Used to configure the digest extern only, not to stream digests or acks -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct DigestEntry { - #[prost(uint32, tag="1")] - pub digest_id: u32, - #[prost(message, optional, tag="2")] - pub config: ::core::option::Option, -} -/// Nested message and enum types in `DigestEntry`. -pub mod digest_entry { - /// a DigestList message is streamed when the following conditions are met: - /// - there is at least one digest ready - /// - the oldest digest in the list has been waiting for at least - /// max_timeout_ns nanoseconds or we have gathered max_list_size digests - /// already - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] - pub struct Config { - /// max timeout for outstanding digest data - #[prost(int64, tag="1")] - pub max_timeout_ns: i64, - /// max size for a digest list - #[prost(int32, tag="2")] - pub max_list_size: i32, - /// timeout for DigestListAck message - #[prost(int64, tag="3")] - pub ack_timeout_ns: i64, - } -} -/// ------------------------------------------------------------------------------ -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct StreamMessageRequest { - #[prost(oneof="stream_message_request::Update", tags="1, 2, 3, 4")] - pub update: ::core::option::Option, -} -/// Nested message and enum types in `StreamMessageRequest`. -pub mod stream_message_request { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Update { - #[prost(message, tag="1")] - Arbitration(super::MasterArbitrationUpdate), - #[prost(message, tag="2")] - Packet(super::PacketOut), - #[prost(message, tag="3")] - DigestAck(super::DigestListAck), - #[prost(message, tag="4")] - Other(::pbjson_types::Any), - } -} -/// Packet sent from the controller to the switch. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct PacketOut { - #[prost(bytes="vec", tag="1")] - pub payload: ::prost::alloc::vec::Vec, - /// This will be based on P4 header annotated as - /// @controller_header("packet_out"). - /// At most one P4 header can have this annotation. - #[prost(message, repeated, tag="2")] - pub metadata: ::prost::alloc::vec::Vec, -} -/// Used by the controller to ack a DigestList message. To avoid flooding the -/// controller, the switch must not generate digest notifications for the same -/// data until a DigestListAck message with the same list_id is received or the -/// ack timeout (ack_timeout_ns field in DigestEntry.Config) expires. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct DigestListAck { - #[prost(uint32, tag="1")] - pub digest_id: u32, - #[prost(uint64, tag="2")] - pub list_id: u64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct StreamMessageResponse { - #[prost(oneof="stream_message_response::Update", tags="1, 2, 3, 4, 5, 6")] - pub update: ::core::option::Option, -} -/// Nested message and enum types in `StreamMessageResponse`. -pub mod stream_message_response { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Update { - #[prost(message, tag="1")] - Arbitration(super::MasterArbitrationUpdate), - #[prost(message, tag="2")] - Packet(super::PacketIn), - #[prost(message, tag="3")] - Digest(super::DigestList), - #[prost(message, tag="4")] - IdleTimeoutNotification(super::IdleTimeoutNotification), - #[prost(message, tag="5")] - Other(::pbjson_types::Any), - /// Used by the server to asynchronously report errors which occur when - /// processing StreamMessageRequest messages. - #[prost(message, tag="6")] - Error(super::StreamError), - } -} -/// Packet sent from the switch to the controller. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct PacketIn { - #[prost(bytes="vec", tag="1")] - pub payload: ::prost::alloc::vec::Vec, - /// This will be based on P4 header annotated as - /// @controller_header("packet_in"). - /// At most one P4 header can have this annotation. - #[prost(message, repeated, tag="2")] - pub metadata: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct DigestList { - /// identifies the digest extern instance - #[prost(uint32, tag="1")] - pub digest_id: u32, - /// identifies a list of entries, used by receiver to ack - #[prost(uint64, tag="2")] - pub list_id: u64, - /// List of entries: each call to the Digest::pack() method corresponds to - /// one entry and we can have as little as one entry. - #[prost(message, repeated, tag="3")] - pub data: ::prost::alloc::vec::Vec, - /// Timestamp at which the server generated the message (in nanoseconds since - /// Epoch) - #[prost(int64, tag="4")] - pub timestamp: i64, -} -/// Any metadata associated with Packet-IO (controller Packet-In or Packet-Out) -/// needs to be modeled as P4 headers carrying special annotations -/// @controller_header("packet_out") and @controller_header("packet_in") -/// respectively. There can be at most one header each with these annotations. -/// These special headers are captured in P4Info ControllerPacketMetadata. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct PacketMetadata { - /// This refers to Metadata.id coming from P4Info ControllerPacketMetadata. - #[prost(uint32, tag="1")] - pub metadata_id: u32, - #[prost(bytes="vec", tag="2")] - pub value: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MasterArbitrationUpdate { - #[prost(uint64, tag="1")] - pub device_id: u64, - /// The role for which the primary client is being arbitrated. For use-cases - /// where multiple roles are not needed, the controller can leave this unset, - /// implying default role and full pipeline access. - #[prost(message, optional, tag="2")] - pub role: ::core::option::Option, - /// The stream RPC with the highest election_id is the primary. The 'primary' - /// controller instance populates this with its latest election_id. Switch - /// populates with the highest election ID it has received from all connected - /// controllers. - #[prost(message, optional, tag="3")] - pub election_id: ::core::option::Option, - /// Switch populates this with OK for the client that is the primary, and - /// with an error status for all other connected clients (at every primary - /// client change). The controller does not populate this field. - #[prost(message, optional, tag="4")] - pub status: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Role { - /// Uniquely identifies this role. - /// Deprecated in 1.4.0. - #[deprecated] - #[prost(uint64, tag="1")] - pub id: u64, - /// Added in 1.4.0. - #[prost(string, tag="3")] - pub name: ::prost::alloc::string::String, - /// Describes the role configuration, i.e. what operations, P4 entities, - /// behaviors, etc. are in the scope of a given role. If config is not set - /// (default case), it implies all P4 objects and control behaviors are in - /// scope, i.e. full pipeline access. The format of this message is - /// out-of-scope of P4Runtime. - #[prost(message, optional, tag="2")] - pub config: ::core::option::Option<::pbjson_types::Any>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct IdleTimeoutNotification { - /// The only fields that are required to be set in each TableEntry are the - /// "key" fields (table_id, match and priority) along with controller_metadata, - /// metadata and idle_timeout_ns. - #[prost(message, repeated, tag="1")] - pub table_entry: ::prost::alloc::vec::Vec, - /// Timestamp at which the server generated the message (in nanoseconds since - /// Epoch) - #[prost(int64, tag="2")] - pub timestamp: i64, -} -/// Used by the server to asynchronously report errors which occur when -/// processing StreamMessageRequest messages. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct StreamError { - /// gRPC canonical error code (see - /// ) - #[prost(int32, tag="1")] - pub canonical_code: i32, - /// Optional. An explanation of the error. - #[prost(string, tag="2")] - pub message: ::prost::alloc::string::String, - /// Optional. Target and architecture specific space to which this error - /// belongs. - /// We encourage using triplet: --, - /// e.g."targetX-psa-vendor1" or "targetY-psa-vendor2". - #[prost(string, tag="3")] - pub space: ::prost::alloc::string::String, - /// Optional. Numeric code drawn from target-specific error space above. - #[prost(int32, tag="4")] - pub code: i32, - /// Used by the server to convey additional information about the error. One of - /// the fields must be set (so that the client can identify which type of - /// stream message triggered the error), but that field may be set to its - /// default value. - #[prost(oneof="stream_error::Details", tags="5, 6, 7")] - pub details: ::core::option::Option, -} -/// Nested message and enum types in `StreamError`. -pub mod stream_error { - /// Used by the server to convey additional information about the error. One of - /// the fields must be set (so that the client can identify which type of - /// stream message triggered the error), but that field may be set to its - /// default value. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Details { - #[prost(message, tag="5")] - PacketOut(super::PacketOutError), - #[prost(message, tag="6")] - DigestListAck(super::DigestListAckError), - #[prost(message, tag="7")] - Other(super::StreamOtherError), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct PacketOutError { - /// Optional. The packet out message that caused the error. - #[prost(message, optional, tag="1")] - pub packet_out: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct DigestListAckError { - /// Optional. The digest list acknowledgement message that caused the error. - #[prost(message, optional, tag="1")] - pub digest_list_ack: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct StreamOtherError { - /// Optional. The architecture-specific stream message that caused the error. - #[prost(message, optional, tag="1")] - pub other: ::core::option::Option<::pbjson_types::Any>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct Uint128 { - /// Highest 64 bits of a 128 bit number. - #[prost(uint64, tag="1")] - pub high: u64, - /// Lowest 64 bits of a 128 bit number. - #[prost(uint64, tag="2")] - pub low: u64, -} -/// ------------------------------------------------------------------------------ -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SetForwardingPipelineConfigRequest { - #[prost(uint64, tag="1")] - pub device_id: u64, - /// Deprecated in 1.4.0. - #[deprecated] - #[prost(uint64, tag="2")] - pub role_id: u64, - /// Added in 1.4.0. - #[prost(string, tag="6")] - pub role: ::prost::alloc::string::String, - #[prost(message, optional, tag="3")] - pub election_id: ::core::option::Option, - #[prost(enumeration="set_forwarding_pipeline_config_request::Action", tag="4")] - pub action: i32, - #[prost(message, optional, tag="5")] - pub config: ::core::option::Option, -} -/// Nested message and enum types in `SetForwardingPipelineConfigRequest`. -pub mod set_forwarding_pipeline_config_request { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - pub enum Action { - Unspecified = 0, - /// Verify that the target can realize the given config. Do not modify the - /// forwarding state in the target. Returns error if config is not provided - /// of if the provided config cannot be realized. - Verify = 1, - /// Save the config if the target can realize it. Do not modify the - /// forwarding state in the target. Any subsequent read/write requests must - /// refer to fields in the new config. Returns error if config is not - /// provided of if the provided config cannot be realized. - VerifyAndSave = 2, - /// Verify, save and realize the given config. Clear the forwarding state - /// in the target. Returns error if config is not provided of if the - /// provided config cannot be realized. - VerifyAndCommit = 3, - /// Realize the last saved, but not yet committed, config. Update the - /// forwarding state in the target by replaying the write requests since the - /// last config was saved. Config should not be provided for this action - /// type. Returns an error if no saved config is found or if a config is - /// provided with this message. - Commit = 4, - /// Verify, save and realize the given config, while preserving the - /// forwarding state in the target. This is an advanced use case to enable - /// changes to the P4 forwarding pipeline configuration with minimal traffic - /// loss. P4Runtime does not impose any constraints on the duration of the - /// traffic loss. The support for this option is not expected to be uniform - /// across all P4Runtime targets. A target that does not support this option - /// may return an UNIMPLEMENTED error. For targets that support this option, - /// an INVALID_ARGUMENT error is returned if no config is provided, or if - /// the existing forwarding state cannot be preserved for the given config - /// by the target. - ReconcileAndCommit = 5, - } - impl Action { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Action::Unspecified => "UNSPECIFIED", - Action::Verify => "VERIFY", - Action::VerifyAndSave => "VERIFY_AND_SAVE", - Action::VerifyAndCommit => "VERIFY_AND_COMMIT", - Action::Commit => "COMMIT", - Action::ReconcileAndCommit => "RECONCILE_AND_COMMIT", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNSPECIFIED" => Some(Self::Unspecified), - "VERIFY" => Some(Self::Verify), - "VERIFY_AND_SAVE" => Some(Self::VerifyAndSave), - "VERIFY_AND_COMMIT" => Some(Self::VerifyAndCommit), - "COMMIT" => Some(Self::Commit), - "RECONCILE_AND_COMMIT" => Some(Self::ReconcileAndCommit), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct SetForwardingPipelineConfigResponse { -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ForwardingPipelineConfig { - #[prost(message, optional, tag="1")] - pub p4info: ::core::option::Option, - /// Target-specific P4 configuration. - #[prost(bytes="vec", tag="2")] - pub p4_device_config: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="3")] - pub cookie: ::core::option::Option, -} -/// Nested message and enum types in `ForwardingPipelineConfig`. -pub mod forwarding_pipeline_config { - /// Metadata (cookie) opaque to the target. A control plane may use this field - /// to uniquely identify this config. There are no restrictions on how such - /// value is computed, or where this is stored on the target, as long as it is - /// returned with a GetForwardingPipelineConfig RPC. When reading the cookie, - /// we need to distinguish those cases where a cookie is NOT present (e.g. not - /// set in the SetForwardingPipelineConfigRequest, therefore we wrap the actual - /// uint64 value in a protobuf message. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] - pub struct Cookie { - #[prost(uint64, tag="1")] - pub cookie: u64, - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct GetForwardingPipelineConfigRequest { - #[prost(uint64, tag="1")] - pub device_id: u64, - #[prost(enumeration="get_forwarding_pipeline_config_request::ResponseType", tag="2")] - pub response_type: i32, -} -/// Nested message and enum types in `GetForwardingPipelineConfigRequest`. -pub mod get_forwarding_pipeline_config_request { - /// Specifies the fields to populate in the response. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - pub enum ResponseType { - /// Default behaviour. Returns a ForwardingPipelineConfig with all fields set - /// as stored by the target. - All = 0, - /// Reply by setting only the cookie field, omitting all other fields. - CookieOnly = 1, - /// Reply by setting the p4info and cookie fields. - P4infoAndCookie = 2, - /// Reply by setting the p4_device_config and cookie fields. - DeviceConfigAndCookie = 3, - } - impl ResponseType { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - ResponseType::All => "ALL", - ResponseType::CookieOnly => "COOKIE_ONLY", - ResponseType::P4infoAndCookie => "P4INFO_AND_COOKIE", - ResponseType::DeviceConfigAndCookie => "DEVICE_CONFIG_AND_COOKIE", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "ALL" => Some(Self::All), - "COOKIE_ONLY" => Some(Self::CookieOnly), - "P4INFO_AND_COOKIE" => Some(Self::P4infoAndCookie), - "DEVICE_CONFIG_AND_COOKIE" => Some(Self::DeviceConfigAndCookie), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetForwardingPipelineConfigResponse { - #[prost(message, optional, tag="1")] - pub config: ::core::option::Option, -} -/// Error message used to report a single P4-entity error for a Write RPC. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Error { - /// gRPC canonical error code (see - /// ) - #[prost(int32, tag="1")] - pub canonical_code: i32, - /// Detailed error message. - #[prost(string, tag="2")] - pub message: ::prost::alloc::string::String, - /// Target and architecture specific space to which this error belongs. - /// We encourage using triplet: --, - /// e.g."targetX-psa-vendor1" or "targetY-psa-vendor2". - #[prost(string, tag="3")] - pub space: ::prost::alloc::string::String, - /// Numeric code drawn from target-specific error space above. - #[prost(int32, tag="4")] - pub code: i32, - /// Optional: Allows reporting back additional target-specific details on the - /// error. - #[prost(message, optional, tag="5")] - pub details: ::core::option::Option<::pbjson_types::Any>, -} -/// ------------------------------------------------------------------------------ -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct CapabilitiesRequest { - /// Optional: Response should include the device-specific capabilities of the - /// device identified by `device_id` in addition to server-wide capabilities. - /// Added in v1.5.0 - #[prost(uint64, tag="1")] - pub device_id: u64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct CapabilitiesResponse { - /// The full semantic version string (e.g. "1.1.0-rc.1") corresponding to the - /// version of the P4Runtime API currently implemented by the server. - #[prost(string, tag="1")] - pub p4runtime_api_version: ::prost::alloc::string::String, - /// Used for experimental features before proposing them for standardization. - /// Added in 1.5.0. - #[prost(message, optional, tag="999")] - pub experimental: ::core::option::Option<::pbjson_types::Any>, -} -/// ------------------------------------------------------------------------------ -/// Reserved controller-specified SDN port numbers for reference. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum SdnPort { - Unknown = 0, - /// SDN ports are numbered starting form 1. - Min = 1, - /// 0xfffffeff: The maximum value of an SDN port (physical or logical). - Max = -257, - /// Reserved SDN port numbers (0xffffff00 - 0xffffffff) - /// 0xfffffffa: Recirculate the packet back to ingress - Recirculate = -6, - /// 0xfffffffd: Send to CPU - Cpu = -3, -} -impl SdnPort { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - SdnPort::Unknown => "SDN_PORT_UNKNOWN", - SdnPort::Min => "SDN_PORT_MIN", - SdnPort::Max => "SDN_PORT_MAX", - SdnPort::Recirculate => "SDN_PORT_RECIRCULATE", - SdnPort::Cpu => "SDN_PORT_CPU", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "SDN_PORT_UNKNOWN" => Some(Self::Unknown), - "SDN_PORT_MIN" => Some(Self::Min), - "SDN_PORT_MAX" => Some(Self::Max), - "SDN_PORT_RECIRCULATE" => Some(Self::Recirculate), - "SDN_PORT_CPU" => Some(Self::Cpu), - _ => None, - } - } -} -include!("p4.v1.tonic.rs"); -// @@protoc_insertion_point(module) diff --git a/rust/src/p4.v1.tonic.rs b/rust/src/p4.v1.tonic.rs deleted file mode 100644 index f3f847b5..00000000 --- a/rust/src/p4.v1.tonic.rs +++ /dev/null @@ -1,687 +0,0 @@ -// @generated -/// Generated client implementations. -pub mod p4_runtime_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::*; - use tonic::codegen::http::Uri; - #[derive(Debug, Clone)] - pub struct P4RuntimeClient { - inner: tonic::client::Grpc, - } - impl P4RuntimeClient { - /// Attempt to create a new client by connecting to a given endpoint. - pub async fn connect(dst: D) -> Result - where - D: TryInto, - D::Error: Into, - { - let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; - Ok(Self::new(conn)) - } - } - impl P4RuntimeClient - where - T: tonic::client::GrpcService, - T::Error: Into, - T::ResponseBody: Body + Send + 'static, - ::Error: Into + Send, - { - pub fn new(inner: T) -> Self { - let inner = tonic::client::Grpc::new(inner); - Self { inner } - } - pub fn with_origin(inner: T, origin: Uri) -> Self { - let inner = tonic::client::Grpc::with_origin(inner, origin); - Self { inner } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> P4RuntimeClient> - where - F: tonic::service::Interceptor, - T::ResponseBody: Default, - T: tonic::codegen::Service< - http::Request, - Response = http::Response< - >::ResponseBody, - >, - >, - , - >>::Error: Into + Send + Sync, - { - P4RuntimeClient::new(InterceptedService::new(inner, interceptor)) - } - /// Compress requests with the given encoding. - /// - /// This requires the server to support it otherwise it might respond with an - /// error. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.send_compressed(encoding); - self - } - /// Enable decompressing responses. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.accept_compressed(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_decoding_message_size(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_encoding_message_size(limit); - self - } - pub async fn write( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/p4.v1.P4Runtime/Write"); - let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new("p4.v1.P4Runtime", "Write")); - self.inner.unary(req, path, codec).await - } - pub async fn read( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response>, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/p4.v1.P4Runtime/Read"); - let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new("p4.v1.P4Runtime", "Read")); - self.inner.server_streaming(req, path, codec).await - } - pub async fn set_forwarding_pipeline_config( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/p4.v1.P4Runtime/SetForwardingPipelineConfig", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new("p4.v1.P4Runtime", "SetForwardingPipelineConfig"), - ); - self.inner.unary(req, path, codec).await - } - pub async fn get_forwarding_pipeline_config( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/p4.v1.P4Runtime/GetForwardingPipelineConfig", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new("p4.v1.P4Runtime", "GetForwardingPipelineConfig"), - ); - self.inner.unary(req, path, codec).await - } - pub async fn stream_channel( - &mut self, - request: impl tonic::IntoStreamingRequest< - Message = super::StreamMessageRequest, - >, - ) -> std::result::Result< - tonic::Response>, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/p4.v1.P4Runtime/StreamChannel", - ); - let mut req = request.into_streaming_request(); - req.extensions_mut() - .insert(GrpcMethod::new("p4.v1.P4Runtime", "StreamChannel")); - self.inner.streaming(req, path, codec).await - } - pub async fn capabilities( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/p4.v1.P4Runtime/Capabilities", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("p4.v1.P4Runtime", "Capabilities")); - self.inner.unary(req, path, codec).await - } - } -} -/// Generated server implementations. -pub mod p4_runtime_server { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::*; - /// Generated trait containing gRPC methods that should be implemented for use with P4RuntimeServer. - #[async_trait] - pub trait P4Runtime: Send + Sync + 'static { - async fn write( - &self, - request: tonic::Request, - ) -> std::result::Result, tonic::Status>; - /// Server streaming response type for the Read method. - type ReadStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result, - > - + Send - + 'static; - async fn read( - &self, - request: tonic::Request, - ) -> std::result::Result, tonic::Status>; - async fn set_forwarding_pipeline_config( - &self, - request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; - async fn get_forwarding_pipeline_config( - &self, - request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; - /// Server streaming response type for the StreamChannel method. - type StreamChannelStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result, - > - + Send - + 'static; - async fn stream_channel( - &self, - request: tonic::Request>, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; - async fn capabilities( - &self, - request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; - } - #[derive(Debug)] - pub struct P4RuntimeServer { - inner: Arc, - accept_compression_encodings: EnabledCompressionEncodings, - send_compression_encodings: EnabledCompressionEncodings, - max_decoding_message_size: Option, - max_encoding_message_size: Option, - } - impl P4RuntimeServer { - pub fn new(inner: T) -> Self { - Self::from_arc(Arc::new(inner)) - } - pub fn from_arc(inner: Arc) -> Self { - Self { - inner, - accept_compression_encodings: Default::default(), - send_compression_encodings: Default::default(), - max_decoding_message_size: None, - max_encoding_message_size: None, - } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> InterceptedService - where - F: tonic::service::Interceptor, - { - InterceptedService::new(Self::new(inner), interceptor) - } - /// Enable decompressing requests with the given encoding. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.accept_compression_encodings.enable(encoding); - self - } - /// Compress responses with the given encoding, if the client supports it. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.send_compression_encodings.enable(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.max_decoding_message_size = Some(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.max_encoding_message_size = Some(limit); - self - } - } - impl tonic::codegen::Service> for P4RuntimeServer - where - T: P4Runtime, - B: Body + Send + 'static, - B::Error: Into + Send + 'static, - { - type Response = http::Response; - type Error = std::convert::Infallible; - type Future = BoxFuture; - fn poll_ready( - &mut self, - _cx: &mut Context<'_>, - ) -> Poll> { - Poll::Ready(Ok(())) - } - fn call(&mut self, req: http::Request) -> Self::Future { - match req.uri().path() { - "/p4.v1.P4Runtime/Write" => { - #[allow(non_camel_case_types)] - struct WriteSvc(pub Arc); - impl tonic::server::UnaryService - for WriteSvc { - type Response = super::WriteResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::write(&inner, request).await - }; - Box::pin(fut) - } - } - let accept_compression_encodings = self.accept_compression_encodings; - let send_compression_encodings = self.send_compression_encodings; - let max_decoding_message_size = self.max_decoding_message_size; - let max_encoding_message_size = self.max_encoding_message_size; - let inner = self.inner.clone(); - let fut = async move { - let method = WriteSvc(inner); - let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); - let res = grpc.unary(method, req).await; - Ok(res) - }; - Box::pin(fut) - } - "/p4.v1.P4Runtime/Read" => { - #[allow(non_camel_case_types)] - struct ReadSvc(pub Arc); - impl< - T: P4Runtime, - > tonic::server::ServerStreamingService - for ReadSvc { - type Response = super::ReadResponse; - type ResponseStream = T::ReadStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::read(&inner, request).await - }; - Box::pin(fut) - } - } - let accept_compression_encodings = self.accept_compression_encodings; - let send_compression_encodings = self.send_compression_encodings; - let max_decoding_message_size = self.max_decoding_message_size; - let max_encoding_message_size = self.max_encoding_message_size; - let inner = self.inner.clone(); - let fut = async move { - let method = ReadSvc(inner); - let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); - let res = grpc.server_streaming(method, req).await; - Ok(res) - }; - Box::pin(fut) - } - "/p4.v1.P4Runtime/SetForwardingPipelineConfig" => { - #[allow(non_camel_case_types)] - struct SetForwardingPipelineConfigSvc(pub Arc); - impl< - T: P4Runtime, - > tonic::server::UnaryService< - super::SetForwardingPipelineConfigRequest, - > for SetForwardingPipelineConfigSvc { - type Response = super::SetForwardingPipelineConfigResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - super::SetForwardingPipelineConfigRequest, - >, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::set_forwarding_pipeline_config( - &inner, - request, - ) - .await - }; - Box::pin(fut) - } - } - let accept_compression_encodings = self.accept_compression_encodings; - let send_compression_encodings = self.send_compression_encodings; - let max_decoding_message_size = self.max_decoding_message_size; - let max_encoding_message_size = self.max_encoding_message_size; - let inner = self.inner.clone(); - let fut = async move { - let method = SetForwardingPipelineConfigSvc(inner); - let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); - let res = grpc.unary(method, req).await; - Ok(res) - }; - Box::pin(fut) - } - "/p4.v1.P4Runtime/GetForwardingPipelineConfig" => { - #[allow(non_camel_case_types)] - struct GetForwardingPipelineConfigSvc(pub Arc); - impl< - T: P4Runtime, - > tonic::server::UnaryService< - super::GetForwardingPipelineConfigRequest, - > for GetForwardingPipelineConfigSvc { - type Response = super::GetForwardingPipelineConfigResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - super::GetForwardingPipelineConfigRequest, - >, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::get_forwarding_pipeline_config( - &inner, - request, - ) - .await - }; - Box::pin(fut) - } - } - let accept_compression_encodings = self.accept_compression_encodings; - let send_compression_encodings = self.send_compression_encodings; - let max_decoding_message_size = self.max_decoding_message_size; - let max_encoding_message_size = self.max_encoding_message_size; - let inner = self.inner.clone(); - let fut = async move { - let method = GetForwardingPipelineConfigSvc(inner); - let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); - let res = grpc.unary(method, req).await; - Ok(res) - }; - Box::pin(fut) - } - "/p4.v1.P4Runtime/StreamChannel" => { - #[allow(non_camel_case_types)] - struct StreamChannelSvc(pub Arc); - impl< - T: P4Runtime, - > tonic::server::StreamingService - for StreamChannelSvc { - type Response = super::StreamMessageResponse; - type ResponseStream = T::StreamChannelStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - tonic::Streaming, - >, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::stream_channel(&inner, request).await - }; - Box::pin(fut) - } - } - let accept_compression_encodings = self.accept_compression_encodings; - let send_compression_encodings = self.send_compression_encodings; - let max_decoding_message_size = self.max_decoding_message_size; - let max_encoding_message_size = self.max_encoding_message_size; - let inner = self.inner.clone(); - let fut = async move { - let method = StreamChannelSvc(inner); - let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); - let res = grpc.streaming(method, req).await; - Ok(res) - }; - Box::pin(fut) - } - "/p4.v1.P4Runtime/Capabilities" => { - #[allow(non_camel_case_types)] - struct CapabilitiesSvc(pub Arc); - impl< - T: P4Runtime, - > tonic::server::UnaryService - for CapabilitiesSvc { - type Response = super::CapabilitiesResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::capabilities(&inner, request).await - }; - Box::pin(fut) - } - } - let accept_compression_encodings = self.accept_compression_encodings; - let send_compression_encodings = self.send_compression_encodings; - let max_decoding_message_size = self.max_decoding_message_size; - let max_encoding_message_size = self.max_encoding_message_size; - let inner = self.inner.clone(); - let fut = async move { - let method = CapabilitiesSvc(inner); - let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); - let res = grpc.unary(method, req).await; - Ok(res) - }; - Box::pin(fut) - } - _ => { - Box::pin(async move { - Ok( - http::Response::builder() - .status(200) - .header("grpc-status", tonic::Code::Unimplemented as i32) - .header( - http::header::CONTENT_TYPE, - tonic::metadata::GRPC_CONTENT_TYPE, - ) - .body(empty_body()) - .unwrap(), - ) - }) - } - } - } - } - impl Clone for P4RuntimeServer { - fn clone(&self) -> Self { - let inner = self.inner.clone(); - Self { - inner, - accept_compression_encodings: self.accept_compression_encodings, - send_compression_encodings: self.send_compression_encodings, - max_decoding_message_size: self.max_decoding_message_size, - max_encoding_message_size: self.max_encoding_message_size, - } - } - } - impl tonic::server::NamedService for P4RuntimeServer { - const NAME: &'static str = "p4.v1.P4Runtime"; - } -}